assorted fixes to api direct messages
This commit is contained in:
parent
8757789213
commit
185ce2da69
@ -267,12 +267,17 @@ require_once('include/items.php');
|
||||
* Returns user info array.
|
||||
*/
|
||||
|
||||
function api_get_user(&$a, $contact_id = null){
|
||||
function api_get_user(&$a, $contact_id = null, $contact_xchan = null){
|
||||
global $called_api;
|
||||
$user = null;
|
||||
$extra_query = "";
|
||||
|
||||
|
||||
if(! is_null($contact_xchan)) {
|
||||
$user = local_channel();
|
||||
$extra_query = " and abook_xchan = '" . dbesc($contact_xchan) . "' ";
|
||||
}
|
||||
else {
|
||||
if(!is_null($contact_id)){
|
||||
$user=$contact_id;
|
||||
$extra_query = " AND abook_id = %d ";
|
||||
@ -302,6 +307,7 @@ require_once('include/items.php');
|
||||
$extra_query .= " AND abook_channel = ".intval(api_user());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $user) {
|
||||
if (api_user() === false) {
|
||||
@ -2021,15 +2027,13 @@ require_once('include/items.php');
|
||||
$ret = Array();
|
||||
if($r) {
|
||||
foreach($r as $item) {
|
||||
if ($box == "inbox" || $item['from-url'] != $profile_url){
|
||||
$recipient = $user_info;
|
||||
// fixme to lookup recipient
|
||||
$sender = api_get_user($a);
|
||||
}
|
||||
elseif ($box == "sentbox" || $item['from-url'] != $profile_url){
|
||||
// fixme to lookup recipient
|
||||
$recipient = api_get_user($a);
|
||||
if ($item['from_xchan'] == $channel['channel_hash']) {
|
||||
$sender = $user_info;
|
||||
$recipient = api_get_user($a, null, $item['to_xchan']);
|
||||
}
|
||||
else {
|
||||
$sender = api_get_user($a, null, $item['from_xchan']);
|
||||
$recipient = $user_info;
|
||||
}
|
||||
|
||||
$ret[]=api_format_message($item, $recipient, $sender);
|
||||
|
Reference in New Issue
Block a user