forked from g2x3k/php-irc
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdefines.php
More file actions
executable file
·314 lines (280 loc) · 7.73 KB
/
defines.php
File metadata and controls
executable file
·314 lines (280 loc) · 7.73 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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
<?php
/*
+---------------------------------------------------------------------------
| PHP-IRC v2.2.1 Service Release
| ========================================================
| by Manick
| (c) 2001-2005 by http://www.phpbots.org/
| Contact: manick@manekian.com
| irc: #manekian@irc.rizon.net
| ========================================
+---------------------------------------------------------------------------
| > defines module
| > Module written by Manick
| > Module Version Number: 2.2.0
+---------------------------------------------------------------------------
| > 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.
+---------------------------------------------------------------------------
| Changes
| =======-------
| > If you wish to suggest or submit an update/change to the source
| > code, email me at manick@manekian.com with the change, and I
| > will look to adding it in as soon as I can.
+---------------------------------------------------------------------------
*/
// Debug Mode
define('DEBUG', 1);
// PID file
define('PID', "bot.pid");
// OS Type (windows/unix/linux/freebsd/unknown/auto)
define('OS', 'auto');
//YOU SHOULD NOT HAVE TO EDIT BELOW THIS POINT UNLESS YOU SPECIFY "unknown" AS OS!
if (OS == "auto")
{
switch (PHP_OS)
{
case "Windows NT":
$OS = "windows";
break;
case "Linux":
$OS = "linux";
break;
case "FreeBSD":
$OS = "freebsd";
break;
case "Unix":
$OS = "unix";
break;
//Thx OrochiTux for below
case "Darwin":
$OS = "freebsd";
break;
default:
$OS = "windows";
break;
}
}
else
{
$OS = OS;
}
if ($OS == 'unknown')
{
define('EAGAIN', 0); /* Try again */
define('EISCONN', 0); /* Transport endpoint is already connected */
define('EALREADY', 0); /* Operation already in progress */
define('EINPROGRESS', 0); /* Operation now in progress */
}
else if ($OS == 'windows')
{
//http://developer.novell.com/support/winsock/doc/appenda.htm
define('EAGAIN', 10035); //EWOULDBLOCK.. kinda like EAGAIN in windows?
define('EISCONN', 10056); /* Transport endpoint is already connected */
define('EALREADY', 10037); /* Operation already in progress */
define('EINPROGRESS', 10036); /* Operation now in progress */
}
else if ($OS == 'freebsd')
{
//Thanks to ryguy@efnet
///usr/include/errno.h (freebsd)
define('EAGAIN', 35); /* Try again */
define('EISCONN', 56); /* Transport endpoint is already connected */
define('EALREADY', 37); /* Operation already in progress */
define('EINPROGRESS', 36); /* Operation now in progress */
}
else if ($OS == 'linux')
{
///usr/include/sys/errno.h (sparc)
define('EAGAIN', 11); /* Try again */
define('EISCONN', 106); /* Transport endpoint is already connected */
define('EALREADY', 114); /* Operation already in progress */
define('EINPROGRESS', 115); /* Operation now in progress */
}
else if ($OS == 'unix')
{
///usr/include/asm/errno.h (mandrake 9.0)
define('EAGAIN', 11); /* Try again */
define('EISCONN', 133); /* Transport endpoint is already connected */
define('EALREADY', 149); /* Operation already in progress */
define('EINPROGRESS', 150); /* Operation now in progress */
}
// Version Definition
define('VERSION', '2.2.1');
define('VERSION_DATE', '04/08/06');
// Timer declarations
define('NICK_CHECK_TIMEOUT', 120); //seconds
define('CHAN_CHECK_TIMEOUT', 60); //seconds
define('PING_TIMEOUT', 130); //seconds (check every 130 seconds if we're still connected)
// Parser definitions
define('MAX_ARGS', 4);
// Status definitions
define('STATUS_IDLE', 0);
define('STATUS_ERROR', 1);
define('STATUS_CONNECTING', 2);
define('STATUS_CONNECTED', 3);
define('STATUS_CONNECTED_SENTREGDATA', 4);
define('STATUS_CONNECTED_REGISTERED', 5);
// Constant Definitions
define('ERROR_TIMEOUT', 60);
define('CONNECT_TIMEOUT', 45);
define('REGISTRATION_TIMEOUT', 60);
define('TIMEOUT_CHECK_TIME', 85); //85
//Constants for Channel Modes
define('BY_MASK', 0);
define('BY_STRING', 1);
define('BY_INT', 2);
define('BY_NONE', 3);
//Used with $ircClass->parseMode
define('USER_MODE', 0);
define('CHANNEL_MODE', 1);
//Random Vars
define('STATUS_JUST_BANNED', 1);
define('STATUS_ALREADY_BANNED', 2);
define('STATUS_NOT_BANNED', 3);
//Socket Class defines
define('SOCK_DEAD', 1);
define('SOCK_CONNECTING', 2);
define('SOCK_LISTENING', 3);
define('SOCK_ACCEPTED', 4);
define('SOCK_ACCEPTING', 5);
define('SOCK_CONNECTED', 6);
define('HIGHEST_PORT', 1000); // this is tcpRangeStart + HIGHEST_PORT
//DCC Class defines
define('FILE', 0);
define('CHAT', 1);
define('DCC_WAITING', 3);
define('DCC_REVERSE', 4);
define('DCC_CONNECTING', 0);
define('DCC_CONNECTED', 1);
define('DCC_LISTENING', 2);
//Connection class defines
define('CONN_READ', 0);
define('CONN_WRITE', 1);
define('CONN_ACCEPT', 2);
define('CONN_CONNECT', 3);
define('CONN_DEAD', 4);
define('CONN_CONNECT_TIMEOUT', 5);
define('CONN_TRANSFER_TIMEOUT', 6);
//Parser Class defines
define('BRIGHT', chr(3) . "13");
define('DARK', chr(3) . "03");
define('NORMAL', chr(16));
define('BOLD', chr(2));
define('UNDERLINE', chr(31));
define('PRIV', 1);
define('DCC', 2);
//File Class defines
define('UPLOAD', 0);
define('DOWNLOAD', 1);
//Used with $ircClass->addQuery
define('QUERY_SUCCESS', 0);
define('QUERY_ERROR', 1);
//Used in ini
define('EXACT_MATCH', 0);
define('AND_MATCH', 1);
define('OR_MATCH', 2);
define('CONTAINS_MATCH', 3);
//Used in socket class to keep track of sockets
class socketInfo {
public $socket;
public $status;
public $readQueue;
public $readLength;
public $writeQueue;
public $writeLength;
public $host;
public $port;
public $newSockInt;
public $listener;
public $owner;
public $class;
public $func;
public $readScheduled; //Used so we don't add infinite queues to the process queue.
public $writeScheduled;
}
//Channel and Username Linked List (Links) Definitions
class channelLink {
public $name;
public $count;
public $memberList = array();
public $banList = array();
public $whoComplete;
public $banComplete;
public $modes;
public $created;
public $topic;
public $topicBy;
}
class memberLink {
public $nick;
public $realNick;
public $host;
public $ident;
public $banned;
public $bantime;
public $status;
public $ignored;
}
// Used in timer class
class timer {
public $name;
public $class;
public $args;
public $interval;
public $lastTimeRun;
public $nextRunTime;
public $func;
}
class usageLink {
public $isBanned;
public $timeBanned;
public $lastTimeUsed;
public $timesUsed;
}
// Useful for sending arguments with timers
class argClass
{
public $arg1;
public $arg2;
public $arg3;
public $arg4;
public $arg5;
public $arg6;
public $arg7;
public $arg8;
public $timer;
}
// Used to instantiate a bot
class botClass {
public $timerClass;
public $ircClass;
public $dccClass;
public $parserClass;
public $socketClass;
public $configFilename;
public $db;
public $config;
}
// Used with processQueue
class queueItem {
public $owner; //IRC Class of owner
public $callBack_class; //CALL BACK class/function to use
public $callBack_function;
public $nextRunTime; //The next getMicroTime() time to run
public $removed;
public $next;
public $prev;
}
?>