+ if ($conv_id) {
+ /* if $conv_id is set, get unknow contacts in thread */
+ /* but first get know contacts url to filter them out */
+ function _contact_link($i){ return dbesc($i['link']); }
+ $known_contacts = array_map(_contact_link, $contacts);
+ $unknow_contacts=array();
+ $r = q("select
+ `author-avatar`,`author-name`,`author-link`
+ from item where parent=%d
+ and (
+ `author-name` LIKE '%%%s%%' OR
+ `author-link` LIKE '%%%s%%'
+ ) and
+ `author-link` NOT IN ('%s')
+ GROUP BY `author-link`
+ ORDER BY `author-name` ASC
+ ",
+ intval($conv_id),
+ dbesc($search),
+ dbesc($search),
+ implode("','", $known_contacts)
+ );
+ if (is_array($r) && count($r)){
+ foreach($r as $row) {
+ // nickname..
+ $up = parse_url($row['author-link']);
+ $nick = explode("/",$up['path']);
+ $nick = $nick[count($nick)-1];
+ $nick .= "@".$up['host'];
+ // /nickname
+ $unknow_contacts[] = array(
+ "type" => "c",
+ "photo" => proxy_url($row['author-avatar']),
+ "name" => $row['author-name'],
+ "id" => '',
+ "network" => "unknown",
+ "link" => $row['author-link'],
+ "nick" => $nick,
+ "forum" => false
+ );
+ }
+ }
+
+ $items = array_merge($items, $unknow_contacts);
+ $tot += count($unknow_contacts);
+ }