From 1c6f301d8faf2e6a5939e47c7a83655615bfc762 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 5 Dec 2012 16:44:07 -0800 Subject: y'all got mail --- include/text.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index ee95646b7..b97b21981 100644 --- a/include/text.php +++ b/include/text.php @@ -1722,6 +1722,27 @@ function xchan_query(&$items) { } +function xchan_mail_query(&$item) { + $arr = array(); + $chans = null; + if($item) { + if($item['from_xchan'] && (! in_array($item['from_xchan'],$arr))) + $arr[] = "'" . dbesc($item['from_xchan']) . "'"; + if($item['to_xchan'] && (! in_array($item['to_xchan'],$arr))) + $arr[] = "'" . dbesc($item['to_xchan']) . "'"; + } + + if(count($arr)) { + $chans = q("select xchan.*,hubloc.* from xchan left join hubloc on hubloc_hash = xchan_hash + where xchan_hash in (" . implode(',', $arr) . ") and ( hubloc_flags & " . intval(HUBLOC_FLAGS_PRIMARY) . " )"); + } + if($chans) { + $item['from'] = find_xchan_in_array($item['from_xchan'],$chans); + $item['to'] = find_xchan_in_array($item['to_xchan'],$chans); + } +} + + function find_xchan_in_array($xchan,$arr) { if(count($arr)) { foreach($arr as $x) { -- cgit v1.2.3