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;
29  bool quitting, introduced_myself, ctcpuser, ctcpeob, firstrun;
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 
51  void OnShutdown() anope_override;
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
PrimitiveExtensibleItem< bool > versionreply
Definition: irc2sql.h:31
Anope::string prefix
Definition: irc2sql.h:28
Definition: users.h:34
IRC2SQL(const Anope::string &modname, const Anope::string &creator)
Definition: irc2sql.h:43
MySQLInterface sqlinterface
Definition: irc2sql.h:25
bool quitting
Definition: irc2sql.h:29
void OnError(const SQL::Result &r) anope_override
Definition: irc2sql.h:13
Interface(Module *m)
Definition: sql.h:188
ServiceReference< SQL::Provider > sql
Definition: irc2sql.h:24
Definition: sql.h:96
void OnResult(const SQL::Result &r) anope_override
Definition: irc2sql.h:9
SQL::Query query
Definition: irc2sql.h:26
#define anope_override
Definition: services.h:56
std::vector< Anope::string > TableList
Definition: irc2sql.h:27
EventReturn
Definition: modules.h:129
Definition: sql.h:8
Definition: logger.h:53
MySQLInterface(Module *o)
Definition: irc2sql.h:7
BotInfo * StatServ
Definition: irc2sql.h:30
Definition: modules.h:163