]> git.mxchange.org Git - friendica.git/commitdiff
maintain backward compatibility with old PMs
authorfriendica <info@friendica.com>
Mon, 5 Dec 2011 22:06:41 +0000 (14:06 -0800)
committerfriendica <info@friendica.com>
Mon, 5 Dec 2011 22:06:41 +0000 (14:06 -0800)
boot.php
include/message.php

index 13546d6bb0a6e43c001084d4f059f3bfdeae72fe..875d4a69b40ab5c48e2f07f955f6f586469ecbca 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -9,7 +9,7 @@ require_once('include/nav.php');
 require_once('include/cache.php');
 
 define ( 'FRIENDICA_PLATFORM',     'Friendica');
-define ( 'FRIENDICA_VERSION',      '2.3.1185' );
+define ( 'FRIENDICA_VERSION',      '2.3.1186' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.22'    );
 define ( 'DB_UPDATE_VERSION',      1109      );
 
index 05157cc83a724b634db0d5d564d621c9c6656df5..baf1bb2d5c6f4c6158130a3d95cd10e1558ec23a 100644 (file)
@@ -27,9 +27,27 @@ function send_message($recipient=0, $body='', $subject='', $replyto=''){
        $hash = random_string();
        $uri = 'urn:X-dfrn:' . $a->get_baseurl() . ':' . local_user() . ':' . $hash ;
 
-       if(! strlen($replyto)) {
+       $convid = 0;
+
+       // look for any existing conversation structure
+
+       if(strlen($replyto)) {
+               $r = q("select convid from mail where uid = %d and uri = '%s' limit 1",
+                       intval(local_user()),
+                       dbesc($replyto)
+               );
+               if(count($r))
+                       $convid = $r[0]['convid'];
+       }               
+
+       if(! strlen($replyto))
                $replyto = $uri;
 
+
+       if(! $convid) {
+
+               // create a new conversation
+
                $conv_guid = get_guid();
 
                $recip_host = substr($contact[0]['url'],strpos($contact[0]['url'],'://')+3);
@@ -52,14 +70,6 @@ function send_message($recipient=0, $body='', $subject='', $replyto=''){
                if(count($r))
                        $convid = $r[0]['id'];
        }
-       else {
-               $r = q("select convid from mail where uid = %d and uri = '%s' limit 1",
-                       intval(local_user()),
-                       dbesc($replyto)
-               );
-               if(count($r))
-                       $convid = $r[0]['convid'];
-       }               
 
        if(! $convid) {
                logger('send message: conversation not found.');