From 275002d88a758d47e15b2f6d97873c243a500451 Mon Sep 17 00:00:00 2001 From: James Walker Date: Fri, 14 May 2010 16:41:29 -0400 Subject: allow hyphens in subdomains for webfinger addresses --- plugins/OStatus/OStatusPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index f183bc7ae..5167842ca 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -257,7 +257,7 @@ class OStatusPlugin extends Plugin $matches = array(); // Webfinger matches: @user@example.com - if (preg_match_all('!(?:^|\s+)@((?:\w+\.)*\w+@(?:\w+\.)*\w+(?:\w+\-\w+)*\.\w+)!', + if (preg_match_all('!(?:^|\s+)@((?:\w+\.)*\w+@(?:\w+\-?\w+\.)*\w+(?:\w+\-\w+)*\.\w+)!', $text, $wmatches, PREG_OFFSET_CAPTURE)) { -- cgit v1.2.3-54-g00ecf From 1999b836c0681c44171d849028fb2d5d0c3d01b8 Mon Sep 17 00:00:00 2001 From: James Walker Date: Fri, 14 May 2010 16:43:21 -0400 Subject: accept either salmon endpoint (until they're unified in the spec) --- plugins/OStatus/lib/discoveryhints.php | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/OStatus/lib/discoveryhints.php b/plugins/OStatus/lib/discoveryhints.php index 80cfbbf15..ca54a0f5f 100644 --- a/plugins/OStatus/lib/discoveryhints.php +++ b/plugins/OStatus/lib/discoveryhints.php @@ -30,6 +30,7 @@ class DiscoveryHints { case Discovery::PROFILEPAGE: $hints['profileurl'] = $link['href']; break; + case Salmon::NS_MENTIONS: case Salmon::NS_REPLIES: $hints['salmon'] = $link['href']; break; -- cgit v1.2.3-54-g00ecf From e36df2921260a8970c81f2d729b121816be188e5 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 17 May 2010 19:37:47 +0000 Subject: Patch from g0: fix for conversation links in Realtime updates Previously was using the reply-to URL, which didn't match with other displays. Now sends to the right conversation page. --- plugins/Realtime/README | 1 - plugins/Realtime/RealtimePlugin.php | 40 ++++++++++++++++++++++++++----------- plugins/Realtime/realtimeupdate.js | 4 ++-- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/plugins/Realtime/README b/plugins/Realtime/README index 524382696..99c79cfab 100644 --- a/plugins/Realtime/README +++ b/plugins/Realtime/README @@ -1,6 +1,5 @@ == TODO == * i18n -* Change in context URL to conversation (try not to construct the URL in JS) * Update mark behaviour (on notice send) * Pause, Send a notice ~ should not update counter * Pause ~ retain up to 50-100 most recent notices diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php index b559d80c6..fa1b5e3e1 100644 --- a/plugins/Realtime/RealtimePlugin.php +++ b/plugins/Realtime/RealtimePlugin.php @@ -250,14 +250,7 @@ class RealtimePlugin extends Plugin $arr['url'] = $notice->bestUrl(); $arr['html'] = htmlspecialchars($notice->rendered); $arr['source'] = htmlspecialchars($arr['source']); - - if (!empty($notice->reply_to)) { - $reply_to = Notice::staticGet('id', $notice->reply_to); - if (!empty($reply_to)) { - $arr['in_reply_to_status_url'] = $reply_to->bestUrl(); - } - $reply_to = null; - } + $arr['conversation_url'] = $this->getConversationUrl($notice); $profile = $notice->getProfile(); $arr['user']['profile_url'] = $profile->profileurl; @@ -272,10 +265,7 @@ class RealtimePlugin extends Plugin $arr['retweeted_status']['source'] = htmlspecialchars($original->source); $originalProfile = $original->getProfile(); $arr['retweeted_status']['user']['profile_url'] = $originalProfile->profileurl; - if (!empty($original->reply_to)) { - $originalReply = Notice::staticGet('id', $original->reply_to); - $arr['retweeted_status']['in_reply_to_status_url'] = $originalReply->bestUrl(); - } + $arr['retweeted_status']['conversation_url'] = $this->getConversationUrl($original); } $original = null; } @@ -303,6 +293,32 @@ class RealtimePlugin extends Plugin return $tags; } + function getConversationUrl($notice) + { + $convurl = null; + + if ($notice->hasConversation()) { + $conv = Conversation::staticGet( + 'id', + $notice->conversation + ); + $convurl = $conv->uri; + + if(empty($convurl)) { + $msg = sprintf( + "Couldn't find Conversation ID %d to make 'in context'" + . "link for Notice ID %d", + $notice->conversation, + $notice->id + ); + + common_log(LOG_WARNING, $msg); + } + } + + return $convurl; + } + function _getScripts() { return array('plugins/Realtime/realtimeupdate.js'); diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index 2e5851ae5..25dc12d58 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -149,8 +149,8 @@ RealtimeUpdate = { "from "+ ""+source+""+ // may have a link ""; - if (data['in_reply_to_status_id']) { - ni = ni+" in context"; + if (data['conversation_url']) { + ni = ni+" in context"; } if (repeat) { -- cgit v1.2.3-54-g00ecf From b77878f46729d48588fb32b8a54ae13f3752c558 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 17 May 2010 19:47:44 +0000 Subject: Include notice fragment on 'in context' links in Realtime plugin family. --- plugins/Realtime/RealtimePlugin.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php index fa1b5e3e1..352afcf78 100644 --- a/plugins/Realtime/RealtimePlugin.php +++ b/plugins/Realtime/RealtimePlugin.php @@ -313,6 +313,8 @@ class RealtimePlugin extends Plugin ); common_log(LOG_WARNING, $msg); + } else { + $convurl .= '#notice-' . $notice->id; } } -- cgit v1.2.3-54-g00ecf