示例#1
0
  void Client::sendPresence()
  {
    if( m_presence != PresenceUnknown &&
        state() >= StateConnected )
    {
      JID jid;
      Stanza *p = Stanza::createPresenceStanza( jid, m_status, m_presence );
#ifdef _WIN32_WCE
      char tmp[5];
      tmp[4] = '\0';
      sprintf( tmp, "%s", m_priority );
      new Tag( p, "priority", tmp );
#else
      std::ostringstream oss;
      oss << m_priority;
      new Tag( p, "priority", oss.str() );
#endif
      StanzaExtensionList::const_iterator it = m_presenceExtensions.begin();
      for( ; it != m_presenceExtensions.end(); ++it )
      {
        p->addChild( (*it)->tag() );
      }

      send( p );
    }
  }