* @param string $obj
*/
public function addEventHandler($name, $pointer, $obj) {
- $this->eventhandlers[] = array($name, $pointer, $obj);
+ $this->eventhanders[] = array($name, $pointer, $obj);
}
/**
if($handler[2] === null) {
$handler[2] = $this;
}
+ $this->log->log("Calling {$handler[1]}", XMPPHP_Log::LEVEL_DEBUG);
$handler[2]->$handler[1]($payload);
}
}
function handle() {
- static $parts = array('message', 'presence',
- 'end_stream', 'session_start');
-
+ $this->conn->addEventHandler('message','handle_message',$this);
+ $this->conn->addEventHandler('presence','handle_presence',$this);
while(!$this->conn->isDisconnected()) {
- $payloads = $this->conn->processUntil($parts, 10);
-
- if ($payloads) {
- foreach($payloads as $event) {
- $pl = $event[1];
- switch($event[0]) {
- case 'message':
- $this->handle_message($pl);
- break;
- case 'presence':
- $this->handle_presence($pl);
- break;
- case 'session_start':
- $this->handle_session($pl);
- break;
- }
- }
- }
-
+ $this->conn->processTime(10);
$this->broadcast_queue();
$this->confirmation_queue();
}
}
- function handle_session($pl) {
- # XXX what to do here?
- return true;
- }
function get_user($from) {
$user = User::staticGet('jabber', jabber_normalize_jid($from));