]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/util.php
lcase tname
[quix0rs-gnu-social.git] / lib / util.php
index ad3bc1038cefd4a5584a8fe61285dc4b6b09a7e9..acc907480685ff1cc2dcd9f2f71a98f32669468a 100644 (file)
@@ -865,16 +865,22 @@ 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 = ($tname) ? array_unique(array_merge($match[1], array(strtolower($tname)))) : $match[1];
        $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; $i<count($match[1]); $i++) {
-               $nickname = $match[1][$i];
+       for ($i=0; $i<count($names); $i++) {
+               $nickname = $names[$i];
                $recipient = common_relative_profile($sender, $nickname, $notice->created);
                if (!$recipient) {
                        continue;