From: Luke Fitzgerald Date: Wed, 16 Jun 2010 17:05:29 +0000 (+0100) Subject: Add callback for status changes X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6dbf0ab1fe355032bfa4c3858b6b75079a2d5dcf;p=quix0rs-gnu-social.git Add callback for status changes --- diff --git a/plugins/Msn/extlib/phpmsnclass/msn.class.php b/plugins/Msn/extlib/phpmsnclass/msn.class.php index 6dc1c49826..05edf86d8b 100644 --- a/plugins/Msn/extlib/phpmsnclass/msn.class.php +++ b/plugins/Msn/extlib/phpmsnclass/msn.class.php @@ -900,6 +900,14 @@ class MSN { $this->addContact($email, 1, $email, true); $this->connectToSBSession('Passive', $sb_ip, $sb_port, $email, array('sid' => $sid, 'ticket' => $ticket)); break; + + case 'NLN': + // NS: <<< NLN {status} {email} {networkid} {nickname} {clientid} {dpobj} + // NS: <<< NLN NLN darkip@inflatablegoldfish.com 1 Luke 2685403136 0 + @list(/* NLN */, $email, $network, $nickname, /* clientid */, /* dbobj */) = @explode(' ', $data); + $this->callHandler('StatusChange', array('screenname' => $email, 'network' => $network, 'nickname' => $nickname)); + break; + case 'OUT': // force logout from NS // NS: <<< OUT xxx @@ -3092,7 +3100,7 @@ X-OIM-Sequence-Num: 1 * * Handler List * IMIn, Pong, ConnectFailed, Reconnect, - * AddedToList, RemovedFromList + * AddedToList, RemovedFromList, StatusChange * * @param string $event Event name * @param string $handler User function to call diff --git a/plugins/Msn/msnmanager.php b/plugins/Msn/msnmanager.php index 9826608ea6..8322cde32d 100644 --- a/plugins/Msn/msnmanager.php +++ b/plugins/Msn/msnmanager.php @@ -93,7 +93,7 @@ class MsnManager extends ImManager { * * @return void */ - function connect() { + public function connect() { if (!$this->conn) { $this->conn = new MSN( array( @@ -161,7 +161,7 @@ class MsnManager extends ImManager { * @param void $data Not used (there to keep callback happy) * @return void */ - function handle_connect_failed($data) { + private function handle_connect_failed($data) { common_log(LOG_NOTICE, 'MSN connect failed, retrying'); } @@ -171,9 +171,18 @@ class MsnManager extends ImManager { * @param void $data Not used (there to keep callback happy) * @return void */ - function handle_reconnect($data) { + private function handle_reconnect($data) { common_log(LOG_NOTICE, 'MSN reconnecting'); } + + /** + * Called by callback when contact changes status + * + * @param array $data Data + */ + private function handle_status_change($data) { + + } /** * Send a message using the daemon @@ -181,7 +190,7 @@ class MsnManager extends ImManager { * @param $data Message * @return boolean true on success */ - function send_raw_message($data) { + public function send_raw_message($data) { $this->connect(); if (!$this->conn) { return false;