Anope IRC Services  Version 2.0
Public Member Functions | Static Public Member Functions | Data Fields | Private Attributes
BotInfo Class Reference

#include <bots.h>

Inheritance diagram for BotInfo:
Inheritance graph
[legend]
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 OnKill ()
 
void SetNewNick (const Anope::string &newnick)
 
const std::set< ChannelInfo * > & GetChannels () const
 
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)
 
- Public Member Functions inherited from User
void ChangeNick (const Anope::string &newnick, time_t ts=Anope::CurTime)
 
void SetDisplayedHost (const Anope::string &host)
 
const Anope::stringGetDisplayedHost () const
 
void SetCloakedHost (const Anope::string &newhost)
 
const Anope::stringGetCloakedHost () const
 
const Anope::stringGetUID () const
 
void SetVIdent (const Anope::string &ident)
 
const Anope::stringGetVIdent () const
 
void SetIdent (const Anope::string &ident)
 
const Anope::stringGetIdent () const
 
Anope::string GetMask () const
 
Anope::string GetDisplayedMask () const
 
void SetRealname (const Anope::string &realname)
 
void SendMessage (BotInfo *source, const char *fmt,...)
 
void SendMessage (BotInfo *source, const Anope::string &msg) anope_override
 
void Identify (NickAlias *na)
 
void Login (NickCore *core)
 
void Logout ()
 
NickCoreAccount () const
 
bool IsIdentified (bool check_nick=false) const
 
bool IsRecognized (bool check_secure=true) const
 
bool IsServicesOper ()
 
bool HasCommand (const Anope::string &cmdstr)
 
bool HasPriv (const Anope::string &privstr)
 
void UpdateHost ()
 
bool HasMode (const Anope::string &name) const
 
void SetModeInternal (const MessageSource &setter, UserMode *um, const Anope::string &param="")
 
void RemoveModeInternal (const MessageSource &setter, UserMode *um)
 
void SetMode (BotInfo *bi, UserMode *um, const Anope::string &param="")
 
void SetMode (BotInfo *bi, const Anope::string &name, const Anope::string &param="")
 
void RemoveMode (BotInfo *bi, UserMode *um, const Anope::string &param="")
 
void RemoveMode (BotInfo *bi, const Anope::string &name, const Anope::string &param="")
 
void SetModes (BotInfo *bi, const char *umodes,...)
 
void SetModesInternal (const MessageSource &source, const char *umodes,...)
 
Anope::string GetModes () const
 
const ModeListGetModeList () const
 
ChanUserContainerFindChannel (Channel *c) const
 
bool IsProtected ()
 
void Kill (const MessageSource &source, const Anope::string &reason)
 
void KillInternal (const MessageSource &source, const Anope::string &reason)
 
void Quit (const Anope::string &reason="")
 
bool Quitting () const
 
Anope::string Mask () const
 
bool BadPassword ()
 
- Public Member Functions inherited from Base
 Base ()
 
virtual ~Base ()
 
void AddReference (ReferenceBase *r)
 
void DelReference (ReferenceBase *r)
 
- Public Member Functions inherited from Extensible
virtual ~Extensible ()
 
template<typename T >
T * GetExt (const Anope::string &name) const
 
bool HasExt (const Anope::string &name) const
 
template<typename T >
T * Extend (const Anope::string &name, const T &what)
 
template<typename T >
T * Extend (const Anope::string &name)
 
template<typename T >
T * Require (const Anope::string &name)
 
template<typename T >
void Shrink (const Anope::string &name)
 
template<>
bool * Extend (const Anope::string &name, const bool &what)
 
- Public Member Functions inherited from CommandReply
virtual ~CommandReply ()
 
- Public Member Functions inherited from Serializable
virtual ~Serializable ()
 
void QueueUpdate ()
 
bool IsCached (Serialize::Data &)
 
void UpdateCache (Serialize::Data &)
 
bool IsTSCached ()
 
void UpdateTS ()
 
Serialize::TypeGetSerializableType () const
 

Static Public Member Functions

static SerializableUnserialize (Serializable *obj, Serialize::Data &)
 
static BotInfoFind (const Anope::string &nick, bool nick_only=false)
 
- Static Public Member Functions inherited from User
static UserOnIntroduce (const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &svhost, const Anope::string &sip, Server *sserver, const Anope::string &srealname, time_t ts, const Anope::string &smodes, const Anope::string &suid, NickCore *nc)
 
static UserFind (const Anope::string &name, bool nick_only=false)
 
static void QuitUsers ()
 
- Static Public Member Functions inherited from Extensible
static void ExtensibleSerialize (const Extensible *, const Serializable *, Serialize::Data &data)
 
static void ExtensibleUnserialize (Extensible *, Serializable *, Serialize::Data &data)
 
- Static Public Member Functions inherited from Serializable
static const std::list
< Serializable * > & 
GetItems ()
 

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
 
- Data Fields inherited from User
Anope::string nick
 
Anope::string host
 
Anope::string vhost
 
Anope::string chost
 
Anope::string realname
 
Anope::string fingerprint
 
sockaddrs ip
 
Serverserver
 
time_t signon
 
time_t timestamp
 
bool super_admin
 
ChanUserList chans
 
time_t lastmemosend
 
time_t lastnickreg
 
time_t lastmail
 
- Data Fields inherited from Extensible
std::set< ExtensibleBase * > extension_items
 
- Data Fields inherited from Serializable
uint64_t id
 
unsigned short redis_ignore
 

Private Attributes

Serialize::Checker< std::set
< ChannelInfo * > > 
channels
 

Additional Inherited Members

- Public Types inherited from User
typedef std::map
< Anope::string, Anope::string
ModeList
 
typedef std::map< Channel
*, ChanUserContainer * > 
ChanUserList
 
- Protected Member Functions inherited from User
 User (const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &svhost, const Anope::string &sip, Server *sserver, const Anope::string &srealname, time_t ts, const Anope::string &smodes, const Anope::string &suid, NickCore *nc)
 
virtual ~User ()
 
- Protected Member Functions inherited from Serializable
 Serializable (const Anope::string &serialize_type)
 
 Serializable (const Serializable &)
 
Serializableoperator= (const Serializable &)
 
- Protected Attributes inherited from User
Anope::string vident
 
Anope::string ident
 
Anope::string uid
 
bool on_access
 
ModeList modes
 
Serialize::Reference< NickCorenc
 
unsigned short invalid_pw_count
 
time_t invalid_pw_time
 

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
nickThe nickname to assign to the bot.
userThe ident to give the bot.
hostThe hostname to give the bot.
realThe realname to give the bot.
bmodesThe modes to give the bot.

Definition at line 24 of file bots.cpp.

References BotListByUID, botmodes, Anope::string::c_str(), conf, created, Anope::CurTime, IRCDProto::DefaultPseudoclientModes, Anope::string::empty(), FOREACH_MOD, 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
uThe user assigning the bot, or NULL
ciThe channel registration to assign the bot to.

Definition at line 153 of file bots.cpp.

References ChannelInfo::bi, channels, EVENT_STOP, FOREACH_MOD, and FOREACH_RESULT.

Referenced by CommandBSAssign::Execute(), CommandCSSetPersist::Execute(), CSSet::Persist::ExtensibleUnserialize(), BSAutoAssign::OnChanRegistered(), BSAssign::OnInvite(), ChanServCore::OnPreUplinkSync(), and ChannelInfo::Unserialize().

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

Definition at line 110 of file bots.cpp.

References BotListByUID, Anope::string::empty(), introduced, IRCD, User::uid, IRCDProto::UID_Retrieve(), and UserListByUID.

Referenced by OnKill().

unsigned BotInfo::GetChannelCount ( ) const

Get the number of channels this bot is assigned to

Definition at line 188 of file bots.cpp.

References channels.

Referenced by CommandBSInfo::Execute().

const std::set< ChannelInfo * > & BotInfo::GetChannels ( ) const

Return the channels this bot is assigned to

Definition at line 148 of file bots.cpp.

References channels.

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

Get command info for a command

Parameters
cnameThe command name
Returns
A struct containing service name and permission

Definition at line 241 of file bots.cpp.

References commands.

void BotInfo::Join ( Channel c,
ChannelStatus status = NULL 
)

Join this bot to a channel

Parameters
cThe channel
statusThe status the bot should have on the channel

Definition at line 193 of file bots.cpp.

References Channel::FindUser(), FOREACH_MOD, IRCD, Channel::JoinUser(), and IRCDProto::SendJoin().

Referenced by Configuration::Conf::Conf(), CommandCSSetPersist::Execute(), ChanServCore::Hold(), Join(), BotServCore::OnUserKicked(), UnrealIRCdProto::SendChannel(), and RatboxProto::SendTopic().

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

Join this bot to a channel

Parameters
chnameThe channel name
statusThe status the bot should have on the channel

Definition at line 205 of file bots.cpp.

References Channel::FindOrCreate(), and Join().

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

Called when a user messages this bot

Parameters
uThe user
messageThe users' message

Definition at line 223 of file bots.cpp.

References User::Account(), commands, User::nick, and Command::Run().

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

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

Part this bot from a channel

Parameters
cThe channel
reasonThe reason we're parting

Definition at line 211 of file bots.cpp.

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

Referenced by Configuration::Conf::Conf(), ChanServCore::Hold(), UnrealIRCdProto::SendChannel(), and RatboxProto::SendTopic().

void BotInfo::Serialize ( Serialize::Data data) const
virtual
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
cnameThe command name
snameThe service name
permissionPermission required to execute the command, if any
Returns
The commandinfo for the newly created command

Definition at line 232 of file bots.cpp.

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

Referenced by Configuration::Conf::Conf().

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

Change the nickname for the bot.

Parameters
newnickThe nick to change to

Definition at line 137 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
uThe user requesting the unassign, or NULL.
ciThe channel registration to remove the bot from.

Definition at line 169 of file bots.cpp.

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

Referenced by ~BotInfo().

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

Field Documentation

std::vector<Anope::string> BotInfo::botchannels

Definition at line 37 of file bots.h.

Referenced by Configuration::Conf::Conf(), and Server::Server().

Anope::string BotInfo::botmodes

Definition at line 35 of file bots.h.

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

Serialize::Checker<std::set<ChannelInfo *> > BotInfo::channels
private

Definition at line 27 of file bots.h.

Referenced by Assign(), GetChannelCount(), GetChannels(), UnAssign(), and ~BotInfo().

CommandInfo::map BotInfo::commands
bool BotInfo::conf
time_t BotInfo::created

Definition at line 29 of file bots.h.

Referenced by BotInfo(), CommandBSInfo::Execute(), LoadBots(), Serialize(), and Unserialize().

bool BotInfo::introduced
time_t BotInfo::lastmsg

Definition at line 31 of file bots.h.

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

bool BotInfo::oper_only

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