当前位置: 首页>>代码示例>>C++>>正文


C++ CMD_IRC_SERVER函数代码示例

本文整理汇总了C++中CMD_IRC_SERVER函数的典型用法代码示例。如果您正苦于以下问题:C++ CMD_IRC_SERVER函数的具体用法?C++ CMD_IRC_SERVER怎么用?C++ CMD_IRC_SERVER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CMD_IRC_SERVER函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: command_2self

static void command_2self(const char *data, IRC_SERVER_REC *server)
{
	char *target, *text;
	void *free_arg;

        CMD_IRC_SERVER(server);

	if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &target, &text))
		return;
	if (*target == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
	irc_send_cmdv(server, "%s %s :%s", current_command, target, text);
	cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:13,代码来源:irc-commands.c

示例2: cmd_op

/* SYNTAX: OP <nicks> */
static void cmd_op(const char *data, IRC_SERVER_REC *server,
		   WI_ITEM_REC *item)
{
        IRC_CHANNEL_REC *channel;
	char *nicks;

	CMD_IRC_SERVER(server);

	nicks = get_nicks(server, item, data, 0, -1, &channel);
	if (nicks != NULL && *nicks != '\0')
		channel_set_singlemode(channel, nicks, "+o");
	g_free_not_null(nicks);
}
开发者ID:svn2github,项目名称:irssi,代码行数:14,代码来源:modes.c

示例3: cmd_wall

/* SYNTAX: WALL [<channel>] <message> */
static void cmd_wall(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
{
	char *channame, *msg, *args, *recoded;
	void *free_arg;
	IRC_CHANNEL_REC *chanrec;
	GSList *tmp, *nicks;

        CMD_IRC_SERVER(server);

	if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTCHAN |
			    PARAM_FLAG_GETREST, item, &channame, &msg))
		return;
	if (*msg == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);

	chanrec = irc_channel_find(server, channame);
	if (chanrec == NULL) cmd_param_error(CMDERR_CHAN_NOT_FOUND);

	/* See if the server has advertised support of wallchops */
	if (g_hash_table_lookup(chanrec->server->isupport, "statusmsg") ||
	    g_hash_table_lookup(chanrec->server->isupport, "wallchops"))
		irc_send_cmdv(server, "NOTICE @%s :%s", chanrec->name, msg);
	else {
		/* Fall back to manually noticing each op */
		nicks = NULL;
		g_hash_table_foreach(chanrec->nicks,
				     (GHFunc) cmd_wall_hash, &nicks);

		args = g_strconcat(chanrec->name, " ", msg, NULL);
		msg = parse_special_string(settings_get_str("wall_format"),
					   SERVER(server), item, args, NULL, 0);
		g_free(args);

		recoded = recode_out(SERVER(server), msg, channame);

		for (tmp = nicks; tmp != NULL; tmp = tmp->next) {
			NICK_REC *rec = tmp->data;

			if (rec != chanrec->ownnick) {
				irc_send_cmdv(server, "NOTICE %s :%s",
					      rec->nick, recoded);
			}
		}

		g_free(recoded);
		g_free(msg);
		g_slist_free(nicks);
	}

	cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:51,代码来源:irc-commands.c

示例4: cmd_server_purge

/* SYNTAX: SERVER PURGE [<target>] */
static void cmd_server_purge(const char *data, IRC_SERVER_REC *server)
{
        char *target;
	void *free_arg;

        CMD_IRC_SERVER(server);

	if (!cmd_get_params(data, &free_arg, 1, &target))
		return;

	irc_server_purge_output(server, *target == '\0' ? NULL : target);

	cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:15,代码来源:irc-commands.c

示例5: cmd_oper

/* SYNTAX: OPER [<nick> [<password>]] */
static void cmd_oper(const char *data, IRC_SERVER_REC *server)
{
	char *nick, *password;
	void *free_arg;

        CMD_IRC_SERVER(server);

        /* asking for password is handled by fe-common */
	if (!cmd_get_params(data, &free_arg, 2, &nick, &password))
		return;
        if (*password == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);

	irc_send_cmdv(server, "OPER %s %s", nick, password);
	cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:16,代码来源:irc-commands.c

示例6: cmd_ver

/* SYNTAX: VER [<nick> | <channel> | *] */
static void cmd_ver(gchar *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
{
	char *str;

	g_return_if_fail(data != NULL);

        CMD_IRC_SERVER(server);
	if (*data == '\0' && !IS_QUERY(item))
		cmd_return_error(CMDERR_NOT_ENOUGH_PARAMS);

	str = g_strdup_printf("%s VERSION", *data == '\0' ?
			      window_item_get_target(item) : data);
	signal_emit("command ctcp", 3, str, server, item);
	g_free(str);
}
开发者ID:Liaf,项目名称:irssi,代码行数:16,代码来源:fe-irc-commands.c

示例7: cmd_wallchops

/* SYNTAX: WALLCHOPS <channel> <message> */
static void cmd_wallchops(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
{
	char *channame, *msg;
	void *free_arg;

        CMD_IRC_SERVER(server);

	if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTCHAN |
			    PARAM_FLAG_GETREST, item, &channame, &msg))
		return;
	if (*msg == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);

	irc_send_cmdv(server, "WALLCHOPS %s :%s", channame, msg);

	cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:17,代码来源:irc-commands.c

示例8: cmd_wallchops

static void cmd_wallchops(const char *data, IRC_SERVER_REC *server,
			  WI_ITEM_REC *item)
{
	char *channame, *msg;
	void *free_arg;

        CMD_IRC_SERVER(server);

	if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTCHAN |
			    PARAM_FLAG_GETREST, item, &channame, &msg))
		return;
	if (*msg == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);

	signal_emit("message irc own_wall", 3, server, msg, channame);

	cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:17,代码来源:fe-irc-commands.c

示例9: cmd_kickban

/* SYNTAX: KICKBAN [<channel>] <nicks> <reason> */
static void cmd_kickban(const char *data, IRC_SERVER_REC *server,
			WI_ITEM_REC *item)
{
        IRC_CHANNEL_REC *chanrec;
	char *channel, *nicks, *reason, *kickcmd, *bancmd, *recoded;
        char **nicklist, *spacenicks;
	void *free_arg;

        CMD_IRC_SERVER(server);

	if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_OPTCHAN | PARAM_FLAG_GETREST,
			    item, &channel, &nicks, &reason))
		return;

	if (*channel == '\0' || *nicks == '\0')
		cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);

	chanrec = irc_channel_find(server, channel);
	if (chanrec == NULL)
		cmd_param_error(CMDERR_CHAN_NOT_FOUND);
	if (!chanrec->wholist)
		cmd_param_error(CMDERR_CHAN_NOT_SYNCED);

	nicklist = g_strsplit(nicks, ",", -1);
        spacenicks = g_strjoinv(" ", nicklist);
	g_strfreev(nicklist);

	recoded = recode_out(SERVER(server), reason, channel);
	kickcmd = g_strdup_printf("%s %s %s", chanrec->name, nicks, recoded);
	g_free(recoded);

	bancmd = g_strdup_printf("%s %s", chanrec->name, spacenicks);
        g_free(spacenicks);

        if (settings_get_bool("kick_first_on_kickban")) {
		signal_emit("command kick", 3, kickcmd, server, chanrec);
		signal_emit("command ban", 3, bancmd, server, chanrec);
	} else {
		signal_emit("command ban", 3, bancmd, server, chanrec);
		signal_emit("command kick", 3, kickcmd, server, chanrec);
	}
	g_free(kickcmd);
	g_free(bancmd);

	cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:47,代码来源:irc-commands.c

示例10: cmd_mode

/* SYNTAX: MODE <your nick>|<channel> [<mode> [<mode parameters>]] */
static void cmd_mode(const char *data, IRC_SERVER_REC *server,
		     IRC_CHANNEL_REC *channel)
{
	IRC_CHANNEL_REC *chanrec;
	char *target, *mode;
	void *free_arg;

        CMD_IRC_SERVER(server);

	if (*data == '+' || *data == '-') {
		target = "*";
		if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_GETREST, &mode))
			return;
	} else {
		if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &target, &mode))
			return;
	}

	if (strcmp(target, "*") == 0) {
		if (!IS_IRC_CHANNEL(channel))
			cmd_param_error(CMDERR_NOT_JOINED);

		target = channel->name;
	}
	if (*target == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);

	if (*mode == '\0') {
		chanrec = irc_channel_find(server, target);
		if (chanrec != NULL)
			target = chanrec->name;

		irc_send_cmdv(server, "MODE %s", target);
	} else if (ischannel(*target))
		channel_set_mode(server, target, mode);
	else {
		if (g_strcasecmp(target, server->nick) == 0) {
			server_redirect_event(server, "mode user", 1, target, -1, NULL,
					      "event mode", "requested usermode change", NULL);
		}

		irc_send_cmdv(server, "MODE %s %s", target, mode);
	}

	cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:46,代码来源:modes.c

示例11: cmd_away

/* SYNTAX: AWAY [-one | -all] [<reason>] */
static void cmd_away(const char *data, IRC_SERVER_REC *server)
{
	GHashTable *optlist;
	char *reason;
	void *free_arg;

        CMD_IRC_SERVER(server);

	if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS |
			    PARAM_FLAG_GETREST, "away", &optlist, &reason)) return;

	if (g_hash_table_lookup(optlist, "one") != NULL)
		server_send_away(server, reason);
	else
		g_slist_foreach(servers, (GFunc) server_send_away, reason);

	cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:19,代码来源:irc-commands.c

示例12: cmd_nick

/* SYNTAX: NICK <new nick> */
static void cmd_nick(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
{
        char *nick;
	void *free_arg;

	g_return_if_fail(data != NULL);

        CMD_IRC_SERVER(server);

	if (!cmd_get_params(data, &free_arg, 1, &nick))
		return;

	g_free(server->last_nick);
	server->last_nick = g_strdup(nick);

	irc_send_cmdv(server, "NICK %s", nick);
	cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:19,代码来源:irc-commands.c

示例13: cmd_nctcp

static void cmd_nctcp(const char *data, IRC_SERVER_REC *server,
		      WI_ITEM_REC *item)
{
	const char *target, *text;
	void *free_arg;

        CMD_IRC_SERVER(server);

	if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST,
			    &target, &text))
		return;
	if (g_strcmp0(target, "*") == 0)
		target = item == NULL ? "" : window_item_get_target(item);
	if (*target == '\0' || *text == '\0')
		cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);

	signal_emit("message irc own_notice", 3, server, text, target);
	cmd_params_free(free_arg);
}
开发者ID:Liaf,项目名称:irssi,代码行数:19,代码来源:fe-irc-commands.c

示例14: cmd_topic

/* SYNTAX: TOPIC [-delete] [<channel>] [<topic>] */
static void cmd_topic(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
{
	GHashTable *optlist;
	char *channame, *topic;
	void *free_arg;

        CMD_IRC_SERVER(server);

	if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTCHAN |
			    PARAM_FLAG_OPTIONS | PARAM_FLAG_GETREST,
			    item, "topic", &optlist, &channame, &topic))
		return;

	irc_send_cmdv(server, *topic == '\0' &&
		      g_hash_table_lookup(optlist, "delete") == NULL ?
		      "TOPIC %s" : "TOPIC %s :%s", channame, topic);

	cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:20,代码来源:irc-commands.c

示例15: cmd_ping

/* SYNTAX: PING [<nick> | <channel> | *] */
static void cmd_ping(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
{
	GTimeVal tv;
        char *str;

        CMD_IRC_SERVER(server);

	if (*data == '\0') {
		if (!IS_QUERY(item))
			cmd_return_error(CMDERR_NOT_ENOUGH_PARAMS);
		data = window_item_get_target(item);
	}

	g_get_current_time(&tv);

	str = g_strdup_printf("%s PING %ld %ld", data, tv.tv_sec, tv.tv_usec);
	signal_emit("command ctcp", 3, str, server, item);
	g_free(str);
}
开发者ID:btamada,项目名称:irssi,代码行数:20,代码来源:irc-commands.c


注:本文中的CMD_IRC_SERVER函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。