| 1 | <? |
|---|
| 2 | /* |
|---|
| 3 | * licqweb. Copyright 2005, Philip Nelson |
|---|
| 4 | * |
|---|
| 5 | * This file is part of licqweb. |
|---|
| 6 | * |
|---|
| 7 | * licqweb is free software; you can redistribute it and/or modify |
|---|
| 8 | * it under the terms of the GNU General Public License as published by |
|---|
| 9 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 10 | * (at your option) any later version. |
|---|
| 11 | * |
|---|
| 12 | * licqweb is distributed in the hope that it will be useful, |
|---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | * GNU General Public License for more details. |
|---|
| 16 | * |
|---|
| 17 | * You should have received a copy of the GNU General Public License |
|---|
| 18 | * along with licqweb; if not, write to the Free Software |
|---|
| 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| 20 | */ |
|---|
| 21 | require_once('config.php'); |
|---|
| 22 | require_once('rms.php'); |
|---|
| 23 | |
|---|
| 24 | session_start(); |
|---|
| 25 | $uin = $_SESSION['uin']; |
|---|
| 26 | $password = $_SESSION['password']; |
|---|
| 27 | session_write_close(); |
|---|
| 28 | |
|---|
| 29 | if (!rmsLogin("$uin\r\n", "$password\r\n")) { |
|---|
| 30 | $message = "<response><method>loginFailed</method><result>Couldn't log in to rms plugin!</result></response>"; |
|---|
| 31 | push($message); |
|---|
| 32 | exit; |
|---|
| 33 | } |
|---|
| 34 | |
|---|
| 35 | $statusMap = array( |
|---|
| 36 | "Online" => "online", |
|---|
| 37 | "Away" => "away", |
|---|
| 38 | "Occupied" => "occupied", |
|---|
| 39 | "NotAvailable" => "na", |
|---|
| 40 | "DoNotDisturb" => "dnd", |
|---|
| 41 | "Offline" => "offline" |
|---|
| 42 | ); |
|---|
| 43 | |
|---|
| 44 | $ret = rmsChangeStatus($_POST['pp'], $statusMap[$_POST['status']]); |
|---|
| 45 | |
|---|
| 46 | header('Content-Type: text/xml'); |
|---|
| 47 | echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"; |
|---|
| 48 | echo " |
|---|
| 49 | <response> |
|---|
| 50 | <method>ackChangeStatus</method> |
|---|
| 51 | <result>$ret</result> |
|---|
| 52 | </response> |
|---|
| 53 | "; |
|---|
| 54 | |
|---|
| 55 | socket_shutdown($sock); |
|---|
| 56 | socket_close($sock); |
|---|
| 57 | ?> |
|---|