aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Weller <igitt@max-weller.de>2012-06-23 19:29:58 +0200
committerMax Weller <igitt@max-weller.de>2012-06-23 19:29:58 +0200
commitf45c881815d1e3ab2cc494f47a836f18044aae5b (patch)
tree1f831fefb704128ab840553be8659bd7aeef82cc
parentd8a376666c0f56baf96f88b74fdcb9575df9ec73 (diff)
downloadvolse-hubzilla-f45c881815d1e3ab2cc494f47a836f18044aae5b.tar.gz
volse-hubzilla-f45c881815d1e3ab2cc494f47a836f18044aae5b.tar.bz2
volse-hubzilla-f45c881815d1e3ab2cc494f47a836f18044aae5b.zip
changes on api_direct_messages_box to allow to retrieve conversations and all messages
-rw-r--r--include/api.php18
1 files changed, 5 insertions, 13 deletions
diff --git a/include/api.php b/include/api.php
index e0e759b61..e22bcc9e9 100644
--- a/include/api.php
+++ b/include/api.php
@@ -1564,15 +1564,15 @@
$start = $page*$count;
-
+ $profile_url = $a->get_baseurl() . '/profile/' . $a->user['nickname'];
if ($box=="sentbox") {
- $sql_extra = "`from-url`='".dbesc( $a->get_baseurl() . '/profile/' . $a->user['nickname'] )."'";
+ $sql_extra = "`from-url`='".dbesc( $profile_url )."'";
} elseif ($box=="conversation") {
$sql_extra = "`parent-uri`='".dbesc( $_GET["uri"] ) ."'";
} elseif ($box=="all") {
$sql_extra = "true";
} elseif ($box=="inbox") {
- $sql_extra = "`from-url`!='".dbesc( $a->get_baseurl() . '/profile/' . $a->user['nickname'] )."'";
+ $sql_extra = "`from-url`!='".dbesc( $profile_url )."'";
}
$r = q("SELECT * FROM `mail` WHERE uid=%d AND $sql_extra ORDER BY created DESC LIMIT %d,%d",
@@ -1582,15 +1582,12 @@
$ret = Array();
foreach($r as $item){
- switch ($box){
- case "inbox":
+ if ($box == "inbox" || $item['from-url'] != $profile_url){
$recipient = $user_info;
$sender = api_get_user($a,$item['contact-id']);
- break;
- case "sentbox":
+ } elseif ($box == "sentbox" || $item['from-url'] != $profile_url){
$recipient = api_get_user($a,$item['contact-id']);
$sender = $user_info;
- break;
}
$ret[]=Array(
@@ -1603,8 +1600,6 @@
'recipient_id'=> $recipient['id'],
'recipient_screen_name'=> $recipient['screen_name'],
'recipient'=> $recipient,
-
-
);
//don't send title to regular StatusNET requests to avoid confusing these apps
if (isset($_GET["getText"])) {
@@ -1615,9 +1610,6 @@
} else {
$ret['text'] = $item['title']."\n".html2plain(bbcode($item['body']), 0);
}
-
-
-
}