irclib.protocol



char[] ircParam (ref char[] params);
Returns:
the next param and updates params to exclude it.

char[] nextWord (ref char[] line);
Returns:
the next word and updates line to exclude it.

char[] nickFromSource (char[] source);
Returns:
the name from a command prefix in one of the formats: "nick!user@host", "nick", "server.name"

char[] addressFromSource (char[] source);
Returns:
"user@host" from the format "nick!user@host", or returns null.

char[] siteFromSource (char[] source);
Returns:
"host" from the format "nick!user@host" or "server.name", or returns null.

char[] userNameFromSource (char[] source);
Returns:
"user" from the format "nick!user@host", or returns null.

class IrcProtocolException : object.Exception;
IRC protocol exception.

this(char[] msg);


interface IQueue ;
Queue incoming and outgoing data.

When implementing: Data to be written must be duplicated if stored. Data to be read must be owned by the reader.

abstract void write (void[] data);


abstract void[] read (int nbytes);


abstract void[] read ();


abstract void[] peek ();


abstract int writeBytes ();
Property:
get number of bytes in the write queue.

abstract int readBytes ();
Property:
get number of bytes in the read queue.

class IrcFrom ;
Source of an IRC command.

this(char[] from);


final char[] from ();
Property:
get the source/prefix.

final char[] fromNick ();
Property:
get

See nickFromSource().

final char[] fromAddress ();
Property:
get

See addressFromSource().

final char[] fromSite ();
Property:
get

See siteFromSource().

final char[] fromUserName ();
Property:
get

See userNameFromSource().

class ChannelTopic : irclib.protocol.IrcFrom;


this(char[] prefix, char[] channelName, char[] topic);


final char[] channelName ();
Property:
get

final char[] topic ();
Property:
get

class IrcMode : irclib.protocol.IrcFrom;


this(char[] prefix, char[] target, char[] modechars, char[] modeparams);


final char[] target ();
Property:
get

final char[] modeChars ();
Property:
get

final char[] modeParams ();
Property:
get

class IrcChannelMode : irclib.protocol.IrcMode;


this(char[] prefix, char[] channelName, char[] modechars, char[] modeparams);


final char[] channelName ();
Property:
get

class IrcMessage : irclib.protocol.IrcFrom;


this(char[] from, char[] target, char[] message);


final char[] target ();
Property:
get

final char[] message ();
Property:
get

class IrcUserMessage : irclib.protocol.IrcMessage;


this(char[] from, char[] target, char[] message);


class IrcChannelMessage : irclib.protocol.IrcMessage;


this(char[] from, char[] target, char[] channelName, char[] message);
Params:
char[] target actual channel target, such as "@#D".
char[] channelName the target without prefix symbols, such as "#D".

final char[] channelName ();
Property:
get

class CtcpMessage : irclib.protocol.IrcMessage;
The message is the CTCP's arguments.

this(char[] from, char[] target, char[] ctcp, char[] message);


final char[] ctcp ();
Property:
get

class CtcpUserMessage : irclib.protocol.CtcpMessage;


this(char[] from, char[] target, char[] ctcp, char[] message);


class CtcpChannelMessage : irclib.protocol.CtcpMessage;


this(char[] from, char[] target, char[] channelName, char[] ctcp, char[] message);


final char[] channelName ();
Property:
get

class IrcQuit : irclib.protocol.IrcFrom;


this(char[] from, char[] reason);


final char[] reason ();
Property:
get

class ChannelKick : irclib.protocol.IrcFrom;
from is the kicker.

this(char[] from, char[] channelName, char[] kickedNick, char[] reason);


final char[] channelName ();
Property:
get

final char[] kickedNick ();
Property:
get

final char[] reason ();
Property:
get

class ChannelJoin : irclib.protocol.IrcFrom;


this(char[] from, char[] channelName);


final char[] channelName ();
Property:
get

class ChannelPart : irclib.protocol.IrcFrom;


this(char[] from, char[] channelName, char[] reason);


final char[] channelName ();
Property:
get

final char[] reason ();
Property:
get

class IrcNick : irclib.protocol.IrcFrom;


this(char[] from, char[] newNick);


final char[] newNick ();
Property:
get the user's new nickname.

class ChannelTopicReply ;


this(char[] channelName, char[] topic);


final char[] channelName ();
Property:
get

final char[] topic ();
Property:
get

class ChannelTopicWhoTimeReply ;


this(char[] channelName, char[] setter, uint ctime);


final char[] channelName ();
Property:
get

final char[] setter ();
Property:
get who set the topic, usually either just a nickname or a server name.

final uint ctime ();
Property:
get time corresponding to C's time().

class IrcProtocol ;
IRC protocol that does not rely on any particular transport means.

The memory used in events may be part of a huge block, so it may be preferable to duplicate the memory if storing portions.

Usage:
serverConnected must be called to log into the server. serverDisconnected must be called to finalize things. serverReadData must be called when data has been added to the queue.

const char[] VERSION ;


this(char[] nick = "MrFoo", char[] userName = "mrfoo", char[] fullName = "D irclib: www.dprogramming.com");


protected void onMessageReceived (IrcMessage imsg);
Channel and user messages.

protected void onUserMessageReceived (IrcUserMessage imsg);
Message target is a user, probably me.

protected void onChannelMessageReceived (IrcChannelMessage imsg);
Message target is a channel, probably one I'm on.

protected void onActionReceived (IrcMessage imsg);


protected void onUserActionReceived (IrcUserMessage imsg);


protected void onChannelActionReceived (IrcChannelMessage imsg);


protected void onMode (IrcMode imode);


protected void onUserMode (IrcUserMode iumode);
Mode target is probably me.

protected void onChannelMode (IrcChannelMode icmode);
Mode target is a channel, probably one I'm on.

protected void onTopicChanged (ChannelTopic ctopic);


protected void onTopicReply (ChannelTopicReply ctr);
When issuing /TOPIC , this is the reply. Upon joining a channel, a topic is also often sent. Note that the "from" is usually only a nick or a server.

protected void onTopicWhoTimeReply (ChannelTopicWhoTimeReply ctwtr);
Usually called after onTopicReply() with more information.

protected void onCtcpReceived (CtcpMessage cmsg);


protected void onUserCtcpReceived (CtcpUserMessage cmsg);


protected void onChannelCtcpReceived (CtcpChannelMessage cmsg);


protected void onNoticeReceived (IrcMessage imsg);
Channel and user notices.

protected void onUserNoticeReceived (IrcUserMessage imsg);
Notice target is a user, probably me.

protected void onChannelNoticeReceived (IrcChannelMessage imsg);
Notice target is a channel, probably one I'm on.

protected void onCtcpReplyReceived (CtcpMessage cmsg);


protected void onUserCtcpReplyReceived (CtcpUserMessage cmsg);


protected void onChannelJoin (ChannelJoin cjoin);
A user has joined a channel.

protected void onChannelPart (ChannelPart cpart);
A user has parted a channel.

protected void onQuit (IrcQuit iquit);
A user has quit IRC.

protected void onChannelKick (ChannelKick ckick);
A user has kicked another user out of a channel.

protected void onNick (IrcNick inick);
A user has changed their nickname.

final void sendUtf8 (bool byes);
Property:
set whether or not to send UTF-8 text instead of Latin-1.

Sending Latin-1 is currently only supported on Windows. This property is now enabled by default.

final bool sendUtf8 ();
Property:
get whether or not to send UTF-8 text instead of Latin-1.

void sendLine (char[] line);
Send a line of text.

The line is not to contain any newline characters; they are sent automatically.

final bool isConnected ();
Property:
get

final bool isLoggedIn ();
Property:
get

protected void onConnected ();


protected void onDisconnected ();


protected void onLoggedIn ();


protected final IQueue queue ();
Property:
get the queue .

final char[] nick ();
Property:
get my nickname.

final void nick (char[] newNick);
Property:
set my nickname.

If connected, this is delayed until the server replies.

final void userName (char[] user);
Property:
set my user name.

final char[] userName ();
Property:
get my user name.

final void fullName (char[] name);
Property:
set my full name.

final char[] fullName ();
Property:
get my full name.

final void sendMessage (char[] target, char[] message);
Send a PRIVMSG command.

final void sendNotice (char[] target, char[] message);
Send a NOTICE command.

final void sendCtcp (char[] target, char[] ctcp, char[] ctcpParams);


final void sendCtcpReply (char[] target, char[] ctcp, char[] ctcpParams);


final void sendAction (char[] target, char[] message);
Send an action, commonly known as "/ME".

final void sendMode (char[] target, char[] modes, char[][] modeparams...);
Change modes.

final char[] network ();
Property:
get network name received from the server. null if not received.

final char[] prefix ();
Property:
get user prefixes for channel status. e.g. "(ov)@+"

final char[] prefixSymbols ();
Property:
get user prefix symbols for channel status.

Indices match up with prefixModes.

final char[] prefixModes ();
Property:
get mode characters for user prefix symbols for channel status.

Indices match up with prefixSymbols.

final uint maximumWatch ();
Property:
get maximum number of entries allowed in WATCH list.

Supports WATCH list if nonzero.

final uint maximumChannels ();
Property:
get maximum number of channels allowed to join at once.

final char[] channelTypes ();
Property:
get the type of channels. e.g. "#&"

final uint maximumModes ();
Property:
get maximum number of modes allowed in one MODE command.

final uint maximumSilence ();
Property:
get maximum number of entries allowed in SILENCE list.

Supports SILENCE list if nonzero.

final char[] caseMapping ();
Property:
get how letter cases should be handled in nicks and channel names. e.g. "rfc1459" or "ascii"

final uint maximumNickLength ();
Property:
get

final char[] channelModes ();
Property:
get

static int strcmpAscii (char[] s1, char[] s2);
Compare strings case insensitively using ASCII.

Returns:
0 on match, < 0 if less, or > 0 if greater.

static int strcmpRfc1459 (char[] s1, char[] s2);
Compare strings case insensitively using RFC 1459 rules.

Returns:
0 on match, < 0 if less, or > 0 if greater.

int strcmp (char[] s1, char[] s2);
Uses the current server's case mapping to compare case insensitive strings.

Returns:
0 on match, < 0 if less, or > 0 if greater.

final char[] channelNameFromTarget (char[] target);
Returns:
channel name, or null if not a channel. e.g. returns "#D" from "@+#D"

final bool isChannelName (char[] s);
Determines if the string is a channel name.

Note:
channel mode prefixes are not considered, use channelNameFromTarget in that case.

protected void onCommand (char[] prefix, char[] cmd, char[] cmdParams);
Process a command from the server.

protected void onLine (char[] line);
A line of text received from the server. Must not contain newline characters.

protected final void serverReadData ();
Call when new data has been added to the queue. The queue does not need to contain newline characters.

protected void sendLoginInfo (char[] serverHost);
Send USER and NICK commands.

Params:
char[] serverHost the server host name for the 3rd parameter of USER.

protected void serverConnected (IQueue queue, char[] serverHost);
Call when a connection to the server has been made.

Params:
IQueue queue the data queue for this connection.
char[] serverHost the name of the server host.

protected void serverDisconnected ();
Call when the connection to the server has been severed; either by the local or remote side.

Page was generated with on Sat Nov 3 13:52:19 2007