/[drupal]/contributions/modules/xmpp_server/contrib/xmpp_roster/xmpp_roster.module
ViewVC logotype

Diff of /contributions/modules/xmpp_server/contrib/xmpp_roster/xmpp_roster.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.3, Thu Sep 25 21:55:22 2008 UTC revision 1.4, Fri Sep 26 00:45:43 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: xmpp_roster.module,v 1.2 2008/09/25 08:23:38 t0talmeltd0wn Exp $  // $Id: xmpp_roster.module,v 1.3 2008/09/25 21:55:22 t0talmeltd0wn Exp $
3    
4  define("XMPP_ROSTER_NONE", 0);  define("XMPP_ROSTER_NONE", 0);
5  define("XMPP_ROSTER_SUBSCRIBED", 1);  define("XMPP_ROSTER_SUBSCRIBED", 1);
# Line 7  define("XMPP_ROSTER_SUBSCRIPTION_PENDING Line 7  define("XMPP_ROSTER_SUBSCRIPTION_PENDING
7    
8  /* ==== Below are hook implementations ==== */  /* ==== Below are hook implementations ==== */
9    
10    /*
11     * Implementation of hook_views_api().
12     * Maybe will be implemented someday when views makes sense to me.
13     */
14    /*function xmpp_roster_views_api() {
15      return array(
16        'api' => 2.0,
17      );
18    }*/
19    
20  /**  /**
21   * Implementation of hook_xmpp_disco_features().   * Implementation of hook_xmpp_disco_features().
22   */   */
# Line 43  function xmpp_roster_xmpp_router_presenc Line 53  function xmpp_roster_xmpp_router_presenc
53    _xmpp_send_to_subscribers($session, $node);    _xmpp_send_to_subscribers($session, $node);
54  }  }
55    
56  function xmpp_roster_xmpp_client_close($client) {  function xmpp_roster_xmpp_server_client_close($client) {
57    $session = xmpp_server_get_session($client);    $session = xmpp_server_get_session($client);
58    
59    $presence = new XmlNode();    $presence = new XmlNode();
# Line 449  function _xmpp_roster_get_query($client, Line 459  function _xmpp_roster_get_query($client,
459        $i->options['subscription'] = $f->subscription;        $i->options['subscription'] = $f->subscription;
460      }      }
461    
462      if (_xmpp_roster_fetch_subscription_state($f->uid, $f->fid)) {      if (_xmpp_roster_fetch_subscription_state($f->uid, $f->fid) == XMPP_ROSTER_SUBSCRIPTION_PENDING) {
463        $i->options['ask'] = 'subscribe';        $i->options['ask'] = 'subscribe';
464      }      }
465    
# Line 467  function _xmpp_roster_get_query($client, Line 477  function _xmpp_roster_get_query($client,
477  }  }
478    
479  function _xmpp_send_to_subscribers(&$session, $node) {  function _xmpp_send_to_subscribers(&$session, $node) {
480    if (is_object($node)) {    if (!is_object($node)) {
481      $node = (object)$node;      $node = (object)$node;
482    }    }
483    
484    $res = db_query("SELECT uid FROM {xmpp_roster_presence    $res = db_query("SELECT uid FROM {xmpp_roster_presence}
485      WHERE fid=%d AND state=%d",      WHERE fid=%d AND state=%d",
486        $session['uid'], XMPP_ROSTER_SUBSCRIBED);        $session['uid'], XMPP_ROSTER_SUBSCRIBED);
487    while($row = db_fetch_object($res)) {    while($row = db_fetch_object($res)) {

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.2