summaryrefslogtreecommitdiff
path: root/classes/Channel.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-12-23 14:33:23 -0500
committerEvan Prodromou <evan@prodromou.name>2008-12-23 14:33:23 -0500
commit04ef1ba8eee7a9e2a565d7b4b747ef607665d562 (patch)
treed56ac33bd6bfb8f8641cc9f63b0f6af52b6edfb9 /classes/Channel.php
parenteb2f9c98ac115ce67e9a740b200c832153ffa05c (diff)
change function headers to K&R style
Another huge change, for PEAR code standards compliance. Function headers have to be in K&R style (opening brace on its own line), instead of having the opening brace on the same line as the function and parameters. So, a little perl magic found all the function definitions and move the opening brace to the next line (properly indented... usually). darcs-hash:20081223193323-84dde-a28e36ecc66672c783c2842d12fc11043c13ab28.gz
Diffstat (limited to 'classes/Channel.php')
-rw-r--r--classes/Channel.php78
1 files changed, 52 insertions, 26 deletions
diff --git a/classes/Channel.php b/classes/Channel.php
index ea3530406..02ece9c0f 100644
--- a/classes/Channel.php
+++ b/classes/Channel.php
@@ -21,23 +21,28 @@ if (!defined('LACONICA')) { exit(1); }
class Channel {
- function on($user) {
+ function on($user)
+ {
return false;
}
- function off($user) {
+ function off($user)
+ {
return false;
}
- function output($user, $text) {
+ function output($user, $text)
+ {
return false;
}
- function error($user, $text) {
+ function error($user, $text)
+ {
return false;
}
- function source() {
+ function source()
+ {
return null;
}
}
@@ -46,33 +51,40 @@ class XMPPChannel extends Channel {
var $conn = null;
- function source() {
+ function source()
+ {
return 'xmpp';
}
- function __construct($conn) {
+ function __construct($conn)
+ {
$this->conn = $conn;
}
- function on($user) {
+ function on($user)
+ {
return $this->set_notify($user, 1);
}
- function off($user) {
+ function off($user)
+ {
return $this->set_notify($user, 0);
}
- function output($user, $text) {
+ function output($user, $text)
+ {
$text = '['.common_config('site', 'name') . '] ' . $text;
jabber_send_message($user->jabber, $text);
}
- function error($user, $text) {
+ function error($user, $text)
+ {
$text = '['.common_config('site', 'name') . '] ' . $text;
jabber_send_message($user->jabber, $text);
}
- function set_notify(&$user, $notify) {
+ function set_notify(&$user, $notify)
+ {
$orig = clone($user);
$user->jabbernotify = $notify;
$result = $user->update($orig);
@@ -94,19 +106,23 @@ class XMPPChannel extends Channel {
class WebChannel extends Channel {
- function source() {
+ function source()
+ {
return 'web';
}
- function on($user) {
+ function on($user)
+ {
return false;
}
- function off($user) {
+ function off($user)
+ {
return false;
}
- function output($user, $text) {
+ function output($user, $text)
+ {
# XXX: buffer all output and send it at the end
# XXX: even better, redirect to appropriate page
# depending on what command was run
@@ -115,7 +131,8 @@ class WebChannel extends Channel {
common_show_footer();
}
- function error($user, $text) {
+ function error($user, $text)
+ {
common_user_error($text);
}
}
@@ -123,7 +140,8 @@ class WebChannel extends Channel {
class AjaxWebChannel extends WebChannel {
- function output($user, $text) {
+ function output($user, $text)
+ {
common_start_html('text/xml;charset=utf-8', true);
common_element_start('head');
common_element('title', null, _('Command results'));
@@ -134,7 +152,8 @@ class AjaxWebChannel extends WebChannel {
common_element_end('html');
}
- function error($user, $text) {
+ function error($user, $text)
+ {
common_start_html('text/xml;charset=utf-8', true);
common_element_start('head');
common_element('title', null, _('Ajax Error'));
@@ -151,23 +170,28 @@ class MailChannel extends Channel {
var $addr = null;
- function source() {
+ function source()
+ {
return 'mail';
}
- function __construct($addr=null) {
+ function __construct($addr=null)
+ {
$this->addr = $addr;
}
- function on($user) {
+ function on($user)
+ {
return $this->set_notify($user, 1);
}
- function off($user) {
+ function off($user)
+ {
return $this->set_notify($user, 0);
}
- function output($user, $text) {
+ function output($user, $text)
+ {
$headers['From'] = $user->incomingemail;
$headers['To'] = $this->addr;
@@ -177,7 +201,8 @@ class MailChannel extends Channel {
return mail_send(array($this->addr), $headers, $text);
}
- function error($user, $text) {
+ function error($user, $text)
+ {
$headers['From'] = $user->incomingemail;
$headers['To'] = $this->addr;
@@ -187,7 +212,8 @@ class MailChannel extends Channel {
return mail_send(array($this->addr), $headers, $text);
}
- function set_notify($user, $value) {
+ function set_notify($user, $value)
+ {
$orig = clone($user);
$user->smsnotify = $value;
$result = $user->update($orig);