X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fchannel.php;h=e83960ac5402cc41fbe1867ca2bceea31c7280f6;hb=44477a70639e6b6fff85e57afd1a7952bde993a7;hp=38c1d4d67f56f37025f8c5bc4115dda5cd3614b9;hpb=bafa1ab1c532118e2230df50ed18a1b4573692b7;p=quix0rs-gnu-social.git diff --git a/lib/channel.php b/lib/channel.php index 38c1d4d67f..e83960ac54 100644 --- a/lib/channel.php +++ b/lib/channel.php @@ -1,7 +1,7 @@ . */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } class Channel { @@ -47,60 +47,22 @@ class Channel } } -class XMPPChannel extends Channel +class CLIChannel extends Channel { - - var $conn = null; - function source() { - return 'xmpp'; - } - - function __construct($conn) - { - $this->conn = $conn; - } - - function on($user) - { - return $this->set_notify($user, 1); - } - - function off($user) - { - return $this->set_notify($user, 0); + return 'cli'; } function output($user, $text) { - $text = '['.common_config('site', 'name') . '] ' . $text; - jabber_send_message($user->jabber, $text); + $site = common_config('site', 'name'); + print "[{$user->nickname}@{$site}] $text\n"; } function error($user, $text) { - $text = '['.common_config('site', 'name') . '] ' . $text; - jabber_send_message($user->jabber, $text); - } - - function set_notify(&$user, $notify) - { - $orig = clone($user); - $user->jabbernotify = $notify; - $result = $user->update($orig); - if (!$result) { - $last_error = &PEAR::getStaticProperty('DB_DataObject','lastError'); - common_log(LOG_ERR, - 'Could not set notify flag to ' . $notify . - ' for user ' . common_log_objstring($user) . - ': ' . $last_error->message); - return false; - } else { - common_log(LOG_INFO, - 'User ' . $user->nickname . ' set notify flag to ' . $notify); - return true; - } + $this->output($user, $text); } }