3 * StatusNet - the distributed open-source microblogging tool
4 * Copyright (C) 2008, 2009, StatusNet, Inc.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
23 * AIM background connection manager for AIM-using queue handlers,
24 * allowing them to send outgoing messages on the right connection.
26 * Input is handled during socket select loop, keepalive pings during idle.
27 * Any incoming messages will be handled.
29 * In a multi-site queuedaemon.php run, one connection will be instantiated
30 * for each site being handled by the current process that has XMPP enabled.
33 class MsnManager extends ImManager
38 * Initialize connection to server.
39 * @return boolean true on success
41 public function start($master)
43 if(parent::start($master))
52 public function getSockets()
56 return $this->conn->getSockets();
63 * Process AIM events that have come in over the wire.
64 * @param resource $socket
66 public function handleInput($socket)
68 common_log(LOG_DEBUG, "Servicing the MSN queue.");
69 $this->stats('msn_process');
70 $this->conn->receive();
76 $this->conn=new MSN(array(
77 'user' => $this->plugin->user,
78 'password' => $this->plugin->password,
79 'alias' => $this->plugin->nickname,
80 'psm' => 'Send me a message to post a notice',
84 $this->conn->registerHandler("IMIn", array($this, 'handle_msn_message'));
85 $this->conn->signon();
90 function handle_msn_message($data)
92 $this->plugin->enqueue_incoming_raw($data);
96 function send_raw_message($data)
102 $this->conn->sflapSend($data[0],$data[1],$data[2],$data[3]);