different message source per command channel
darcs-hash:20081004173427-5ed1f-2a818562f5aa7143b68a0eab3e9f26cd02926c0b.gz
This commit is contained in:
parent
6406d5f8ef
commit
4d30c534d9
|
@ -36,12 +36,20 @@ class Channel {
|
||||||
function error($user, $text) {
|
function error($user, $text) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function source() {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class XMPPChannel extends Channel {
|
class XMPPChannel extends Channel {
|
||||||
|
|
||||||
var $conn = NULL;
|
var $conn = NULL;
|
||||||
|
|
||||||
|
function source() {
|
||||||
|
return 'xmpp';
|
||||||
|
}
|
||||||
|
|
||||||
function __construct($conn) {
|
function __construct($conn) {
|
||||||
$this->conn = $conn;
|
$this->conn = $conn;
|
||||||
}
|
}
|
||||||
|
@ -85,6 +93,10 @@ class XMPPChannel extends Channel {
|
||||||
|
|
||||||
class WebChannel extends Channel {
|
class WebChannel extends Channel {
|
||||||
|
|
||||||
|
function source() {
|
||||||
|
return 'web';
|
||||||
|
}
|
||||||
|
|
||||||
function on($user) {
|
function on($user) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -110,6 +122,10 @@ class WebChannel extends Channel {
|
||||||
class MailChannel extends Channel {
|
class MailChannel extends Channel {
|
||||||
|
|
||||||
var $addr = NULL;
|
var $addr = NULL;
|
||||||
|
|
||||||
|
function source() {
|
||||||
|
return 'mail';
|
||||||
|
}
|
||||||
|
|
||||||
function __construct($addr=NULL) {
|
function __construct($addr=NULL) {
|
||||||
$this->addr = $addr;
|
$this->addr = $addr;
|
||||||
|
|
|
@ -202,7 +202,7 @@ class MessageCommand extends Command {
|
||||||
$channel->error($this->user, _('Don\'t send a message to yourself; just say it to yourself quietly instead.'));
|
$channel->error($this->user, _('Don\'t send a message to yourself; just say it to yourself quietly instead.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$message = Message::saveNew($this->user->id, $other->id, $body, 'xmpp');
|
$message = Message::saveNew($this->user->id, $other->id, $this->text, $channel->source());
|
||||||
if ($message) {
|
if ($message) {
|
||||||
$channel->output($this->user, sprintf(_('Direct message to %s sent'), $this->other));
|
$channel->output($this->user, sprintf(_('Direct message to %s sent'), $this->other));
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user