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.
32 class AimManager extends ImManager
36 * Initialize connection to server.
37 * @return boolean true on success
39 public function start($master)
41 if(parent::start($master))
50 public function getSockets()
54 return array($this->conn->myConnection);
61 * Process AIM events that have come in over the wire.
62 * @param resource $socket
64 public function handleInput($socket)
66 common_log(LOG_DEBUG, "Servicing the AIM queue.");
67 $this->stats('aim_process');
68 $this->conn->receive();
74 $this->conn=new Aim($this->plugin->user,$this->plugin->password,4);
75 $this->conn->registerHandler("IMIn",array($this,"handle_aim_message"));
76 $this->conn->myServer="toc.oscar.aol.com";
77 $this->conn->signon();
78 // @todo i18n FIXME: Update translator documentation, please.
79 // TRANS: No idea what the use case for this message is.
80 $this->conn->setProfile(_m('Send me a message to post a notice'),false);
85 function handle_aim_message($data)
87 $this->plugin->enqueueIncomingRaw($data);
91 function send_raw_message($data)
97 $this->conn->sflapSend($data[0],$data[1],$data[2],$data[3]);