summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-07-15 15:31:42 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-07-15 15:31:42 -0400
commit1ae7357340b588dd16597527ee038b39e31489d9 (patch)
treee59317cb530c02d4c4cdec96017b6a0cc89c5494
parent3da84feabd10c93211d1dc8aadb82d4faeaee79b (diff)
build channel strings in CometPlugin
-rw-r--r--plugins/Comet/CometPlugin.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/plugins/Comet/CometPlugin.php b/plugins/Comet/CometPlugin.php
index 3e4f493b6..1735d2b15 100644
--- a/plugins/Comet/CometPlugin.php
+++ b/plugins/Comet/CometPlugin.php
@@ -48,13 +48,15 @@ class CometPlugin extends RealtimePlugin
public $server = null;
public $username = null;
public $password = null;
+ public $prefix = null;
protected $bay = null;
- function __construct($server=null, $username=null, $password=null)
+ function __construct($server=null, $username=null, $password=null, $prefix=null)
{
$this->server = $server;
$this->username = $username;
$this->password = $password;
+ $this->prefix = $prefix;
parent::__construct();
}
@@ -74,11 +76,13 @@ class CometPlugin extends RealtimePlugin
function _updateInitialize($timeline, $user_id)
{
- return "CometUpdate.init(\"$this->server\", \"$timeline\", $user_id, \"$this->replyurl\", \"$this->favorurl\", \"$this->deleteurl\");";
+ $script = parent::_updateInitialize($timeline, $user_id);
+ return $script." CometUpdate.init(\"$this->server\", \"$timeline\", $user_id, \"$this->replyurl\", \"$this->favorurl\", \"$this->deleteurl\");";
}
function _connect()
{
+ require_once INSTALLDIR.'/plugins/Comet/bayeux.class.inc.php';
// Bayeux? Comet? Huh? These terms confuse me
$this->bay = new Bayeux($this->server, $this->user, $this->password);
}
@@ -92,4 +96,12 @@ class CometPlugin extends RealtimePlugin
{
unset($this->bay);
}
+
+ function _pathToChannel($path)
+ {
+ if (!empty($this->prefix)) {
+ array_unshift($path, $this->prefix);
+ }
+ return '/' . implode('/', $path);
+ }
}