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


C++ CChannel::RemoveStreamByLocalSid方法代码示例

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


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

示例1: OnPresenceJob

void* CXEPxibb::OnPresenceJob(void* pvThis) throw()
{
	CXEPxibb* pXEPxibb = (CXEPxibb*) pvThis;
	CPresenceHandler* pPresenceHandler = &(pXEPxibb->PresenceHandler);
	CXMPPCore* pXMPPCore = pXEPxibb->pXMPPCore;

	CPresenceStanza PresenceStanza;

	while(pXMPPCore->Receive(pPresenceHandler, &PresenceStanza))
	{
		pXEPxibb->MutexOnChannelManager.Lock();
		
		try
		{
			CChannelManager* pChannelManager = pXEPxibb->GetChannelManager(PresenceStanza.GetFrom());

			if(pChannelManager != NULL)
			{
				for(u16 i = 0 ; i < pChannelManager->GetMaxChannel() ; i++)
				{
					CChannel* pChannel = pChannelManager->GetChannelByLocalCid(i);
					
					if(pChannel != NULL)
					{
						pXMPPCore->CommitHandler(pChannel->GetStreamOpenHandler());
						pXMPPCore->CommitHandler(pChannel->GetChannelDataHandler());
					
						for(u16 j = 0 ; j < pChannel->GetMaxStream() ; j++)
						{
							CStream* pStream = pChannel->GetStreamByLocalSid(j);
							
							if(pStream != NULL)
							{
								pXMPPCore->CommitHandler(pStream->GetStreamDataHandler());
								pChannel->RemoveStreamByLocalSid(j);
							}
						}
						
						pChannelManager->RemoveChannelByLocalCid(i);
					}
				}

				pXEPxibb->RemoveChannelManager(PresenceStanza.GetFrom());
			}
		}
		
		catch(exception& e)
		{
			#ifdef __DEBUG__
		cerr << e.what() << endl;
		#endif //__DEBUG__

		}
		
		pXEPxibb->MutexOnChannelManager.UnLock();
	}
	
	return NULL;
}
开发者ID:jahrome,项目名称:xmpp-tunnel,代码行数:59,代码来源:CXEPxibb.cpp

示例2: CloseStream

void CXEPxibb::CloseStream(const CJid& rJid, u16 localCid, u16 localSid)
{
	u16 remoteCid;
	u16 remoteSid;
	
	MutexOnChannelManager.Lock();

	try
	{
		// we are looking for the channelmanager associate to the Jid 		
		CChannelManager* pChannelManager = GetChannelManager(rJid);
				
		if(pChannelManager == NULL)
		throw CXEPxibbException(CXEPxibbException::XEPXEC_CLOSESTREAMERROR);
		
		// we are looking for the channel associate to the localCid
		CChannel* pChannel = pChannelManager->GetChannelByLocalCid(localCid);

		if(pChannel == NULL)
		throw CXEPxibbException(CXEPxibbException::XEPXEC_CLOSESTREAMERROR);

		remoteCid = pChannel->GetRemoteCid();

		// we are looking for the stream associate to the localSid
		CStream* pStream = pChannel->GetStreamByLocalSid(localSid);

		if(pStream == NULL)
		throw CXEPxibbException(CXEPxibbException::XEPXEC_CLOSESTREAMERROR);

		remoteSid = pStream->GetRemoteSid();

		pXMPPCore->CommitHandler(pStream->GetStreamDataHandler());
		pChannel->RemoveStreamByLocalSid(localSid);
	}
	
	catch(exception& e)
	{
		MutexOnChannelManager.UnLock();
		#ifdef __DEBUG__
		cerr << e.what() << endl;
		#endif //__DEBUG__

		throw CXEPxibbException(CXEPxibbException::XEPXEC_CLOSESTREAMERROR);
	}

	MutexOnChannelManager.UnLock();

	// we build the iq request
	string id;
	pXMPPCore->GenerateId(id);
	
	CStreamCloseStanza StreamCloseStanza(rJid, remoteCid, remoteSid, id);

	// we build the handler associate to the iq request
	CIQResultStanza IQResultStanza;
	CHandler IQResultHandler;

	CXMLFilter* pXMLFilter = new CXMLFilter("iq");
	pXMLFilter->SetAttribut("from", rJid.GetFull());
	pXMLFilter->SetAttribut("id", id);

	IQResultHandler.AddXMLFilter(pXMLFilter);
	
	pXMPPCore->RequestHandler(&IQResultHandler);

	// we send the iq request
	if(!pXMPPCore->Send(&StreamCloseStanza))
	throw CXEPxibbException(CXEPxibbException::XEPXEC_CLOSESTREAMERROR);

	// we receive the iq result
	if(!pXMPPCore->Receive(&IQResultHandler, &IQResultStanza))
	throw CXEPxibbException(CXEPxibbException::XEPXEC_CLOSESTREAMERROR);

	pXMPPCore->CommitHandler(&IQResultHandler);
	pXMPPCore->RemoveId(id);
}
开发者ID:jahrome,项目名称:xmpp-tunnel,代码行数:76,代码来源:CXEPxibb.cpp

示例3: Detach

void CXEPxibb::Detach()
{
	try
	{
		if(pXMPPCore == NULL)
		return;
	
		pXMPPCore->CommitHandler(&ChannelOpenHandler);
		pXMPPCore->CommitHandler(&ChannelCloseHandler);
		pXMPPCore->CommitHandler(&StreamCloseHandler);
		pXMPPCore->CommitHandler(&PresenceHandler);
	
		ThreadOnChannelCloseJob.Wait();
		ThreadOnStreamCloseJob.Wait();
		ThreadOnPresenceJob.Wait();
	
		for(u16 i = 0 ; i < ChannelManagerList.size() ; i++)
		{
			CChannelManager* pChannelManager = ChannelManagerList[i];
			
			if(pChannelManager != NULL)
			{
				for(u16 j = 0 ; j < pChannelManager->GetMaxChannel() ; j++)
				{
					CChannel* pChannel = pChannelManager->GetChannelByLocalCid(j);

					if(pChannel != NULL)
					{
						pXMPPCore->CommitHandler(pChannel->GetStreamOpenHandler());
						pXMPPCore->CommitHandler(pChannel->GetChannelDataHandler());
						
						for(u16 k = 0 ; k < pChannel->GetMaxStream() ; k++)
						{
							CStream* pStream = pChannel->GetStreamByLocalSid(k);
								
							if(pStream != NULL)
							{
								pXMPPCore->CommitHandler(pStream->GetStreamDataHandler());
								pChannel->RemoveStreamByLocalSid(k);
							}
						}

						pChannelManager->RemoveChannelByLocalCid(j);
					}	
				}
				
				delete pChannelManager;
				ChannelManagerList[i] = NULL;
			}
		}
	
		pXMPPCore = NULL;
	}
	
	catch(exception& e)
	{
		#ifdef __DEBUG__
		cerr << e.what() << endl;
		#endif //__DEBUG__

		throw CXEPxibbException(CXEPxibbException::XEPXEC_DETACHERROR);
	}
}
开发者ID:jahrome,项目名称:xmpp-tunnel,代码行数:63,代码来源:CXEPxibb.cpp

示例4: OnChannelCloseJob

void* CXEPxibb::OnChannelCloseJob(void* pvThis) throw()
{
	CXEPxibb* pXEPxibb = (CXEPxibb*) pvThis;
	CChannelCloseHandler* pChannelCloseHandler = &(pXEPxibb->ChannelCloseHandler);
	CXMPPCore* pXMPPCore = pXEPxibb->pXMPPCore;

	CChannelCloseStanza ChannelCloseStanza;

	while(pXMPPCore->Receive(pChannelCloseHandler, &ChannelCloseStanza))
	{
		pXEPxibb->MutexOnChannelManager.Lock();
		
		try
		{
			CChannelManager* pChannelManager = pXEPxibb->GetChannelManager(ChannelCloseStanza.GetRemoteJid());

			if(pChannelManager != NULL)
			{
				CChannel* pChannel = pChannelManager->GetChannelByRemoteCid(ChannelCloseStanza.GetChannelId());

				if(pChannel != NULL)
				{
					pXMPPCore->CommitHandler(pChannel->GetStreamOpenHandler());
					pXMPPCore->CommitHandler(pChannel->GetChannelDataHandler());
				
					for(u16 i = 0 ; i < pChannel->GetMaxStream() ; i++)
					{
						CStream* pStream = pChannel->GetStreamByLocalSid(i);
						
						if(pStream != NULL)
						{
							pXMPPCore->CommitHandler(pStream->GetStreamDataHandler());
							pChannel->RemoveStreamByLocalSid(i);
						}
					}
				}
				
				pChannelManager->RemoveChannelByRemoteCid(ChannelCloseStanza.GetChannelId());
			}
		}
		
		catch(exception& e)
		{
			#ifdef __DEBUG__
		cerr << e.what() << endl;
		#endif //__DEBUG__

		}
		
		pXEPxibb->MutexOnChannelManager.UnLock();

		CIQResultStanza IQResultStanza;		
		IQResultStanza.SetTo(ChannelCloseStanza.GetRemoteJid());
		IQResultStanza.SetId(ChannelCloseStanza.GetId());
		 
		if(!pXMPPCore->Send(&IQResultStanza))
		return NULL;
	}
	
	return NULL;
}
开发者ID:jahrome,项目名称:xmpp-tunnel,代码行数:61,代码来源:CXEPxibb.cpp


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