public $server = null;
public $port = 5222;
public $user = 'update';
- public $resource = null;
+ public $resource = 'gnusocial';
public $encryption = true;
public $password = null;
public $host = null; // only set if != server
function getDisplayName(){
// TRANS: Plugin display name.
- return _m('XMPP/Jabber/GTalk');
+ return _m('XMPP/Jabber');
}
/**
case 'XMPPHP_XMPP':
require_once $dir . '/extlib/XMPPHP/XMPP.php';
return false;
- case 'Sharing_XMPP':
- case 'Queued_XMPP':
- require_once $dir . '/'.$cls.'.php';
- return false;
- case 'XmppManager':
- require_once $dir . '/'.strtolower($cls).'.php';
- return false;
- default:
- return true;
}
+
+ return parent::onAutoload($cls);
}
function onStartImDaemonIoManagers(&$classes)
$this->queuedConnection()->message($screenname, $body, 'chat');
}
- function sendNotice($screenname, $notice)
+ function sendNotice($screenname, Notice $notice)
{
$msg = $this->formatNotice($notice);
$entry = $this->format_entry($notice);
*
* @return string Extra information (Atom, HTML, addresses) in string format
*/
- function format_entry($notice)
+ protected function format_entry(Notice $notice)
{
$profile = $notice->getProfile();
$xs = new XMLStringer();
$xs->elementStart('html', array('xmlns' => 'http://jabber.org/protocol/xhtml-im'));
$xs->elementStart('body', array('xmlns' => 'http://www.w3.org/1999/xhtml'));
- $xs->element('a', array('href' => $profile->profileurl),
- $profile->nickname);
- $xs->text(": ");
+ $xs->element('a', array('href' => $profile->profileurl), $profile->nickname);
+ try {
+ $parent = $notice->getParent();
+ $orig_profile = $parent->getProfile();
+ $orig_profurl = $orig_profile->getUrl();
+ $xs->text(" => ");
+ $xs->element('a', array('href' => $orig_profurl), $orig_profile->nickname);
+ $xs->text(": ");
+ } catch (InvalidUrlException $e) {
+ $xs->text(sprintf(' => %s', $orig_profile->nickname));
+ } catch (Exception $e) {
+ $xs->text(": ");
+ }
if (!empty($notice->rendered)) {
+ $notice->rendered = str_replace("\t", "", $notice->rendered);
$xs->raw($notice->rendered);
} else {
$xs->raw(common_render_content($notice->content, $notice));
array('id' => $notice->conversation)).'#notice-'.$notice->id),
// TRANS: Link description to notice in conversation.
// TRANS: %s is a notice ID.
- sprintf(_m('[%s]'),$notice->id));
+ sprintf(_m('[%u]'),$notice->id));
$xs->elementEnd('body');
$xs->elementEnd('html');
* Build a queue-proxied XMPP interface object. Any outgoing messages
* will be run back through us for enqueing rather than sent directly.
*
- * @return Queued_XMPP
+ * @return QueuedXMPP
* @throws Exception if server settings are invalid.
*/
function queuedConnection(){
throw new Exception(_m('You must specify a password in the configuration.'));
}
- return new Queued_XMPP($this, $this->host ?
+ return new QueuedXMPP($this, $this->host ?
$this->host :
$this->server,
$this->port,
*
* @return boolean hook return
*/
- function onGetValidDaemons(&$daemons)
+ function onGetValidDaemons(array &$daemons)
{
if( isset($this->server) &&
isset($this->port) &&
}
- function onPluginVersion(&$versions)
+ function onPluginVersion(array &$versions)
{
$versions[] = array('name' => 'XMPP',
- 'version' => STATUSNET_VERSION,
+ 'version' => GNUSOCIAL_VERSION,
'author' => 'Craig Andrews, Evan Prodromou',
'homepage' => 'http://status.net/wiki/Plugin:XMPP',
'rawdescription' =>