From 2c1ba66016924f6efb0832ede6041cd2d7d67a19 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 23 Jan 2013 01:26:38 -0800 Subject: [PATCH] make @tags half-ass work --- mod/acl.php | 4 ++-- mod/item.php | 25 +++++++++++-------------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/mod/acl.php b/mod/acl.php index 0290edca8..2f1866f85 100644 --- a/mod/acl.php +++ b/mod/acl.php @@ -201,8 +201,8 @@ function acl_init(&$a){ "name" => $g['name'], "id" => $g['id'], "xid" => $g['hash'], - "link" => $g['url'], - "nick" => $g['nick'], + "link" => $g['nick'], + "nick" => substr($g['nick'],0,strpos($g['nick'],'@')) ); } } 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 .= ',';