1<?php
2/**
3 * lock.class.php
4 *
5 * Copyright © 2006 Stephane Gully <stephane.gully@gmail.com>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library 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 GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, 51 Franklin St, Fifth Floor,
20 * Boston, MA  02110-1301  USA
21 */
22require_once dirname(__FILE__)."/../pfci18n.class.php";
23require_once dirname(__FILE__)."/../pfcuserconfig.class.php";
24require_once dirname(__FILE__)."/../pfcproxycommand.class.php";
25
26/**
27 * pfcProxyCommand_lock
28 * if the chat is locked, redirect users to a given url
29 * @author Stephane Gully <stephane.gully@gmail.com>
30 */
31class pfcProxyCommand_lock extends pfcProxyCommand
32{
33  function run(&$xml_reponse, $p)
34  {
35    $clientid    = $p["clientid"];
36    $param       = $p["param"];
37    $sender      = $p["sender"];
38    $recipient   = $p["recipient"];
39    $recipientid = $p["recipientid"];
40
41    $c =& pfcGlobalConfig::Instance();
42    $u =& pfcUserConfig::Instance();
43
44    // check if the chat is locked
45    if ($c->islocked)
46    {
47      $xml_reponse->redirect($c->lockurl);
48      return false;
49    }
50    else
51    {
52      // forward the command to the next proxy or to the final command
53      $p["clientid"]    = $clientid;
54      $p["param"]       = $param;
55      $p["sender"]      = $sender;
56      $p["recipient"]   = $recipient;
57      $p["recipientid"] = $recipientid;
58      return $this->next->run($xml_reponse, $p);
59    }
60  }
61}
62
63?>