anope- supernets anope source code & configuration |
git clone git://git.acid.vegas/anope.git |
Log | Files | Refs | Archive | README |
irc2sql.h (2988B)
1 /* 2 * 3 * (C) 2013-2022 Anope Team 4 * Contact us at team@anope.org 5 * 6 * Please read COPYING and README for further details. 7 */ 8 9 #include "module.h" 10 #include "modules/sql.h" 11 12 class MySQLInterface : public SQL::Interface 13 { 14 public: 15 MySQLInterface(Module *o) : SQL::Interface(o) { } 16 17 void OnResult(const SQL::Result &r) anope_override 18 { 19 } 20 21 void OnError(const SQL::Result &r) anope_override 22 { 23 if (!r.GetQuery().query.empty()) 24 Log(LOG_DEBUG) << "m_irc2sql: Error executing query " << r.finished_query << ": " << r.GetError(); 25 else 26 Log(LOG_DEBUG) << "m_irc2sql: Error executing query: " << r.GetError(); 27 } 28 }; 29 30 class IRC2SQL : public Module 31 { 32 ServiceReference<SQL::Provider> sql; 33 MySQLInterface sqlinterface; 34 SQL::Query query; 35 std::vector<Anope::string> TableList, ProcedureList, EventList; 36 Anope::string prefix, GeoIPDB; 37 bool quitting, introduced_myself, ctcpuser, ctcpeob, firstrun; 38 BotInfo *StatServ; 39 PrimitiveExtensibleItem<bool> versionreply; 40 41 void RunQuery(const SQL::Query &q); 42 void GetTables(); 43 44 bool HasTable(const Anope::string &table); 45 bool HasProcedure(const Anope::string &table); 46 bool HasEvent(const Anope::string &table); 47 48 void CheckTables(); 49 50 public: 51 IRC2SQL(const Anope::string &modname, const Anope::string &creator) : 52 Module(modname, creator, EXTRA | VENDOR), sql("", ""), sqlinterface(this), versionreply(this, "CTCPVERSION") 53 { 54 firstrun = true; 55 quitting = false; 56 introduced_myself = false; 57 } 58 59 void OnShutdown() anope_override; 60 void OnReload(Configuration::Conf *config) anope_override; 61 void OnNewServer(Server *server) anope_override; 62 void OnServerQuit(Server *server) anope_override; 63 void OnUserConnect(User *u, bool &exempt) anope_override; 64 void OnUserQuit(User *u, const Anope::string &msg) anope_override; 65 void OnUserNickChange(User *u, const Anope::string &oldnick) anope_override; 66 void OnUserAway(User *u, const Anope::string &message) anope_override; 67 void OnFingerprint(User *u) anope_override; 68 void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) anope_override; 69 void OnUserModeUnset(const MessageSource &setter, User *u, const Anope::string &mname) anope_override; 70 void OnUserLogin(User *u) anope_override; 71 void OnNickLogout(User *u) anope_override; 72 void OnSetDisplayedHost(User *u) anope_override; 73 74 void OnChannelCreate(Channel *c) anope_override; 75 void OnChannelDelete(Channel *c) anope_override; 76 void OnLeaveChannel(User *u, Channel *c) anope_override; 77 void OnJoinChannel(User *u, Channel *c) anope_override; 78 EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string ¶m) anope_override; 79 EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string ¶m) anope_override; 80 81 void OnTopicUpdated(User *source, Channel *c, const Anope::string &user, const Anope::string &topic) anope_override; 82 83 void OnBotNotice(User *u, BotInfo *bi, Anope::string &message) anope_override; 84 };