IrcClient

Represents an IRC client connection.

Use the separate type $(DPREF tracker, IrcTracker) returned by $(DPREF tracker, track) to keep track of the channels the user for this connection is a member of, and the members of those channels.

class IrcClient {}

Constructors

this
this()
this(Socket socket)

Create a new unconnected IRC client.

Members

Aliases

nick
deprecated alias nick = nickName

Nick name of the user for this client.

Functions

addChannelModes
void addChannelModes(char[] channel, ChannelMode[] modes)

Add or remove channel modes in the given channel.

addToChannelList
void addToChannelList(char[] channel, char list, char[][] addresses)

Add or remove an address to/from a _channel list.

addUserModes
void addUserModes(char[] modes)

Add or remove user modes to/from this user.

connect
void connect(Address serverAddress, char[] password)
void connect(Address serverAddress)

Connect this client to a server.

connected
bool connected()

Check if this client is connected.

ctcpError
void ctcpError(char[] targetNick, char[] invalidData, char[] error)

Send a CTCP _error message reply.

ctcpQuery
void ctcpQuery(char[] target, char[] query)
void ctcpQuery(char[] target, char[] tag, char[] data)

Send a CTCP _query to a channel or user.

ctcpReply
void ctcpReply(char[] targetNick, char[] reply)
void ctcpReply(char[] targetNick, char[] tag, char[] data)

Send a CTCP _reply to a user.

getUser
IrcUser getUser(char[] prefix)
Undocumented in source. Be warned that the author may not have intended to support it.
join
void join(char[] channel)

Join a _channel.

join
void join(char[] channel, char[] key)

Join a passworded _channel.

kick
void kick(char[] channel, char[] user)
void kick(char[] channel, char[] user, char[] comment)
void kick(char[] channel, Range users)
void kick(char[] channel, Range users, char[] comment)

Kick one or more _users from a _channel.

kick
void kick(Range channelUserPairs)
void kick(Range channelUserPairs, char[] comment)

Kick users from channels in a single message.

maxNickNameLength
ushort maxNickNameLength()

The maximum number of characters (bytes) allowed in this user's nick name.

networkName
string networkName()

The name of the IRC network the server is part of, or null if the server has not advertised the network name.

nickName
string nickName()
void nickName(char[] newNick)
void nickName(string newNick)

Nick name of the user for this client.

notice
void notice(char[] target, char[] message)

Send notices to a channel or user. Each line in message is sent as one notice. Lines exceeding the IRC _message length limit will be split up into multiple notices.

noticef
void noticef(char[] target, char[] fmt, FormatArgs fmtArgs)

Send formatted notices to a channel or user. Each line in the formatted result is sent as one notice. Lines exceeding the IRC message length limit will be split up into multiple notices.

part
void part(char[] channel)

Leave a _channel.

part
void part(char[] channel, char[] message)

Leave a _channel with a parting _message.

queryNames
void queryNames(char[][] channels)

Query the list of members in the given channels.

queryUserhost
void queryUserhost(char[][] nicks)

Query the user name and host name of up to 5 users.

queryWhois
void queryWhois(char[] nick)

Query information about a particular user.

quit
void quit(char[] message)

Leave and disconnect from the server.

read
bool read()

Read all available data from the connection, parse all complete IRC messages and invoke registered callbacks.

realName
string realName()
void realName(string newRealName)

Real name of the user for this client.

removeChannelModes
void removeChannelModes(char[] channel, ChannelMode[] modes)

Add or remove channel modes in the given channel.

removeFromChannelList
void removeFromChannelList(char[] channel, char list, char[][] addresses)

Add or remove an address to/from a _channel list.

removeUserModes
void removeUserModes(char[] modes)

Add or remove user modes to/from this user.

send
void send(char[] target, char[] message)

Send lines of chat to a channel or user. Each line in message is sent as one _message. Lines exceeding the IRC _message length limit will be split up into multiple messages.

sendf
void sendf(char[] target, char[] fmt, FormatArgs fmtArgs)

Send formatted lines of chat to a channel or user. Each line in the formatted result is sent as one message. Lines exceeding the IRC message length limit will be split up into multiple messages.

serverAddress
inout(Address) serverAddress()

Address of the server this client is currently connected to, or null if this client is not connected.

userName
string userName()
void userName(string newUserName)

User name of the user for this client.

writef
void writef(const(char)[] rawline, T fmtArgs)

Write a raw message to the connection stream.

Static variables

formatBuffer
char[1540] formatBuffer;
Undocumented in source.

Structs

ChannelMode
struct ChannelMode

Add or remove channel modes in the given channel.

Variables

onConnect
void delegate()[] onConnect;

Invoked when this client has successfully connected to a server.

onCtcpQuery
void delegate(IrcUser user, in char[] source, in char[] tag, in char[] data)[] onCtcpQuery;

Invoked when a CTCP query is received in a message. IrcClient.onMessage is not invoked for the given message when onCtcpQuery has a non-zero number of registered handlers. Note: This callback is only invoked when there is a CTCP message at the start of the message, and any subsequent CTCP messages in the same message are discarded. To handle multiple CTCP queries in one message, use IrcClient.onMessage with $(DPREF ctcp, ctcpExtract).

onCtcpReply
void delegate(IrcUser user, in char[] source, in char[] tag, in char[] data)[] onCtcpReply;

Invoked when a CTCP reply is received in a notice. IrcClient.onNotice is not invoked for the given notice when onCtcpReply has a non-zero number of registered handlers. Note: This callback is only invoked when there is a CTCP message at the start of the notice, and any subsequent CTCP messages in the same notice are discarded. To handle multiple CTCP replies in one notice, use IrcClient.onNotice with $(DPREF ctcp, ctcpExtract).

onJoin
void delegate(IrcUser user, in char[] channel)[] onJoin;

Invoked when another user joins a channel that this user is a member of.

onKick
void delegate(IrcUser kicker, in char[] channel, in char[] kickedNick, in char[] comment)[] onKick;

Invoked when a user is kicked (forcefully removed) from a channel that this user is a member of.

onMessage
void delegate(IrcUser user, in char[] target, in char[] message)[] onMessage;

Invoked when a message is picked up by the user for this client.

onNameList
void delegate(in char[] channel, in char[][] nickNames)[] onNameList;

Invoked when a list of member nick names for a channel are received.

onNameListEnd
void delegate(in char[] channel)[] onNameListEnd;

Invoked when the complete list of members of a _channel have been received. All invocations of onNameList between invocations of this event are part of the same member list.

onNickChange
void delegate(IrcUser user, in char[] newNick)[] onNickChange;

Invoked when a user receives a new nickname.

onNickInUse
const(char)[] delegate(in char[] newNick)[] onNickInUse;

Invoked when the requested nick name of the user for this client is already in use.

onNotice
void delegate(IrcUser user, in char[] target, in char[] message)[] onNotice;

Invoked when a notice is picked up by the user for this client.

onPart
void delegate(IrcUser user, in char[] channel)[] onPart;

Invoked when a user parts a channel that this user is a member of. Also invoked when this user parts a channel.

onQuit
void delegate(IrcUser user, in char[] comment)[] onQuit;

Invoked when another user disconnects from the network.

onSuccessfulJoin
void delegate(in char[] channel)[] onSuccessfulJoin;

Invoked following a call to IrcClient.join when the _channel was successfully joined.

onTopic
void delegate(in char[] channel, in char[] topic)[] onTopic;

Invoked when a _channel is joined, a _topic is set in a _channel or when the current _topic was requested.

onTopicInfo
void delegate(in char[] channel, in char[] nick, in char[] time)[] onTopicInfo;

Invoked when a _channel is joined or when the current _topic was requested.

onUserhostReply
void delegate(in IrcUser[] users)[] onUserhostReply;

Invoked with the reply of a userhost query.

onWhoisAccountReply
void delegate(in char[] nick, in char[] accountName)[] onWhoisAccountReply;
onWhoisChannelsReply
void delegate(in char[] nick, in char[][] channels)[] onWhoisChannelsReply;
onWhoisEnd
void delegate(in char[] nick)[] onWhoisEnd;
onWhoisIdleReply
void delegate(in char[] nick, int idleTime)[] onWhoisIdleReply;
onWhoisOperatorReply
void delegate(in char[] nick)[] onWhoisOperatorReply;

Invoked when a WHOIS reply is received.

onWhoisReply
void delegate(IrcUser userInfo, in char[] realName)[] onWhoisReply;
onWhoisServerReply
void delegate(in char[] nick, in char[] serverHostName, in char[] serverInfo)[] onWhoisServerReply;

Invoked when a WHOIS reply is received.

socket
Socket socket;
Undocumented in source.

Meta