]> git.mxchange.org Git - friendica.git/commitdiff
modified api message reply to set title to conversion title, when replying.
authorSebastian Egbers <sebastian@egbers.info>
Mon, 25 Jun 2012 13:53:56 +0000 (15:53 +0200)
committerSebastian Egbers <sebastian@egbers.info>
Mon, 25 Jun 2012 13:53:56 +0000 (15:53 +0200)
include/api.php

index 1db9d020be2b5ba417fc5e28696f6316eb65b82e..2da183f01925eb1651d8fe46c41a7ff28d6d7a1e 100644 (file)
 
                $sender = api_get_user($a);
                
+               require_once("include/message.php");
+
                $r = q("SELECT `id` FROM `contact` WHERE `uid`=%d AND `nick`='%s'",
                                intval(local_user()),
                                dbesc($_POST['screen_name']));
-               
-               require_once("include/message.php");
 
                $recipient = api_get_user($a, $r[0]['id']);                     
                $replyto = '';
+               $sub     = '';
                if (x($_REQUEST,'replyto')) {
-                       $r = q('SELECT `uri` FROM `mail` WHERE `uid`=%d AND `id`=%d',
+                       $r = q('SELECT `uri`, `title` FROM `mail` WHERE `uid`=%d AND `id`=%d',
                                        intval(local_user()),
                                        intval($_REQUEST['replyto']));
                        $replyto = $r[0]['uri'];
-               }
-
-               if (x($_REQUEST,'title')) {
-                       $sub = $_REQUEST['title'];
+                       $sub     = $r[0]['title'];
                }
                else {
-                       $sub = ((strlen($_POST['text'])>10)?substr($_POST['text'],0,10)."...":$_POST['text']);
+                       if (x($_REQUEST,'title')) {
+                               $sub = $_REQUEST['title'];
+                       }
+                       else {
+                               $sub = ((strlen($_POST['text'])>10)?substr($_POST['text'],0,10)."...":$_POST['text']);
+                       }
                }
+
                $id = send_message($recipient['id'], $_POST['text'], $sub, $replyto);
 
                if ($id>-1) {