Anope IRC Services  Version 2.0
irc2sql.h
Go to the documentation of this file.
1 #include "module.h"
2 #include "modules/sql.h"
3 
4 class MySQLInterface : public SQL::Interface
5 {
6  public:
8 
10  {
11  }
12 
14  {
15  if (!r.GetQuery().query.empty())
16  Log(LOG_DEBUG) << "m_irc2sql: Error executing query " << r.finished_query << ": " << r.GetError();
17  else
18  Log(LOG_DEBUG) << "m_irc2sql: Error executing query: " << r.GetError();
19  }
20 };
21 
22 class IRC2SQL : public Module
23 {
27  std::vector<Anope::string> TableList, ProcedureList, EventList;
32 
33  void RunQuery(const SQL::Query &q);
34  void GetTables();
35 
36  bool HasTable(const Anope::string &table);
37  bool HasProcedure(const Anope::string &table);
38  bool HasEvent(const Anope::string &table);
39 
40  void CheckTables();
41 
42  public:
43  IRC2SQL(const Anope::string &modname, const Anope::string &creator) :
44  Module(modname, creator, EXTRA | VENDOR), sql("", ""), sqlinterface(this), versionreply(this, "CTCPVERSION")
45  {
46  firstrun = true;
47  quitting = false;
48  introduced_myself = false;
49  }
50 
52  void OnReload(Configuration::Conf *config) anope_override;
53  void OnNewServer(Server *server) anope_override;
54  void OnServerQuit(Server *server) anope_override;
55  void OnUserConnect(User *u, bool &exempt) anope_override;
56  void OnUserQuit(User *u, const Anope::string &msg) anope_override;
57  void OnUserNickChange(User *u, const Anope::string &oldnick) anope_override;
58  void OnFingerprint(User *u) anope_override;
59  void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) anope_override;
60  void OnUserModeUnset(const MessageSource &setter, User *u, const Anope::string &mname) anope_override;
61  void OnUserLogin(User *u) anope_override;
62  void OnNickLogout(User *u) anope_override;
63  void OnSetDisplayedHost(User *u) anope_override;
64 
65  void OnChannelCreate(Channel *c) anope_override;
66  void OnChannelDelete(Channel *c) anope_override;
67  void OnLeaveChannel(User *u, Channel *c) anope_override;
68  void OnJoinChannel(User *u, Channel *c) anope_override;
69  EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string &param) anope_override;
70  EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string &param) anope_override;
71 
72  void OnTopicUpdated(Channel *c, const Anope::string &user, const Anope::string &topic) anope_override;
73 
74  void OnBotNotice(User *u, BotInfo *bi, Anope::string &message) anope_override;
75 };
76 
77 
Definition: bots.h:24
Definition: servers.h:42
void OnUserModeUnset(const MessageSource &setter, User *u, const Anope::string &mname) anope_override
Definition: irc2sql.cpp:152
void OnTopicUpdated(Channel *c, const Anope::string &user, const Anope::string &topic) anope_override
Definition: irc2sql.cpp:246
std::vector< Anope::string > EventList
Definition: irc2sql.h:27
bool firstrun
Definition: irc2sql.h:29
PrimitiveExtensibleItem< bool > versionreply
Definition: irc2sql.h:31
void OnNewServer(Server *server) anope_override
Definition: irc2sql.cpp:60
Anope::string prefix
Definition: irc2sql.h:28
void OnShutdown() anope_override
Definition: irc2sql.cpp:3
Definition: users.h:34
bool ctcpeob
Definition: irc2sql.h:29
IRC2SQL(const Anope::string &modname, const Anope::string &creator)
Definition: irc2sql.h:43
MySQLInterface sqlinterface
Definition: irc2sql.h:25
EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string &param) anope_override
Definition: irc2sql.cpp:215
std::vector< Anope::string > ProcedureList
Definition: irc2sql.h:27
void OnUserLogin(User *u) anope_override
Definition: irc2sql.cpp:157
bool quitting
Definition: irc2sql.h:29
void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) anope_override
Definition: irc2sql.cpp:143
void OnError(const SQL::Result &r) anope_override
Definition: irc2sql.h:13
void OnSetDisplayedHost(User *u) anope_override
Definition: irc2sql.cpp:170
Interface(Module *m)
Definition: sql.h:188
void OnLeaveChannel(User *u, Channel *c) anope_override
Definition: irc2sql.cpp:230
void OnChannelDelete(Channel *c) anope_override
Definition: irc2sql.cpp:194
void OnJoinChannel(User *u, Channel *c) anope_override
Definition: irc2sql.cpp:201
ServiceReference< SQL::Provider > sql
Definition: irc2sql.h:24
Definition: sql.h:96
void OnChannelCreate(Channel *c) anope_override
Definition: irc2sql.cpp:180
bool HasEvent(const Anope::string &table)
Definition: utils.cpp:54
void OnResult(const SQL::Result &r) anope_override
Definition: irc2sql.h:9
SQL::Query query
Definition: irc2sql.h:26
void OnServerQuit(Server *server) anope_override
Definition: irc2sql.cpp:73
#define anope_override
Definition: services.h:56
void OnUserConnect(User *u, bool &exempt) anope_override
Definition: irc2sql.cpp:83
void OnNickLogout(User *u) anope_override
Definition: irc2sql.cpp:165
bool HasProcedure(const Anope::string &table)
Definition: utils.cpp:46
void OnUserQuit(User *u, const Anope::string &msg) anope_override
Definition: irc2sql.cpp:116
std::vector< Anope::string > TableList
Definition: irc2sql.h:27
EventReturn
Definition: modules.h:129
Definition: sql.h:8
bool HasTable(const Anope::string &table)
Definition: utils.cpp:38
void CheckTables()
Definition: tables.cpp:3
void OnFingerprint(User *u) anope_override
Definition: irc2sql.cpp:134
void RunQuery(const SQL::Query &q)
Definition: utils.cpp:3
void GetTables()
Definition: utils.cpp:9
Definition: logger.h:53
void OnUserNickChange(User *u, const Anope::string &oldnick) anope_override
Definition: irc2sql.cpp:126
void OnReload(Configuration::Conf *config) anope_override
Definition: irc2sql.cpp:11
MySQLInterface(Module *o)
Definition: irc2sql.h:7
void OnBotNotice(User *u, BotInfo *bi, Anope::string &message) anope_override
Definition: irc2sql.cpp:258
BotInfo * StatServ
Definition: irc2sql.h:30
EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string &param) anope_override
Definition: irc2sql.cpp:224
Definition: anope.h:20
bool introduced_myself
Definition: irc2sql.h:29
Definition: modules.h:163
Anope::string GeoIPDB
Definition: irc2sql.h:28
bool ctcpuser
Definition: irc2sql.h:29