Exemplo n.º 1
0
void SOCKS5BytestreamManager::acknowledgeStreamHost( bool success, const JID& jid,
        const std::string& sid )
{
    AsyncTrackMap::const_iterator it = m_asyncTrackMap.find( sid );
    if( it == m_asyncTrackMap.end() || !m_parent )
        return;

    const AsyncS5BItem& item = (*it).second;

    IQ* iq = 0;

    if( item.incoming )
    {
        iq = new IQ( IQ::Result, item.from.full(), item.id );
        if( item.to )
            iq->setFrom( item.to );

        if( success )
            iq->addExtension( new Query( jid, sid, false ) );
        else
            iq->addExtension( new Error( StanzaErrorTypeCancel, StanzaErrorItemNotFound ) );

        m_parent->send( *iq );
    }
    else
    {
        if( success )
        {
            const std::string& id = m_parent->getID();
            iq = new IQ( IQ::Set, jid.full(), id );
            iq->addExtension( new Query( item.from, sid, true ) );

            m_trackMap[id] = sid;
            m_parent->send( *iq, this, S5BActivateStream );
        }
    }

    delete iq;
}
Exemplo n.º 2
0
  void VCardManager::fetchVCard( const JID& jid, VCardHandler* vch )
  {
    if( !m_parent || !vch )
      return;

    TrackMap::const_iterator it = m_trackMap.find( jid.bare() );
    if( it != m_trackMap.end() )
      return;

    const std::string& id = m_parent->getID();
    IQ iq ( IQ::Get, jid, id );
    iq.addExtension( new VCard() );

    m_trackMap[id] = vch;
    m_parent->send( iq, this,VCardHandler::FetchVCard  );
  }