Exemplo n.º 1
0
bool CChat::CreateChannel(LPCTSTR pszName, LPCTSTR pszPassword, CChatMember *pMember)
{
	ADDTOCALLSTACK("CChat::CreateChannel");
	if ( pMember )
	{
		CClient *pClient = pMember->GetClient();
		if ( pClient && !pClient->IsPriv(PRIV_GM) && !(g_Cfg.m_iChatFlags & CHATF_CHANNELCREATION) )
		{
			CGString sName;
			FormatName(sName, NULL, true);
			pMember->SendChatMsg(CHATMSG_PlayerMessage, sName, " Channel creation is disabled.");
			return false;
		}
	}
	if ( !IsValidName(pszName, false) )
	{
		if ( pMember )
			pMember->SendChatMsg(CHATMSG_InvalidConferenceName);
		return false;
	}
	else if ( FindChannel(pszName) )
	{
		if ( pMember )
			pMember->SendChatMsg(CHATMSG_DuplicatedConferenceName);
		return false;
	}

	CChatChannel *pChannel = new CChatChannel(pszName, pszPassword, !pMember);
	m_Channels.InsertTail(pChannel);
	BroadcastAddChannel(pChannel);
	if ( pMember && (g_Cfg.m_iChatFlags & CHATF_CHANNELMODERATION) )
		pChannel->SetModerator(pMember->GetChatName());
	return true;
}
Exemplo n.º 2
0
bool CChat::CreateChannel(LPCTSTR pszName, LPCTSTR pszPassword, CChatChanMember * pMember)
{
	ADDTOCALLSTACK("CChat::CreateChannel");
	if (!m_fChatsOK)
	{
		CGString sName;
		DecorateName(sName, NULL, true);
		pMember->SendChatMsg(CHATMSG_PlayerTalk, sName, "Conference creation is disabled.");
		return false;
	}
	CChatChannel * pChannel = new CChatChannel( pszName, pszPassword );
	m_Channels.InsertTail( pChannel );
	pChannel->SetModerator(pMember->GetChatName());
	// Send all clients with an open chat window the new channel name
	SendNewChannel(pChannel);
	return true;
}