]> git.mxchange.org Git - friendica.git/blobdiff - mod/message.php
allow crepair to change name - as long as it isn't blank
[friendica.git] / mod / message.php
index 60e6b38fceb723456e71856ef51f62cf1bb05b93..4b494e906f5be8df0f0e8747d6b7d41d9997f678 100644 (file)
@@ -27,6 +27,10 @@ function message_post(&$a) {
                        break;
                case -3:
                        notice( t('Message could not be sent.') . EOL );
+                       break;
+               case -4:
+                       notice( t('Message collection failure.') . EOL );
+                       break;
                default:
                        info( t('Message sent.') . EOL );
        }
@@ -103,12 +107,15 @@ function message_content(&$a) {
                                );
 
                                // remove diaspora conversation pointer
+                               // Actually if we do this, we can never receive another reply to that conversation,
+                               // as we will never again have the info we need to re-create it. 
+                               // We'll just have to orphan it. 
 
-                               if($convid) {
-                                       q("delete from conv where id = %d limit 1",
-                                               intval($convid)
-                                       );
-                               }
+                               //if($convid) {
+                               //      q("delete from conv where id = %d limit 1",
+                               //              intval($convid)
+                               //      );
+                               //}
 
                                if($r)
                                        info( t('Conversation removed.') . EOL );
@@ -213,11 +220,19 @@ function message_content(&$a) {
                );
                if(count($r)) { 
                        $contact_id = $r[0]['contact-id'];
+                       $convid = $r[0]['convid'];
+
+                       $sql_extra = sprintf(" and `mail`.`parent-uri` = '%s' ", dbesc($r[0]['parent-uri']));
+                       if($convid)
+                               $sql_extra = sprintf(" and ( `mail`.`parent-uri` = '%s' OR `mail`.`convid` = '%d' ) ",
+                                       dbesc($r[0]['parent-uri']),
+                                       intval($convid)
+                               );  
+
                        $messages = q("SELECT `mail`.*, `contact`.`name`, `contact`.`url`, `contact`.`thumb` 
                                FROM `mail` LEFT JOIN `contact` ON `mail`.`contact-id` = `contact`.`id` 
-                               WHERE `mail`.`uid` = %d AND `mail`.`parent-uri` = '%s' ORDER BY `mail`.`created` ASC",
-                               intval(local_user()),
-                               dbesc($r[0]['parent-uri'])
+                               WHERE `mail`.`uid` = %d $sql_extra ORDER BY `mail`.`created` ASC",
+                               intval(local_user())
                        );
                }
                if(! count($messages)) {