]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/extra/m_sqlutils.h
Add extra parameter to OnUserPreNotice and OnUserPrePrivmsg, CUList &exempt_list...
[user/henk/code/inspircd.git] / src / modules / extra / m_sqlutils.h
1 #ifndef INSPIRCD_SQLUTILS
2 #define INSPIRCD_SQLUTILS
3
4 #include "modules.h"
5
6 #define SQLUTILAU "SQLutil AssociateUser"
7 #define SQLUTILAC "SQLutil AssociateChan"
8 #define SQLUTILUA "SQLutil UnAssociate"
9 #define SQLUTILGU "SQLutil GetAssocUser"
10 #define SQLUTILGC "SQLutil GetAssocChan"
11 #define SQLUTILSUCCESS "You shouldn't be reading this (success)"
12
13 /** Used to associate an SQL query with a user
14  */
15 class AssociateUser : public Request
16 {
17 public:
18         /** Query ID
19          */
20         unsigned long id;
21         /** User
22          */
23         userrec* user;
24         
25         AssociateUser(Module* s, Module* d, unsigned long i, userrec* u)
26         : Request(s, d, SQLUTILAU), id(i), user(u)
27         {
28         }
29         
30         AssociateUser& S()
31         {
32                 Send();
33                 return *this;
34         }
35 };
36
37 /** Used to associate an SQL query with a channel
38  */
39 class AssociateChan : public Request
40 {
41 public:
42         /** Query ID
43          */
44         unsigned long id;
45         /** Channel
46          */
47         chanrec* chan;
48         
49         AssociateChan(Module* s, Module* d, unsigned long i, chanrec* u)
50         : Request(s, d, SQLUTILAC), id(i), chan(u)
51         {
52         }
53         
54         AssociateChan& S()
55         {
56                 Send();
57                 return *this;
58         }
59 };
60
61 /** Unassociate a user or  class from an SQL query
62  */
63 class UnAssociate : public Request
64 {
65 public:
66         /** The query ID
67          */
68         unsigned long id;
69
70         UnAssociate(Module* s, Module* d, unsigned long i)
71         : Request(s, d, SQLUTILUA), id(i)
72         {
73         }
74         
75         UnAssociate& S()
76         {
77                 Send();
78                 return *this;
79         }
80 };
81
82 /** Get the user associated with an SQL query ID
83  */
84 class GetAssocUser : public Request
85 {
86 public:
87         /** The query id
88          */
89         unsigned long id;
90         /** The user
91          */
92         userrec* user;
93
94         GetAssocUser(Module* s, Module* d, unsigned long i)
95         : Request(s, d, SQLUTILGU), id(i), user(NULL)
96         {
97         }
98         
99         GetAssocUser& S()
100         {
101                 Send();
102                 return *this;
103         }
104 };
105
106 /** Get the channel associated with an SQL query ID
107  */
108 class GetAssocChan : public Request
109 {
110 public:
111         /** The query id
112          */
113         unsigned long id;
114         /** The channel
115          */
116         chanrec* chan;
117
118         GetAssocChan(Module* s, Module* d, unsigned long i)
119         : Request(s, d, SQLUTILGC), id(i), chan(NULL)
120         {
121         }
122         
123         GetAssocChan& S()
124         {
125                 Send();
126                 return *this;
127         }
128 };
129
130 #endif