Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef BOTS_H
00011 #define BOTS_H
00012
00013 #include "users.h"
00014 #include "anope.h"
00015 #include "serialize.h"
00016 #include "commands.h"
00017
00018
00019 typedef Anope::map<BotInfo *> botinfo_map;
00020
00021 extern CoreExport Serialize::Checker<botinfo_map> BotListByNick, BotListByUID;
00022
00023
00024 class CoreExport BotInfo : public User, public Serializable
00025 {
00026 public:
00027 time_t created;
00028
00029 time_t lastmsg;
00030
00031 CommandInfo::map commands;
00032
00033 Anope::string botmodes;
00034
00035 std::vector<Anope::string> botchannels;
00036
00037 bool introduced;
00038
00039 bool oper_only;
00040
00041 bool conf;
00042
00050 BotInfo(const Anope::string &nick, const Anope::string &user = "", const Anope::string &host = "", const Anope::string &real = "", const Anope::string &bmodes = "");
00051
00054 virtual ~BotInfo();
00055
00056 void Serialize(Serialize::Data &data) const;
00057 static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
00058
00059 void GenerateUID();
00060
00064 void SetNewNick(const Anope::string &newnick);
00065
00069 void RejoinAll();
00070
00075 void Assign(User *u, ChannelInfo *ci);
00076
00081 void UnAssign(User *u, ChannelInfo *ci);
00082
00085 unsigned GetChannelCount() const;
00086
00091 void Join(Channel *c, ChannelStatus *status = NULL);
00092
00097 void Join(const Anope::string &chname, ChannelStatus *status = NULL);
00098
00103 void Part(Channel *c, const Anope::string &reason = "");
00104
00109 virtual void OnMessage(User *u, const Anope::string &message);
00110
00117 CommandInfo& SetCommand(const Anope::string &cname, const Anope::string &sname, const Anope::string &permission = "");
00118
00123 CommandInfo *GetCommand(const Anope::string &cname);
00124
00130 static BotInfo* Find(const Anope::string &nick, bool nick_only = false);
00131 };
00132
00133 extern CoreExport BotInfo *BotServ, *ChanServ, *Global, *HostServ, *MemoServ, *NickServ, *OperServ;
00134
00135 #endif // BOTS_H