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

void ICQ2000::Client::setStatus ( const Status  st,
bool  inv 
)

Set your status. This is used to set your status, as well as to connect and disconnect from the network. When you wish to connect to the ICQ network, set status to something other than STATUS_OFFLINE and connecting will be initiated. When you wish to disconnect set the status to STATUS_OFFLINE and disconnection will be initiated.

Parameters:
st the status
inv whether to be invisible or not

Definition at line 1463 of file Client.cpp.

  {
    m_status_wanted = st;
    m_invisible_wanted = inv;

    if (st == STATUS_OFFLINE) {
      if (m_state != NOT_CONNECTED)
      Disconnect(DisconnectedEvent::REQUESTED);

      return;
    }

    if (m_state == BOS_LOGGED_IN) {
      /*
       * The correct sequence of events are:
       * - when going from visible to invisible
       *   - send the Add to Visible list (or better named Set in this case)
       *   - send set Status
       * - when going from invisible to visible
       *   - send set Status
       *   - send the Add to Invisible list (or better named Set in this case)
       */

      Buffer b(&m_translator);

      if (!m_self->isInvisible() && inv) {
      // visible -> invisible
      FLAPwrapSNAC( b, AddVisibleSNAC(m_visible_list) );
      }
      
      FLAPwrapSNAC( b, SetStatusSNAC(Contact::MapStatusToICQStatus(st, inv), m_web_aware) );
      
      if (m_self->isInvisible() && !inv) {
      // invisible -> visible
      FLAPwrapSNAC( b, AddInvisibleSNAC(m_invisible_list) );
      }
      
      Send(b);

    } else {
      // We'll set this as the initial status upon connecting
      m_status_wanted = st;
      m_invisible_wanted = inv;
      
      // start connecting if not already
      if (m_state == NOT_CONNECTED)
      ConnectAuthorizer(AUTH_AWAITING_CONN_ACK);
    }
  }


Generated by  Doxygen 1.6.0   Back to index