forked from GNUsocial/gnu-social
optionally add a username/password on server side for Comet
This commit is contained in:
parent
5affe093ab
commit
b12e72ae31
@ -45,9 +45,11 @@ class CometPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
var $server = null;
|
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();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
@ -131,7 +133,7 @@ class CometPlugin extends Plugin
|
|||||||
$json = $this->noticeAsJson($notice);
|
$json = $this->noticeAsJson($notice);
|
||||||
|
|
||||||
// Bayeux? Comet? Huh? These terms confuse me
|
// 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) {
|
foreach ($timelines as $timeline) {
|
||||||
$this->log(LOG_INFO, "Posting notice $notice->id to '$timeline'.");
|
$this->log(LOG_INFO, "Posting notice $notice->id to '$timeline'.");
|
||||||
|
@ -26,9 +26,12 @@ class Bayeux
|
|||||||
private $oCurl = '';
|
private $oCurl = '';
|
||||||
private $nNextId = 0;
|
private $nNextId = 0;
|
||||||
|
|
||||||
|
private $sUser = '';
|
||||||
|
private $sPassword = '';
|
||||||
|
|
||||||
public $sUrl = '';
|
public $sUrl = '';
|
||||||
|
|
||||||
function __construct($sUrl)
|
function __construct($sUrl, $sUser='', $sPassword='')
|
||||||
{
|
{
|
||||||
$this->sUrl = $sUrl;
|
$this->sUrl = $sUrl;
|
||||||
|
|
||||||
@ -43,6 +46,10 @@ class Bayeux
|
|||||||
curl_setopt($this->oCurl, CURLOPT_POST, 1);
|
curl_setopt($this->oCurl, CURLOPT_POST, 1);
|
||||||
curl_setopt($this->oCurl, CURLOPT_RETURNTRANSFER,1);
|
curl_setopt($this->oCurl, CURLOPT_RETURNTRANSFER,1);
|
||||||
|
|
||||||
|
if (!is_null($sUser) && mb_strlen($sUser) > 0) {
|
||||||
|
curl_setopt($this->oCurl, CURLOPT_USERPWD,"$sUser:$sPassword");
|
||||||
|
}
|
||||||
|
|
||||||
$this->handShake();
|
$this->handShake();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user