diff options
author | Evan Prodromou <evan@prodromou.name> | 2008-08-04 15:07:49 -0400 |
---|---|---|
committer | Evan Prodromou <evan@prodromou.name> | 2008-08-04 15:07:49 -0400 |
commit | 6d5a61de9f9c7a6e577b9e81907768b8be57b930 (patch) | |
tree | 377c0521ebe93e9231d242eac9cd66c73fd6c92f | |
parent | f0f6d0e60349f28e71b8fc1fa995a9daca326c12 (diff) |
add commands to turn sms notification on and off
darcs-hash:20080804190749-84dde-0b6d007e3da6d468e7dbe1c859f2c5c753726e8a.gz
-rwxr-xr-x | maildaemon.php | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/maildaemon.php b/maildaemon.php index 5be62efb8..0a96bfeb4 100755 --- a/maildaemon.php +++ b/maildaemon.php @@ -98,9 +98,30 @@ class MailerDaemon { } function handle_command($user, $msg) { - return false; + $cmd = trim(strtolower($msg)); + switch ($cmd) { + case 'off': + $this->set_notify($user, false); + return true; + case 'on': + $this->set_notify($user, true); + return true; + default: + return false; + } } + function set_notify($user, $value) { + $orig = clone($user); + $user->smsnotify = $value; + $result = $user->update($orig); + if (!$result) { + common_log_db_error($user, 'UPDATE', __FILE__); + return false; + } + return true; + } + function respond($from, $to, $response) { $headers['From'] = $to; |