simpleirc-0.2.0: Simple IRC Library

Portabilityportable
Stabilityprovisional
Maintainermorfeusz8@gmail.com

Network.SimpleIRC.Core

Contents

Description

For information on how to use this library please take a look at the readme file on github, http://github.com/dom96/SimpleIRC#readme.

Synopsis

Types

type MIrc = MVar IrcServerSource

data IrcConfig Source

Constructors

IrcConfig 

Fields

cAddr :: String

Server address to connect to

cPort :: Int

Server port to connect to

cNick :: String

Nickname

cUsername :: String

Username

cRealname :: String

Realname

cChannels :: [String]

List of channels to join on connect

cEvents :: [IrcEvent]

Events to bind

cCTCPVersion :: String

What to send on CTCP VERSION

cCTCPTime :: IO String

What to send on CTCP TIME

data IrcEvent Source

Constructors

Privmsg EventFunc

PRIVMSG

Numeric EventFunc

Numeric, 001, 002, 372 etc.

Ping EventFunc

PING

Join EventFunc

JOIN

Part EventFunc

PART

Mode EventFunc

MODE

Topic EventFunc

TOPIC

Invite EventFunc

INVITE

Kick EventFunc

KICK

Quit EventFunc

QUIT

Nick EventFunc

NICK

Notice EventFunc

NOTICE

RawMsg EventFunc

This event gets called on every message received

Disconnect (IrcServer -> IO ())

This event gets called whenever the connection with the server is dropped

Instances

Functions

connectSource

Arguments

:: IrcConfig

Configuration

-> Bool

Run in a new thread

-> Bool

Print debug messages

-> IO (Either IOError MIrc)

IrcServer instance

Connects to a server

disconnectSource

Arguments

:: MIrc 
-> ByteString

Quit message

-> IO () 

Sends a QUIT command to the server.

sendRaw :: MIrc -> ByteString -> IO ()Source

Sends a raw command to the server

sendMsgSource

Arguments

:: MIrc 
-> ByteString

Channel

-> ByteString

Message

-> IO () 

Sends a message to a channel

Please note: As of now this function doesn't provide flood control. So be careful with \n.

Utils

getDest :: MIrc -> IrcMessage -> IO ByteStringSource

Gets the destination, i.e if the IrcMessage was sent directly to you returns the senders nick otherwise the channel.

Accessors

getChannels :: MIrc -> IO [ByteString]Source

Returns a list of channels currently joined.

Currently this is not updated on KICK or PART.

getNickname :: MIrc -> IO ByteStringSource

Returns the current nickname.

Currently this is not updated on NICK.

getAddress :: MIrc -> IO ByteStringSource

Returns the address

getUsername :: MIrc -> IO ByteStringSource

Returns the User name

getRealname :: MIrc -> IO ByteStringSource

Returns the Real name