void CChat::SendNewChannel(CChatChannel * pNewChannel)
{
	ADDTOCALLSTACK("CChat::SendNewChannel");
	// Send this new channel name to all clients using the chat system
	ClientIterator it;
	for (CClient* pClient = it.next(); pClient != NULL; pClient = it.next())
	{
		if ( ! pClient->IsChatActive())
			continue;
		pClient->addChatSystemMessage(CHATMSG_SendChannelName, pNewChannel->GetName(), pNewChannel->GetModeString());
	}
}
void CChat::SendDeleteChannel(CChatChannel * pChannel)
{
	ADDTOCALLSTACK("CChat::SendDeleteChannel");
	// Send a delete channel name message to all clients using the chat system
	
	ClientIterator it;
	for (CClient* pClient = it.next(); pClient != NULL; pClient = it.next())
	{
		if ( ! pClient->IsChatActive())
			continue;
		pClient->addChatSystemMessage(CHATMSG_RemoveChannelName, pChannel->GetName());
	}
}
void CChat::Broadcast(CChatChanMember *pFrom, LPCTSTR pszText, CLanguageID lang, bool fOverride)
{
	ADDTOCALLSTACK("CChat::Broadcast");
	ClientIterator it;
	for (CClient *pClient = it.next(); pClient != NULL; pClient = it.next())
	{
		if (!pClient->IsChatActive())
			continue;
		if (fOverride || pClient->IsReceivingAllowed())
		{
			CGString sName;
			DecorateName(sName, pFrom, fOverride);
			pClient->SendChatMsg(CHATMSG_PlayerTalk, sName, pszText, lang);
		}
	}
}
void CChat::WhereIs(CChatChanMember * pBy, LPCTSTR pszName ) const
{
	ADDTOCALLSTACK("CChat::WhereIs");
	
	ClientIterator it;
	for (CClient* pClient = it.next(); pClient != NULL; pClient = it.next())
	{
		if ( ! strcmp( pClient->GetChatName(), pszName))
			continue;

		TCHAR *pszMsg = Str_GetTemp();
		if (! pClient->IsChatActive() || !pClient->GetChannel())
			sprintf(pszMsg, "%s is not currently in a conference.", pszName);
		else
			sprintf(pszMsg, "%s is in conference '%s'.", static_cast<LPCTSTR>(pszName), static_cast<LPCTSTR>(pClient->GetChannel()->GetName()));
		CGString sFrom;
		DecorateName(sFrom, NULL, true);
		pBy->SendChatMsg(CHATMSG_PlayerTalk, sFrom, pszMsg);
		return;
	}

	pBy->SendChatMsg(CHATMSG_NoPlayer, pszName);
}
Exemple #5
0
void CChat::WhereIs(CChatChanMember * pBy, lpctstr pszName ) const
{
	ADDTOCALLSTACK("CChat::WhereIs");
	
	ClientIterator it;
	for (CClient* pClient = it.next(); pClient != nullptr; pClient = it.next())
	{
		if ( ! strcmp( pClient->GetChatName(), pszName))
			continue;

		tchar *pszMsg = Str_GetTemp();
		if (! pClient->IsChatActive() || !pClient->GetChannel())
			sprintf(pszMsg, "%s is not currently in a conference.", pszName);
		else
			sprintf(pszMsg, "%s is in conference '%s'.", pszName, pClient->GetChannel()->GetName());
		CSString sFrom;
		DecorateName(sFrom, nullptr, true);
		pBy->SendChatMsg(CHATMSG_PlayerTalk, sFrom, pszMsg);
		return;
	}

	pBy->SendChatMsg(CHATMSG_NoPlayer, pszName);
}