Logo Search packages:      
Sourcecode: jabber-jit version File versions  Download package

void it_iq ( session  s,
jpacket  jp 
)

Process incoming IQ request

Definition at line 46 of file iq.c.

References session_st::connected, elemqueue::elem, it_iq_browse_server(), it_iq_gateway_get(), it_iq_gateway_set(), it_iq_last(), it_iq_last_server(), it_iq_reg_get(), it_iq_reg_remove(), it_iq_search_get(), it_iq_search_set(), it_iq_time(), it_iq_vcard(), it_iq_vcard_server(), it_iq_version(), session_st::queue, session_st::queue_last, and session_st::ti.

Referenced by it_session_confirmed(), and it_session_jpacket().

{
    char *ns;

    if (s->connected == 0)  {
      /* not yet connected, enqueue request */
      queue_elem queue;
      queue = pmalloco(jp->p,sizeof(_queue_elem));
      queue->elem = (void *)jp;
      
      QUEUE_PUT(s->queue,s->queue_last,queue);
      return; 
    } 
    
    ns = xmlnode_get_attrib(jp->iq,"xmlns");
    switch (jpacket_subtype(jp))
      {
      case JPACKET__GET:
        if (j_strcmp(ns,NS_REGISTER) == 0)
          it_iq_reg_get(s,jp);
        else if (j_strcmp(ns,NS_SEARCH) == 0)
          it_iq_search_get(s, jp);
        else if (j_strcmp(ns,NS_VERSION) == 0)
          it_iq_version(s->ti,jp);
        else if (j_strcmp(ns,NS_TIME) == 0)
          it_iq_time(s->ti,jp);
        else if (j_strcmp(ns,NS_GATEWAY) == 0)
          it_iq_gateway_get(s,jp);
        else if (j_strcmp(ns,NS_BROWSE) == 0)
          jp->to->user ? it_iq_browse_user(s,jp) : it_iq_browse_server(s->ti,jp);    
        else if (j_strcmp(ns,NS_VCARD) == 0)
          jp->to->user ? it_iq_vcard(s,jp) : it_iq_vcard_server(s->ti,jp);
        else if (j_strcmp(ns,NS_LAST) == 0)
          jp->to->user ? it_iq_last(s,jp) : it_iq_last_server(s->ti,jp);        
        else {
          jutil_error(jp->x,TERROR_NOTIMPL);
          it_deliver(s->ti,jp->x);
        }
        break;
        
    case JPACKET__SET:
      if (j_strcmp(ns,NS_REGISTER) == 0) {
        if(xmlnode_get_tag(jp->iq,"remove")) {
          it_iq_reg_remove(s,jp);
        }
        else {
          jutil_error(jp->x,TERROR_NOTIMPL);  
          it_deliver(s->ti,jp->x);
        }
      }      
      else if (j_strcmp(ns,NS_SEARCH) == 0)
        it_iq_search_set(s, jp);      
      else if (j_strcmp(ns,NS_GATEWAY) == 0)
        it_iq_gateway_set(s,jp);
      else {
        if (j_strcmp(ns,NS_VERSION) == 0 || j_strcmp(ns,NS_TIME) == 0)
          jutil_error(jp->x,TERROR_NOTALLOWED);
        else
          jutil_error(jp->x,TERROR_NOTIMPL);  
        
        it_deliver(s->ti,jp->x);
      }
      break;
      
    default:
      xmlnode_free(jp->x);
      break;
    }
}


Generated by  Doxygen 1.6.0   Back to index