Handlers
Methods
void onPing(const string& response)
This handler is called when we recieve a server ping request. response is the string that should be sent back.
This is the only handler without an empty default handler. If you override this method, you will override the default handling of server ping events (namely sending response back to the server).
void onMessage(const string& target, const string& message, const string& senderNickname, const string& senderUsername, const string& senderHostname)
This handler is called whenever we recieve a message (either to a channel we are in, or privately to us.) A good method of determining whether the message was sent to us privately is to check if target is equal to out nickname. ie:
if (target == getNickname()) {
// this was a private message to us
} else {
// must be a channel message
}
void onNotice(const string& target, const string& message, const string& senderNickname, const string& senderUsername, const string& senderHostname)
This handler is called whenever we recieve a message in a notice (either to a channel we are in, or privately to us.) A good method of determining whether the message was sent to us privately is to check if target is equal to out nickname. ie:
if (target == getNickname()) {
// this was a private message to us
} else {
// must be a channel message
}
void onNicknameChange(const string& oldNickname, const string& newNickname, const string& senderUsername, const string& senderHostname)
This handler is called whenever someone (possibly us) changes their nickname in a channel we are in. Overridding this function will not affect the frameworks ability to keep track of its own nickname (as the code is seperate from the default handler), so you need not worry.
void onDisconnect()
This handler is called whenever we get disconnected. It is not a good idea to call the start method again from within this handler, but instead you should let your object destroy itself and create a new instance of it.
void onConnect()
This handler is called when we are finished connecting and logging in to the IRC server. This is a good time to join channels.
void onRawLine(const string& line)
This handler is called whenever we recieve a line from the server. You can use this handler to do any custom handling.
Overriding this handler will not interfere with the frameworks processing of other events.
void onCtcpRequest(const string& target, const string& request, const string& senderNickname, const string& senderUsername, const string& senderHostname)
This handler is called whenever we recieve a CTCP request. This includes actions (which are technically CTCP requests). Overriding this handler will not interfere with the calling of other CTCP related handlers (such as onAction).
void onCtcpResponse(const string& target, const string& response, const string& senderNickname, const string& senderUsername, const string& senderHostname)
This handler is called whenever we recieve a CTCP response.
void onAction(const string& target, const string& message, const string& senderNickname, const string& senderUsername, const string& senderHostname)
This handler is called whenever we recieve an action message (either to a channel we are in, or privately to us.) A good method of determining whether the action was sent to us privately is to check if target is equal to out nickname. ie:
if (target == getNickname()) {
// this was a private action message to us
} else {
// must be a channel action message
}
void onJoinChannel(const string& senderNickname, const string& channel, const string& senderUsername, const string& senderHostname)
This handler is called when someone (possibly us) joins a channel we are in.
void onPartChannel(const string& senderNickname, const string& channel, const string& reason, const string& senderUsername, const string& senderHostname)
This handler is called when someone (possibly us) parts a channel we are in.
void onKick(const string& senderNickname, const string& kickedNickname, const string& channel, const string& message, const string& senderUsername, const string& senderHostname)
This handler is called when someone (possibly us) gets kicked from a channel we are in.
void sendRawLine(const string& line) const
Sends a raw line to the server.
void sendMessage(const string& target, const string& message) const
sends a message to specified target (generally either another user or a channel).
void joinChannel(const string& channel, const string& key = "") const
Joins specified channel.
void partChannel(const string& channel, const string& reason = "") const
Parts (leaves) the specified channel.
void quit(const string& message = "") const
Quits (disconnects) from the IRC server.
void changeNickname(const string& newNickname) const
Requests a nickname change.
void setChannelMode(const string& channel, const string& modeLine) const
Sets specified channel mode(s).
Example: setChannelMode("#yourchannel","+o someuser");
void setUserMode(const string& nickname, const string& modeLine) const
Sets specified users mode(s) on specified user (remember, things like channel ops, voice, etc. are all channel modes, not user modes).
void op(const string& channel, const string& nickname) const
Gives channel operator priviledges to specified user in specified channel.
void deop(const string& channel, const string& nickname) const
Removes channel operator priviledges from specified user in specified channel.
void voice(const string& channel, const string& nickname) const
Gives voice priviledges to specified user in specified channel.
void devoice(const string& channel, const string& nickname) const
Removes voice priviledges from specified user in specified channel.
void ban(const string& channel, const string& hostmask) const
Bans specified hostmask from the channel.
void removeBan(const string& channel, const string& hostmask) const
Removes specified hostmask from the channel ban list.
void kick(const string& channel, const string& nickname, const string& reason = "") const
Kicks specified user from the specified channel, with the optional specified reason.
void sendNotice(const string& target, const string& message) const
Sends a notice to the specified target (a user, or channel).
void sendAction(const string& target, const string& message) const
Sends an action to the specified target (a user, or channel).
void sendCtcpRequest(const string& target, const string& request) const
Sends a Ctcp request to the specified target (a user or channel).
void sendCtcpResponse(const string& target, const string& response) const
Sends a Ctcp responce to the specified target (a user or channel).
const string getNickname() const
Returns what the bot currently believes to be its nickname.
void debugMessage(const string& message) const
Outputs a debug message to console (if debug output is enabled).
void shutdown()
Shuts down this instance of the framework (the start method will return).
void setDebugOutput(bool enable = true)
Enables or disables console debug output.
bool start(const string& serverHostname, const string& serverPassword, const int serverPort, const string& nickname, const string& userName = "ARGIrc", const string& realName = "ARGIrc")
Starts up the framework (connects to the server with the given information).
|
|