...
|
...
|
@@ -189,8 +189,14 @@ sub massive_send_sms {
|
189
|
189
|
my $request = shift;
|
190
|
190
|
my @results = sql_request("SELECT * FROM __tables__ WHERE phone = '$request->{phone}' AND table_id = '$request->{table}'");
|
191
|
191
|
if (scalar(@results) == 1) {
|
|
192
|
+ if ($to_gtalksms_queue->pending() > 0) {
|
|
193
|
+ $to_gtalksms_queue->insert(0, [$request->{phone}, "un envoi massif est déjà en cours, lancé par " . $cfg::config{last_sender} . ", reste " . $to_gtalksms_queue->pending() . ", annulation"]);
|
|
194
|
+ return;
|
|
195
|
+ }
|
|
196
|
+ $cfg::config{last_sender} = $request->{phone_owner};
|
192
|
197
|
my @results = sql_request("SELECT * FROM $request->{table}");
|
193
|
|
- my $start_msg = "envoi de " . scalar(@results) . " SMS (30 max par demi-heure)";
|
|
198
|
+ my $qty = scalar(@results);
|
|
199
|
+ my $start_msg = "envoi de " . $qty . " SMS (fin prévue entre ". strftime("%H:%M", localtime(time() + $qty * 60)) . " et " . strftime("%H:%M", localtime(time() + $qty * 90)) . ")";
|
194
|
200
|
$to_gtalksms_queue->enqueue([$request->{phone}, $start_msg]);
|
195
|
201
|
foreach my $contact (@results) {
|
196
|
202
|
$contact->{phone} =~ s/[\s\.]//g;
|
...
|
...
|
@@ -470,8 +476,12 @@ sub from_gtalksms_parse {
|
470
|
476
|
&insert(\%request);
|
471
|
477
|
},
|
472
|
478
|
$cfg::user{"ping"} => sub {
|
|
479
|
+ my $envoi_en_cours = "";
|
|
480
|
+ if ($to_gtalksms_queue->pending() > 0) {
|
|
481
|
+ $envoi_en_cours = "\nenvoi en cours de traitement " . $cfg::config{last_sender};
|
|
482
|
+ }
|
473
|
483
|
log_bot("envoi d'un pong à $request{phone} $request{phone_owner}");
|
474
|
|
- $to_gtalksms_queue->enqueue([$request{phone}, "pong ($phone_status)"]);
|
|
484
|
+ $to_gtalksms_queue->insert(0, [$request{phone}, "pong ($phone_status)" . $envoi_en_cours]);
|
475
|
485
|
},
|
476
|
486
|
$cfg::user{"test intro pour action"} => sub {
|
477
|
487
|
my $intro = $1;
|