[go: up one dir, main page]

Menu

[ab7a0e]: / mod.gnutest / gnutest.h  Maximize  Restore  History

Download this file

258 lines (218 with data), 6.6 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
/**
* gnutest.h
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*
* $Id: gnutest.h,v 1.14 2005/01/17 23:09:54 dan_karrels Exp $
*/
#ifndef __GNUTEST_H
#define __GNUTEST_H "$Id: gnutest.h,v 1.14 2005/01/17 23:09:54 dan_karrels Exp $"
#include <string>
#include <vector>
#include "client.h"
#include "iClient.h"
#include "Channel.h"
#include "StringTokenizer.h"
namespace gnuworld
{
/**
* The purpose of this class is to test new features added to
* the gnuworld server core.
*/
class gnutest : public xClient
{
public:
/**
* Constructor receives name of config file.
*/
gnutest( const std::string& ) ;
/**
* Destructor closes all streams and deallocates any memory
* created by this instance.
*/
virtual ~gnutest() ;
/**
* This method is invoked when this module is first loaded.
* This is a good place to setup timers, connect to DB, etc.
* At this point, the server may not yet be connected to the
* network, so please do not issue join/nick requests.
*/
virtual void OnAttach() ;
/**
* This method is called when this module is being unloaded from
* the server. This is a good place to cleanup, including
* deallocating timers, closing connections, closing log files,
* and deallocating private data stored in iClients.
*/
virtual void OnDetach( const std::string& =
std::string( "Server Shutdown" ) ) ;
/**
* This method is called when the server connects to the network.
* Note that if this module is attached while already connected
* to a network, this method is still invoked.
*/
virtual void OnConnect() ;
/**
* This method is invoked when the server disconnects from
* its uplink.
*/
virtual void OnDisconnect() ;
/**
* This method is called when a channel event occurs on one
* of the channels for which this client has requested to
* be notified of events.
*/
virtual void OnChannelEvent( const channelEventType&,
Channel*,
void* data1 = 0, void* data2 = 0,
void* data3 = 0, void* data4 = 0 ) ;
/**
* This method is called when a network event occurs, and
* the client has registered for that event.
*/
virtual void OnEvent( const eventType& theEvent,
void* data1 = 0, void* data2 = 0,
void* data3 = 0, void* data4 = 0 ) ;
/**
* This method is called for the client to burst all channels
* once the server connects to the network.
*/
virtual void BurstChannels() ;
/**
* This method is called when a network client messages
* this client.
*/
virtual void OnPrivateMessage( iClient*, const std::string&,
bool secure = false ) ;
/**
* This method is called when a channel message occurs
* in a channel in which an xClient resides, and the
* xClient is user mode -d.
*/
virtual void OnChannelMessage( iClient* Sender,
Channel* theChan,
const std::string& Message ) ;
/**
* This method is invoked when a fake client belonging to this
* xClient receives a channel message.
*/
virtual void OnFakeChannelMessage( iClient* srcClient,
iClient* destClient,
Channel* theChan,
const std::string& message ) ;
/**
* This method is invoked when a fake client belonging to this
* xClient receives a channel notice.
*/
virtual void OnFakeChannelNotice( iClient* srcClient,
iClient* destClient,
Channel* theChan,
const std::string& message ) ;
/**
* This method is called when a network message arrives for
* one of the fake clients owned by this xClient.
*/
virtual void OnFakePrivateMessage( iClient* srcClient,
iClient* destClient,
const std::string& message,
bool secure = false ) ;
/**
* This method is called when a network notice arrives for
* one of the fake clients owned by this xClient.
*/
virtual void OnFakePrivateNotice( iClient* srcClient,
iClient* destClient,
const std::string& message,
bool secure = false ) ;
/**
* Invoked when a fake client of this xClient receives a
* channel CTCP.
*/
virtual void OnFakeChannelCTCP( iClient* srcClient,
iClient* fakeClient,
Channel* theChan,
const std::string& command,
const std::string& message ) ;
/**
* Invoked when a fake client of this xClient receives a
* channel CTCP.
*/
virtual void OnFakeCTCP( iClient* srcClient,
iClient* fakeClient,
const std::string& command,
const std::string& message,
bool secure = false ) ;
/**
* This method is called when a timer expires.
*/
virtual void OnTimer( const xServer::timerID&, void* ) ;
protected:
/**
* Spawn a fake client.
*/
virtual void spawnClient( iClient* requestingClient,
const StringTokenizer& st ) ;
/**
* Spawn a fake server.
*/
virtual void spawnServer( iClient* requestingClient,
const StringTokenizer& st ) ;
/**
* Remove a fake client.
*/
virtual void removeClient( iClient* requestingClient,
const StringTokenizer& st ) ;
/**
* Remove a fake server.
*/
virtual void removeServer( iClient* requestingClient,
const StringTokenizer& st ) ;
/**
* Request that a spawned (fake) client join a channel.
*/
virtual void spawnJoin( iClient* requestingClient,
const StringTokenizer& st ) ;
/**
* Request that a spawned (fake) client part a channel.
*/
virtual void spawnPart( iClient* requestingClient,
const StringTokenizer& st ) ;
/**
* Report information about a channel.
*/
virtual void chanInfo( const Channel* theChan ) ;
/**
* This is the name of the operator only channel on which this
* client sits.
*/
std::string operChan ;
/**
* I have no idea what this is.
*/
std::string timerChan ;
/**
* This type is used for the helpTable, which will store basic
* information about what commands gnutest supports.
*/
typedef std::map< std::string, std::string > helpTableType ;
/**
* This is used to store basic information about what commands
* gnutest supports.
*/
helpTableType helpTable ;
} ;
} // namespace gnuworld
#endif // __GNUTEST_H