...
|
...
|
@@ -16,6 +16,7 @@ use threads;
|
16
|
16
|
use threads::shared;
|
17
|
17
|
use Thread::Queue;
|
18
|
18
|
|
|
19
|
+$ENV{PWD} = "" if not defined $ENV{PWD};
|
19
|
20
|
my $scriptconf = $ENV{PWD} . "/$0";
|
20
|
21
|
$scriptconf =~ s/\.pl$//;
|
21
|
22
|
$scriptconf =~ s/$/.conf/;
|
...
|
...
|
@@ -36,7 +37,7 @@ $SIG{INT}=\&terminate;
|
36
|
37
|
#my $next_sms :shared; # utilisé pour le top du procahin envoi
|
37
|
38
|
my $debugLevel = 0;
|
38
|
39
|
|
39
|
|
-my $maxs_status : shared = "";
|
|
40
|
+my $phone_status : shared = "";
|
40
|
41
|
|
41
|
42
|
my $from_gtalksms_queue = Thread::Queue->new;
|
42
|
43
|
my $to_gtalksms_queue = Thread::Queue->new;
|
...
|
...
|
@@ -245,7 +246,7 @@ sub control_sms_flow {
|
245
|
246
|
sub xmpp_send {
|
246
|
247
|
my $msg = shift;
|
247
|
248
|
$bot->MessageSend(
|
248
|
|
- to => $cfg::config{xmpp}->{maxs},
|
|
249
|
+ to => $cfg::config{xmpp}->{phoneBuddy},
|
249
|
250
|
from => $cfg::config{xmpp}->{userName} . "@" . $cfg::config{xmpp}->{hostName},
|
250
|
251
|
resource => $cfg::config{xmpp}->{resource},
|
251
|
252
|
type => 'chat',
|
...
|
...
|
@@ -423,7 +424,7 @@ sub from_gtalksms_parse {
|
423
|
424
|
},
|
424
|
425
|
'^\s*ping\s*$' => sub {
|
425
|
426
|
log_bot("envoi d'un pong à $request{phone} $request{phone_owner}");
|
426
|
|
- $to_gtalksms_queue->enqueue([$request{phone}, "pong ($maxs_status)"]);
|
|
427
|
+ $to_gtalksms_queue->enqueue([$request{phone}, "pong ($phone_status)"]);
|
427
|
428
|
},
|
428
|
429
|
);
|
429
|
430
|
|
...
|
...
|
@@ -449,11 +450,10 @@ $bot->SetMessageCallBacks(chat => \&messageCB);
|
449
|
450
|
#print "Logged in to $hostName:$portNumber...\n";
|
450
|
451
|
$bot->PresenceSend();
|
451
|
452
|
my $roster = $bot->Roster;
|
452
|
|
-$roster->add($cfg::config{xmpp}->{maxs});
|
|
453
|
+$roster->add($cfg::config{xmpp}->{phoneBuddy});
|
453
|
454
|
|
454
|
455
|
while(defined($bot->Process())) {
|
455
|
456
|
$bot->RosterGet();
|
456
|
|
- my $status = $roster->query($cfg::config{xmpp}->{maxs},'resources');
|
457
|
|
- $maxs_status = $status->{GTalkSMS}->{status} =~ s/^GTalkSMS - //r if $status;
|
|
457
|
+ my $status = $roster->query($cfg::config{xmpp}->{phoneBuddy},'resources');
|
|
458
|
+ $phone_status = $status->{GTalkSMS}->{status} =~ s/^GTalkSMS - //r if $status;
|
458
|
459
|
}
|
459
|
|
-print "fin";
|