From 225208e634da9cd600038308d26129368d8f4b60 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 15 Jul 2008 22:58:42 -0400 Subject: [PATCH] add alternative reply format darcs-hash:20080716025842-84dde-b4100ca8cec891d34d14c1bc66912cbd3762bdfb.gz --- lib/util.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/util.php b/lib/util.php index ad3bc1038c..5d6ef7681a 100644 --- a/lib/util.php +++ b/lib/util.php @@ -595,7 +595,7 @@ function common_render_content($text, $notice) { $id = $notice->profile_id; $r = preg_replace('@https?://[^)\]>\s]+@', '\0', $r); $r = preg_replace('/(^|\s+)@([a-z0-9]{1,64})/e', "'\\1@'.common_at_link($id, '\\2')", $r); - $r = preg_replace('/^T ([A-Z0-9]{1,64}) /e', "'T '.common_at_link($id, '\\1').' '", $r); + $r = preg_replace('/^T ([A-Z0-9]{1,64}) /e', "'T '.common_at_link($id, strtolower('\\1')).' '", $r); # XXX: # tags # XXX: machine tags return $r; @@ -865,16 +865,25 @@ function common_redirect($url, $code=307) { } function common_save_replies($notice) { + # Alternative reply format + if (preg_match('/^T ([A-Z0-9]{1,64}) /', $notice->content, $match)) { + $tname = $match[1]; + } # extract all @messages $cnt = preg_match_all('/(?:^|\s)@([a-z0-9]{1,64})/', $notice->content, $match); - if (!$cnt) { + if (!$cnt && !$tname) { return true; } + # XXX: is there another way to make an array copy? + $names = array_merge($match[1], array()); + if ($tname) { + array_unshift($tname, $names); + } $sender = Profile::staticGet($notice->profile_id); # store replied only for first @ (what user/notice what the reply directed, # we assume first @ is it) - for ($i=0; $icreated); if (!$recipient) { continue;