#include <PircBot.h>
Inheritance diagram for PircBot:
Public Member Functions | |
virtual void | ban (const char *const channel, const char *const hostmask) const throw (Exception &) |
Bans a user from a channel. | |
virtual void | changeNick (const char *const newNick) const throw (Exception &) |
Attempt to change the current nick (nickname) of the bot when it is connected to an IRC server. | |
virtual void | connect (const char *const hostname, const unsigned int &port, const char *const password) throw (IOException &, IrcException &, NickAlreadyInUseException &, Exception &) |
Attempt to connect to the specified IRC server using the supplied password. | |
virtual void | connect (const char *const hostname, const unsigned int &port) throw (IOException &, IrcException &, NickAlreadyInUseException &, Exception &) |
Attempt to connect to the specified IRC server and port number. | |
virtual void | connect (const char *const hostname) throw (IOException &, IrcException &, NickAlreadyInUseException &, Exception &) |
Attempt to connect to the specified IRC server. | |
virtual void | deOp (const char *const channel, const char *const nick) const throw (Exception &) |
Removes operator privilidges from a user on a channel. | |
virtual void | deVoice (const char *const channel, const char *const nick) const throw (Exception &) |
Removes voice privilidges from a user on a channel. | |
virtual void | disconnect () const throw (Exception &) |
This method disconnects from the server cleanly by calling the quitServer() method. | |
virtual void | dispose () throw (Exception &) |
Disposes of all thread resources used by this PircBot. | |
virtual const char ** | getChannels (int &sizeOfArray) const throw (Exception &) |
Returns an array of all channels that we are in. | |
virtual const char * | getFinger () const throw (Exception &) |
Gets the internal finger message of the PircBot. | |
virtual const char * | getLogin () const throw (Exception &) |
Gets the internal login of the PircBot. | |
virtual unsigned int | getMaxLineLength () const throw (Exception &) |
Gets the maximum length of any line that is sent via the IRC protocol. | |
virtual unsigned int | getMessageDelay () const throw (Exception &) |
Returns the number of milliseconds that will be used to separate consecutive messages to the server from the outgoing message queue. | |
virtual const char * | getName () const throw (Exception &) |
Gets the name of the PircBot. | |
virtual const char * | getNick () throw (Exception &) |
Returns the current nick of the bot. | |
virtual unsigned int | getOutgoingQueueSize () const throw (Exception &) |
Gets the number of lines currently waiting in the outgoing message Queue. | |
const char * | getPassword () const throw (Exception &) |
Returns the last password that we used when connecting to an IRC server. | |
unsigned int | getPort () const throw (Exception &) |
Returns the port number of the last IRC server that the PircBot tried to connect to. | |
const char * | getServer () const throw (Exception &) |
Returns the name of the last IRC server the PircBot tried to connect to. | |
virtual User * | getUsers (const char *const channel, unsigned int &arraySize) const throw (Exception &) |
Returns an array of all users in the specified channel. | |
virtual const char * | getVersion () const throw (Exception &) |
Gets the internal version of the PircBot. | |
virtual void | handleLine (const char *const line) throw (Exception &) |
This method handles events when any line of text arrives from the server, then calling the appropriate method in the PircBot. | |
virtual bool | isConnected () const throw (Exception &) |
Returns whether or not the PircBot is currently connected to a server. | |
virtual void | join () const throw (Exception &) |
Block until all internal threads are done processing. | |
virtual void | joinChannel (const char *const channel, const char *const key) const throw (Exception &) |
Joins a channel with a key. | |
virtual void | joinChannel (const char *const channel) const throw (Exception &) |
Joins a channel. | |
virtual void | kick (const char *const channel, const char *const nick, const char *const reason) const throw (Exception &) |
Kicks a user from a channel, giving a reason. | |
virtual void | kick (const char *const channel, const char *const nick) const throw (Exception &) |
Kicks a user from a channel. | |
virtual void | listChannels (const char *const parameters) const throw (Exception &) |
Issues a request for a list of all channels on the IRC server. | |
virtual void | listChannels () const throw (Exception &) |
Issues a request for a list of all channels on the IRC server. | |
virtual void | log (const char *const line) const throw (Exception &) |
Adds a line to the log. | |
virtual void | onDisconnect () throw (Exception &) |
This method carries out the actions to be performed when the PircBot gets disconnected. | |
virtual void | op (const char *const channel, const char *const nick) const throw (Exception &) |
Grants operator privilidges to a user on a channel. | |
void | operator delete (void *p) |
All delete's will be handled through this dll. | |
void * | operator new (unsigned int size) |
All new's will be handled through this dll. | |
virtual void | partChannel (const char *const channel, const char *const reason) const throw (Exception &) |
Parts a channel, giving a reason. | |
virtual void | partChannel (const char *const channel) const throw (Exception &) |
Parts a channel. | |
PircBot () throw (Exception &) | |
Constructs a PircBot with the default settings. | |
virtual void | quitServer (const char *const reason) const throw (Exception &) |
Quits from the IRC server with a reason. | |
virtual void | quitServer () const throw (Exception &) |
Quits from the IRC server. | |
virtual void | reconnect () throw (IOException &, IrcException &, NickAlreadyInUseException &, Exception &) |
Reconnects to the IRC server that we were previously connected to. | |
virtual void | sendAction (const char *const target, const char *const action) const throw (Exception &) |
Sends an action to the channel or to a user. | |
virtual void | sendCTCPCommand (const char *const target, const char *const command) const throw (Exception &) |
Sends a CTCP command to a channel or user. | |
virtual void | sendInvite (const char *const nick, const char *const channel) const throw (Exception &) |
Sends an invitation to join a channel. | |
virtual void | sendMessage (const char *const target, const char *const message) const throw (Exception &) |
Sends a message to a channel or a private message to a user. | |
virtual void | sendNotice (const char *const target, const char *const notice) const throw (Exception &) |
Sends a notice to the channel or to a user. | |
virtual void | sendRawLine (const char *const line) const throw (Exception &) |
Sends a raw line to the IRC server as soon as possible, bypassing the outgoing message queue. | |
virtual void | sendRawLineViaQueue (const char *const line) const throw (Exception &) |
Sends a raw line through the outgoing message queue. | |
virtual void | setAutoNickChange (bool autoNickChange) throw (Exception &) |
When you connect to a server and your nick is already in use and this is set to true, a new nick will be automatically chosen. | |
virtual void | setMessageDelay (const unsigned int &delay) throw (Exception &) |
Sets the number of milliseconds to delay between consecutive messages when there are multiple messages waiting in the outgoing message queue. | |
virtual void | setMode (const char *const channel, const char *const mode) const throw (Exception &) |
Set the mode of a channel. | |
virtual void | setTopic (const char *const channel, const char *const topic) const throw (Exception &) |
Set the topic for a channel. | |
virtual void | setVerbose (const bool &verbose) throw (Exception &) |
Sets the verbose mode. | |
virtual void | startIdentServer () const throw (Exception &) |
Starts an ident server (Identification Protocol Server, RFC 1413). | |
virtual void | unBan (const char *const channel, const char *const hostmask) const throw (Exception &) |
Unbans a user from a channel. | |
virtual void | voice (const char *const channel, const char *const nick) const throw (Exception &) |
Grants voice privilidges to a user on a channel. | |
virtual | ~PircBot () |
Default virtual destructor. | |
Static Public Member Functions | |
static void | releaseMemoryOfCharArray (const char **array, const unsigned int size) throw (Exception &) |
Deallocates the memory of the array that comes from PircBot::getChannels(). | |
static void | releaseMemoryOfUserArray (User *userArray) throw (Exception &) |
Deallocates the memory of a userArray. | |
Protected Member Functions | |
virtual void | onAction (const char *const sender, const char *const login, const char *const hostname, const char *const target, const char *const action) throw (Exception &) |
This method is called whenever an ACTION is sent from a user. | |
virtual void | onChannelInfo (const char *const channel, const int &userCount, const char *const topic) throw (Exception &) |
After calling the listChannels() method in PircBot, the server will start to send us information about each channel on the server. | |
virtual void | onConnect () throw (Exception &) |
This method is called once the PircBot has successfully connected to the IRC server. | |
virtual void | onDeop (const char *const channel, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname, const char *const recipient) throw (Exception &) |
Called when a user (possibly us) gets operator status taken away. | |
virtual void | onDeVoice (const char *const channel, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname, const char *const recipient) throw (Exception &) |
Called when a user (possibly us) gets voice status removed. | |
virtual void | onFinger (const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname, const char *const target) throw (Exception &) |
This method is called whenever we receive a FINGER request. | |
virtual void | onInvite (const char *const targetNick, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname, const char *const channel) throw (Exception &) |
Called when we are invited to a channel by a user. | |
virtual void | onJoin (const char *const channel, const char *const sender, const char *const login, const char *const hostname) throw (Exception &) |
This method is called whenever someone (possibly us) joins a channel which we are on. | |
virtual void | onKick (const char *const channel, const char *const kickerNick, const char *const kickerLogin, const char *const kickerHostname, const char *const recipientNick, const char *const reason) throw (Exception &) |
This method is called whenever someone (possibly us) is kicked from any of the channels that we are in. | |
virtual void | onMessage (const char *const channel, const char *const sender, const char *const login, const char *const hostname, const char *const message) throw (Exception &) |
This method is called whenever a message is sent to a channel. | |
virtual void | onMode (const char *const channel, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname, const char *const mode) throw (Exception &) |
Called when the mode of a channel is set. | |
virtual void | onNickChange (const char *const oldNick, const char *const login, const char *const hostname, const char *const newNick) throw (Exception &) |
This method is called whenever someone (possibly us) changes nick on any of the channels that we are on. | |
virtual void | onNotice (const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname, const char *const target, const char *const notice) throw (Exception &) |
This method is called whenever we receive a notice. | |
virtual void | onOp (const char *const channel, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname, const char *const recipient) throw (Exception &) |
Called when a user (possibly us) gets granted operator status for a channel. | |
virtual void | onPart (const char *const channel, const char *const sender, const char *const login, const char *const hostname) throw (Exception &) |
This method is called whenever someone (possibly us) parts a channel which we are on. | |
virtual void | onPing (const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname, const char *const target, const char *const pingValue) throw (Exception &) |
This method is called whenever we receive a PING request from another user. | |
virtual void | onPrivateMessage (const char *const sender, const char *const login, const char *const hostname, const char *const message) throw (Exception &) |
This method is called whenever a private message is sent to the PircBot. | |
virtual void | onQuit (const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname, const char *const reason) throw (Exception &) |
This method is called whenever someone (possibly us) quits from the server. | |
virtual void | onRemoveChannelBan (const char *const channel, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname, const char *const hostmask) throw (Exception &) |
Called when a hostmask ban is removed from a channel. | |
virtual void | onRemoveChannelKey (const char *const channel, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname, const char *const key) throw (Exception &) |
Called when a channel key is removed. | |
virtual void | onRemoveChannelLimit (const char *const channel, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname) throw (Exception &) |
Called when the user limit is removed for a channel. | |
virtual void | onRemoveInviteOnly (const char *const channel, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname) throw (Exception &) |
Called when a channel has 'invite only' removed. | |
virtual void | onRemoveModerated (const char *const channel, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname) throw (Exception &) |
Called when a channel has moderated mode removed. | |
virtual void | onRemoveNoExternalMessages (const char *const channel, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname) throw (Exception &) |
Called when a channel is set to allow messages from any user, even if they are not actually in the channel. | |
virtual void | onRemovePrivate (const char *const channel, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname) throw (Exception &) |
Called when a channel is marked as not being in private mode. | |
virtual void | onRemoveSecret (const char *const channel, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname) throw (Exception &) |
Called when a channel has 'secret' mode removed. | |
virtual void | onRemoveTopicProtection (const char *const channel, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname) throw (Exception &) |
Called when topic protection is removed for a channel. | |
virtual void | onServerPing (const char *const response) throw (Exception &) |
The actions to perform when a PING request comes from the server. | |
virtual void | onServerResponse (const int &code, const char *const response) throw (Exception &) |
This method is called when we receive a numeric response from the IRC server. | |
virtual void | onSetChannelBan (const char *const channel, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname, const char *const hostmask) throw (Exception &) |
Called when a user (possibly us) gets banned from a channel. | |
virtual void | onSetChannelKey (const char *const channel, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname, const char *const key) throw (Exception &) |
Called when a channel key is set. | |
virtual void | onSetChannelLimit (const char *const channel, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname, const int &limit) throw (Exception &) |
Called when a user limit is set for a channel. | |
virtual void | onSetInviteOnly (const char *const channel, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname) throw (Exception &) |
Called when a channel is set to 'invite only' mode. | |
virtual void | onSetModerated (const char *const channel, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname) throw (Exception &) |
Called when a channel is set to 'moderated' mode. | |
virtual void | onSetNoExternalMessages (const char *const channel, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname) throw (Exception &) |
Called when a channel is set to only allow messages from users that are in the channel. | |
virtual void | onSetPrivate (const char *const channel, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname) throw (Exception &) |
Called when a channel is marked as being in private mode. | |
virtual void | onSetSecret (const char *const channel, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname) throw (Exception &) |
Called when a channel is set to be in 'secret' mode. | |
virtual void | onSetTopicProtection (const char *const channel, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname) throw (Exception &) |
Called when topic protection is enabled for a channel. | |
virtual void | onTime (const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname, const char *const target) throw (Exception &) |
This method is called whenever we receive a TIME request. | |
virtual void | onTopic (const char *const channel, const char *const topic, const char *const setBy, long date, bool changed) throw (Exception &) |
This method is called whenever a user sets the topic, or when PircBot joins a new channel and discovers its topic. | |
virtual void | onTopic (const char *const channel, const char *const topic) throw (Exception &) |
This method is called whenever a user sets the topic, or when PircBot joins a new channel and discovers its topic. | |
virtual void | onUnknown (const char *const line) throw (Exception &) |
This method is called whenever we receive a line from the server that the PircBot has not been programmed to recognise. | |
virtual void | onUserList (const char *const channel, User *users, int usersArraySize) throw (Exception &) |
This method is called when we receive a user list from the server after joining a channel. | |
virtual void | onUserMode (const char *const targetNick, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname, const char *const mode) throw (Exception &) |
Called when the mode of a user is set. | |
virtual void | onVersion (const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname, const char *const target) throw (Exception &) |
This method is called whenever we receive a VERSION request. | |
virtual void | onVoice (const char *const channel, const char *const sourceNick, const char *const sourceLogin, const char *const sourceHostname, const char *const recipient) throw (Exception &) |
Called when a user (possibly us) gets voice status granted in a channel. | |
virtual void | setFinger (const char *const finger) throw (Exception &) |
Sets the interal finger message. | |
virtual void | setLogin (const char *const login) throw (Exception &) |
Sets the internal login of the Bot. | |
virtual void | setName (const char *const name) throw (Exception &) |
Sets the name of the bot, which will be used as its nick when it tries to join an IRC server. | |
virtual void | setVersion (const char *const version) throw (Exception &) |
Sets the internal version of the Bot. | |
Private Member Functions | |
PircBot & | operator= (const PircBot &pircbot) |
The assignment operator. | |
PircBot (const PircBot &pircbot) | |
The copy constructor. | |
Private Attributes | |
PircBotImpl * | m_pimpl |
The private implementation in which you cannot get access to. | |
Friends | |
class | PircBotImpl |
It provides an event-driven architecture to handle common IRC events, flood protection, DCC support, ident support, and more. The comprehensive logfile format is suitable for use with pisg to generate channel statistics.
Methods of the PircBot class can be called to send events to the IRC server that it connects to. For example, calling the sendMessage method will send a message to a channel or user on the IRC server. Multiple servers can be supported using multiple instances of PircBot.
To perform an action when the PircBot receives a normal message from the IRC server, you would override the onMessage method defined in the PircBot class. All onXYZ methods in the PircBot class are automatically called when the event XYZ happens, so you would override these if you wish to do something when it does happen.
Some event methods, such as onPing, should only really perform a specific function (i.e. respond to a PING from the server). For your convenience, such methods are already correctly implemented in the PircBot and should not normally need to be overridden. Please read the full documentation for each method to see which ones are already implemented by the PircBot class.
Please visit the PircBot homepage at http://pircbotcpp.sourceforge.net/ for full revision history, a beginners guide to creating your first PircBot and a list of some existing C++ IRC bots and clients that use the PircBotcpp framework.
|
Constructs a PircBot with the default settings. Your own constructors in classes which extend the PircBot abstract class should be responsible for changing the default settings if required.
|
|
Default virtual destructor. It will disconnect you from the server call PircBot::dispose() and delete the private implementation (pimpl) |
|
The copy constructor. For now, I am not allowing this to be invoked.
|
|
Bans a user from a channel. An example of a valid hostmask is "*!*compu@*.18hp.net". This may be used in conjunction with the kick method to permanently remove a user from a channel. Successful use of this method may require the bot to have operator status itself.
|
|
Attempt to change the current nick (nickname) of the bot when it is connected to an IRC server. After confirmation of a successful nick change, the getNick method will return the new nick.
|
|
Attempt to connect to the specified IRC server using the supplied password. The onConnect method is called upon success.
|
|
Attempt to connect to the specified IRC server and port number. The onConnect method is called upon success.
|
|
Attempt to connect to the specified IRC server. The onConnect method is called upon success.
|
|
Removes operator privilidges from a user on a channel. Successful use of this method may require the bot to have operator status itself.
|
|
Removes voice privilidges from a user on a channel. Successful use of this method may require the bot to have operator status itself.
|
|
This method disconnects from the server cleanly by calling the quitServer() method. Providing the PircBot was connected to an IRC server, the onDisconnect() will be called as soon as the disconnection is made by the server.
|
|
Disposes of all thread resources used by this PircBot. This may be useful when writing bots or clients that use multiple servers (and therefore multiple PircBot instances) or when integrating a PircBot with an existing program. Each PircBot runs its own threads for dispatching messages from its outgoing message queue and receiving messages from the server. Calling dispose() ensures that these threads are stopped, thus freeing up system resources. Once a PircBot object has been disposed, it should not be used again. Attempting to use a PircBot that has been disposed may result in unpredictable behaviour.
|
|
Returns an array of all channels that we are in. Note that if you call this method immediately after joining a new channel, the new channel may not appear in this array as it is not possible to tell if the join was successful until a response is received from the IRC server. Release the memory through releaseMemoryOfCharArray. DO NOT try and release the memory yourself. Let releaseMemoryOfCharArray handle the release of the memory.
|
|
Gets the internal finger message of the PircBot.
|
|
Gets the internal login of the PircBot.
|
|
Gets the maximum length of any line that is sent via the IRC protocol.
The IRC RFC specifies that line lengths, including the trailing
|
|
Returns the number of milliseconds that will be used to separate consecutive messages to the server from the outgoing message queue.
|
|
Gets the name of the PircBot. This is the name that will be used as as a nick when we try to join servers.
|
|
Returns the current nick of the bot. Note that if you have just changed your nick, this method will still return the old nick until confirmation of the nick change is received from the server. The nick returned by this method is maintained only by the PircBot class and is guaranteed to be correct in the context of the IRC server.
|
|
Gets the number of lines currently waiting in the outgoing message Queue. If this returns 0, then the Queue is empty and any new message is likely to be sent to the IRC server immediately.
|
|
Returns the last password that we used when connecting to an IRC server. This does not imply that the connection attempt to the server was successful (we suggest you look at the onConnect method). A value of null is returned if the PircBot has never tried to connect to a server using a password.
|
|
Returns the port number of the last IRC server that the PircBot tried to connect to. This does not imply that the connection attempt to the server was successful (we suggest you look at the onConnect method). A value of -1 is returned if the PircBot has never tried to connect to a server.
|
|
Returns the name of the last IRC server the PircBot tried to connect to. This does not imply that the connection attempt to the server was successful (we suggest you look at the onConnect method). A value of null is returned if the PircBot has never tried to connect to a server.
|
|
Returns an array of all users in the specified channel. DO NOT try and delete this pointer yourself. Instead to deallocate call releaseMemoryOfUserArray(). This is to keep everything dll boundary safe. There are some important things to note about this method:-
|
|
Gets the internal version of the PircBot.
|
|
This method handles events when any line of text arrives from the server, then calling the appropriate method in the PircBot. This method is protected and only called by the InputThread for this instance. This method may not be overridden! This method was protected in Java but it's public here so it can be accessed in InputThread
|
|
Returns whether or not the PircBot is currently connected to a server. The result of this method should only act as a rough guide, as the result may not be valid by the time you act upon it.
|
|
Block until all internal threads are done processing. Call this at the bottom of your main() if you want pircbot to continue processing without terminating your main. You can also call this if you have a mulithreaded program and you want just one thread to block with irc processing. To terminate the internal threads, call the PircBot::dispose() method. This will cause pircbot to shut down its threads for this join() to become unblocked.
|
|
Joins a channel with a key.
|
|
Joins a channel.
|
|
Kicks a user from a channel, giving a reason. This method attempts to kick a user from a channel and may require the bot to have operator status in the channel.
|
|
Kicks a user from a channel. This method attempts to kick a user from a channel and may require the bot to have operator status in the channel.
|
|
Issues a request for a list of all channels on the IRC server. When the PircBot receives information for each channel, it will call the onChannelInfo method, which you will need to override if you want it to do anything useful. Some IRC servers support certain parameters for LIST requests. One example is a parameter of ">10" to list only those channels that have more than 10 users in them. Whether these parameters are supported or not will depend on the IRC server software.
|
|
Issues a request for a list of all channels on the IRC server. When the PircBot receives information for each channel, it will call the onChannelInfo method, which you will need to override if you want it to do anything useful.
|
|
Adds a line to the log. This log is currently output to the standard output and is in the correct format for use by tools such as pisg, the Perl IRC Statistics Generator. You may override this method if you wish to do something else with log entries. Each line in the log begins with a number which represents the logging time This timestamp and the following log entry are separated by a single space character, " ". Outgoing messages are distinguishable by a log entry that has ">>>" immediately following the space character after the timestamp. DCC events use "+++" and warnings about unhandled Exceptions and Errors use "###". This implementation of the method will only cause log entries to be output if the PircBot has had its verbose mode turned on by calling setVerbose(true);
|
|
This method is called whenever an ACTION is sent from a user. E.g. such events generated by typing "/me goes shopping" in most IRC clients. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
After calling the listChannels() method in PircBot, the server will start to send us information about each channel on the server. You may override this method in order to receive the information about each channel as soon as it is received. Note that certain channels, such as those marked as hidden, may not appear in channel listings. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
This method is called once the PircBot has successfully connected to the IRC server. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
Called when a user (possibly us) gets operator status taken away. This is a type of mode change and is also passed to the onMode method in the PircBot class. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
Called when a user (possibly us) gets voice status removed. This is a type of mode change and is also passed to the onMode method in the PircBot class. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
This method carries out the actions to be performed when the PircBot gets disconnected. This may happen if the PircBot quits from the server, or if the connection is unexpectedly lost. Disconnection from the IRC server is detected immediately if either we or the server close the connection normally. If the connection to the server is lost, but neither we nor the server have explicitly closed the connection, then it may take a few minutes to detect (this is commonly referred to as a "ping timeout"). If you wish to get your IRC bot to automatically rejoin a server after the connection has been lost, then this is probably the ideal method to override to implement such functionality. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required. This was protected in the Java version but I had to make it public in the C++ version since other classes were calling this method
|
|
This method is called whenever we receive a FINGER request. This abstract implementation responds correctly, so if you override this method, be sure to either mimic its functionality or to call PircBot::onFinger(...);
|
|
Called when we are invited to a channel by a user. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
This method is called whenever someone (possibly us) joins a channel which we are on. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
This method is called whenever someone (possibly us) is kicked from any of the channels that we are in. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
This method is called whenever a message is sent to a channel. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
Called when the mode of a channel is set. You may find it more convenient to decode the meaning of the mode string by overriding the onOp, onDeOp, onVoice, onDeVoice, onChannelKey, onDeChannelKey, onChannelLimit, onDeChannelLimit, onChannelBan or onDeChannelBan methods as appropriate. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
This method is called whenever someone (possibly us) changes nick on any of the channels that we are on. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
This method is called whenever we receive a notice. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
Called when a user (possibly us) gets granted operator status for a channel. This is a type of mode change and is also passed to the onMode method in the PircBot class. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
This method is called whenever someone (possibly us) parts a channel which we are on. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
This method is called whenever we receive a PING request from another user. This abstract implementation responds correctly, so if you override this method, be sure to either mimic its functionality or to call PircBot::onPing(...);
|
|
This method is called whenever a private message is sent to the PircBot. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
This method is called whenever someone (possibly us) quits from the server. We will only observe this if the user was in one of the channels to which we are connected. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
Called when a hostmask ban is removed from a channel. This is a type of mode change and is also passed to the onMode method in the PircBot class. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
Called when a channel key is removed. This is a type of mode change and is also passed to the onMode method in the PircBot class. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
Called when the user limit is removed for a channel. This is a type of mode change and is also passed to the onMode method in the PircBot class. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
Called when a channel has 'invite only' removed. This is a type of mode change and is also passed to the onMode method in the PircBot class. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
Called when a channel has moderated mode removed. This is a type of mode change and is also passed to the onMode method in the PircBot class. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
Called when a channel is set to allow messages from any user, even if they are not actually in the channel. This is a type of mode change and is also passed to the onMode method in the PircBot class. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
Called when a channel is marked as not being in private mode. This is a type of mode change and is also passed to the onMode method in the PircBot class. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
Called when a channel has 'secret' mode removed. This is a type of mode change and is also passed to the onMode method in the PircBot class. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
Called when topic protection is removed for a channel. This is a type of mode change and is also passed to the onMode method in the PircBot class. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
The actions to perform when a PING request comes from the server. This sends back a correct response, so if you override this method, be sure to either mimic its functionality or to call PircBot::onServerPing(response);
|
|
This method is called when we receive a numeric response from the IRC server. Numerics in the range from 001 to 099 are used for client-server connections only and should never travel between servers. Replies generated in response to commands are found in the range from 200 to 399. Error replies are found in the range from 400 to 599.
For example, we can use this method to discover the topic of a channel when we join it. If we join the channel test which has a topic of "I am King of Test" then the response will be " PircBot implements the interface ReplyConstants, which contains contstants that you may find useful here. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
Called when a user (possibly us) gets banned from a channel. Being banned from a channel prevents any user with a matching hostmask from joining the channel. For this reason, most bans are usually directly followed by the user being kicked :-) This is a type of mode change and is also passed to the onMode method in the PircBot class. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
Called when a channel key is set. When the channel key has been set, other users may only join that channel if they know the key. Channel keys are sometimes referred to as passwords. This is a type of mode change and is also passed to the onMode method in the PircBot class. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
Called when a user limit is set for a channel. The number of users in the channel cannot exceed this limit. This is a type of mode change and is also passed to the onMode method in the PircBot class. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
Called when a channel is set to 'invite only' mode. A user may only join the channel if they are invited by someone who is already in the channel. This is a type of mode change and is also passed to the onMode method in the PircBot class. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
Called when a channel is set to 'moderated' mode. If a channel is moderated, then only users who have been 'voiced' or 'opped' may speak or change their nicks. This is a type of mode change and is also passed to the onMode method in the PircBot class. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
Called when a channel is set to only allow messages from users that are in the channel. This is a type of mode change and is also passed to the onMode method in the PircBot class. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
Called when a channel is marked as being in private mode. This is a type of mode change and is also passed to the onMode method in the PircBot class. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
Called when a channel is set to be in 'secret' mode. Such channels typically do not appear on a server's channel listing. This is a type of mode change and is also passed to the onMode method in the PircBot class. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
Called when topic protection is enabled for a channel. Topic protection means that only operators in a channel may change the topic. This is a type of mode change and is also passed to the onMode method in the PircBot class. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
This method is called whenever we receive a TIME request. This abstract implementation responds correctly, so if you override this method, be sure to either mimic its functionality or to call PircBot::onTime(...);
|
|
This method is called whenever a user sets the topic, or when PircBot joins a new channel and discovers its topic. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
This method is called whenever a user sets the topic, or when PircBot joins a new channel and discovers its topic. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
This method is called whenever we receive a line from the server that the PircBot has not been programmed to recognise. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
This method is called when we receive a user list from the server after joining a channel. DO NOT try and delete the User pointer. Instead to deallocate call releaseMemoryOfUserArray(). This is to keep everything dll boundary safe. Shortly after joining a channel, the IRC server sends a list of all users in that channel. The PircBot collects this information and calls this method as soon as it has the full list. To obtain the nick of each user in the channel, call the getNick() method on each User object in the array. At a later time, you may call the getUsers method to obtain an up to date list of the users in the channel. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
Called when the mode of a user is set. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
This method is called whenever we receive a VERSION request. This abstract implementation responds with the PircBot's _version string, so if you override this method, be sure to either mimic its functionality or to call PircBot::onVersion(...);
|
|
Called when a user (possibly us) gets voice status granted in a channel. This is a type of mode change and is also passed to the onMode method in the PircBot class. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.
|
|
Grants operator privilidges to a user on a channel. Successful use of this method may require the bot to have operator status itself.
|
|
All delete's will be handled through this dll. This is required for dll boundary safety. Instead of allowing the compiler to choose if it wants to inline this we have made it so that it cannot. If we let the compiler choose to inline or not inline this and the "new operator" we can run into dll boundary issues. The issue would be that the compiler would inline one and not the other. Thus, your executable with its own heap would allocate/delete and this dll would do the other. That's a dll boundary safety violation.
Reimplemented from ReplyConstants. |
|
All new's will be handled through this dll. This is required for dll boundary safety. Instead of allowing the compiler to choose if it wants to inline this we have made it so that it cannot. If we let the compiler choose to inline or not inline this and the "delete operator" we can run into dll boundary issues. The issue would be that the compiler would inline one and not the other. Thus, your executable with its own heap would allocate/delete and this dll would do the other. That's a dll boundary safety violation.
Reimplemented from ReplyConstants. |
|
The assignment operator. For now, I am not allowing a copy to be made.
|
|
Parts a channel, giving a reason.
|
|
Parts a channel.
|
|
Quits from the IRC server with a reason. Providing we are actually connected to an IRC server, the onDisconnect() method will be called as soon as the IRC server disconnects us.
|
|
Quits from the IRC server. Providing we are actually connected to an IRC server, the onDisconnect() method will be called as soon as the IRC server disconnects us.
|
|
Reconnects to the IRC server that we were previously connected to. If necessary, the appropriate port number and password will be used. This method will throw an IrcException if we have never connected to an IRC server previously.
|
|
Deallocates the memory of the array that comes from PircBot::getChannels(). Call this to deallocate the memory. This method ensures dll boundary safety. DO NOT try and delete the memory of array yourself. Use this method instead.
|
|
Deallocates the memory of a userArray. Call to deallocate memory of a userArray such as in the call of PircBot::getUsers(). This method ensures dll boundary safety. DO NOT try and delete the memory of userArray yourself. Use this method instead.
|
|
Sends an action to the channel or to a user.
|
|
Sends a CTCP command to a channel or user.
(Client to client protocol). Examples of such commands are "PING <number>", "FINGER", "VERSION", etc. For example, if you wish to request the version of a user called "Dave", then you would call
|
|
Sends an invitation to join a channel. Some channels can be marked as "invite-only", so it may be useful to allow a bot to invite people into it.
|
|
Sends a message to a channel or a private message to a user. These messages are added to the outgoing message queue and sent at the earliest possible opportunity. Some examples: - // Send the message "Hello!" to the channel cs. sendMessage("#cs", "Hello!");
// Send a private message to Paul that says "Hi". sendMessage("Paul", "Hi");
You may optionally apply colours, boldness, underlining, etc to the message by using the
|
|
Sends a notice to the channel or to a user.
|
|
Sends a raw line to the IRC server as soon as possible, bypassing the outgoing message queue.
|
|
Sends a raw line through the outgoing message queue.
|
|
When you connect to a server and your nick is already in use and this is set to true, a new nick will be automatically chosen. This is done by adding numbers to the end of the nick until an available nick is found.
|
|
Sets the interal finger message. This should be set before joining any servers.
|
|
Sets the internal login of the Bot. This should be set before joining any servers.
|
|
Sets the number of milliseconds to delay between consecutive messages when there are multiple messages waiting in the outgoing message queue. This has a default value of 1000ms. It is a good idea to stick to this default value, as it will prevent your bot from spamming servers and facing the subsequent wrath! However, if you do need to change this delay value (not recommended), then this is the method to use.
|
|
Set the mode of a channel. This method attempts to set the mode of a channel. This may require the bot to have operator status on the channel. For example, if the bot has operator status, we can grant operator status to "Dave" on the cs channel by calling setMode("#cs", "+o Dave"); An alternative way of doing this would be to use the op method.
|
|
Sets the name of the bot, which will be used as its nick when it tries to join an IRC server. This should be set before joining any servers, otherwise the default nick will be used. You would typically call this method from the constructor of the class that extends PircBot. The changeNick method should be used if you wish to change your nick when you are connected to a server.
|
|
Set the topic for a channel. This method attempts to set the topic of a channel. This may require the bot to have operator status if the topic is protected.
|
|
Sets the verbose mode. If verbose mode is set to true, then log entries will be printed to the standard output. The default value is false and will result in no output. For general development, we strongly recommend setting the verbose mode to true.
|
|
Sets the internal version of the Bot. This should be set before joining any servers.
|
|
Starts an ident server (Identification Protocol Server, RFC 1413). Most IRC servers attempt to contact the ident server on connecting hosts in order to determine the user's identity. A few IRC servers will not allow you to connect unless this information is provided. So when a PircBot is run on a machine that does not run an ident server, it may be necessary to call this method to start one up. Calling this method starts up an ident server which will respond with the login provided by calling getLogin() and then shut down immediately. It will also be shut down if it has not been contacted within 60 seconds of creation. If you require an ident response, then the correct procedure is to start the ident server and then connect to the IRC server. The IRC server may then contact the ident server to get the information it needs. The ident server will fail to start if there is already an ident server running on port 113, or if you are running as an unprivileged user who is unable to create a server socket on that port number. If it is essential for you to use an ident server when connecting to an IRC server, then make sure that port 113 on your machine is visible to the IRC server so that it may contact the ident server.
|
|
Unbans a user from a channel. An example of a valid hostmask is "*!*compu@*.18hp.net". Successful use of this method may require the bot to have operator status itself.
|
|
Grants voice privilidges to a user on a channel. Successful use of this method may require the bot to have operator status itself.
|
|
The private implementation in which you cannot get access to. This shared_ptr holds the private methods and private member variables of this class. This makes ABI (Application Binary Interface) more resilient to change. See the private implementation idiom on the internet for more information about this. |