From: Evan Prodromou Date: Sat, 4 Oct 2008 17:34:27 +0000 (-0400) Subject: different message source per command channel X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4d30c534d97a4bceddb8e426cb850196df7713b2;p=quix0rs-gnu-social.git different message source per command channel darcs-hash:20081004173427-5ed1f-2a818562f5aa7143b68a0eab3e9f26cd02926c0b.gz --- diff --git a/classes/Channel.php b/classes/Channel.php index ee0e57c89a..a0dc715389 100644 --- a/classes/Channel.php +++ b/classes/Channel.php @@ -36,12 +36,20 @@ class Channel { function error($user, $text) { return false; } + + function source() { + return NULL; + } } class XMPPChannel extends Channel { var $conn = NULL; + function source() { + return 'xmpp'; + } + function __construct($conn) { $this->conn = $conn; } @@ -85,6 +93,10 @@ class XMPPChannel extends Channel { class WebChannel extends Channel { + function source() { + return 'web'; + } + function on($user) { return false; } @@ -110,6 +122,10 @@ class WebChannel extends Channel { class MailChannel extends Channel { var $addr = NULL; + + function source() { + return 'mail'; + } function __construct($addr=NULL) { $this->addr = $addr; diff --git a/classes/Command.php b/classes/Command.php index e049ff8cef..3a64e2fdaf 100644 --- a/classes/Command.php +++ b/classes/Command.php @@ -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.')); 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) { $channel->output($this->user, sprintf(_('Direct message to %s sent'), $this->other)); } else {