]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/extra/m_sqlutils.h
Header update: 2007 -> 2008
[user/henk/code/inspircd.git] / src / modules / extra / m_sqlutils.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
6  * See: http://www.inspircd.org/wiki/index.php/Credits
7  *
8  * This program is free but copyrighted software; see
9  *            the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #ifndef INSPIRCD_SQLUTILS
15 #define INSPIRCD_SQLUTILS
16
17 #include "modules.h"
18
19 #define SQLUTILAU "SQLutil AssociateUser"
20 #define SQLUTILAC "SQLutil AssociateChan"
21 #define SQLUTILUA "SQLutil UnAssociate"
22 #define SQLUTILGU "SQLutil GetAssocUser"
23 #define SQLUTILGC "SQLutil GetAssocChan"
24 #define SQLUTILSUCCESS "You shouldn't be reading this (success)"
25
26 /** Used to associate an SQL query with a user
27  */
28 class AssociateUser : public Request
29 {
30 public:
31         /** Query ID
32          */
33         unsigned long id;
34         /** User
35          */
36         User* user;
37         
38         AssociateUser(Module* s, Module* d, unsigned long i, User* u)
39         : Request(s, d, SQLUTILAU), id(i), user(u)
40         {
41         }
42         
43         AssociateUser& S()
44         {
45                 Send();
46                 return *this;
47         }
48 };
49
50 /** Used to associate an SQL query with a channel
51  */
52 class AssociateChan : public Request
53 {
54 public:
55         /** Query ID
56          */
57         unsigned long id;
58         /** Channel
59          */
60         Channel* chan;
61         
62         AssociateChan(Module* s, Module* d, unsigned long i, Channel* u)
63         : Request(s, d, SQLUTILAC), id(i), chan(u)
64         {
65         }
66         
67         AssociateChan& S()
68         {
69                 Send();
70                 return *this;
71         }
72 };
73
74 /** Unassociate a user or  class from an SQL query
75  */
76 class UnAssociate : public Request
77 {
78 public:
79         /** The query ID
80          */
81         unsigned long id;
82
83         UnAssociate(Module* s, Module* d, unsigned long i)
84         : Request(s, d, SQLUTILUA), id(i)
85         {
86         }
87         
88         UnAssociate& S()
89         {
90                 Send();
91                 return *this;
92         }
93 };
94
95 /** Get the user associated with an SQL query ID
96  */
97 class GetAssocUser : public Request
98 {
99 public:
100         /** The query id
101          */
102         unsigned long id;
103         /** The user
104          */
105         User* user;
106
107         GetAssocUser(Module* s, Module* d, unsigned long i)
108         : Request(s, d, SQLUTILGU), id(i), user(NULL)
109         {
110         }
111         
112         GetAssocUser& S()
113         {
114                 Send();
115                 return *this;
116         }
117 };
118
119 /** Get the channel associated with an SQL query ID
120  */
121 class GetAssocChan : public Request
122 {
123 public:
124         /** The query id
125          */
126         unsigned long id;
127         /** The channel
128          */
129         Channel* chan;
130
131         GetAssocChan(Module* s, Module* d, unsigned long i)
132         : Request(s, d, SQLUTILGC), id(i), chan(NULL)
133         {
134         }
135         
136         GetAssocChan& S()
137         {
138                 Send();
139                 return *this;
140         }
141 };
142
143 #endif