summaryrefslogtreecommitdiff
path: root/plugins/Comet/CometPlugin.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-05-01 11:19:20 -0700
committerEvan Prodromou <evan@controlyourself.ca>2009-05-01 11:19:20 -0700
commitec8dd014e3d10a05b57549cf4f0e82a630ef6303 (patch)
tree2fe1c6cabf7a38e01a7e5bc8605eb39b57b4f175 /plugins/Comet/CometPlugin.php
parentaee641ee1e311fb0af0f9f6d75ca7fae2c7d8477 (diff)
parentb12e72ae312488caf7cb1e1a396eb05dd38326a9 (diff)
Merge branch '0.7.x' into querybyid
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;