irc-fun-client-0.2.0.0: Another library for writing IRC clients.

Safe HaskellNone
LanguageHaskell2010

Network.IRC.Fun.Client.IO

Synopsis

Documentation

data Connection Source

Details of the connection to IRC.

Constructors

Connection 

Fields

server :: String

IRC Server address, e.g. "irc.freenode.net"

port :: Int

IRC server port, 6667 should be a safe default

tls :: Bool

Whether to make an encrypted connection via TLS (not implemented)

nick :: String

IRC nickname for the bot, e.g. "funbot"

password :: Maybe String

Connection password, use if the nickname is registered

data Handle :: *

Haskell defines operations to read and write characters from and to files, represented by values of type Handle. Each value of this type is a handle: a record used by the Haskell run-time system to manage I/O with file system objects. A handle has at least the following properties:

  • whether it manages input or output or both;
  • whether it is open, closed or semi-closed;
  • whether the object is seekable;
  • whether buffering is disabled, or enabled on a line or block basis;
  • a buffer (whose length may be zero).

Most handles will also have a current I/O position indicating where the next input or output operation will occur. A handle is readable if it manages only input or both input and output; likewise, it is writable if it manages only output or both input and output. A handle is open when first allocated. Once it is closed it can no longer be used for either input or output, though an implementation cannot re-use its storage while references remain to it. Handles are in the Show and Eq classes. The string produced by showing a handle is system dependent; it should include enough information to identify the handle for debugging. A handle is equal according to == only to itself; no attempt is made to compare the internal state of different handles for equality.

ircConnect :: Connection -> IO Handle Source

Connect to an IRC server using the given connection parameters, and return a handle to the open socket. This just opens a TCP connection, without sending any IRC commands.

ircDisconnect :: Handle -> IO () Source

Disconnect from IRC by closing the client's side of the connection. This function is mainly provided for completeness. You should probably use the QUIT command of IRC to quit the network in a manner coordinated with the server.

hPutIrcRaw :: Handle -> String -> IO () Source

Send an IRC command, given in string form, to the server. The given command string shouldn't contain any newlines.

hPutIrcGeneric :: Handle -> GenericMessage -> IO () Source

Send an IRC message represented in generic form to the server.

hPutIrc :: Handle -> Message -> IO () Source

Send an IRC message to the server.

hGetIrcRaw :: Handle -> IO String Source

Receive an IRC message, given in string form, from the server. The resulting string won't contain newlines.

hGetIrcGenericOnce :: Handle -> IO (Maybe GenericMessage) Source

Receive an IRC message in generic form from the server. If parsing the message read from the server fails, Nothing is returned.

hGetIrcGeneric :: Handle -> IO GenericMessage Source

Receive the next valid (successfully parsed) IRC message in generic form from the server.

hGetIrcOnce :: Handle -> IO (Maybe (Either SpecificReply SpecificMessage)) Source

Receive an IRC message from the server. If parsing the message read from the server fails, Nothing is returned.

hGetIrc :: Handle -> IO (Either SpecificReply SpecificMessage) Source

Receive the next valid (successfully parsed) IRC message from the server.