]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
use smsemail stored value
authorEvan Prodromou <evan@prodromou.name>
Mon, 21 Jul 2008 04:23:02 +0000 (00:23 -0400)
committerEvan Prodromou <evan@prodromou.name>
Mon, 21 Jul 2008 04:23:02 +0000 (00:23 -0400)
darcs-hash:20080721042302-84dde-b077675affa13a761ba07b4c5ac4ff667cf00eb2.gz

lib/mail.php
maildaemon.php

index 3bcb0923d707fff70df2eed061f5cc9c155476d7..61570d2951945b143243f9cc87d5c1d450f67988 100644 (file)
@@ -159,7 +159,9 @@ function mail_new_incoming_address() {
 }
 
 function mail_broadcast_notice_sms($notice) {
+       
        $user = new User();
+       
        $user->smsnotify = 1;
        $user->whereAdd('EXISTS (select subscriber from subscriptions where ' .
                                        ' subscriber = user.id and subscribed = ' . $notice->profile_id);
@@ -175,7 +177,7 @@ function mail_broadcast_notice_sms($notice) {
 function mail_send_notice($notice, $user) {
        $profile = $user->getProfile();
        $name = $profile->getBestName();
-       $to = $name . ' <' . $sms_email . '>';
+       $to = $name . ' <' . $user->smsemail . '>';
        $other = $notice->getProfile();
 
        $headers = array();
index 59659b9909c1075c277843b026dd82eae012d194..4c03b151d1d3de7564aefd1454dfb6d11d1937f8 100755 (executable)
@@ -31,6 +31,9 @@ require_once(INSTALLDIR . '/lib/common.php');
 require_once(INSTALLDIR . '/lib/mail.php');
 require_once('Mail/mimeDecode.php');
 
+# FIXME: we use both Mail_mimeDecode and mailparse
+# Need to move everything to mailparse
+
 class MailerDaemon {
        
        function __construct() {
@@ -49,12 +52,16 @@ class MailerDaemon {
                }
                if (!$this->user_match_to($user, $to)) {
                        $this->error($from, _('Sorry, that is not your incoming email address.'));
+                       return false;
                }
                if (!$user->emailpost) {
+                       $this->error($from, _('Sorry, no incoming email allowed.'));
+                       return false;
                }
                $response = $this->handle_command($user, $msg);
                if ($response) {
                        $this->respond($from, $to, $response);
+                       return true;
                }
                $msg = $this->cleanup_msg($msg);
                $this->add_notice($user, $msg);
@@ -71,7 +78,12 @@ class MailerDaemon {
                        return NULL;
                }
                $from = $froms[0];
-               return User::staticGet('email', common_canonical_email($from['address']));
+               $addr = common_canonical_email($from['address']);
+               $user = User::staticGet('email', $addr);
+               if (!$user) {
+                       $user = User::staticGet('smsemail', $addr);
+               }
+               return $user;
        }
 
        function user_match_to($user, $to_hdr) {