IRCProtocol Class Reference

Class that convert messages to IRC messages. More...

#include <ircprotocol.h>

List of all members.

Public Member Functions

 IRCProtocol ()
 Constructor.
 ~IRCProtocol ()
 Destructor.

Static Public Member Functions

static vector< string > identify (string, string, string, string)
 Construct a string to identify to an irc server.
static string quitServer (string raison="autokilled!")
 Construct a string to quit an irc server.
static string joinChannel (string)
 Construct a string to join a channel.
static string leaveChannel (string, string raison="\\o_")
 Construct a string to leave a channel.
static string changeNick (string)
 Construct a string to change nick.
static string ping (string)
 Construct a string to ping the server.
static string pong (string)
 Construct a string to respond to a ping.
static string sendMsg (string, string)
 Construct a string to send a message.
static vector< string > sendMsg (string, vector< string >)
 Construct a vector with strings to send several messages.
static string sendAction (string, string)
 Construct a string to send an action on a channel.
static string changeTopic (string, string)
 Construct a string to change a channel topic.
static vector< string > applyModes (string, vector< string >, char, char, unsigned int)
 Construct strings to apply a mode on different people.
static vector< string > op (vector< string >, string)
 Construct strings to op people on a channel.
static string op (string, string)
 Construct a string to op a user on a channel.
static vector< string > unop (vector< string >, string)
 Construct strings to unop people on a channel.
static string unop (string, string)
 Construct a string to unop a user on a channel.
static vector< string > voice (vector< string >, string)
 Construct strings to voice people on a channel.
static string voice (string, string)
 Construct a string to voice a user on a channel.
static vector< string > unvoice (vector< string >, string)
 Construct strings to unvoice people on a channel.
static string unvoice (string, string)
 Construct a string to unvoice a user on a channel.
static string ban (string, string)
 Construct a string to ban a host on a channel.
static string unban (string, string)
 Construct a string to unban a host on a channel.
static string sendNotice (string, string)
 Construct a string to send a notice.
static vector< string > sendNotices (string, vector< string >)
 Construct strings to send notices.
static string kick (string, string, string)
 Construct a string to kick someone from channel.
static string who (string, string)
 Construct a string for a WHO command.
static string invite (string, string)
 Construct a string for a INVITE command.


Detailed Description

Class that convert messages to IRC messages.

This class convert "humain" strings to IRC messages This class allow the bot to connect to different servers type simply by changing its code methods All methods a static, no object needed

Definition at line 44 of file ircprotocol.h.


Constructor & Destructor Documentation

IRCProtocol::IRCProtocol (  ) 

Constructor.

Class contructor

Definition at line 34 of file ircprotocol.cpp.

IRCProtocol::~IRCProtocol (  ) 

Destructor.

Class destructor

Definition at line 41 of file ircprotocol.cpp.


Member Function Documentation

vector< string > IRCProtocol::applyModes ( string  channel,
vector< string >  users_list,
char  sign,
char  mode,
unsigned int  limit 
) [static]

Construct strings to apply a mode on different people.

Construct strings to apply a mode on different people

Parameters:
channel Channel where apply modes
users_list Users on witch apply modes
mode Mode ti apply
sign Mode sign
limit Limit for size
Returns:
Strings for modes

Definition at line 181 of file ircprotocol.cpp.

Referenced by unbanall().

string IRCProtocol::ban ( string  mask,
string  channel 
) [static]

Construct a string to ban a host on a channel.

Format a string to ban a mask on a channel

Parameters:
mask mask to ban
channel ban's channel
Returns:
ban string

Definition at line 302 of file ircprotocol.cpp.

Referenced by ban(), banmask(), and joinHandler().

string IRCProtocol::changeNick ( string  nick  )  [static]

Construct a string to change nick.

Format a string to change the bot nickname

Parameters:
nick New nick
Returns:
String containing the message to send to change nick

Definition at line 99 of file ircprotocol.cpp.

Referenced by getMyFirstNick(), identify(), secondaryNick(), and setNick().

string IRCProtocol::changeTopic ( string  channel,
string  topic 
) [static]

Construct a string to change a channel topic.

Format a string to change a topic

Parameters:
channel Channel witch topic will change
topic New topic
Returns:
String containing the message to send to change a channel topic

Definition at line 167 of file ircprotocol.cpp.

Referenced by topic(), and topicHandler().

vector< string > IRCProtocol::identify ( string  pass,
string  ident,
string  name,
string  nick 
) [static]

Construct a string to identify to an irc server.

Format strings to identify to an IRC server according to parameters

Parameters:
pass IRC server password (empty string if not required)
ident Connection Ident
name Connection Name
nick Connection Nick
Returns:
Vector containing strings to send to the server for authentification

Definition at line 53 of file ircprotocol.cpp.

References changeNick().

Referenced by BotKernel::connect().

string IRCProtocol::invite ( string  channel,
string  nick 
) [static]

Construct a string for a INVITE command.

Format a string to send a INVITE command

Parameters:
channel Channel where invite the user
nick Nick to invite
Returns:
String containing the invite command

Definition at line 465 of file ircprotocol.cpp.

Referenced by invite().

string IRCProtocol::joinChannel ( string  channel  )  [static]

Construct a string to join a channel.

Format a string to join a channel

Parameters:
channel Channel to join
Returns:
String containing the message to send to join the channel

Definition at line 78 of file ircprotocol.cpp.

Referenced by cycleChannel(), joinChannel(), kickHandler(), onEndOfMOTD(), onInvite(), partHandler(), quitHandler(), and rejoinChan().

string IRCProtocol::kick ( string  nick,
string  chan,
string  reason 
) [static]

Construct a string to kick someone from channel.

Format a string to kick a user from a channel

Parameters:
nick User nick to kick
chan Channel from witch one the user is kicked
reason Kick reason, can be empty
Returns:
String containing the message to kick the user

Definition at line 454 of file ircprotocol.cpp.

Referenced by ban(), banmask(), joinHandler(), kick(), kickall(), kickHandler(), masskick(), modeHandler(), and randomKick().

string IRCProtocol::leaveChannel ( string  channel,
string  reason = "\\o_" 
) [static]

Construct a string to leave a channel.

Format a string to leave a channel

Parameters:
channel Channel to leave
reason Leave msg. Can be empty
Returns:
String containing the message to send to leave the channel

Definition at line 89 of file ircprotocol.cpp.

Referenced by cycleChannel(), kickHandler(), leaveChannel(), partHandler(), and quitHandler().

string IRCProtocol::op ( string  nick,
string  channel 
) [static]

Construct a string to op a user on a channel.

Construct a string to op a user on a channel Obsolete : use applyModes instead

Parameters:
nick Nick to op
channel Channel where the nick must be opped
Returns:
OP string

Definition at line 246 of file ircprotocol.cpp.

vector< string > IRCProtocol::op ( vector< string >  vectorNicks,
string  channel 
) [static]

Construct strings to op people on a channel.

Format strings to op users on a channel Obsolete : use applyModes instead

Parameters:
vectorNicks Vector containing string containing nicks to op
channel Channel where nicks must be opped
Returns:
Strings containing instructions to op users

Definition at line 212 of file ircprotocol.cpp.

Referenced by joinHandler(), op(), and opall().

string IRCProtocol::ping ( string  ping  )  [static]

Construct a string to ping the server.

Format a string to ping the server

Parameters:
ping String that the server must reply to validate the ping
Returns:
String containing the message to send to ping the server

Definition at line 109 of file ircprotocol.cpp.

Referenced by checkConnection().

string IRCProtocol::pong ( string  pong  )  [static]

Construct a string to respond to a ping.

Format a string to pong the server

Parameters:
pong string ping answer
Returns:
String containing the message to send to pong the server

Definition at line 119 of file ircprotocol.cpp.

Referenced by pinged().

string IRCProtocol::quitServer ( string  reason = "autokilled!"  )  [static]

Construct a string to quit an irc server.

Format a string to quit an IRC server

Parameters:
reason Quit message. Can be empty
Returns:
String containing the message to send to quit the IRC server

Definition at line 68 of file ircprotocol.cpp.

Referenced by disconnect().

string IRCProtocol::sendAction ( string  channel,
string  action 
) [static]

Construct a string to send an action on a channel.

Send an action on a channel. An action is that kind of message : * trustyrc slaps toto

Parameters:
channel Channel where to send the action
action Action to send
Returns:
A string containing the formatted message

Definition at line 156 of file ircprotocol.cpp.

Referenced by slapUser().

vector< string > IRCProtocol::sendMsg ( string  destination,
vector< string >  messages 
) [static]

Construct a vector with strings to send several messages.

Format a strings to send a messages to a channel or to a user

Parameters:
destination Messages receiver (channel or user(pv query))
messages Messages to send
Returns:
Vector with strings containing the messages to send to the server to send messages on a channel or to a user

Definition at line 141 of file ircprotocol.cpp.

string IRCProtocol::sendMsg ( string  destination,
string  message 
) [static]

Construct a string to send a message.

Format a string to send a message to a channel or to a user

Parameters:
destination Message receiver (channel or user(pv query))
message Message to send
Returns:
String containing the message to send to the server to send a message on a channel or to a user

Definition at line 130 of file ircprotocol.cpp.

Referenced by autoop(), autovoice(), ball(), bug(), bzsearch(), checkBug(), danstonchat(), displayAdvertise(), displayPaste(), endSurvey(), fas(), greplog(), hl(), host2ip(), ip2host(), lamoule(), lastQuote(), lastseen(), launchSurvey(), myFunction(), planet(), player(), protectmodes(), protecttopic(), q3(), quote(), randomKick(), searchQuote(), stopSurvey(), tele(), tell(), top5(), topshot(), toptotal(), trad(), unautoop(), unautovoice(), unprotectmodes(), unprotecttopic(), warsow(), whoowns(), and wiki().

string IRCProtocol::sendNotice ( string  destination,
string  notice 
) [static]

vector< string > IRCProtocol::sendNotices ( string  destination,
vector< string >  notices 
) [static]

Construct strings to send notices.

Format strings to send notices

Parameters:
destination Notice receiver (nick or channel)
notices Notices messages
Returns:
Strings containing the messages to send the notices

Definition at line 425 of file ircprotocol.cpp.

Referenced by baninfos(), banlist(), chanlev(), commandsStatus(), ignoreList(), listads(), listlibs(), listmodules(), superadminlist(), and whoami().

string IRCProtocol::unban ( string  mask,
string  channel 
) [static]

Construct a string to unban a host on a channel.

Format a string to unban a mask on a channel

Parameters:
mask Mask to unban
channel Channel where to unban the user
Returns:
Unban string

Definition at line 313 of file ircprotocol.cpp.

Referenced by bandel(), and Moderation::clearOutBans().

string IRCProtocol::unop ( string  nick,
string  channel 
) [static]

Construct a string to unop a user on a channel.

Construct a string to unop a user on a channel

Parameters:
nick Nick to unop
channel Channel where the nick must be unopped
Returns:
UNOP string

Definition at line 291 of file ircprotocol.cpp.

vector< string > IRCProtocol::unop ( vector< string >  vectorNicks,
string  channel 
) [static]

Construct strings to unop people on a channel.

Format strings to unop users on a channel Obsolete : use applyModes instead

Parameters:
vectorNicks Vector containing string containing nicks to unop
channel Channel where nicks must be unopped
Returns:
Strings containing instructions to unop users

Definition at line 258 of file ircprotocol.cpp.

Referenced by unop(), and unopall().

string IRCProtocol::unvoice ( string  nick,
string  channel 
) [static]

Construct a string to unvoice a user on a channel.

Construct a string to unvoice a user on a channel

Parameters:
nick Nick to unvoice
channel Channel where the nick must be unvoiced
Returns:
voice string

Definition at line 403 of file ircprotocol.cpp.

vector< string > IRCProtocol::unvoice ( vector< string >  vectorNicks,
string  channel 
) [static]

Construct strings to unvoice people on a channel.

Format strings to unvoice users on a channel Obsolete : use applyModes instead

Parameters:
vectorNicks Vector containing string containing nicks to unvoice
channel Channel where nicks must be unvoiced
Returns:
Strings containing instructions to unvoice users

Definition at line 370 of file ircprotocol.cpp.

Referenced by unvoice(), and unvoiceall().

string IRCProtocol::voice ( string  nick,
string  channel 
) [static]

Construct a string to voice a user on a channel.

Construct a string to voice a user on a channel

Parameters:
nick Nick to voice
channel Channel where the nick must be voiced
Returns:
voice string

Definition at line 358 of file ircprotocol.cpp.

vector< string > IRCProtocol::voice ( vector< string >  vectorNicks,
string  channel 
) [static]

Construct strings to voice people on a channel.

Format strings to voice users on a channel Obsolete : use applyModes instead

Parameters:
vectorNicks Vector containing string containing nicks to voice
channel Channel where nicks must be voiced
Returns:
Strings containing instructions to voice users

Definition at line 325 of file ircprotocol.cpp.

Referenced by joinHandler(), voice(), and voiceall().

string IRCProtocol::who ( string  channel,
string  params 
) [static]

Construct a string for a WHO command.

Format a string to send a WHO command

Parameters:
channel Channel for the WHO command
params Parameters for WHO command
Returns:
The WHO command

Definition at line 439 of file ircprotocol.cpp.

Referenced by onJoin(), and reloadUsers().


The documentation for this class was generated from the following files:

Generated on Sun Aug 16 15:28:46 2009 for trustyRC by  doxygen 1.5.8