Ejemplo n.º 1
0
//=============================================================================================================
void CChatTargetFilter::msgEntered(const ucstring &msg, CChatWindow *chatWindow)
{
	// Special case for yubo chat
	if(_TargetGroup==CChatGroup::yubo_chat)
	{
		CInterfaceManager	*pIM= CInterfaceManager::getInstance();
		pIM->sendStringToYuboChat(msg);
		return;
	}

	// Common Target case
	if (ClientCfg.Local)
	{
		chatWindow->displayMessage(msg, CRGBA::White, _TargetGroup, _TargetDynamicChannelDbIndex);
		return;
	}

	// forward to the target
	if (_TargetPartyChat && _TargetPartyChat->getListener())
	{
		_TargetPartyChat->getListener()->msgEntered(msg, chatWindow);
	}
	else if (!_TargetPlayer.empty())
	{
		// the target must be a player, make a tell on him
		// TODO: adapt this to unicode when this is OK on server side
		ChatMngr.tell(_TargetPlayer.toString(), msg.toString());
		// direct output in the chat
		chatWindow->displayLocalPlayerTell(msg);
	}
	else
	{
		 // chat to a chat group (say, shout, universe) also for team (with special case in setChatMode)
		 // this mode is cached so this should be ok
		ChatMngr.setChatMode(_TargetGroup, ChatMngr.getDynamicChannelIdFromDbIndex(_TargetDynamicChannelDbIndex));
		// send the string
		ChatMngr.chat(msg, _TargetGroup == CChatGroup::team);
	}
}
Ejemplo n.º 2
0
	void execute (CCtrlBase *pCaller, const std::string &sParams)
	{
		string receiver = getParam (sParams, "player");
		ucstring message;
		message.fromUtf8(getParam (sParams, "text"));
//		message = getParam (sParams, "text");
		if (receiver.empty() || message.empty())
			return;

		// Get the chat window (if any)
		CChatWindow *cw = NULL;
		CGroupEditBox *eb = pCaller?dynamic_cast<CGroupEditBox *>(pCaller):NULL;
		if (eb)
			cw = getChatWndMgr().getChatWindowFromCaller(eb);

		// Send the message.
		ChatMngr.tell(receiver, message);

		// display in the good window
		CInterfaceProperty prop;
		prop.readRGBA("UI:SAVE:CHAT:COLORS:SPEAKER"," ");
		ucstring finalMsg;
		CChatWindow::encodeColorTag(prop.getRGBA(), finalMsg, false);

		ucstring csr(CHARACTER_TITLE::isCsrTitle(UserEntity->getTitleRaw()) ? "(CSR) " : "");
		finalMsg += csr + CI18N::get("youTell") + ": ";
		prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," ");
		CChatWindow::encodeColorTag(prop.getRGBA(), finalMsg, true);
		finalMsg += message;
		// display msg with good color
//		TDataSetIndex dsi; // not used ....
		PeopleInterraction.ChatInput.Tell.displayTellMessage(/*dsi, */finalMsg, receiver, prop.getRGBA());

		ucstring s = CI18N::get("youTellPlayer");
		strFindReplace(s, "%name", receiver);
		strFindReplace(finalMsg, CI18N::get("youTell"), s);
		CInterfaceManager::getInstance()->log(finalMsg);
	}