#include <bots.h>
Inherits User, and Serializable.

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) |
| CommandInfo & | SetCommand (const Anope::string &cname, const Anope::string &sname, const Anope::string &permission="") |
| CommandInfo * | GetCommand (const Anope::string &cname) |
Static Public Member Functions | |
| static Serializable * | Unserialize (Serializable *obj, Serialize::Data &) |
| static BotInfo * | Find (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::string > | botchannels |
| bool | introduced |
| bool | oper_only |
| bool | conf |
Definition at line 24 of file bots.h.
| 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.
| 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] |
Destroy a bot, clearing up appropriately.
Definition at line 50 of file bots.cpp.
References ChannelInfo::bi, BotListByNick, BotListByUID, Anope::string::empty(), introduced, IRCD, Server::IsSynced(), Me, User::nick, Serializable::QueueUpdate(), RegisteredChannelList, IRCDProto::SendQuit(), IRCDProto::SendSQLineDel(), and User::uid.
| void BotInfo::Assign | ( | User * | u, | |
| ChannelInfo * | ci | |||
| ) |
Assign this bot to a given channel, removing the existing assigned bot if one exists.
| 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] |
Find a bot by nick
| nick | The nick | |
| nick_only | True to only look by nick, and not by UID |
Definition at line 262 of file bots.cpp.
References BotListByNick, BotListByUID, IRCD, Serializable::QueueUpdate(), and IRCDProto::RequiresID.
Referenced by BotServCore::BotServCore(), ChanServCore::ChanServCore(), CommandBSBot::DoAdd(), CommandBSBot::DoChange(), MyXMLRPCEvent::DoCommand(), DoCommands(), CommandBSBot::DoDel(), DoServices(), RewriteCommand::Execute(), CommandNSInfo::Execute(), CommandSeen::Execute(), CommandCSLog::Execute(), CommandBSSetPrivate::Execute(), CommandBSInfo::Execute(), CommandBSAssign::Execute(), GlobalCore::GlobalCore(), HostServCore::HostServCore(), Join(), User::Kill(), LoadBotInfo(), LoadBots(), LoadChannels(), Log::Log(), MemoServCore::MemoServCore(), NickServCore::NickServCore(), BSAutoAssign::OnChanRegistered(), OnDatabaseReadMetadata(), ModuleProxyScan::OnUserConnect(), OperServCore::OperServCore(), ReadDatabase(), Channel::Reset(), Message::Whois::Run(), Message::Privmsg::Run(), IRCDMessageIdle::Run(), UnrealIRCdProto::SendJoin(), PlexusProto::SendJoin(), ngIRCdProto::SendJoin(), InspIRCd12Proto::SendJoin(), InspIRCdProto::SendJoin(), BahamutIRCdProto::SendJoin(), Unserialize(), UplinkSocket::Message::~Message(), and UplinkSocket::~UplinkSocket().
| void BotInfo::GenerateUID | ( | ) |
Definition at line 108 of file bots.cpp.
References Anope::string::empty(), Servers::TS6_UID_Retrieve(), User::uid, and UserListByUID.
| 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 | ) |
| void BotInfo::Join | ( | Channel * | c, | |
| ChannelStatus * | status = NULL | |||
| ) |
Join this bot to a channel
| c | The channel | |
| status | The status the bot should have on the channel |
Definition at line 185 of file bots.cpp.
References ServerConfig::BSSmartJoin, Anope::string::c_str(), Config, Channel::FindUser(), FOREACH_MOD, Entry::GetMask(), Channel::GetModeList(), Channel::GetParam(), Channel::HasMode(), I_OnBotJoin, IRCD, Anope::string::is_pos_number_only(), Channel::JoinUser(), Entry::Matches(), Channel::name, User::nick, ModeManager::ProcessModes(), Channel::RemoveMode(), IRCDProto::SendJoin(), IRCDProto::SendNotice(), and Channel::users.
Referenced by Assign(), DoServices(), CommandCSSetPersist::Execute(), Channel::Hold(), Join(), Channel::KickInternal(), RejoinAll(), and UnrealIRCdProto::SendChannel().
| void BotInfo::Join | ( | const Anope::string & | chname, | |
| ChannelStatus * | status = NULL | |||
| ) |
| void BotInfo::OnMessage | ( | User * | u, | |
| const Anope::string & | message | |||
| ) | [virtual] |
Called when a user messages this bot
| 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
| 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
| cname | The command name | |
| sname | The service name | |
| permission | Permission required to execute the command, if any |
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.
| 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.
| 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] |
Definition at line 87 of file bots.cpp.
References anope_dynamic_static_cast(), BotInfo(), created, Find(), User::host, User::nick, oper_only, and User::realname.
Referenced by Serialize::RegisterTypes().
| std::vector<Anope::string> BotInfo::botchannels |
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 31 of file bots.h.
Referenced by DoCommands(), CommandOSModInfo::Execute(), CommandHelp::Execute(), CommandCSLog::Execute(), GetCommand(), InitCommands(), OnMessage(), and SetCommand().
| bool BotInfo::conf |
Definition at line 41 of file bots.h.
Referenced by BotInfo(), CommandBSBot::DoChange(), CommandBSBot::DoDel(), DoneServices(), and DoServices().
| time_t BotInfo::created |
Definition at line 27 of file bots.h.
Referenced by BotInfo(), CommandBSInfo::Execute(), LoadBotInfo(), LoadBots(), DBPlain::OnSaveDatabase(), Serialize(), and Unserialize().
| bool BotInfo::introduced |
Definition at line 37 of file bots.h.
Referenced by BotInfo(), Message::Kill::Run(), Server::Server(), ~BotInfo(), UplinkSocket::Message::~Message(), and UplinkSocket::~UplinkSocket().
| time_t BotInfo::lastmsg |
Definition at line 29 of file bots.h.
Referenced by BotInfo(), Message::Whois::Run(), and IRCDMessageIdle::Run().
| bool BotInfo::oper_only |
Definition at line 39 of file bots.h.
Referenced by BotInfo(), CommandBSInfo::Execute(), CommandBSBotList::Execute(), CommandBSAssign::Execute(), Serialize(), and Unserialize().
1.7.1