本文整理汇总了C++中IQ::subtype方法的典型用法代码示例。如果您正苦于以下问题:C++ IQ::subtype方法的具体用法?C++ IQ::subtype怎么用?C++ IQ::subtype使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IQ
的用法示例。
在下文中一共展示了IQ::subtype方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: handleIqID
void PrivateXML::handleIqID( const IQ& iq, int context )
{
TrackMap::iterator t = m_track.find( iq.id() );
if( t == m_track.end() )
return;
if( iq.subtype() == IQ::Result )
{
if( context == RequestXml )
{
const Query* q = iq.findExtension<Query>( ExtPrivateXML );
if( q )
(*t).second->handlePrivateXML( q->privateXML() );
}
else if( context == StoreXml )
(*t).second->handlePrivateXMLResult( iq.id(), PrivateXMLHandler::PxmlStoreOk );
}
else if( iq.subtype() == IQ::Error )
{
if( context == RequestXml )
(*t).second->handlePrivateXMLResult( iq.id(), PrivateXMLHandler::PxmlRequestError );
else if( context == StoreXml )
(*t).second->handlePrivateXMLResult( iq.id(), PrivateXMLHandler::PxmlStoreError );
}
m_track.erase( t );
}
示例3: handleIqID
void RosterManager::handleIqID( const IQ& iq, int context )
{
if( iq.subtype() == IQ::Result ) // initial roster
{
const Query* q = iq.findExtension<Query>( ExtRoster );
if( q )
mergeRoster( q->roster() );
if( context == RequestRoster )
{
if( m_parent )
m_parent->rosterFilled();
if( m_rosterListener )
m_rosterListener->handleRoster( m_roster );
}
}
else if( iq.subtype() == IQ::Error )
{
if( context == RequestRoster && m_parent )
m_parent->rosterFilled();
if( m_rosterListener )
m_rosterListener->handleRosterError( iq );
}
}
示例4: handleIqID
void FlexibleOffline::handleIqID( const IQ& iq, int context )
{
if( !m_flexibleOfflineHandler )
return;
switch( context )
{
case FORequestMsgs:
switch( iq.subtype() )
{
case IQ::Result:
m_flexibleOfflineHandler->handleFlexibleOfflineResult( FomrRequestSuccess );
break;
case IQ::Error:
switch( iq.error()->error() )
{
case StanzaErrorForbidden:
m_flexibleOfflineHandler->handleFlexibleOfflineResult( FomrForbidden );
break;
case StanzaErrorItemNotFound:
m_flexibleOfflineHandler->handleFlexibleOfflineResult( FomrItemNotFound );
break;
default:
m_flexibleOfflineHandler->handleFlexibleOfflineResult( FomrUnknownError );
break;
}
break;
default:
break;
}
break;
case FORemoveMsgs:
switch( iq.subtype() )
{
case IQ::Result:
m_flexibleOfflineHandler->handleFlexibleOfflineResult( FomrRemoveSuccess );
break;
case IQ::Error:
switch( iq.error()->error() )
{
case StanzaErrorForbidden:
m_flexibleOfflineHandler->handleFlexibleOfflineResult( FomrForbidden );
break;
case StanzaErrorItemNotFound:
m_flexibleOfflineHandler->handleFlexibleOfflineResult( FomrItemNotFound );
break;
default:
m_flexibleOfflineHandler->handleFlexibleOfflineResult( FomrUnknownError );
break;
}
break;
default:
break;
}
break;
}
}
示例5: 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();
}
示例6: processResourceBind
void Client::processResourceBind( const IQ& iq )
{
switch( iq.subtype() )
{
case IQ::Result:
{
const ResourceBind* rb = iq.findExtension<ResourceBind>( ExtResourceBind );
if( !rb || !rb->jid() )
{
notifyOnResourceBindError( 0 );
break;
}
m_jid = rb->jid();
m_resourceBound = true;
m_selectedResource = m_jid.resource();
notifyOnResourceBind( m_jid.resource() );
if( m_streamFeatures & StreamFeatureSession )
createSession();
else
connected();
break;
}
case IQ::Error:
{
notifyOnResourceBindError( iq.error() );
break;
}
default:
break;
}
}
示例7: 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() );
}
示例8: handleIqID
void NonSaslAuth::handleIqID( const IQ& iq, int context )
{
switch( iq.subtype() )
{
case IQ::Error:
{
const Error* e = iq.error();
if( e )
{
switch( e->error() )
{
case StanzaErrorConflict:
m_parent->setAuthFailure( NonSaslConflict );
break;
case StanzaErrorNotAcceptable:
m_parent->setAuthFailure( NonSaslNotAcceptable );
break;
case StanzaErrorNotAuthorized:
m_parent->setAuthFailure( NonSaslNotAuthorized );
break;
default:
break;
}
}
m_parent->setAuthed( false );
m_parent->disconnect( ConnAuthenticationFailed );
break;
}
case IQ::Result:
switch( context )
{
case TrackRequestAuthFields:
{
const Query* q = iq.findExtension<Query>( ExtNonSaslAuth );
if( !q )
return;
const std::string& id = m_parent->getID();
IQ re( IQ::Set, JID(), id );
re.addExtension( q->newInstance( m_parent->username(), m_sid,
m_parent->password(),
m_parent->jid().resource() ) );
m_parent->send( re, this, TrackSendAuth );
break;
}
case TrackSendAuth:
m_parent->setAuthed( true );
m_parent->connected();
break;
}
break;
default:
break;
}
}
示例9: 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;
}
示例10: 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;
}
示例11: handleIq
bool PrivacyManager::handleIq( const IQ& iq )
{
const Query* q = iq.findExtension<Query>( ExtPrivacy );
if( iq.subtype() != IQ::Set || !m_privacyListHandler
|| !q || q->name().empty() )
return false;
m_privacyListHandler->handlePrivacyListChanged( q->name() );
IQ re( IQ::Result, JID(), iq.id() );
m_parent->send( re );
return true;
}
示例12: handleIq
bool RosterManager::handleIq( const IQ& iq )
{
if( iq.subtype() != IQ::Set ) // FIXME add checks for 'from' attribute (empty or bare self jid?)
return false;
// single roster item push
const Query* q = iq.findExtension<Query>( ExtRoster );
if( q && q->roster().size() )
mergePush( q->roster() );
IQ re( IQ::Result, JID(), iq.id() );
m_parent->send( re );
return true;
}
示例13: processCreateSession
void Client::processCreateSession( const IQ& iq )
{
switch( iq.subtype() )
{
case IQ::Result:
connected();
break;
case IQ::Error:
notifyOnSessionCreateError( iq.error() );
break;
default:
break;
}
}
示例14: send
void TestInitiator::send( const IQ& iq )
{
// printf( "TestInitiator::senD(IQ): %s\n", iq.tag()->xml().c_str() );
m_result2 = false;
switch( m_test )
{
case 2:
case 3:
if( iq.subtype() == IQ::Result && iq.to().full() == "[email protected]" )
m_result2 = true;
break;
}
}
示例15: handleIqID
void Session::handleIqID( const IQ& iq, int context )
{
if( iq.subtype() == IQ::Error )
{
const Error* e = iq.findExtension<Error>( ExtError );
m_handler->handleSessionActionError( (Action)context, this, e );
switch( context )
{
case ContentAccept:
break;
case ContentAdd:
break;
case ContentModify:
break;
case ContentReject:
break;
case ContentRemove:
break;
case DescriptionInfo:
break;
case SessionAccept:
break;
case SessionInfo:
break;
case SessionInitiate:
m_state = Ended;
break;
case SessionTerminate:
break;
case TransportAccept:
break;
case TransportInfo:
break;
case TransportReject:
break;
case TransportReplace:
break;
case InvalidAction:
break;
default:
break;
}
}
}