-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCFlxBotServer.class.php
1404 lines (1330 loc) · 66.4 KB
/
CFlxBotServer.class.php
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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?PHP
/*
+---------------------------------------------------------------------------+
| Spioner Bot Version 0.2.3 |
+---------------------------------------------------------------------------+
| Copyright (c) 2004 Asso. Naellia - Département de Développement Naedev |
+---------------------------------------------------------------------------+
| Auteur : Cyprien "Fulax" Nicolas <[email protected]> |
| Contributeurs : JEDI_BC, sebbu, Xanthor |
| Date de création : 26 Sep 2004 17:37:25 CEST |
| |
| Ce logiciel est un programme informatique servant à effectuer des |
| opérations diverses sur des canaux et réseaux utilisant le protocole de |
| communication IRC, tel qu'il est défini dans la RFC 1459. |
+---------------------------------------------------------------------------+
| Ce logiciel est régi par la licence CeCILL soumise au droit français et |
| respectant les principes de diffusion des logiciels libres. Vous pouvez |
| utiliser, modifier et/ou redistribuer ce programme sous les conditions |
| de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA |
| sur le site "http://www.cecill.info". |
| |
| En contrepartie de l'accessibilité au code source et des droits de copie, |
| de modification et de redistribution accordés par cette licence, il n'est |
| offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons, |
| seule une responsabilité restreinte pèse sur l'auteur du programme, le |
| titulaire des droits patrimoniaux et les concédants successifs. |
| |
| A cet égard l'attention de l'utilisateur est attirée sur les risques |
| associés au chargement, à l'utilisation, à la modification et/ou au |
| développement et à la reproduction du logiciel par l'utilisateur étant |
| donné sa spécificité de logiciel libre, qui peut le rendre complexe à |
| manipuler et qui le réserve donc à des développeurs et des professionnels |
| avertis possédant des connaissances informatiques approfondies. Les |
| utilisateurs sont donc invités à charger et tester l'adéquation du |
| logiciel à leurs besoins dans des conditions permettant d'assurer la |
| sécurité de leurs systèmes et ou de leurs données et, plus généralement, |
| à l'utiliser et l'exploiter dans les mêmes conditions de sécurité. |
| |
| Le fait que vous puissiez accéder à cet en-tête signifie que vous avez |
| pris connaissance de la licence CeCILL, et que vous en avez accepté les |
| termes. |
+---------------------------------------------------------------------------+
*/
error_reporting('E_ALL | E_STRICT');
//ini_set('output_buffering','Off');
//ini_set('implicit_flush','On');
ini_set('max_execution_time','0');
///////////////////////////////////////////////////////////////////////////////
// CFlxBotServer.class.php5 : Classe PHP5 de gestion d'un bot multi-serveurs //
///////////////////////////////////////////////////////////////////////////////
class CFlxBotServer
{
# --- Proprietes
public $sServerURI = ''; // Server URI
public $nServerPort = 0; // Server Port
public $sNick = ''; // Bot nick
public $sMasterChan = ''; // Master chan : a chan where the bot reports everything he have to report
public $sBotModes = ''; // Modes to be set on the bot when it connects
public $sServerName = ''; // Server Name, will be determinated after connection
public $sNetworkName = ''; // Network Name, will be determinated after connection
public $sVarName = ''; // contient le nom du domaine du reseau
public $bReconnect = false; // Reconnect onto serveur if connexion is closed
public $sChans = ''; // List of chans the bot will join at this connection, for syntax, see the RFC1459, JOIN command
protected $sIndex = NULL; // Object index in $oServers array
public $rSocket = NULL; // Socket ressources value
protected $bConnected = false; // Connection status
protected $aBuffer = array(); // Message buffer
public $sLogChan = array(); // contient les salons à logguer
public $aWhois = array(); // temp whois
public $aWho = array(); // temp who
public $aWhoWas = array(); // temp whowas
public $aMap = array(); // temp map
public $aLinks = array(); // temp links
public $aList = array(); // temp list
public $aMOTD = array(''); // temp MOTD --> fichier
public $aINFO = array(''); // temp INFO --> fichier
public $aNAMES = array(); // temp NAMES
public $aMODE = array(); // temp MODE
public $aCreationTime = array(); // temp channel creation time
public $aBAN = array(); // temp BAN
public $aEXCEPT = array(); // temp except
public $sJoined = false; // pour réutiliser
public $alusers = array(); // temp lusers
public $aLUSERS = array(); // temp LUSERS
public $aISON = ''; // temp ISON
public $aISON_nick = ''; // liste nick ISON
public $aGAMES = array(); // temp GAME
public $aDCC_SEND_IP = array(); //temp dcc send ip
public $sSocketText = ''; // Socket Text
public $aOwners2 = array(); // liste owners2
public $aSubowners2 = array(); // liste subowners2
public $aRaws = array(); // Raws vars configuration
public $aVars = array(); // Internal vars
# --- Constructeur
function __construct($a_sIndex,$a_sServerURI,$a_nServerPort,$a_sNick,$a_sMasterChan,$a_sChans,$a_sBotModes,$a_bReconnect = false,$a_sLogChan='')
{
$this->sIndex = $a_sIndex;
$this->sServerURI = $a_sServerURI;
$this->nServerPort = $a_nServerPort;
$this->sNick = $a_sNick;
$this->sMasterChan = $a_sMasterChan;
$this->sChans = $a_sChans;
$this->sBotModes = $a_sBotModes;
$this->bReconnect = $a_bReconnect;
if(is_array($a_sLogChan)) $this->sLogChan = $a_sLogChan;
else $this->sLogChan=explode(',',$a_sLogChan);
// Initialisation des vars
$this->aVars['sChans'] = '';
$this->vInitVars();
return true;
}
# --- Methodes
# - Initialisation
function vInitVars()
{
//// Debug display vars
$this->aVars['display'] = array();
// Raws
$this->aVars['display']['raw'] = array();
$this->aVars['display']['raw'][324] = true; // Displays RPL_CHANNELMODEIS
$this->aVars['display']['raw'][329] = true; // Displays RPL_CREATIONTIME
$this->aVars['display']['raw'][401] = true; // Displays ERR_NOSUCHNICK
// Texts
$this->aVars['display']['invites'] = true; // Displays invitations into debug window
$this->aVars['display']['PPE'] = false; // Displays Ping? Pong! Event
$this->aVars['display']['privmsg'] = true; // Displays channel messages
$this->aVars['display']['selfkicks'] = true; // Displays kicks when the bot is kicked
$this->aVars['display']['snotices'] = true; // Displays bot's notices
$this->aVars['display']['sprivmsg'] = true; // Displays bot's queries
$this->aVars['display']['sctcp'] = true; // Displays bot's ctcp
//// MasterChan report vars
$this->aVars['report'] = array();
// Raws
$this->aVars['report']['raw'] = array();
$this->aVars['report']['raw'][324] = false; // Reports RPL_CHANNELMODEIS
$this->aVars['report']['raw'][329] = false; // Reports RPL_CREATIONTIME
$this->aVars['report']['raw'][401] = true; // Reports ERR_NOSUCHNICK
// Texts
$this->aVars['report']['invites'] = true; // Reports invitations in $sMasterChan
$this->aVars['report']['PPE'] = false; // Reports Ping? Pong! Event
$this->aVars['report']['selfkicks'] = true; // Reports kicks when the bot is kicked
$this->aVars['report']['snotices'] = false; // Reports bot's notices
$this->aVars['report']['sprivmsg'] = false; // Reports bot's queries
$this->aVars['report']['sctcp'] = false; // Reports bot's ctcp
//// Answers configuration
// Raws
$this->aVars['raw'] = array();
$this->aVars['raw'][324]['listen'] = false; // Listens raw RPL_CHANNELMODEIS
$this->aVars['raw'][329]['listen'] = false; // Listens raw RPL_CREATIONTIME
$this->aVars['raw'][401]['listen'] = false; // Listens raw ERR_NOSUCHNICK
// Invites
$this->aVars['invite'] = array();
$this->aVars['invite']['autojoin'] = true; // Automaticaly join un channel on invite
$this->aVars['invite']['referrer'] = true; // Says in the new channel who invited it in
// Kicks
$this->aVars['kicks']['autorejoin'] = true; // Auto-rejoin a channel from which the bot is kicked
}
# - Gestion de la socket
# Ouverture et connexion
function vSockConnect()
{
$errno=$errstr='';
$opts=array('ssl'=>array('allow_self_signed'=>true));
$context = stream_context_create($opts);
$default = stream_context_get_default();
stream_context_set_option($default,'ssl','allow_self_signed',true);
//$this->rSocket = stream_socket_client($this->sServerURI, $errno, $errstr, 30,STREAM_CLIENT_ASYNC_CONNECT,$default);
//$this->rSocket = stream_socket_client('sslv3://irc.otaku-irc.net:7000', $errno, $errstr, 30,STREAM_CLIENT_CONNECT,$context);
//echo 'tentative de connection en ssl<br/>'.chr(13).chr(10);
/*var_dump(gethostbynamel($this->sServerURI));
var_dump(strpos($this->sServerURI,'://'));
var_dump(gethostbynamel(substr($this->sServerURI,strpos($this->sServerURI,'://')+3)));
die();*/
if(gethostbynamel($this->sServerURI)===false&&gethostbynamel(substr($this->sServerURI,strpos($this->sServerURI,'://')+3))===false) {
return false;
}
$this->rSocket = stream_socket_client($this->sServerURI.':'.$this->nServerPort, $errno, $errstr, 60,STREAM_CLIENT_CONNECT,$context) or die('ne répond pas'.chr(13).chr(10));
stream_set_blocking($this->rSocket,false);
//var_dump($this->rSocket);
//var_dump((bool)$this->rSocket);
//var_dump(is_resource($this->rSocket));
if(!is_resource($this->rSocket)) {
echo "$errstr ($errno)<br />\n";
die();
}
if($this->rSocket)
//if(is_ressource($this->rSocket))
//if($this->rSocket = pfsockopen($this->sServerURI,$this->nServerPort))
{
//echo 'a'."\r\n";
//stream_set_timeout($this->rSocket,60);
//stream_set_blocking($this->rSocket,false);
//echo 'a'."\r\n";
sleep(5);
while($this->vSockGet()) {
if(stripos($this->sSocketText,'NOTICE AUTH :BitlBee-IRCd initialized, please go on')!==false) {
echo "\r\n\r\n";
var_dump('BITLBEE');
echo "\r\n\r\n";
}
$this->vSockPut($this->sSocketText,1,false);
}
sleep(1);
//echo 'a'."\r\n";
if(stripos($this->sServerURI,'bitlbee')===false) $this->vSockPut('PASS [envoi du pass]',2,false);
if(stripos($this->sServerURI,'bitlbee')===false) $this->vSockPut('PASS '.PASS_BOT,0,true,false);
if(!array_key_exists('SERVER_NAME',$_SERVER)) $_SERVER['SERVER_NAME']='command-line';
$name=explode(':',$_SERVER['SERVER_NAME']);
$name=$name[0];
$sServerURI=str_replace('ssl://','',$this->sServerURI);
//var_dump('USER spioner spioner@'.$name.' '.$sServerURI.' :'.$GLOBALS['sVersion']);
$this->vSockPut('USER spioner spioner@'.$name.' '.$sServerURI.' :'.$GLOBALS['sVersion']);
$this->vSockPut('NICK '.$this->sNick);
if(stripos($this->sServerURI,'bitlbee')!==false) {
$this->vSockPut('USER bitlbee bitlbee bitlbee :bitlbee');
$this->vSockPut('NICK sebbu-robot');
}
$bNickValid = false;
$nNickCount = 0;
$aMatches=array();
$this->bConnected = true;
$before=time();
while($bNickValid === false)
{
if($this->vSockGet()) {
$this->vSockPut($this->sSocketText,1,false);
}
elseif(!$before) {
break;
}
elseif($before+30<time())
{
$before=false;
break;
}
else {
usleep(100000);
continue;
}
if(!eregi(' 433 | 001 ',$this->sSocketText))
{
if(preg_match('/^ERROR :Closing Link: (.*)\r$/',$this->sSocketText,$aMatches))
{
$this->vSockPut('Deconnexion : '.$aMatches[1],5,false);
$this->bConnected = false;
break;
}
elseif(preg_match('/^PING :(.*)\r$/',$this->sSocketText,$aMatches))
{
$this->vSockPut('PONG '.$aMatches[1]);
}
elseif(preg_match('/^:([^ ]+) (\d\d\d) '.$this->sNick.' (.*)$/i',$this->sSocketText,$aMatches))
{
$this->vParseRaws($aMatches);
}
}
elseif(eregi(' 433 ',$this->sSocketText))
{
$this->sNick = $this->sNick.$nNickCount++;
$this->vSockPut('NICK '.$this->sNick);
}
elseif(preg_match('/^:([^ ]+) 001 /',$this->sSocketText,$aMatches))
{
if(isset($aMatches[1])) {
$this->sServerName = $aMatches[1];
}
$bNickValid = true;
break;
}
}
if($before==false) {
$this->vSockPut('Deconnexion : ',5,false);
$this->bConnected=false;
return false;
}
if($this->bConnected)
{
if(strlen($this->sBotModes))
$this->vSockPut('MODE '.$this->sNick.' '.$this->sBotModes);
$this->vSockPut('[PHP] SLEEP(2);',9,false);
sleep(2);
$this->vSockPut('JOIN '.$this->sMasterChan);
$this->vSockPut('MODE '.$this->sMasterChan);
$this->vSockPut('MODE '.$this->sMasterChan.' +b');
$this->vSockPut('MODE '.$this->sMasterChan.' +e');
$this->vSockPut('NAMES '.$this->sMasterChan);
$sJoined = false;
while(!$sJoined)
{
if($this->vSockGet()) {
$this->vSockPut($this->sSocketText,1,false);
} else {
usleep(100000);
continue;
}
if( preg_match('/^:(('.$this->sNick.')!([^!]+)@([^@]+)) JOIN :('.$this->sMasterChan.')/i',$this->sSocketText,$aMatches) && stripos($this->sServerURI,'bitlbee')===false )
{
$this->aVars['sMask'] = $aMatches[1];
$this->aVars['sIdent'] = $aMatches[3];
$this->aVars['sHost'] = $aMatches[4];
$this->sMasterChan = $aMatches[5];
$this->aVars['sChans'] = " $this->sMasterChan ";
$this->vSockPut('PRIVMSG '.$this->sMasterChan.' :Hello, I am Bot spioner, running version '.$GLOBALS['sVersion']);
$this->vSockPut('PRIVMSG '.$this->sMasterChan.' :My Mask is '.$this->aVars['sMask']);
if(!array_key_exists('REMOTE_ADDR',$_SERVER)) $_SERVER['REMOTE_ADDR']='command-line';
/*$name=explode(':',$_SERVER['SERVER_NAME']);
$name=$name[0];*/
$this->vSockPut('PRIVMSG '.$this->sMasterChan.' :I have been executed by '.$_SERVER['REMOTE_ADDR']);
if(strlen($this->sChans))
{
$this->vSockPut('PRIVMSG '.$this->sMasterChan.' :I am joining '.$this->sChans);
$this->vSockPut('JOIN '.$this->sChans);
/*foreach(explode(',',$this->sChans) as $value) {
$this->vSockPut('MODE '.$value);
$this->vSockPut('MODE '.$value.' +b');
$this->vSockPut('MODE '.$value.' +e');
}*/
}
$this->aVars['report']['snotices'] = true;
$this->aVars['report']['sprivmsg'] = true;
$sJoined = true;
break;
}
elseif( preg_match('/^:(('.$this->sNick.')!([^!]+)@([^@]+)) JOIN :('.$this->sMasterChan.'|&(?:amp;)?bitlbee)/i',$this->sSocketText,$aMatches) && stripos($this->sServerURI,'bitlbee')!==false )
{
$this->aVars['sMask'] = $aMatches[1];
$this->aVars['sIdent'] = $aMatches[3];
$this->aVars['sHost'] = $aMatches[4];
$this->aVars['sChans'] = " $this->sMasterChan ";
$this->vSockPut('PRIVMSG &bitlbee :identify '.PASS_BOT);
$this->vSockPut('PRIVMSG &bitlbee :account on');
$sJoined = true;
break;
}
else
{
$this->vParseText();
}
}
$this->sJoined=true;
}
return true;
}
else
{
return false;
}
}
# Envoi de donnees
function vSockPut($a_sText,$a_nType = 2,$a_bSend = true,$a_bDisplay = true)
{
$sText = trim($a_sText);
if(!strlen($sText)) return;
if($a_bDisplay and $GLOBALS['bOutput'])
{
$ctcp=$me=chr(1);$bold=chr(2);$color=chr(3);$fin=chr(15);$reverse=chr(22);$underline=chr(31);
$sServerURI=str_replace('ssl://','',$this->sServerURI);
$sText = htmlentities($sText);
$sText = preg_replace('/([^]*)/is','<u>$1</u>',$sText);
$sText = preg_replace('/'.$bold.'([^'.$bold.$fin.']*)['.$bold.$fin.']/is','<strong>$1</strong>',$sText);
//$text = preg_replace('/12((?:(?!).)*)(?!\d+)/is','<font color="#0000FF">$1</font>',$text);
$sText = preg_replace('/(['.$reverse.$underline.$ctcp.'])/e','\'<strong>\'.str_pad(ord(\'\\1\'),3,0,STR_PAD_LEFT).\'</strong>\'',$sText);
$sec=time();$usec=substr(microtime(),0,10);$usec=substr($usec,1,7);
switch($a_nType)
{
case 1: // Incoming messages
echo date('=[H:i:s',$sec).$usec.'] '.'<em>'.$sServerURI.(strlen($this->sNetworkName)?'('.$this->sNetworkName.')':'').'</em> '.$sText.' <br/>'."\r\n";
#echo date('=[H:i:s] ').'<em>'.$this->sServerURI.'('.$this->sNetworkName.')</em> '.$sText.'<br/>'."\n";
break;
case 2: // Outgoing messages
echo date('=[H:i:s',$sec).$usec.'] '.'<em>'.$sServerURI.(strlen($this->sNetworkName)?'('.$this->sNetworkName.')':'').'</em> '.$sText.' <br/>'."\r\n";
if(array_key_exists('sMask',$this->aVars)&&strlen($this->aVars['sMask'])>0) {
//file_put_contents('outgoing_messages.log',trim($sText).chr(13).chr(10),FILE_APPEND);
//echo 'vParseOutgoingText launched<br/>'."\r\n";
$this->vParseOutgoingText(':'.$this->aVars['sMask'].' '.trim($sText));
//echo 'vParseOutgoingText ended<br/>'."\r\n";
}
else {
//file_put_contents('outgoing_messages.log',trim($sText).chr(13).chr(10),FILE_APPEND);
//echo 'vParseOutgoingText launched<br/>'."\r\n";
if(!array_key_exists('SERVER_NAME',$_SERVER)) $_SERVER['SERVER_NAME']='command-line';
$this->vParseOutgoingText(':'.$this->sNick.'!spioner@'.$_SERVER['SERVER_NAME'].' '.trim($sText));
//echo 'vParseOutgoingText ended<br/>'."\r\n";
}
#echo date('>[H:i:s] ').'<em>'.$sServerURI.'('.$this->sNetworkName.')</em> '.$sText.'<br/>'."\n";
break;
case 5: // Server specific notices
echo date('=[H:i:s',$sec).$usec.'] '.'<em>'.$sServerURI.(strlen($this->sNetworkName)?'('.$this->sNetworkName.')':'').'</em> '.$sText.' <br/>'."\r\n";
file_put_contents('snotices.log',trim($sText).chr(13).chr(10),FILE_APPEND);
#echo date('![H:i:s] ').'<em>'.$this->sServerURI.($this->sNetworkName?'('.$this->sNetworkName.')':'').'</em> '.$sText.'<br/>'."\n";
break;
case 9: // General Message, non server specific
echo date('=[H:i:s',$sec).$usec.'] '.$sText.' <br/>'."\r\n";
#echo date('@[H:i:s] ').$sText.'<br/>'."\n";
break;
default:
break;
}
}
if($a_bSend)
{
//fputs($this->rSocket,$a_sText."\n\r");
fputs($this->rSocket,$a_sText."\r\n");
}
}
# Lecture de donnees
function vSockGet()
{
$sSocketText = fgets($this->rSocket,1024);
if($nLen = strlen($sSocketText)) {
$this->sSocketText = $sSocketText;
return $nLen;
}
else return false;
}
function vBufferAddLine($a_sTextMsg,$a_nType = 2,$a_bSend = true,$a_bDisplay = true) {
$this->aBuffer[] = array($a_sTextMsg,$a_nType,$a_bSend,$a_bDisplay);
}
function vBufferReadLine() {
list($sTextMsg,$nType,$bSend,$bDisplay) = array_shift($this->aBuffer);
$this->vSockPut($sTextMsg,$nType,$bSend,$bDisplay);
}
function vBufferHasLine() {
return count($this->aBuffer);
}
function vBufferClear() {
while($this->vBufferHasLine()) {
$this->vBufferReadLine();
}
}
function vCallBackExternalFunction($a_sFunctionName,$a_aIndexes,$a_aParameters = false)
{
if(!function_exists($a_sFunctionName))
{
$this->vBufferAddLine('FATAL ERROR AVOIDED : Call to undefined function '.$a_sFunctionName.' in '.$a_aIndexes['file'].':'.$a_aIndexes['line'].'.',9,false);
return false;
}
if(is_array($a_aParameters))
call_user_func_array($a_sFunctionName,$a_aParameters);
else
call_user_func_array($a_sFunctionName);
return true;
}
function bIsConnected()
{
return $this->bConnected;
}
function bGetNickServIdent()
{
return true;
}
function vParseText()
{
$aMatches=array();
if(preg_match('/^:([^ ]+) (\d\d\d) '.$this->sNick.' (.*)$/i',$this->sSocketText,$aMatches))
{
$this->vParseRaws($aMatches);
}
// INVITE (rfc1459) Invited to channel.
elseif(preg_match('/^:([^ ]+) INVITE '.preg_quote($this->sNick,'/').' :?([&#][^\cG, ]{0,199})$/',trim($this->sSocketText),$aMatches))
{
if(in_array($aMatches[2],$this->sLogChan)) {
log_add($this->sVarName.' '.$aMatches[2].'.log',$this->sSocketText);
}
// The bot has been invited
$this->vParseInvite($aMatches);
}
// JOIN (rfc1459) Joined a channel
elseif(preg_match('/^:(([^!]+)!([^@]+)@([^ ]+)) JOIN :?([&#][^\cG, ]{0,199})$/',trim($this->sSocketText),$aMatches))
{
//var_dump($aMatches);
if(in_array($aMatches[5],$this->sLogChan)) {
log_add($this->sVarName.' '.$aMatches[5].'.log',$this->sSocketText);
}
if($aMatches[2]!=$this->sNick) $this->vSockPut('NAMES '.$aMatches[5]);
// The bot or someone else is joining a channel
$this->vParseJoin($aMatches);
}
/* elseif(preg_match("/^:(([^!@]+)!([^!@]*)@([^!@]*)) JOIN :?([&#][^\cG, ]{0,199})(?:,([&#][^\cG, ]{0,199}))?(?: ([^, ]+)(?:,([^, ]+))?)?$/",$this->sSocketText,$aMatches))
{
#
}*/
// KICK (rfc1459) Kicked from a channel
elseif(preg_match('/^:([^ ]+) KICK ([&#][^\cG, ]{0,199}) ([^ ]+)(?: :(.*))?$/',trim($this->sSocketText),$aMatches))
{
if(in_array($aMatches[2],$this->sLogChan)) {
log_add($this->sVarName.' '.$aMatches[2].'.log',$this->sSocketText);
}
$this->vSockPut('NAMES '.$aMatches[2]);
// The bot or someone alse has been kicked from a channel
$this->vParseKick($aMatches);
}
/* elseif(preg_match('/^:(([^!@]+)!([^!@]*)@([^!@]*)) KICK ([&#][^\cG, ]{0,199}) ([^ ]+)(?: :(.*))?$/',$this->sSocketText,$aMatches))
{
#
}*/
// KILL (rfc1459) Killed from server
elseif(preg_match('/^:([^ ]+) KILL ([^ ]+) :(.*)$/',trim($this->sSocketText),$aMatches))
{
//var_dump(trim($this->sSocketText));
$temp=array_merge(array_unique(array_merge(explode(',',$this->sChans),explode(',',$this->sMasterChan))));
foreach($temp as $chan) {
if(in_array($chan,$this->sLogChan)&&array_key_exists($chan,$this->aNAMES)&&names_search($this->aNAMES[$chan],$aMatches[2])) {
log_add($this->sVarName.' '.$chan.'.log',$this->sSocketText);
}
if($aMatches[2]!=$this->sNick) $this->vSockPut('NAMES '.$chan);
}
// The bot or someone alse has been killed from a server
$this->vParseKill($aMatches);
//echo 'vParseKill ended<br/>'."\r\n";
}
// MODE (rfc1459) User or Channel mode change
elseif(preg_match('/^:([^ ]+) MODE ([^ ]+) ([-+][A-Za-z]+(?:[-+]?[A-Za-z]+)*)(?: (.*))?$/',trim($this->sSocketText),$aMatches))
{
if(in_array($aMatches[2],$this->sLogChan)) {
log_add($this->sVarName.' '.$aMatches[2].'.log',$this->sSocketText);
}
// Mode change
$this->vParseMode($aMatches);
}
/* elseif(preg_match("/^:(([^!@]+)!([^!@]*)@([^!@]*)) MODE ([&#][^\cG, ]{0,199}) ([-+][A-Za-z](?:[-+]?[A-Za-z]+)*)(?: (.*))?$/",$this->sSocketText,$aMatches))
{
#
}*/
// NICK (rfc1459) Nick change.
elseif(preg_match('/^:(([^!]+)!([^@]+)@([^ ]+)) NICK :?(.*)$/',trim($this->sSocketText),$aMatches))
{
//var_dump($this->sChans,$this->sMasterChan);
$temp=array_merge(array_unique(array_merge(explode(',',$this->sChans),explode(',',$this->sMasterChan))));
foreach($temp as $chan) {
if(in_array($chan,$this->sLogChan)&&array_key_exists($chan,$this->aNAMES)&&names_search($this->aNAMES[$chan],$aMatches[2])) {
log_add($this->sVarName.' '.$chan.'.log',$this->sSocketText);
}
$this->vSockPut('NAMES '.$chan);
}
var_dump($aMatches[2],$aMatches[5]);
if(array_key_exists($aMatches[2],$this->aOwners2)) {
unset($this->aOwners2[$aMatches[2]]);
$this->aOwners2[$aMatches[5]]=true;
}
elseif(array_key_exists($aMatches[2],$this->aSubowners2)) {
unset($this->aSubowners2[$aMatches[2]]);
$this->aSubowners2[$aMatches[5]]=true;
}
// Nick change
$this->vParseNick($aMatches);
}
// NOTICE (rfc1459) Private Notice
elseif(preg_match('/^:([^ ]+) NOTICE ([^ ]+) :(.*)$/',trim($this->sSocketText),$aMatches))
{
if(in_array($aMatches[2],$this->sLogChan)) {
log_add($this->sVarName.' '.$aMatches[2].'.log',$this->sSocketText);
}
// Notices
$this->vParseNotice($aMatches);
}
/* elseif(preg_match('/^:(([^!@]+)!([^!@]*)@([^!@]*)) NOTICE ('.$this->sNick.') :(.*)$/',$this->sSocketText,$aMatches))
{
# --- Query messages
}
elseif(preg_match('/^:(([^!@]+)!([^!@]*)@([^!@]*)) NOTICE ([^ ]+) :(.*)$/',$this->sSocketText,$aMatches))
{
#
}*/
// PART (rfc1459) Parted a channel
elseif(preg_match('/^:(([^!]+)!([^@]+)@([^ ]+)) PART ([&#][^\cG, ]{0,199})(?: :(.*))?$/',trim($this->sSocketText),$aMatches))
{
if(in_array($aMatches[5],$this->sLogChan)) {
log_add($this->sVarName.' '.$aMatches[5].'.log',$this->sSocketText);
}
$this->vSockPut('NAMES '.$aMatches[5]);
// Leaving a channel
var_dump($aMatches[2],$aMatches[5]);
if(array_key_exists($aMatches[2],$this->aOwners2)&&$aMatches[5]==$this->sMasterChan) {
unset($this->aOwners2[$aMatches[2]]);
}
elseif(array_key_exists($aMatches[2],$this->aSubowners2)&&$aMatches[5]==$this->sMasterChan) {
unset($this->aSubowners2[$aMatches[2]]);
}
$this->vParsePart($aMatches);
}
/* elseif(preg_match('/^:(([^!@]+)!([^!@]*)@([^!@]*)) PART ([&#][^\cG, ]{0,199})(?:,([&#][^\cG, ]{0,199}))?(?: :(.*))?$/',$this->sSocketText,$aMatches))
{
#
}*/
// PONG (rfc1459) Server Ping
elseif(preg_match('/^:([^ ]+) PONG ([^ ]+)(?: [^ ]+)?(?: :(.*))?$/',trim($this->sSocketText),$aMatches))
{
$this->vParsePong($aMatches);
}
// PRIVMSG (rfc1459) Private Message
elseif(preg_match('/^:([^ ]+) PRIVMSG ([^ ]+) :(.*)$/',trim($this->sSocketText),$aMatches))
{
if(in_array($aMatches[2],$this->sLogChan)) {
log_add($this->sVarName.' '.$aMatches[2].'.log',$this->sSocketText);
}
if($aMatches[2]==$this->sNick) {
log_add('privmsg.log',$this->sSocketText);
}
$this->vParsePrivMsg($aMatches);
}
elseif(preg_match('/^PRIVMSG ([^ ]+) :(.*)$/',trim($this->sSocketText),$aMatches))
{
if(in_array($aMatches[1],$this->sLogChan)) {
log_add($this->sVarName.' '.$aMatches[1].'.log',$this->sSocketText);
}
if($aMatches[1]==$this->sNick) {
log_add('privmsg.log',$this->sSocketText);
}
$this->vParsePrivMsg($aMatches);
}
/* elseif(preg_match('/^:(([^!@]+)!([^!@]*)@([^!@]*)) PRIVMSG ('.$this->sNick.') :(.*)$/',$this->sSocketText,$aMatches))
{
# --- Query messages
}
elseif(preg_match('/^:(([^!@]+)!([^!@]*)@([^!@]*)) PRIVMSG ([^ ]+) :(?:'.$this->sNick.'[:,]? )?(.*)$/',$this->sSocketText,$aMatches))
{
# --- Channel Messages
}*/
// QUIT (rfc1459) Quit the server.
elseif(preg_match('/^:(([^!]+)!([^@]+)@([^ ]+)) QUIT :(.*)$/',trim($this->sSocketText),$aMatches))
{
//>> :Fitz[ouille]`[email protected] QUIT :Connection reset by peer
$temp=array_merge(array_unique(array_merge(explode(',',$this->sChans),explode(',',$this->sMasterChan))));
foreach($temp as $chan) {
if(in_array($chan,$this->sLogChan)&&array_key_exists($chan,$this->aNAMES)&&names_search($this->aNAMES[$chan],$aMatches[2])) {
log_add($this->sVarName.' '.$chan.'.log',$this->sSocketText);
}
$this->vSockPut('NAMES '.$chan);
}
if(array_key_exists($aMatches[1],$this->aOwners2)) {
unset($this->aOwners2[$aMatches[1]]);
}
elseif(array_key_exists($aMatches[1],$this->aSubowners2)) {
unset($this->aSubowners2[$aMatches[1]]);
}
$this->vParseQuit($aMatches);
}
// TOPIC (rfc1459) Channel topic change
elseif(preg_match('/^:(([^!]+)!([^@]+)@([^ ]+)) TOPIC ([&#][^\cG, ]{0,199}) :(.*)$/',trim($this->sSocketText),$aMatches))
{
if(in_array($aMatches[5],$this->sLogChan)) {
log_add($this->sVarName.' '.$aMatches[5].'.log',$this->sSocketText);
}
$this->vParseTopic($aMatches);
}
// WALLOPS (rfc1459) Wallops, Server and Users
elseif(preg_match('/^:([^ ]+) WALLOPS :(.*)$/',trim($this->sSocketText),$aMatches))
{
$this->vParseWallops($aMatches);
}
/* elseif(preg_match('/^:(([^!@]+)!([^!@]*)@([^!@]*)) WALLOPS :(.*)$/',$this->sSocketText,$aMatches))
{
#
}*/
// PING
elseif(preg_match('/^PING :(.*)$/',trim($this->sSocketText),$aMatches))
{
$this->vParsePing($aMatches);
}
// ERROR
elseif(preg_match('/^ERROR :Closing Link: ([^\[]+)\[([^\]]+)\] (\S*) ?\((.+)\)$/',trim($this->sSocketText),$aMatches))
{
//var_dump(trim($this->sSocketText));
$temp=array_merge(array_unique(array_merge(explode(',',$this->sChans),explode(',',$this->sMasterChan))));
//var_dump($temp);
foreach($temp as $chan) {
if(in_array($chan,$this->sLogChan)&&array_key_exists($chan,$this->aNAMES)&&names_search($this->aNAMES[$chan],$aMatches[1])) {
log_add($this->sVarName.' '.$chan.'.log',$this->sSocketText);
}
if($aMatches[1]!=$this->sNick) $this->vSockPut('NAMES '.$chan);
}
$this->aOwners2=$this->aSubowners2=array();
$this->vParseError($aMatches);
}
else {
var_dump(trim($this->sSocketText));
}
}
function vParseOutgoingText($a_aMatches) {
//var_dump($a_aMatches);
return $GLOBALS['vParseOutgoingText'] ($a_aMatches,$this);
//return vParseOutgoingText($a_aMatches,$this);
}
function vParseRaws($a_aMatches)
{
//echo '<br/><br/>'.chr(13).chr(10).strlen($GLOBALS['vParseRaws']).chr(13).chr(10).'<br/><br/>'.chr(13).chr(10);
return $GLOBALS['vParseRaws'] ($a_aMatches,$this);
//return vParseRaws($a_aMatches,$this);
}
function vParseInvite($a_aMatches)
{ # /^:([^ ]+) INVITE '.preg_quote($this->sNick,'/').' :?([&#][^\cG, ]{0,199})$/
$aMatches = $a_aMatches;
$aUserMatches = array();
if(!preg_match('/^([^!]+)!([^@ ]+)@([^ ]+)$/',$aMatches[1],$aUserMatches))
$aUserMatches[1] = $aMatches[1];
if($this->aVars['display']['invites'] == true)
{
$this->vBufferAddLine($this->sSocketText,1,false);
}
if(stripos('#_#',trim($aMatches[2]))===false) {
$this->vBufferAddLine('JOIN '.trim($aMatches[2]));
$this->vSockPut('MODE '.trim($aMatches[2]));
$this->vSockPut('MODE '.trim($aMatches[2]).' +b');
$this->vSockPut('MODE '.trim($aMatches[2]).' +e');
$this->vSockPut('NAMES '.trim($aMatches[2]));
//unset($a_aMatches,$aMatches,$aUserMatches);
//return true;
}
else {
$this->vBufferAddLine('PRIVMSG '.$this->sMasterChan.' :(WARNING) invitation sur #_# par '.$aUserMatches[1].'.');
//unset($a_aMatches,$aMatches,$aUserMatches);
//return true;
}
if($this->aVars['report']['invites'] == true)
{
if($this->aVars['invite']['autojoin'] == true)
{
$this->vBufferAddLine('PRIVMSG '.$this->sMasterChan.' :'.$aUserMatches[1].' invited me in '.trim($aMatches[2]).'.');
}
else
{
$this->vBufferAddLine('PRIVMSG '.$this->sMasterChan.' :'.$aUserMatches[1].' invited me in '.trim($aMatches[2]).', but $this->aVars[\'invite\'][\'autojoin\'] is set to false, so I will not join.');
}
}
if($this->aVars['invite']['autojoin'] == true)
{
if($this->aVars['invite']['referrer'] == true)
{
$this->vBufferAddLine('PRIVMSG '.trim($aMatches[2]).' :'.$aUserMatches[1].' invited me here.');
}
}
unset($a_aMatches,$aMatches,$aUserMatches);
return true;
}
function vParseJoin($a_aMatches)
{ # /^:(([^!]+)!([^@]+)@([^ ]+)) JOIN :?([&#][^\cG, ]{0,199})$/
$aMatches = $a_aMatches;
if($aMatches[2] === $this->sNick)
{
// The bot is joining a channel
if(!preg_match('/ '.preg_quote(trim($aMatches[5]),'/').' /i',$this->aVars['sChans'])) {
$aChans = explode(' ',trim($this->aVars['sChans']));
$aChans[] = trim($aMatches[5]);
natcasesort($aChans);
$this->aVars['sChans'] = ' '.implode(' ',$aChans).' ';
$this->vSockPut('MODE '.trim($aMatches[5]));
$this->vSockPut('MODE '.trim($aMatches[5]).' +b');
$this->vSockPut('MODE '.trim($aMatches[5]).' +e');
$this->vSockPut('NAMES '.trim($aMatches[5]));
}
else
$this->vBufferAddLine('PRIVMSG '.$this->sMasterChan.' :I have just joined '.trim($aMatches[5]).' but it seems I had to be there for a while...');
}
else
{
// Someone else is
}
unset($a_aMatches,$aMatches);
return true;
}
function vParseKick($a_aMatches)
{ # /^:([^ ]+) KICK ([&#][^\cG, ]{0,199}) ([^ ]+)(?: :(.*))?$/
$aMatches = $a_aMatches;
$aUserMatches = array();
if(!preg_match('/^([^!]+)!([^@ ]+)@([^ ]+)$/',$aMatches[1],$aUserMatches))
$aUserMatches[1] = $aMatches[1];
if($aMatches[3] === $this->sNick)
{
# --- The bot is kicked
# - Displays it
if(isset($this->aVars['display']['selfkicks']) and $this->aVars['display']['selfkicks'] == true)
{
$this->vBufferAddLine($this->sSocketText,1,false);
}
# - Reports it
if($this->aVars['report']['selfkicks'] == true)
{
if(isset($aMatches[4]))
{
$this->vBufferAddLine('PRIVMSG '.$this->sMasterChan.' :'.$aUserMatches[1].' kicked me from '.trim($aMatches[2]).' with "'.trim($a_aMatches[4]).'" for reason.');
}
else
{
$this->vBufferAddLine('PRIVMSG '.$this->sMasterChan.' :'.$aUserMatches[1].' kicked me from '.trim($aMatches[2]));
}
}
# - Registers it
if(preg_match('/ '.preg_quote(trim($aUserMatches[2]),'/').' /i',$this->aVars['sChans']))
{
$this->aVars['sChans'] = preg_replace('/ '.preg_quote(trim($aMatches[2]),'/').' /i','',$this->aVars['sChans']);
}
else
{
$this->vBufferAddLine('PRIVMSG '.$this->sMasterChan.' :I have just been kicked from '.trim($aMatches[2]).' but I was not in this channel... $this->aVars[\'sChans\'] = '.$this->aVars['sChans']);
}
# - Rejoins the chan
if($this->aVars['kicks']['autorejoin'] == true)
{
$this->vBufferAddLine('JOIN '.trim($aMatches[2]));
}
}
else
{
// someone else is
if(isset($this->aVars['display']['kicks']) and $this->aVars['display']['kicks'] == true)
{
$this->vBufferAddLine($this->sSocketText,1,false);
}
}
unset($a_aMatches,$aMatches,$aUserMatches);
return true;
}
function vParseKill($a_aMatches)
{ # /^:([^ ]+) KILL ([^ ]+) :(.*)$/
$aMatches = $a_aMatches;
$aUserMatches = array();
if(!preg_match('/^([^!]+)!([^@ ]+)@([^ ]+)$/',$aMatches[1],$aUserMatches))
$aUserMatches[1] = $aMatches[1];
unset($a_aMatches,$aMatches,$aUserMatches);
return true;
}
function vParseMode($a_aMatches)
{ # /^:([^ ]+) MODE ([^ ]+) ([-+][A-Za-z]+(?:[-+]?[A-Za-z]+)*)(?: (.*))?$/
$aMatches = $a_aMatches;
$aUserMatches = array();
if(!preg_match('/^([^!]+)!([^@ ]+)@([^ ]+)$/',$aMatches[1],$aUserMatches))
$aUserMatches[1] = $aMatches[1];
if($aMatches[2] === $this->sNick)
{
$this->aVars['sBotModes'] .= $aMatches[3];
}
unset($a_aMatches,$aMatches,$aUserMatches);
return true;
}
function vParseNick($a_aMatches)
{ # /^:([^ ]+) NICK :(.*)$/
$aMatches = $a_aMatches;
$aUserMatches = array();
/*var_dump($aUserMatches);
var_dump($aMatches);*/
if(!preg_match('/^([^!]+)!([^@ ]+)@([^ ]+)$/',$aMatches[1],$aUserMatches)) {
$aUserMatches[1] = $aMatches[1];
}
//var_dump($aUserMatches);
//var_dump($aMatches);
//die();
if($aUserMatches[1] !== $aMatches[5]) {
// Syncing mask information
// Syncing Nick
if($aUserMatches[1] === $this->sNick) {
$this->sNick = trim($aMatches[5]);
// Checking current mask
if($this->aVars['sIdent'].'@'.$this->aVars['sHost'] !== $aUserMatches[2].'@'.$aUserMatches[3]) {
$this->vBufferAddLine('PRIVMSG '.$this->sMasterChan.' :My mask has changed from '.$this->aVars['sMask'].' to '.$this->sNick.'!'.$aUserMatches[2].'@'.$aUserMatches[3]);
}
// Syncing Ident
if($this->aVars['sIdent'] !== $aUserMatches[2]) {
$this->aVars['sIdent'] = $aUserMatches[2];
}
// Syncing Host
if($this->aVars['sHost'] !== $aUserMatches[3]) {
$this->aVars['sHost'] = $aUserMatches[3];
}
// Syncing Mask
$this->aVars['sMask'] = $this->sNick.'!'.$this->aVars['sIdent'].'@'.$this->aVars['sHost'];
}
}
if($aUserMatches[1] === $this->sNick)
{
$this->sNick = $aMatches[2];
}
unset($a_aMatches,$aMatches,$aUserMatches);
return true;
}
function vParseNotice($a_aMatches)
{ # /^:([^ ]+) NOTICE ([^ ]+) :(.*)$/
$aMatches = $a_aMatches;
$aSubMatches2=$aSubMatches = array();
$aUserMatches = array();
if(!preg_match('/^([^!]+)!([^@ ]+)@([^ ]+)$/',$aMatches[1],$aUserMatches))
$aUserMatches[1] = $aMatches[1];
if($aMatches[2] === $this->sNick)
{
// Display command
if($this->aVars['display']['snotices'] == true)
{
$this->vBufferAddLine($this->sSocketText,1,false);
}
// Report command
if($this->aVars['report']['snotices'] == true)
{
if($aUserMatches[1] == $this->sServerURI
or $aUserMatches[1] == $this->sServerName)
{
if(preg_match('/^\*\*\* Notice \-\- Received KILL message for ([^!]+)![^ ]+ from ([^ ]+) Path: ([^!]+)![^ ]+ \((?:(?:GHOST command)|(?:Nick [cC]ollision)|(?:Session limit exceeded))(.*)\)/',$aMatches[3],$aSubMatches))
return true;
elseif(preg_match('/^\*\*\* Notice \-\- Received KILL message for ([^!]+)![^ ]+ from ([^ ]+) Path: ([^!]+)![^ ]+ \((.*)\)/',$aMatches[3],$aSubMatches))
{ # utopia.ekynox.net NOTICE spioner :*** Notice -- Received KILL message for [email protected] from Keeper Path: services.ekynox.net!Keeper (Pub en pv ! Prochaine fois: exclusion définitive)
if(eregi(' #rules ',$this->aVars['sChans']) and ($aSubMatches[2] == 'Keeper' or $aSubMatches[2] == 'OperServ')) {
$this->vBufferAddLine('PRIVMSG #Rules :-Server Notice- '.$aSubMatches[1].' has been killed by '.$aSubMatches[2].'!'.$aSubMatches[3].' : '.$aSubMatches[4]);
} else {
$this->vBufferAddLine('PRIVMSG '.$this->sMasterChan.' :-Server Notice- '.$aSubMatches[1].' has been killed by '.$aSubMatches[2].'!'.$aSubMatches[3].' : '.$aSubMatches[4]);
}
}
elseif(preg_match('/^\*\*\* Notice \-\- ([^ ]+) \(([^ ]+)\) \[([^ ]+)\] (.*)/',$aMatches[3],$aSubMatches))
{ # utopia.ekynox.net NOTICE spioner :*** Notice -- wty[BedO] ([email protected]) [wty] is now a network administrator (N)
$this->vBufferAddLine('PRIVMSG '.$this->sMasterChan.' :-Server Notice- '.$aSubMatches[1].'!'.$aSubMatches[2].' ('.$aSubMatches[3].') '.$aSubMatches[4]);
}
else
/*if($aUserMatches[1]!=$this->sServerName)*/
$this->vBufferAddLine('PRIVMSG '.$this->sMasterChan.' :-'.$aUserMatches[1].'- '.trim($aMatches[3])."");
}
elseif(strtolower($aUserMatches[1])==strtolower('HostServ')) {
//print('second HostServ'.chr(10).'1');
// prendre en compte le message de HostSev pour la vhost
if(preg_match('!HostServ\!([^@]*)@(\S*) NOTICE '.$this->sNick.' :Votre vhost (\S*) est activée.!i',$aMatches[0],$aSubMatches2)) {
//enlever le gras
$aSubMatches2[3]=str_ireplace( array(chr(1),chr(2),chr(3),chr(15),chr(22),chr(31)), '', $aSubMatches2[3] );
// Syncing Ident
/*if($this->aVars['sIdent'] !== $aUserMatches[2]) {
$this->aVars['sIdent'] = $aUserMatches[2];
}*/
// Syncing Host
if($this->aVars['sHost'] !== $aSubMatches2[3]) {
$this->aVars['sHost'] = $aSubMatches2[3];
}
// Syncing Mask
$this->aVars['sMask'] = $this->sNick.'!'.$this->aVars['sIdent'].'@'.$this->aVars['sHost'];
}
elseif(false) {
//elseif(preg_match('!HostServ\!([^@]*)@(\S*) NOTICE '.$this->sNick.' :Votre vhost a été enlevée. Pour réactiver la protection de votre IP, tapez /mode '.$this->sNick.' +x!i',$aMatches[0],$aSubMatches2)) {
}
}
else
$this->vBufferAddLine('PRIVMSG '.$this->sMasterChan.' :-'.$aUserMatches[1].'- '.trim($aMatches[3])."");
}
}
unset($a_aMatches,$aMatches,$aUserMatches);
return true;
}
function vParsePart($a_aMatches)
{ # /^:(([^!]+)!([^@]+)@([^ ]+)) PART ([&#][^\cG, ]{0,199})(?: :(.*))?$/
$aMatches = $a_aMatches;