aboutsummaryrefslogtreecommitdiffstats
path: root/include/api.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-12-22 18:05:34 -0800
committerfriendica <info@friendica.com>2014-12-22 18:05:34 -0800
commitf66df5e137313b2332c6b7e5eb517fb079327ad8 (patch)
treee9f0c20ad8f67d2a13017e4d9c66054546b6096e /include/api.php
parent63ae4b515022843cadb27940c13f2b72a8c5faa5 (diff)
downloadvolse-hubzilla-f66df5e137313b2332c6b7e5eb517fb079327ad8.tar.gz
volse-hubzilla-f66df5e137313b2332c6b7e5eb517fb079327ad8.tar.bz2
volse-hubzilla-f66df5e137313b2332c6b7e5eb517fb079327ad8.zip
direct messages in api have some issues, not properly ported from friendica originally. Here's a start.
I think at best they may return encrypted gibberish currently, but let's work through them one at a time.
Diffstat (limited to 'include/api.php')
-rw-r--r--include/api.php19
1 files changed, 10 insertions, 9 deletions
diff --git a/include/api.php b/include/api.php
index aeee95d3b..9954bb67e 100644
--- a/include/api.php
+++ b/include/api.php
@@ -1868,11 +1868,11 @@ require_once('include/items.php');
require_once("include/message.php");
- $r = q("SELECT `id` FROM `contact` WHERE `uid`=%d AND `nick`='%s'",
- intval(api_user()),
- dbesc($_POST['screen_name']));
+ $r = q("SELECT `abook_id` FROM `abook` WHERE `abook_channel`=%d ",
+ intval(api_user())
+ );
- $recipient = api_get_user($a, $r[0]['id']);
+ $recipient = api_get_user($a, $r[0]['abook_id']);
$replyto = '';
$sub = '';
if (x($_REQUEST,'replyto')) {
@@ -1925,10 +1925,11 @@ require_once('include/items.php');
if ($page<0) $page=0;
$start = $page*$count;
-
- $profile_url = $a->get_baseurl() . '/channel/' . $a->user['nickname'];
+ $channel = $a->get_channel();
+
+ $profile_url = $a->get_baseurl() . '/channel/' . $channel['channel_address'];
if ($box=="sentbox") {
- $sql_extra = "`from-url`='".dbesc( $profile_url )."'";
+ $sql_extra = "`from_xchan`='".dbesc( $channel['channel_hash'] )."'";
}
elseif ($box=="conversation") {
$sql_extra = "`parent_mid`='".dbesc( $_GET["uri"] ) ."'";
@@ -1937,10 +1938,10 @@ require_once('include/items.php');
$sql_extra = "true";
}
elseif ($box=="inbox") {
- $sql_extra = "`from-url`!='".dbesc( $profile_url )."'";
+ $sql_extra = "`from_xchan`!='".dbesc( $channel['channel_hash'] )."'";
}
- $r = q("SELECT * FROM `mail` WHERE uid=%d AND $sql_extra ORDER BY created DESC LIMIT %d OFFSET %d",
+ $r = q("SELECT * FROM `mail` WHERE channel_id = %d AND $sql_extra ORDER BY created DESC LIMIT %d OFFSET %d",
intval(api_user()),
intval($count), intval($start)
);