Example #1
0
command_result basic_server_buffer<Document, Selector>::
	on_command_emote(const user& from,
	                 const std::string& paramlist)
{
	user_table& table = this->m_user_table;

	net6::packet pack("obby_emote_message");
	pack << &from << paramlist;

	for(user_table::iterator iter =
		table.begin(user::flags::CONNECTED, user::flags::NONE);
	    iter != table.end(user::flags::CONNECTED, user::flags::NONE);
	    ++ iter)
	{
		// command_result will be sent to sender automatically, so
		// there is no need to send emote message packet extra
		if(&(*iter) == &from) continue;

		net6_server().send(pack, iter->get_net6() );
	}

	basic_buffer<Document, Selector>::m_chat.add_emote_message(
		paramlist,
		from
	);

	return command_result(command_result::NO_REPLY);
}
Example #2
0
obby::command_result obby::command_map::on_help(const user& from,
                                                const std::string& paramlist)
{
	std::string reply;

	for(map_type::const_iterator iter = m_map->begin();
	    iter != m_map->end();
	    ++ iter)
	{
		reply += iter->second.name;
		reply += ' ';
		reply += iter->second.desc;
		reply += '\n';
	}

	return command_result(command_result::REPLY, reply);
}
Example #3
0
static void help_browser_run(const gchar *path)
{
	gchar *name = options->helpers.html_browser.command_name;
	gchar *cmd = options->helpers.html_browser.command_line;
	gchar *result = NULL;
	gint i;

	i = 0;
	while (!result)
		{
		if ((name && *name) || (cmd && *cmd)) {
			DEBUG_1("Trying browser: name=%s command=%s", name, cmd);
			result = command_result(name, cmd);
			DEBUG_1("Result: %s", result);
			if (result)
				{
				int ret = help_browser_command(result, path);

				if (ret == 0) break;
				g_free(result);
				result = NULL;
			}
		}
		if (!html_browsers[i]) break;
		name = html_browsers[i++];
		cmd = html_browsers[i++];
		}

	if (!result)
		{
		log_printf("Unable to detect an installed browser.\n");
		return;
		}

	g_free(result);
}