Пример #1
0
	void execute (CCtrlBase * /* pCaller */, const std::string &sParams)
	{
		// Param
		ucstring text = CI18N::get ("uiTalkMemMsg"+sParams);

		// Find the base group
		if (!text.empty())
		{
			ChatMngr.setChatMode (CChatGroup::say);
			ChatMngr.chat(text);
		}
	}
Пример #2
0
	void execute (CCtrlBase * /* pCaller */, const std::string &sParams)
	{
		// Param
		uint mode;
		fromString(getParam (sParams, "mode"), mode);
		ucstring text;
		text.fromUtf8 (getParam (sParams, "text"));
//		text = getParam (sParams, "text");

		// Parse any tokens in the text
		if ( ! CInterfaceManager::parseTokens(text))
		{
			return;
		}

		// Find the base group
		if ((mode<CChatGroup::nbChatMode) && !text.empty())
		{
			if(text[0] == '/')
			{
				string str = text.toUtf8();
				string cmdWithArgs = str.substr(1);

				// Get the command name from the string, can contain spaces
				string cmd = cmdWithArgs.substr(0, cmdWithArgs.find(' '));
				if (cmdWithArgs.find('"') == 0)
				{
					string::size_type pos = cmdWithArgs.find('"', 1);
					if (string::npos != pos)
					{
						cmd = cmdWithArgs.substr(1, pos - 1);
					}
				}

				if ( NLMISC::ICommand::exists( cmd ) )
				{
					NLMISC::ICommand::execute( cmdWithArgs, g_log );
				} 
				else
				{
					CInterfaceManager *im = CInterfaceManager::getInstance();
					im->displaySystemInfo (ucstring(cmd+": ")+CI18N::get ("uiCommandNotExists"));
				}
			}
			else
			{
				ChatMngr.setChatMode((CChatGroup::TGroupType)mode);
				ChatMngr.chat(text, mode == CChatGroup::team);
			}
		}
	}
Пример #3
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);
	}
}