From 2c1ba66016924f6efb0832ede6041cd2d7d67a19 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 23 Jan 2013 01:26:38 -0800 Subject: make @tags half-ass work --- mod/item.php | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'mod/item.php') diff --git a/mod/item.php b/mod/item.php index f42de79f0..93f859982 100644 --- a/mod/item.php +++ b/mod/item.php @@ -889,29 +889,34 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) { } } if($tagcid) { //if there was an id + + //select contact with that id from the logged in user's contact list - $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", + $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash + WHERE abook_id = %d AND abook_channel = %d LIMIT 1", intval($tagcid), intval($profile_uid) ); + } else { $newname = str_replace('_',' ',$name); //select someone from this user's contacts by name - $r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1", + $r = q("SELECT * FROM abook left join xchan on abook_xchan - xchan_hash + WHERE xchan_name = '%s' AND abook_channel = %d LIMIT 1", dbesc($newname), intval($profile_uid) ); if(! $r) { //select someone by attag or nick and the name passed in - $r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1", +/* $r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1", dbesc($name), dbesc($name), intval($profile_uid) ); - } +*/ } } /* } elseif(strstr($name,'_') || strstr($name,' ')) { //no id //get the real name @@ -931,16 +936,8 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) { }*/ //$r is set, if someone could be selected if(count($r)) { - $profile = $r[0]['url']; - //set newname to nick, find alias - if($r[0]['network'] === 'stat') { - $newname = $r[0]['nick']; - $stat = true; - if($r[0]['alias']) - $alias = $r[0]['alias']; - } - else - $newname = $r[0]['name']; + $profile = $r[0]['xchan_url']; + $newname = $r[0]['xchan_name']; //add person's id to $inform if(strlen($inform)) $inform .= ','; -- cgit v1.2.3