summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-06-22 23:02:59 -0400
committerEvan Prodromou <evan@prodromou.name>2008-06-22 23:02:59 -0400
commit47bc5562f6da6fc226aa577a1fdc556ccad3bf62 (patch)
treeee2acf76c672f88e454c6708ebddf4b7e91b53a5
parentcf96f138f9de1e45a1e1a5527a77ffcae0761b86 (diff)
strip whitespace in xmppdaemon
darcs-hash:20080623030259-84dde-303fe8b38d237871861b5475c2b15b3d8605369b.gz
-rw-r--r--xmppdaemon.php30
1 files changed, 15 insertions, 15 deletions
diff --git a/xmppdaemon.php b/xmppdaemon.php
index f1a817e3f..2cf001754 100644
--- a/xmppdaemon.php
+++ b/xmppdaemon.php
@@ -24,7 +24,7 @@ require_once(INSTALLDIR . '/lib/common.php');
require_once('xmpp.php');
class XMPPDaemon {
-
+
function XMPPDaemon() {
foreach (array('server', 'port', 'user', 'password', 'resource') as $attr) {
$this->$attr = common_config('xmpp', $attr);
@@ -40,10 +40,10 @@ class XMPPDaemon {
$this->conn->connect();
return !$this->conn->disconnected;
}
-
+
function handle() {
while(!$this->conn->disconnected) {
- $payloads = $this->conn->processUntil(array('message', 'presence',
+ $payloads = $this->conn->processUntil(array('message', 'presence',
'end_stream', 'session_start'));
foreach($payloads as $event) {
$pl = $event[1];
@@ -95,16 +95,16 @@ class XMPPDaemon {
$result = $user->update($orig);
if (!$id) {
$last_error = &PEAR::getStaticProperty('DB_DataObject','lastError');
- $this->log(LOG_ERROR,
+ $this->log(LOG_ERROR,
'Could not set notify flag to ' . $notify .
- ' for user ' . common_log_objstring($user) .
+ ' for user ' . common_log_objstring($user) .
': ' . $last_error->message);
} else {
$this->log(LOG_INFO,
'User ' . $user->nickname . ' set notify flag to ' . $notify);
}
}
-
+
function add_notice(&$user, &$pl) {
$notice = new Notice();
$notice->profile_id = $user->id;
@@ -114,9 +114,9 @@ class XMPPDaemon {
$id = $notice->insert();
if (!$id) {
$last_error = &PEAR::getStaticProperty('DB_DataObject','lastError');
- $this->log(LOG_ERROR,
- 'Could not insert ' . common_log_objstring($notice) .
- ' for user ' . common_log_objstring($user) .
+ $this->log(LOG_ERROR,
+ 'Could not insert ' . common_log_objstring($notice) .
+ ' for user ' . common_log_objstring($user) .
': ' . $last_error->message);
return;
}
@@ -125,9 +125,9 @@ class XMPPDaemon {
$result = $notice->update($orig);
if (!$result) {
$last_error = &PEAR::getStaticProperty('DB_DataObject','lastError');
- $this->log(LOG_ERROR,
- 'Could not add URI to ' . common_log_objstring($notice) .
- ' for user ' . common_log_objstring($user) .
+ $this->log(LOG_ERROR,
+ 'Could not add URI to ' . common_log_objstring($notice) .
+ ' for user ' . common_log_objstring($user) .
': ' . $last_error->message);
return;
}
@@ -135,7 +135,7 @@ class XMPPDaemon {
$this->log(LOG_INFO,
'Added notice ' . $notice->id . ' from user ' . $user->nickname);
}
-
+
function handle_presence(&$pl) {
$user = User::staticGet('jabber', $pl['from']);
if (!$user) {
@@ -146,11 +146,11 @@ class XMPPDaemon {
$this->add_notice($user, $pl);
}
}
-
+
function handle_session(&$pl) {
$conn->presence($status="Send me a message to post a notice");
}
-
+
function log($level, $msg) {
common_log($level, 'XMPPDaemon('.$this->resource.'): '.$msg);
}