summaryrefslogtreecommitdiff
path: root/plugins/Comet/CometPlugin.php
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@controlyourself.ca>2009-05-05 22:54:46 +0000
committerSarven Capadisli <csarven@controlyourself.ca>2009-05-05 22:54:46 +0000
commitaaeed091d23a0d2f969578dd95ead8df4ea7eb11 (patch)
treef6693acebba5373eb1f0b2c75dfa5f969e0ddb5b /plugins/Comet/CometPlugin.php
parent51377258a1660fee02a3f92436dc40ee40f2a88d (diff)
parent0bbf56f6dc1acb448594f21334f610229c4c76bd (diff)
Merge branch '0.7.x' into 0.8.x
Diffstat (limited to 'plugins/Comet/CometPlugin.php')
-rw-r--r--plugins/Comet/CometPlugin.php33
1 files changed, 29 insertions, 4 deletions
diff --git a/plugins/Comet/CometPlugin.php b/plugins/Comet/CometPlugin.php
index 2e0bb40a4..45251c66f 100644
--- a/plugins/Comet/CometPlugin.php
+++ b/plugins/Comet/CometPlugin.php
@@ -45,9 +45,11 @@ class CometPlugin extends Plugin
{
var $server = null;
- function __construct($server=null)
+ function __construct($server=null, $username=null, $password=null)
{
- $this->server = $server;
+ $this->server = $server;
+ $this->username = $username;
+ $this->password = $password;
parent::__construct();
}
@@ -82,8 +84,22 @@ class CometPlugin extends Plugin
' ');
}
+ $user = common_current_user();
+
+ if (!empty($user->id)) {
+ $user_id = $user->id;
+ } else {
+ $user_id = 0;
+ }
+
+ $replyurl = common_local_url('newnotice');
+ $favorurl = common_local_url('favor');
+ // FIXME: need to find a better way to pass this pattern in
+ $deleteurl = common_local_url('deletenotice',
+ array('notice' => '0000000000'));
+
$action->elementStart('script', array('type' => 'text/javascript'));
- $action->raw("$(document).ready(function() { updater.init(\"$this->server\", \"$timeline\");});");
+ $action->raw("$(document).ready(function() { updater.init(\"$this->server\", \"$timeline\", $user_id, \"$replyurl\", \"$favorurl\", \"$deleteurl\"); });");
$action->elementEnd('script');
return true;
@@ -117,7 +133,7 @@ class CometPlugin extends Plugin
$json = $this->noticeAsJson($notice);
// Bayeux? Comet? Huh? These terms confuse me
- $bay = new Bayeux($this->server);
+ $bay = new Bayeux($this->server, $this->user, $this->password);
foreach ($timelines as $timeline) {
$this->log(LOG_INFO, "Posting notice $notice->id to '$timeline'.");
@@ -144,6 +160,15 @@ class CometPlugin extends Plugin
$arr = $act->twitter_status_array($notice, true);
$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;
+ }
$profile = $notice->getProfile();
$arr['user']['profile_url'] = $profile->profileurl;