her'

 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
<?php
require_once('./XMPPHP/XMPP.php');
require_once('./WebIcqLite.php');
$conn = new XMPPHP_XMPP('conference.lan', '5222', 'loca', 'l0c4', 'lo', 'jabber.lan', $printlog=false, $loglevel=XMPPHP_Log::LEVEL_INFO);
$icq = new WebIcqLite();
$icq->connect('589751983', 'ololol') or die($icq->error);
#$icq->send_message('330382', 'soobsh') or die($icq->error);
if($icq->is_connected()){
$gate = true;
while($gate){
print_r($icq->read_message());
echo "\r\n\r\n\r\n";
}
}
try {
$conn->connect();
while($conn){
$payloads = $conn->processUntil(array('session_start', 'message'));
foreach($payloads as $event){
$pl = $event[1];
switch($event[0]){
case 'session_start':
$conn->presence($status = 'Cheese!');
break;
case 'message':
#echo "ot: ".$pl['from']."\r\ntext: ".$pl['body']."\r\n";
# soobsheniya ot admin
if(preg_match('/^!say ([0-9]+?) (.+?)$/s ', $pl['body'], $matches)){
$icq->send_message($matches[1], iconv('utf-8', 'cp1251', $matches[2]));
$conn->message($pl['from'], 'soobshenie '.$matches[1].' yshlo');
}
if(preg_match('/^aryvano@gmail.com\/(.+?)$/', $pl['from'])){
if($pl['body'] == '!test') $conn->message($pl['from'], 'vse ok boss');
#if($pl['body'] == '!quit') $conn->disconnect();
if($pl['body'] == '!olo'){
if($gate){
$icq->send_message('330382', rand(0, 1000));
$conn->message($pl['from'], 'soobchenie yshlo');
} else {
$conn->message($pl['from'], 'icq ne podlychena');
}
}
}
break;
}
}
}
} catch(XMPPHP_Exception $e) {
die($e->getMessage());
}
?>