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

void it_session_confirmed ( session  s  ) 

Session thread, called from wp_client when connected

Definition at line 154 of file session.c.

References session_st::connected, elemqueue::elem, session_st::exit_flag, session_st::id, it_iq(), it_message(), it_s10n(), it_session_presence_send(), it_session_register(), it_sms_presence(), iti::own_roster, session_st::queue, session_st::queue_last, session_st::roster_changed, session_st::start_time, session_st::ti, and session_st::type.

                                    {
  queue_elem queue;
  jpacket jp;
  
  if (s->exit_flag) return;
  
  s->start_time = time(NULL);
    
  log_record("sessionstart", "", "", ";%s;", 
             jid_full(s->id));

  queue = QUEUE_GET(s->queue,s->queue_last);
  jp = queue->elem;

  if (s->type != stype_normal) {
    it_session_register(s,jp);
      
    if (s->exit_flag)
      return;
  }
  else {
    if (jp->type == JPACKET_PRESENCE) {    
      /* send actual presence state to Jabber */
      it_session_presence_send(s);
      /* send actual presence state to ICQ */
      SendStatus(s);
    }        
    else {
      log_alert("debug","Internal error!");
    }
    xmlnode_free(jp->x);
  }

  /* process enqueued packets */

  if(s->exit_flag) return;

  s->connected = 1;

  if ((s->ti->own_roster)&&(s->roster_changed)) {
      it_save_contacts(s);
      s->roster_changed = 0;
  }

  /* set sms contacts presence */
  it_sms_presence(s,1);
    
  /* flush buffer of packets waiting for login to finish */
  while ((queue = QUEUE_GET(s->queue,s->queue_last)) != NULL)
  {
    jp = queue->elem;

    /* JPACKET_PRESENCE is never buffered */
    switch (jp->type)
    {
      case JPACKET_IQ:
        it_iq(s,jp);
        break;
      case JPACKET_S10N:
        it_s10n(s,jp);
        break;
      case JPACKET_MESSAGE:
        it_message(s,jp);     
        break;

      default:
        xmlnode_free(jp->x);
    }

    /* if got error, do not process more packetc */
    if(s->exit_flag) return;
  }
}


Generated by  Doxygen 1.6.0   Back to index