• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ CMD_IRC_SERVER函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: cmd_kick

/* SYNTAX: KICK [<channel>] <nicks> [<reason>] */
static void cmd_kick(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
{
	char *channame, *nicks, *reason;
	void *free_arg;

        CMD_IRC_SERVER(server);

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

	if (*channame == '\0' || *nicks == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
	if (!ischannel(*channame)) cmd_param_error(CMDERR_NOT_JOINED);

	g_string_sprintf(tmpstr, "KICK %s %s :%s", channame, nicks, reason);
	irc_send_cmd_split(server, tmpstr->str, 3, server->max_kicks_in_cmd);

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


示例17: cmd_ping

/* SYNTAX: PING <nicks> */
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' || strcmp(data, "*") == 0) {
		if (!IS_IRC_ITEM(item))
                        cmd_return_error(CMDERR_NOT_JOINED);

		data = item->name;
	}

	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:svn2github,项目名称:irssi,代码行数:21,代码来源:irc-commands.c


示例18: cmd_invite

/* SYNTAX: INVITE <nick> [<channel>] */
static void cmd_invite(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
{
	char *nick, *channame;
	void *free_arg;

        CMD_IRC_SERVER(server);

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

	if (*nick == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
	if (*channame == '\0' || strcmp(channame, "*") == 0) {
		if (!IS_IRC_CHANNEL(item))
			cmd_param_error(CMDERR_NOT_JOINED);

		channame = IRC_CHANNEL(item)->name;
	}

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


示例19: cmd_notice

/* SYNTAX: NOTICE <targets> <message> */
static void cmd_notice(const char *data, IRC_SERVER_REC *server,
		       WI_ITEM_REC *item)
{
	char *target, *msg;
	void *free_arg;

        CMD_IRC_SERVER(server);

	if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST,
			    &target, &msg))
		return;
	if (strcmp(target, "*") == 0)
		target = item == NULL ? NULL : item->name;
	if (*target == '\0' || *msg == '\0')
		cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);

	g_string_sprintf(tmpstr, "NOTICE %s :%s", target, msg);
	irc_send_cmd_split(server, tmpstr->str, 2, server->max_msgs_in_cmd);

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


示例20: cmd_list

/* SYNTAX: LIST [-yes] [<channel>] */
static void cmd_list(const char *data, IRC_SERVER_REC *server,
		     WI_ITEM_REC *item)
{
	GHashTable *optlist;
	char *str;
	void *free_arg;

        CMD_IRC_SERVER(server);

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

	if (*str == '\0' && g_hash_table_lookup(optlist, "yes") == NULL &&
	    (server->channels_formed <= 0 ||
	     server->channels_formed > LIST_MAX_CHANNELS_PASS))
		cmd_param_error(CMDERR_NOT_GOOD_IDEA);

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CMICMDBASE_GETOPTION函数代码示例发布时间:2022-05-30
下一篇:
C++ CMDQ_ERR函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap