]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/channel.php
Merge branch 'testing' into moveaccount
[quix0rs-gnu-social.git] / lib / channel.php
index f1e2055466ae2f7f83fe66b39b8ca9b94f2caaac..fbc2e8697c803e7c9aa6ebd373560c869436893d 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+ * StatusNet - the distributed open-source microblogging tool
+ * Copyright (C) 2008, 2009, StatusNet, Inc.
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
 
+/**
+ * @todo Needs documentation.
+ */
 class Channel
 {
     function on($user)
@@ -47,9 +50,27 @@ class Channel
     }
 }
 
-class XMPPChannel extends Channel
+class CLIChannel extends Channel
 {
+    function source()
+    {
+        return 'cli';
+    }
 
+    function output($user, $text)
+    {
+        $site = common_config('site', 'name');
+        print "[{$user->nickname}@{$site}] $text\n";
+    }
+
+    function error($user, $text)
+    {
+        $this->output($user, $text);
+    }
+}
+
+class XMPPChannel extends Channel
+{
     var $conn = null;
 
     function source()
@@ -135,6 +156,7 @@ class WebChannel extends Channel
         #      depending on what command was run
         $this->out->startHTML();
         $this->out->elementStart('head');
+        // TRANS: Title for command results.
         $this->out->element('title', null, _('Command results'));
         $this->out->elementEnd('head');
         $this->out->elementStart('body');
@@ -155,6 +177,7 @@ class AjaxWebChannel extends WebChannel
     {
         $this->out->startHTML('text/xml;charset=utf-8');
         $this->out->elementStart('head');
+        // TRANS: Title for command results.
         $this->out->element('title', null, _('Command results'));
         $this->out->elementEnd('head');
         $this->out->elementStart('body');
@@ -167,7 +190,8 @@ class AjaxWebChannel extends WebChannel
     {
         $this->out->startHTML('text/xml;charset=utf-8');
         $this->out->elementStart('head');
-        $this->out->element('title', null, _('Ajax Error'));
+        // TRANS: Title for command results.
+        $this->out->element('title', null, _('AJAX error'));
         $this->out->elementEnd('head');
         $this->out->elementStart('body');
         $this->out->element('p', array('id' => 'error'), $text);
@@ -178,7 +202,6 @@ class AjaxWebChannel extends WebChannel
 
 class MailChannel extends Channel
 {
-
     var $addr = null;
 
     function source()
@@ -203,10 +226,10 @@ class MailChannel extends Channel
 
     function output($user, $text)
     {
-
         $headers['From'] = $user->incomingemail;
         $headers['To'] = $this->addr;
 
+        // TRANS: E-mail subject when a command has completed.
         $headers['Subject'] = _('Command complete');
 
         return mail_send(array($this->addr), $headers, $text);
@@ -214,10 +237,10 @@ class MailChannel extends Channel
 
     function error($user, $text)
     {
-
         $headers['From'] = $user->incomingemail;
         $headers['To'] = $this->addr;
 
+        // TRANS: E-mail subject when a command has failed.
         $headers['Subject'] = _('Command failed');
 
         return mail_send(array($this->addr), $headers, $text);