summaryrefslogtreecommitdiff
path: root/localmarkdown2sms
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2010-07-09 16:48:16 +0200
committerJonas Smedegaard <dr@jones.dk>2010-07-09 16:48:16 +0200
commit7fd4dd5d86074afc6acb0375e2d20e28584c2327 (patch)
tree32e8cb895204a4caee4d49a6914ab27487f53e7f /localmarkdown2sms
parentf4597a538a41f86188fb7f093f05648d939c127c (diff)
Improve sendsmg() in localmarkdown2sms and localsendsms to use $from and $to (not us $sms_phone and reuse $phone).
Diffstat (limited to 'localmarkdown2sms')
-rwxr-xr-xlocalmarkdown2sms12
1 files changed, 6 insertions, 6 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;