diff options
-rwxr-xr-x | localmarkdown2sms | 12 | ||||
-rwxr-xr-x | localsendsms | 10 |
2 files changed, 11 insertions, 11 deletions
diff --git a/localmarkdown2sms b/localmarkdown2sms index 5afdd89..0ba1622 100755 --- a/localmarkdown2sms +++ b/localmarkdown2sms @@ -204,7 +204,7 @@ sub transliterate { } sub sendmsg { - my ($phone, $desc, $msg) = @_; + my ($from, $to, $desc, $msg) = @_; unless ($dummy) { my $ua = LWP::UserAgent->new(agent => "localmarkdown2sms"); @@ -212,9 +212,9 @@ sub sendmsg { my $url = $sms_url . '?' . $sms_usertag . '=' . uri_escape($sms_user) . '&password=' . uri_escape($sms_pw) - . '&to=' . uri_escape($phone); + . '&to=' . uri_escape($to); $url .= '&api_id=' . uri_escape($sms_api) if ($sms_api); - $url .= '&from=' . uri_escape($sms_phone) if ($sms_phone); + $url .= '&from=' . uri_escape($from) if ($from); $url .= '&smsc=' . uri_escape($sms_smsc) if ($sms_smsc); $url .= '&concatenation=true' if ($sms_concatenation); $url .= '&concat=' . uri_escape($sms_concat) if ($sms_concat); @@ -232,7 +232,7 @@ sub sendmsg { } DEBUG "Done $desc"; } else { - print STDERR "\n --> $phone: $desc\n"; + print STDERR "\n [$from --> $to: $desc]\n\n"; print STDERR $msg . "\n"; } } @@ -242,7 +242,7 @@ my $num_children = $#{ $reply{$key} } + 1; # How many children we'll create if (0 == $num_children) { my $err_en = "Sorry, I don't recognize \"$key\" as a keyword: Please check spelling and try again."; my $err_it = "Spiacente, non riconosco \"$key\" come parola chiave.\nControlla che sia corretta e riprova."; - &sendmsg($phone, "fallback message", $err_it . "\n" . $err_en); + &sendmsg($sms_phone, $phone, "fallback message", $err_it . "\n" . $err_en); exit; } @@ -255,7 +255,7 @@ if ($debug) { } for my $num ( 0 .. $num_children - 1 ) { sleep($delay{$key}[$num]) unless ($nosleep); - &sendmsg($phone, "reply #$num [" . $delay{$key}[$num] . "s]", $reply{$key}[$num]); + &sendmsg($sms_phone, $phone, "reply #$num [" . $delay{$key}[$num] . "s]", $reply{$key}[$num]); } 1; diff --git a/localsendsms b/localsendsms index 8e33cd2..ad4b749 100755 --- a/localsendsms +++ b/localsendsms @@ -69,7 +69,7 @@ sub transliterate { } sub sendmsg { - my ($phone, $desc, $msg) = @_; + my ($from, $to, $desc, $msg) = @_; unless ($dummy) { my $ua = LWP::UserAgent->new(agent => "localsendsms"); @@ -77,9 +77,9 @@ sub sendmsg { my $url = $sms_url . '?' . $sms_usertag . '=' . uri_escape($sms_user) . '&password=' . uri_escape($sms_pw) - . '&to=' . uri_escape($phone); + . '&to=' . uri_escape($to); $url .= '&api_id=' . uri_escape($sms_api) if ($sms_api); - $url .= '&from=' . uri_escape($sms_phone) if ($sms_phone); + $url .= '&from=' . uri_escape($from) if ($from); $url .= '&smsc=' . uri_escape($sms_smsc) if ($sms_smsc); $url .= '&concatenation=true' if ($sms_concatenation); $url .= '&concat=' . uri_escape($sms_concat) if ($sms_concat); @@ -97,11 +97,11 @@ sub sendmsg { } DEBUG "Done $desc"; } else { - print STDERR "\n --> $phone: $desc\n"; + print STDERR "\n [$from --> $to: $desc]\n\n"; print STDERR $msg . "\n"; } } -&sendmsg($phone, "message", "@ARGV"); +&sendmsg($sms_phone, $phone, "message", "@ARGV"); 1; |