diff options
author | Christian Hesse <mail@eworm.de> | 2019-07-25 13:17:51 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2019-07-25 14:24:18 +0200 |
commit | 1c4dfeaa4aef8121377821184c0ed798605e6282 (patch) | |
tree | ca63467f80abf31b5f0655224fe98e1e162eaf40 /sms-forward | |
parent | cc9b2620e7674ce86660d2214be16cfa17bb0f15 (diff) |
sms-forward: get values into arrays
Diffstat (limited to 'sms-forward')
-rw-r--r-- | sms-forward | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/sms-forward b/sms-forward index 1c50552..6a3cf70 100644 --- a/sms-forward +++ b/sms-forward @@ -14,8 +14,7 @@ :error "Warning: See log for details."; } -:local Allowed [ / tool sms get allowed-number ]; -:local Secret [ / tool sms get secret ]; +:local Settings [ / tool sms get ]; # forward SMS in a loop :while ([ / tool sms inbox print count-only ] > 0) do={ @@ -24,16 +23,14 @@ :local Delete [ :toarray "" ]; :foreach Sms in=[ / tool sms inbox find where phone=$Phone ] do={ - :local Message [ / tool sms inbox get $Sms message ]; - :local TimeStamp [ / tool sms inbox get $Sms timestamp ]; - :local Type [ / tool sms inbox get $Sms type ]; + :local SmsVal [ / tool sms inbox get $Sms ]; - :if ($Phone = $Allowed && $Message~("^:cmd " . $Secret . " script ")) do={ + :if ($Phone = $Settings->"allowed" && ($SmsVal->"message")~("^:cmd " . $Settings->"secret" . " script ")) do={ :log debug "Removing SMS, which started a script."; / tool sms inbox remove $Sms; } else={ - :set Messages ($Messages . "\n\nOn " . $TimeStamp . \ - " type " . $Type . ":\n" . $Message); + :set Messages ($Messages . "\n\nOn " . $SmsVal->"timestamp" . \ + " type " . $SmsVal->"type" . ":\n" . $SmsVal->"message"); :set Delete ($Delete, $Sms); } } |