aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-12-22 18:26:11 -0800
committerfriendica <info@friendica.com>2014-12-22 18:26:11 -0800
commitee89ff51244f6c5cd9a1d3b563c932dacbde89d9 (patch)
treef6c1c112d64940a61be1f21667c8abe2ff93a06e
parentf66df5e137313b2332c6b7e5eb517fb079327ad8 (diff)
downloadvolse-hubzilla-ee89ff51244f6c5cd9a1d3b563c932dacbde89d9.tar.gz
volse-hubzilla-ee89ff51244f6c5cd9a1d3b563c932dacbde89d9.tar.bz2
volse-hubzilla-ee89ff51244f6c5cd9a1d3b563c932dacbde89d9.zip
some improvements in api direct messages
-rw-r--r--include/api.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/include/api.php b/include/api.php
index 9954bb67e..51de412cf 100644
--- a/include/api.php
+++ b/include/api.php
@@ -1868,8 +1868,11 @@ require_once('include/items.php');
require_once("include/message.php");
- $r = q("SELECT `abook_id` FROM `abook` WHERE `abook_channel`=%d ",
- intval(api_user())
+ // in a decentralised world the screen name is ambiguous
+
+ $r = q("SELECT `abook_id` FROM `abook` left join xchan on abook_xchan = xchan_hash WHERE `abook_channel`=%d and xchan_addr like '%s'",
+ intval(api_user()),
+ dbesc($_POST['screen_name'] . '@%')
);
$recipient = api_get_user($a, $r[0]['abook_id']);
@@ -1951,10 +1954,12 @@ require_once('include/items.php');
foreach($r as $item) {
if ($box == "inbox" || $item['from-url'] != $profile_url){
$recipient = $user_info;
- $sender = api_get_user($a,$item['contact-id']);
+ // fixme to lookup recipient
+ $sender = api_get_user($a);
}
elseif ($box == "sentbox" || $item['from-url'] != $profile_url){
- $recipient = api_get_user($a,$item['contact-id']);
+ // fixme to lookup recipient
+ $recipient = api_get_user($a);
$sender = $user_info;
}