Public Member Functions | Static Public Member Functions | Data Fields

BotInfo Class Reference

#include <bots.h>

Inherits User, and Serializable.

Collaboration diagram for BotInfo:
Collaboration graph
[legend]

Public Member Functions

 BotInfo (const Anope::string &nick, const Anope::string &user="", const Anope::string &host="", const Anope::string &real="", const Anope::string &bmodes="")
virtual ~BotInfo ()
void Serialize (Serialize::Data &data) const
void GenerateUID ()
void SetNewNick (const Anope::string &newnick)
void RejoinAll ()
void Assign (User *u, ChannelInfo *ci)
void UnAssign (User *u, ChannelInfo *ci)
unsigned GetChannelCount () const
void Join (Channel *c, ChannelStatus *status=NULL)
void Join (const Anope::string &chname, ChannelStatus *status=NULL)
void Part (Channel *c, const Anope::string &reason="")
virtual void OnMessage (User *u, const Anope::string &message)
CommandInfoSetCommand (const Anope::string &cname, const Anope::string &sname, const Anope::string &permission="")
CommandInfoGetCommand (const Anope::string &cname)

Static Public Member Functions

static SerializableUnserialize (Serializable *obj, Serialize::Data &)
static BotInfoFind (const Anope::string &nick, bool nick_only=false)

Data Fields

time_t created
time_t lastmsg
CommandInfo::map commands
Anope::string botmodes
std::vector< Anope::stringbotchannels
bool introduced
bool oper_only
bool conf

Detailed Description

Definition at line 24 of file bots.h.


Constructor & Destructor Documentation

BotInfo::BotInfo ( const Anope::string nick,
const Anope::string user = "",
const Anope::string host = "",
const Anope::string real = "",
const Anope::string bmodes = "" 
)

Create a new bot.

Parameters:
nick The nickname to assign to the bot.
user The ident to give the bot.
host The hostname to give the bot.
real The realname to give the bot.
bmodes The modes to give the bot.

Definition at line 26 of file bots.cpp.

References BotListByUID, botmodes, Anope::string::c_str(), conf, created, Anope::CurTime, IRCDProto::DefaultPseudoclientModes, Anope::string::empty(), introduced, IRCD, Server::IsSynced(), lastmsg, Me, User::nick, oper_only, IRCDProto::SendClientIntroduction(), IRCDProto::SendSQLine(), User::SetModesInternal(), and User::uid.

Referenced by Unserialize().

BotInfo::~BotInfo (  )  [virtual]

Member Function Documentation

void BotInfo::Assign ( User u,
ChannelInfo ci 
)

Assign this bot to a given channel, removing the existing assigned bot if one exists.

Parameters:
u The user assigning the bot, or NULL
ci The channel registration to assign the bot to.

Definition at line 139 of file bots.cpp.

References ChannelInfo::bi, ServerConfig::BSMinUsers, ChannelInfo::c, Config, ModeManager::DefaultBotModes, EVENT_STOP, FOREACH_RESULT, I_OnBotAssign, Server::IsSynced(), Join(), Me, and Channel::users.

Referenced by CommandCSSetPersist::Execute(), CommandBSAssign::Execute(), BSAutoAssign::OnChanRegistered(), Server::Sync(), and ChannelInfo::Unserialize().

BotInfo * BotInfo::Find ( const Anope::string nick,
bool  nick_only = false 
) [static]
void BotInfo::GenerateUID (  ) 
unsigned BotInfo::GetChannelCount (  )  const

Get the number of channels this bot is assigned to

Definition at line 172 of file bots.cpp.

References ChannelInfo::bi, and RegisteredChannelList.

Referenced by CommandBSInfo::Execute(), and DBPlain::OnSaveDatabase().

CommandInfo * BotInfo::GetCommand ( const Anope::string cname  ) 

Get command info for a command

Parameters:
cname The command name
Returns:
A struct containing service name and permission

Definition at line 254 of file bots.cpp.

References commands.

void BotInfo::Join ( Channel c,
ChannelStatus status = NULL 
)
void BotInfo::Join ( const Anope::string chname,
ChannelStatus status = NULL 
)

Join this bot to a channel

Parameters:
chname The channel name
status The status the bot should have on the channel

Definition at line 221 of file bots.cpp.

References Find(), and Join().

void BotInfo::OnMessage ( User u,
const Anope::string message 
) [virtual]

Called when a user messages this bot

Parameters:
u The user
message The users' message

Definition at line 236 of file bots.cpp.

References User::Account(), commands, User::nick, and RunCommand().

Referenced by Message::Privmsg::Run().

void BotInfo::Part ( Channel c,
const Anope::string reason = "" 
)

Part this bot from a channel

Parameters:
c The channel
reason The reason we're parting

Definition at line 227 of file bots.cpp.

References Anope::string::c_str(), Channel::DeleteUser(), Anope::string::empty(), Channel::FindUser(), IRCD, and IRCDProto::SendPart().

Referenced by DoServices(), Channel::Hold(), and UnrealIRCdProto::SendChannel().

void BotInfo::RejoinAll (  ) 

Rejoins all channels that this bot is assigned to. Used on /kill, rename, etc.

Definition at line 128 of file bots.cpp.

References ChannelInfo::bi, ServerConfig::BSMinUsers, ChannelInfo::c, Config, Join(), RegisteredChannelList, and Channel::users.

Referenced by CommandBSBot::DoChange().

void BotInfo::Serialize ( Serialize::Data &  data  )  const [virtual]

Implements Serializable.

Definition at line 77 of file bots.cpp.

References created, User::host, User::ident, User::nick, oper_only, and User::realname.

CommandInfo & BotInfo::SetCommand ( const Anope::string cname,
const Anope::string sname,
const Anope::string permission = "" 
)

Link a command name to a command in services

Parameters:
cname The command name
sname The service name
permission Permission required to execute the command, if any
Returns:
The commandinfo for the newly created command

Definition at line 245 of file bots.cpp.

References commands, CommandInfo::name, and CommandInfo::permission.

Referenced by DoCommands().

void BotInfo::SetNewNick ( const Anope::string newnick  ) 

Change the nickname for the bot.

Parameters:
newnick The nick to change to

Definition at line 117 of file bots.cpp.

References BotListByNick, User::nick, and UserListByNick.

Referenced by CommandBSBot::DoChange().

void BotInfo::UnAssign ( User u,
ChannelInfo ci 
)

Remove this bot from a given channel.

Parameters:
u The user requesting the unassign, or NULL.
ci The channel registration to remove the bot from.

Definition at line 154 of file bots.cpp.

References ChannelInfo::bi, ChannelInfo::c, EVENT_STOP, Channel::FindUser(), FOREACH_RESULT, I_OnBotUnAssign, and User::nick.

Referenced by CommandCSSetPersist::Execute().

Serializable * BotInfo::Unserialize ( Serializable obj,
Serialize::Data &  data 
) [static]

Field Documentation

Definition at line 35 of file bots.h.

Referenced by DoServices(), and Server::Server().

Definition at line 33 of file bots.h.

Referenced by BotInfo(), and Server::Server().

Definition at line 41 of file bots.h.

Referenced by BotInfo(), CommandBSBot::DoChange(), CommandBSBot::DoDel(), DoneServices(), and DoServices().

Definition at line 29 of file bots.h.

Referenced by BotInfo(), Message::Whois::Run(), and IRCDMessageIdle::Run().


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