当前位置: 首页>>代码示例>>C++>>正文


C++ IQ::from方法代码示例

本文整理汇总了C++中IQ::from方法的典型用法代码示例。如果您正苦于以下问题:C++ IQ::from方法的具体用法?C++ IQ::from怎么用?C++ IQ::from使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IQ的用法示例。


在下文中一共展示了IQ::from方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: handleIqID

  void Adhoc::handleIqID( const IQ& iq, int context )
  {
    if( context != ExecuteAdhocCommand )
      return;

    m_adhocTrackMapMutex.lock();
    AdhocTrackMap::iterator it = m_adhocTrackMap.find( iq.id() );
    bool haveIdHandler = ( it != m_adhocTrackMap.end() );
    m_adhocTrackMapMutex.unlock();
    if( !haveIdHandler || (*it).second.context != context
        || (*it).second.remote != iq.from() )
      return;

    switch( iq.subtype() )
    {
      case IQ::Error:
        (*it).second.ah->handleAdhocError( iq.from(), iq.error(), (*it).second.handlerContext );
        break;
      case IQ::Result:
      {
        const Adhoc::Command* ac = iq.findExtension<Adhoc::Command>( ExtAdhocCommand );
        if( ac )
          (*it).second.ah->handleAdhocExecutionResult( iq.from(), *ac, (*it).second.handlerContext );
        break;
      }
      default:
        break;
    }
    m_adhocTrackMapMutex.lock();
    m_adhocTrackMap.erase( it );
    m_adhocTrackMapMutex.unlock();
  }
开发者ID:dvdjg,项目名称:GoapCpp,代码行数:32,代码来源:adhoc.cpp

示例2: send

  void ClientBase::send( IQ& iq, IqHandler* ih, int ctx )
  {
    const PrivateXML::Query* q = iq.findExtension<PrivateXML::Query>( ExtPrivateXML );
    if( !q )
      return;

    Tag* tag = q->tag();
    switch( m_test )
    {
      case 1:
      {
        if( iq.subtype() == IQ::Set
            && tag && *(tag->findChild( "foo", "xmlns", "test" )) == *t1 )
        {
          IQ re( IQ::Result, iq.from(), iq.id() );
          re.addExtension( new PrivateXML::Query() );
          ih->handleIqID( re, ctx );
        }
        break;
      }
      case 2:
      {
        if( iq.subtype() == IQ::Get
            && tag && tag->hasChild( "foo", "xmlns", "test" ) )
        {
          IQ re( IQ::Result, iq.from(), iq.id() );
          re.addExtension( new PrivateXML::Query( t1->clone() ) );
          ih->handleIqID( re, ctx );
        }
        break;
      }
    }
    delete tag;
  }
开发者ID:ForNeVeR,项目名称:cthulhu-bot,代码行数:34,代码来源:privatexml_test.cpp

示例3: handleIqID

void Search::handleIqID( const IQ& iq, int context )
{
    TrackMap::iterator it = m_track.find( iq.id() );
    if( it != m_track.end() )
    {
        switch( iq.subtype() )
        {
        case IQ::Result:
        {
            const Query* q = iq.findExtension<Query>( ExtSearch );
            if( !q )
                return;

            switch( context )
            {
            case FetchSearchFields:
            {
                if( q->form() )
                {
                    (*it).second->handleSearchFields( iq.from(), q->form() );
                }
                else
                {
                    (*it).second->handleSearchFields( iq.from(), q->fields(), q->instructions() );
                }
                break;
            }
            case DoSearch:
            {
                if( q->form() )
                {
                    (*it).second->handleSearchResult( iq.from(), q->form() );
                }
                else
                {
                    (*it).second->handleSearchResult( iq.from(), q->result() );
                }
                break;
            }
            }
            break;
        }
        case IQ::Error:
            (*it).second->handleSearchError( iq.from(), iq.error() );
            break;

        default:
            break;
        }

        m_track.erase( it );
    }

    return;
}
开发者ID:humantargetjoe,项目名称:xmpplink,代码行数:55,代码来源:search.cpp

示例4: handleIq

    bool Session::handleIq( const IQ& iq )
    {
      const Jingle* j = iq.findExtension<Jingle>( ExtJingle );
      if( !j || j->sid() != m_sid || !m_handler || !m_parent )
        return false;

      switch( j->action() )
      {
        case SessionAccept:
          m_state = Active;
          m_responder = j->responder();
          break;
        case SessionInitiate:
          m_state = Pending;
          m_initiator = j->initiator();
          if( !m_responder )
            m_responder = m_parent->jid();
          break;
        case SessionTerminate:
          m_state = Ended;
          break;
        default:
          break;
      }

      IQ re( IQ::Result, iq.from(), iq.id() );
      m_parent->send( re );

      m_handler->handleSessionAction( j->action(), this, j );

      return true;
    }
开发者ID:Barrett17,项目名称:Caya,代码行数:32,代码来源:jinglesession.cpp

示例5: handleIqID

  void LastActivity::handleIqID( const IQ& iq, int /*context*/ )
  {
    if( !m_lastActivityHandler )
      return;

    if( iq.subtype() == IQ::Result )
    {
      const Query* q = iq.findExtension<Query>( ExtLastActivity );
      if( !q || q->seconds() < 0 )
        return;

      m_lastActivityHandler->handleLastActivityResult( iq.from(), q->seconds(), q->status() );
    }
    else if( iq.subtype() == IQ::Error && iq.error() )
      m_lastActivityHandler->handleLastActivityError( iq.from(), iq.error()->error() );
  }
开发者ID:iVideo,项目名称:weishao,代码行数:16,代码来源:lastactivity.cpp

示例6: handleIq

  bool InBandBytestream::handleIq( const IQ& iq ) // data or open request, always 'set'
  {
    const IBB* i = iq.findExtension<IBB>( ExtIBB );
    if( !i || !m_handler || iq.subtype() != IQ::Set )
      return false;

    if( !m_open )
    {
      if( i->type() == IBBOpen )
      {
        returnResult( iq.from(), iq.id() );
        m_open = true;
        m_handler->handleBytestreamOpen( this );
        return true;
      }
      return false;
    }

    if( i->type() == IBBClose )
    {
      returnResult( iq.from(), iq.id() );
      closed();
      return true;
    }

    if( ( m_lastChunkReceived + 1 ) != i->seq() )
    {
      m_open = false;
      returnError( iq.from(), iq.id(), StanzaErrorTypeModify, StanzaErrorItemNotFound );
      return false;
    }

    if( i->data().empty() )
    {
      m_open = false;
      returnError( iq.from(), iq.id(), StanzaErrorTypeModify, StanzaErrorBadRequest );
      return false;
    }

    returnResult( iq.from(), iq.id() );
    m_handler->handleBytestreamData( this, i->data() );
    m_lastChunkReceived++;
    return true;
  }
开发者ID:AimuTran,项目名称:avbot,代码行数:44,代码来源:inbandbytestream.cpp

示例7: handleIq

  bool LastActivity::handleIq( const IQ& iq )
  {
    const Query* q = iq.findExtension<Query>( ExtLastActivity );
    if( !q || iq.subtype() != IQ::Get )
      return false;

    IQ re( IQ::Result, iq.from(), iq.id() );
    re.addExtension( new Query( EmptyString, (long)( time( 0 ) - m_active ) ) );
    m_parent->send( re );

    return true;
  }
开发者ID:iVideo,项目名称:weishao,代码行数:12,代码来源:lastactivity.cpp

示例8: handleIqID

  void Disco::handleIqID( const IQ& iq, int context )
  {
    DiscoHandlerMap::iterator it = m_track.find( iq.id() );
    if( it != m_track.end() && (*it).second.dh )
    {
      switch( iq.subtype() )
      {
        case IQ::Result:
          switch( context )
          {
            case GetDiscoInfo:
            {
              const Info* di = iq.findExtension<Info>( ExtDiscoInfo );
              if( di )
                (*it).second.dh->handleDiscoInfo( iq.from(), *di, (*it).second.context );
              break;
            }
            case GetDiscoItems:
            {
              const Items* di = iq.findExtension<Items>( ExtDiscoItems );
              if( di )
                (*it).second.dh->handleDiscoItems( iq.from(), *di, (*it).second.context );
              break;
            }
          }
          break;

        case IQ::Error:
        {
          (*it).second.dh->handleDiscoError( iq.from(), iq.error(), (*it).second.context );
          break;
        }

        default:
          break;
      }

      m_track.erase( it );
    }
  }
开发者ID:AimuTran,项目名称:avbot,代码行数:40,代码来源:disco.cpp

示例9: send

void DiscoTest::send( const IQ& iq, IqHandler*, int ctx )
{
  Tag* q = 0;
  if( m_test == 8 )
  {
    IQ re( IQ::Result, iq.from(), iq.id() );
    q = new Tag( "query" );
    q->setXmlns( XMLNS_DISCO_INFO );
    new Tag( q, "feature", "var", XMLNS_DISCO_INFO );
    new Tag( q, "feature", "var", "foofeature" );
    new Tag( q, "feature", "var", "foofeature2" );
    re.addExtension( new Disco::Info( q ) );
    m_disco->handleIqID( re, ctx );
  }
  else if( m_test == 9 )
  {
    IQ re( IQ::Result, iq.from(), iq.id() );
    q = new Tag( "query" );
    q->setXmlns( XMLNS_DISCO_ITEMS );
    q->addAttribute( "node", "foonode" );
    Tag* i = new Tag( q, "item", "jid", "jid1" );
    i->addAttribute( "node", "node1" );
    i->addAttribute( "name", "name1" );
    i = new Tag( q, "item", "jid", "jid2" );
    i->addAttribute( "node", "node2" );
    i->addAttribute( "name", "name2" );
    re.addExtension( new Disco::Items( q ) );
    m_disco->handleIqID( re, ctx );
  }
  else if( m_test == 10 )
  {
    IQ re( IQ::Error, iq.from(), iq.id() );
    re.addExtension( new Error( StanzaErrorTypeCancel, StanzaErrorItemNotFound ) );
    m_disco->handleIqID( re, ctx );
  }

  delete q;
}
开发者ID:jvalvert,项目名称:societas,代码行数:38,代码来源:disco_test.cpp

示例10: handleIqID

  void VCardManager::handleIqID( const IQ& iq, int context )
  {
    TrackMap::iterator it = m_trackMap.find( iq.id() );
    if( it != m_trackMap.end() )
    {
      switch( iq.subtype() )
      {
        case IQ::Result:
        {
          switch( context )
          {
            case VCardHandler::FetchVCard:
            {
              const VCard* v = iq.findExtension<VCard>( ExtVCard );
              (*it).second->handleVCard( iq.from(), v );
              break;
            }
            case VCardHandler::StoreVCard:
              (*it).second->handleVCardResult( VCardHandler::StoreVCard, iq.from() );
              break;
          }
        }
        break;
        case IQ::Error:
        {
          (*it).second->handleVCardResult( (VCardHandler::VCardContext)context,
                                           iq.from(),
                                           iq.error() ? iq.error()->error()
                                                       : StanzaErrorUndefined );
          break;
        }
        default:
          break;
      }

      m_trackMap.erase( it );
    }
  }
开发者ID:AimuTran,项目名称:avbot,代码行数:38,代码来源:vcardmanager.cpp

示例11: switch

bool SOCKS5BytestreamManager::handleIq( const IQ& iq )
{
    const Query* q = iq.findExtension<Query>( ExtS5BQuery );
    if( !q || !m_socks5BytestreamHandler
            || m_trackMap.find( iq.id() ) != m_trackMap.end() )
        return false;

    switch( iq.subtype() )
    {
    case IQ::Set:
    {
        const std::string& sid = q->sid();
// FIXME What is haveStream() good for?
        if( /*haveStream( iq.from() ) ||*/ sid.empty() || q->mode() == S5BUDP )
        {
            rejectSOCKS5Bytestream( iq.from(), iq.id(), StanzaErrorNotAcceptable );
            return true;
        }
        AsyncS5BItem asi;
        asi.sHosts = q->hosts();
        asi.id = iq.id();
        asi.from = iq.from();
        asi.to = iq.to();
        asi.incoming = true;
        m_asyncTrackMap[sid] = asi;
        m_socks5BytestreamHandler->handleIncomingBytestreamRequest( sid, iq.from() );
        break;
    }
    case IQ::Error:
        m_socks5BytestreamHandler->handleBytestreamError( iq, EmptyString );
        break;
    default:
        break;
    }

    return true;
}
开发者ID:kofbashen,项目名称:weishao,代码行数:37,代码来源:socks5bytestreammanager.cpp

示例12: handleIqID

  void SIManager::handleIqID( const IQ& iq, int context )
  {
    switch( iq.subtype() )
    {
      case IQ::Result:
        if( context == OfferSI )
        {
          TrackMap::iterator it = m_track.find( iq.id() );
          if( it != m_track.end() )
          {
            const SI* si = iq.findExtension<SI>( ExtSI );
            if( !si /*|| si->profile().empty()*/ )
              return;

//             Tag* si = iq.query();
//             Tag* ptag = 0;
//             Tag* fneg = 0;
//             if( si && si->name() == "si" && si->xmlns() == XMLNS_SI )
//             {
//               ptag = si->findChildWithAttrib( XMLNS, (*it).second.profile );
//               fneg = si->findChild( "feature", XMLNS, XMLNS_FEATURE_NEG );
//             }

            // FIXME: remove above commented code and
            // check corectness of last 3 params!
            (*it).second.sih->handleSIRequestResult( iq.from(), iq.to(), (*it).second.sid, *si );
            m_track.erase( it );
          }
        }
        break;
      case IQ::Error:
        if( context == OfferSI )
        {
          TrackMap::iterator it = m_track.find( iq.id() );
          if( it != m_track.end() )
          {
            (*it).second.sih->handleSIRequestError( iq, (*it).second.sid );
            m_track.erase( it );
          }
        }
        break;
      default:
        break;
    }
  }
开发者ID:Abhi347,项目名称:s3eGloox,代码行数:45,代码来源:simanager.cpp

示例13: handleIq

  bool SIManager::handleIq( const IQ& iq )
  {
    TrackMap::iterator itt = m_track.find( iq.id() );
    if( itt != m_track.end() )
      return false;

    const SI* si = iq.findExtension<SI>( ExtSI );
    if( !si || si->profile().empty() )
      return false;

    HandlerMap::const_iterator it = m_handlers.find( si->profile() );
    if( it != m_handlers.end() && (*it).second )
    {
      (*it).second->handleSIRequest( iq.from(), iq.to(), iq.id(), *si );
      return true;
    }

    return false;
  }
开发者ID:Abhi347,项目名称:s3eGloox,代码行数:19,代码来源:simanager.cpp

示例14: Tag

AdhocTag::AdhocTag(const IQ &stanza) : Tag("command") {
    m_from = stanza.from().full();
    m_id = stanza.id();
    xdata = NULL;
    Tag *iq = stanza.tag();
    Tag *command = iq->findChild("command");
    if (command) {
        const Tag::AttributeList & attributes = command->attributes();
        for (Tag::AttributeList::const_iterator it = attributes.begin(); it != attributes.end(); it++) {
            addAttribute(std::string((*it)->name()), std::string((*it)->value()));
        }
        Tag *x = command->findChildWithAttrib("xmlns","jabber:x:data");
        if (x) {
            xdata = x->clone();
            addChild(xdata);
        }
    }
    delete iq;
}
开发者ID:bochi,项目名称:spectrum-gw,代码行数:19,代码来源:adhoctag.cpp

示例15: handleIq

  bool Adhoc::handleIq( const IQ& iq )
  {
    if( iq.subtype() != IQ::Set )
      return false;

    const Adhoc::Command* ac = iq.findExtension<Adhoc::Command>( ExtAdhocCommand );
    if( !ac || ac->node().empty())
      return false;

    AdhocCommandProviderMap::const_iterator it = m_adhocCommandProviders.find( ac->node() );
    if( it != m_adhocCommandProviders.end() )
    {
      const std::string& sess = ac->sessionID().empty() ? m_parent->getID() : ac->sessionID();
      m_activeSessions[sess] = iq.id();
      (*it).second->handleAdhocCommand( iq.from(), *ac, sess );
      return true;
    }

    return false;
  }
开发者ID:dvdjg,项目名称:GoapCpp,代码行数:20,代码来源:adhoc.cpp


注:本文中的IQ::from方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。