]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Mail.php
Use rawContent for Special Options to avoid a protected options() method
[friendica.git] / src / Model / Mail.php
index 307724a2629dfbde29053155bd8c979f41fa7a10..79a0b5f72bf22ea07b4437b02f5d03a417647d68 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -74,9 +74,7 @@ class Mail
                        return false;
                }
 
-               if ($msg['reply']) {
-                       $reply = DBA::selectFirst('mail', ['uri', 'uri-id'], ['parent-uri' => $msg['parent-uri'], 'reply' => false]);
-
+               if ($msg['reply'] && DBA::isResult($reply = DBA::selectFirst('mail', ['uri', 'uri-id'], ['parent-uri' => $msg['parent-uri'], 'reply' => false]))) {
                        $msg['thr-parent']    = $reply['uri'];
                        $msg['thr-parent-id'] = $reply['uri-id'];
                } else {
@@ -106,7 +104,7 @@ class Mail
                                'link'  => DI::baseUrl() . '/message/' . $msg['id'],
                        ];
 
-                       notification($notif_params);
+                       DI::notify()->createFromArray($notif_params);
 
                        Logger::info('Mail is processed, notification was sent.', ['id' => $msg['id'], 'uri' => $msg['uri']]);
                }
@@ -173,7 +171,7 @@ class Mail
                        $recip_host = substr($recip_host, 0, strpos($recip_host, '/'));
 
                        $recip_handle = (($contact['addr']) ? $contact['addr'] : $contact['nick'] . '@' . $recip_host);
-                       $sender_handle = $a->user['nickname'] . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3);
+                       $sender_handle = $a->getLoggedInUserNickname() . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3);
 
                        $conv_guid = System::createUUID();
                        $convuri = $recip_handle . ':' . $conv_guid;
@@ -189,7 +187,7 @@ class Mail
                }
 
                if (!$convid) {
-                       Logger::log('send message: conversation not found.');
+                       Logger::notice('send message: conversation not found.');
                        return -4;
                }
 
@@ -293,7 +291,7 @@ class Mail
                }
 
                if (!$convid) {
-                       Logger::log('send message: conversation not found.');
+                       Logger::notice('send message: conversation not found.');
                        return -4;
                }