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

C++ IS_IRC_CHANNEL函数代码示例

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

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



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

示例1: cmd_who

/* SYNTAX: WHO <nicks>|<channels>|** */
static void cmd_who(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
{
	char *channel, *rest;
	void *free_arg;

	g_return_if_fail(data != NULL);
	if (!IS_IRC_SERVER(server) || !server->connected)
		cmd_return_error(CMDERR_NOT_CONNECTED);

	if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &channel, &rest))
		return;

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

		channel = item->name;
	}
	if (strcmp(channel, "**") == 0) {
		/* ** displays all nicks.. */
		*channel = '\0';
	}

	irc_send_cmdv(server, *rest == '\0' ? "WHO %s" : "WHO %s %s",
		      channel, rest);
	cmd_params_free(free_arg);

	/* add default redirection */
	server_redirect_default((SERVER_REC *) server, "bogus command who");
}
开发者ID:svn2github,项目名称:irssi,代码行数:31,代码来源:irc-commands.c


示例2: channel_mode_is_set

int channel_mode_is_set(IRC_CHANNEL_REC *channel, char mode)
{
	g_return_val_if_fail(IS_IRC_CHANNEL(channel), FALSE);

	return channel->mode == NULL ? FALSE :
		mode_is_set(channel->mode, mode);
}
开发者ID:svn2github,项目名称:irssi,代码行数:7,代码来源:modes.c


示例3: cmd_names

static void cmd_names(const char *data, IRC_SERVER_REC *server,
		      WI_ITEM_REC *item)
{
        GHashTable *optlist;
	char *channel;
	void *free_arg;

        CMD_IRC_SERVER(server);

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

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

		channel = IRC_CHANNEL(item)->name;
	}

	if (strcmp(channel, "**") == 0) {
		/* ** displays all nicks.. */
                irc_send_cmd(server, "NAMES");
	} else {
		irc_send_cmdv(server, "NAMES %s", channel);
	}

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


示例4: cmd_who

/* SYNTAX: WHO [<nicks> | <channels> | **] */
static void cmd_who(const char *data, IRC_SERVER_REC *server,
		    WI_ITEM_REC *item)
{
	char *channel, *rest;
	void *free_arg;

        CMD_IRC_SERVER(server);

	if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &channel, &rest))
		return;

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

		channel = IRC_CHANNEL(item)->name;
	}
	if (strcmp(channel, "**") == 0) {
		/* ** displays all nicks.. */
		*channel = '\0';
	}

	irc_send_cmdv(server, *rest == '\0' ? "WHO %s" : "WHO %s %s",
		      channel, rest);
	cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:27,代码来源:irc-commands.c


示例5: g_return_val_if_fail

char *ban_get_mask(IRC_CHANNEL_REC *channel, const char *nick)
{
	NICK_REC *rec;
	char *str, *user, *host;

	g_return_val_if_fail(IS_IRC_CHANNEL(channel), NULL);
	g_return_val_if_fail(nick != NULL, NULL);

	rec = nicklist_find(CHANNEL(channel), nick);
	if (rec == NULL || rec->host == NULL) return NULL;

	str = irc_get_mask(nick, rec->host, bantype);

	/* there's a limit of 10 characters in user mask. so, banning
	   someone with user mask of 10 characters gives us "*1234567890",
	   which is one too much.. so, replace the 10th character with '*' */
	user = strchr(str, '!');
	if (user == NULL) return str;

	host = strchr(++user, '@');
	if (host == NULL) return str;

	if ((int) (host-user) > 10) {
		/* too long user mask */
		user[9] = '*';
		g_memmove(user+10, host, strlen(host)+1);
	}
	return str;
}
开发者ID:svn2github,项目名称:irssi,代码行数:29,代码来源:bans.c


示例6: channel_destroyed

static void channel_destroyed(IRC_CHANNEL_REC *channel)
{
	if (!IS_IRC_CHANNEL(channel))
                return;

	banlist_free(channel->banlist);
}
开发者ID:svn2github,项目名称:irssi,代码行数:7,代码来源:mode-lists.c


示例7: nick_mode_change

/* Change nick's mode in channel */
static void nick_mode_change(IRC_CHANNEL_REC *channel, const char *nick,
			     char mode, int type, const char *setby)
{
	NICK_REC *nickrec;
	char modestr[2], typestr[2];

	g_return_if_fail(IS_IRC_CHANNEL(channel));
	g_return_if_fail(nick != NULL);

	nickrec = nicklist_find(CHANNEL(channel), nick);
	if (nickrec == NULL) return; /* No /names list got yet */

	if (mode == '@') nickrec->op = type == '+';
	else if (mode == '+') nickrec->voice = type == '+';
	else if (mode == '%') nickrec->halfop = type == '+';
	if (channel->server->prefix[(unsigned char) mode] != '\0') {
		if (type == '+')
			prefix_add(nickrec->prefixes, mode, (SERVER_REC *) channel->server);
		else
			prefix_del(nickrec->prefixes, mode);
	}

	modestr[0] = mode; modestr[1] = '\0';
	typestr[0] = type; typestr[1] = '\0';
	signal_emit("nick mode changed", 5,
		    channel, nickrec, setby, modestr, typestr);
}
开发者ID:hloeung,项目名称:irssi,代码行数:28,代码来源:modes.c


示例8: get_wildcard_nicks

static int get_wildcard_nicks(GString *output, const char *mask,
			      IRC_CHANNEL_REC *channel, int op, int voice)
{
	GSList *nicks, *tmp;
        int count;

	g_return_val_if_fail(output != NULL, 0);
	g_return_val_if_fail(mask != NULL, 0);
	g_return_val_if_fail(IS_IRC_CHANNEL(channel), 0);

        count = 0;
	nicks = nicklist_find_multiple(CHANNEL(channel), mask);
	for (tmp = nicks; tmp != NULL; tmp = tmp->next) {
		NICK_REC *rec = tmp->data;

		if ((op == 1 && !rec->op) || (op == 0 && rec->op) ||
		    (voice == 1 && !rec->voice) || (voice == 0 && rec->voice))
			continue;

		if (g_strcasecmp(rec->nick, channel->server->nick) == 0)
			continue;

		g_string_sprintfa(output, "%s ", rec->nick);
                count++;
	}
	g_slist_free(nicks);

        return count;
}
开发者ID:svn2github,项目名称:irssi,代码行数:29,代码来源:modes.c


示例9: sig_channel_destroyed

static void sig_channel_destroyed(IRC_CHANNEL_REC *channel)
{
	g_return_if_fail(channel != NULL);

	if (IS_IRC_CHANNEL(channel) && !channel->server->disconnected &&
	    !channel->synced)
		query_remove_all(channel);
}
开发者ID:svn2github,项目名称:irssi,代码行数:8,代码来源:channels-query.c


示例10: NICK

/* expands to your usermode on channel, op '@', halfop '%', "+" voice */
static char *expando_cumode(SERVER_REC *server, void *item, int *free_ret)
{
	if (IS_IRC_CHANNEL(item) && CHANNEL(item)->ownnick) {
		return NICK(CHANNEL(item)->ownnick)->op ? "@" :
		       NICK(CHANNEL(item)->ownnick)->halfop ? "%" :
		       NICK(CHANNEL(item)->ownnick)->voice ? "+" : "";
	}
	return "";
}
开发者ID:svn2github,项目名称:irssi,代码行数:10,代码来源:irc-expandos.c


示例11: sig_channel_destroyed

static void sig_channel_destroyed(IRC_CHANNEL_REC *channel)
{
	if (!IS_IRC_CHANNEL(channel))
                return;

	if (channel->server != NULL && !channel->left && !channel->kicked) {
		/* destroying channel record without actually
		   having left the channel yet */
		signal_emit("command part", 3, "", channel->server, channel);
	}
}
开发者ID:svn2github,项目名称:irssi,代码行数:11,代码来源:irc-channels.c


示例12: sig_remove_rejoin

/* join ok/failed - remove from rejoins list. this happens always after join
   except if the "target unavailable" error happens again */
static void sig_remove_rejoin(IRC_CHANNEL_REC *channel)
{
	REJOIN_REC *rec;

	if (!IS_IRC_CHANNEL(channel) || channel->server == NULL)
		return;

	rec = rejoin_find(channel->server, channel->name);
	if (rec != NULL && rec->joining) {
		/* join failed, remove the rejoin */
		rejoin_destroy(channel->server, rec);
	}
}
开发者ID:svn2github,项目名称:irssi,代码行数:15,代码来源:channel-rejoin.c


示例13: cmd_devoice

/* SYNTAX: DEVOICE <nicks> */
static void cmd_devoice(const char *data, IRC_SERVER_REC *server,
			IRC_CHANNEL_REC *channel)
{
	char *nicks;

	if (!IS_IRC_CHANNEL(channel))
		return;

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


示例14: channels_have_all_names

static int channels_have_all_names(IRC_SERVER_REC *server)
{
	GSList *tmp;

	for (tmp = server->channels; tmp != NULL; tmp = tmp->next) {
		IRC_CHANNEL_REC *rec = tmp->data;

		if (IS_IRC_CHANNEL(rec) && !rec->names_got)
			return 0;
	}

	return 1;
}
开发者ID:svn2github,项目名称:irssi,代码行数:13,代码来源:channels-query.c


示例15: NICK

/* expands to your usermode on channel, op '@', halfop '%', "+" voice or other */
static char *expando_cumode(SERVER_REC *server, void *item, int *free_ret)
{
	if (IS_IRC_CHANNEL(item) && CHANNEL(item)->ownnick) {
		char prefix = NICK(CHANNEL(item)->ownnick)->prefixes[0];
		if (prefix != '\0') {
			char *cumode = g_malloc(2);
			cumode[0] = prefix;
			cumode[1] = '\0';
			*free_ret = TRUE;
			return cumode;
		}
	}
	return "";
}
开发者ID:Jellyfrog,项目名称:irssi,代码行数:15,代码来源:irc-expandos.c


示例16: sig_channel_destroyed

/* destroy all knockouts in channel */
static void sig_channel_destroyed(IRC_CHANNEL_REC *channel)
{
	GSList *tmp, *next;

	if (!IS_IRC_CHANNEL(channel) || !IS_IRC_SERVER(channel->server))
		return;

	for (tmp = channel->server->knockoutlist; tmp != NULL; tmp = next) {
		KNOCKOUT_REC *rec = tmp->data;

		next = tmp->next;
		if (rec->channel == channel)
			knockout_destroy(channel->server, rec);
	}
}
开发者ID:svn2github,项目名称:irssi,代码行数:16,代码来源:irc-commands.c


示例17: nick_mode_change

/* Change nick's mode in channel */
static void nick_mode_change(IRC_CHANNEL_REC *channel, const char *nick,
			     const char mode, int type)
{
	NICK_REC *nickrec;

	g_return_if_fail(IS_IRC_CHANNEL(channel));
	g_return_if_fail(nick != NULL);

	nickrec = nicklist_find(CHANNEL(channel), nick);
	if (nickrec == NULL) return; /* No /names list got yet */

	if (mode == '@') nickrec->op = type == '+';
	if (mode == '+') nickrec->voice = type == '+';
	if (mode == '%') nickrec->halfop = type == '+';

	signal_emit("nick mode changed", 2, channel, nickrec);
}
开发者ID:svn2github,项目名称:irssi,代码行数:18,代码来源:modes.c


示例18: sig_channel_joined

static void sig_channel_joined(IRC_CHANNEL_REC *channel)
{
	if (!IS_IRC_CHANNEL(channel))
		return;

	if (!settings_get_bool("channel_sync"))
		return;

	/* Add channel to query lists */
	if (!channel->no_modes)
		query_add_channel(channel, CHANNEL_QUERY_MODE);
	query_add_channel(channel, CHANNEL_QUERY_WHO);
	if (!channel->no_modes)
		query_add_channel(channel, CHANNEL_QUERY_BMODE);

	query_check(channel->server);
}
开发者ID:svn2github,项目名称:irssi,代码行数:17,代码来源:channels-query.c


示例19: 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


示例20: NICK

/* expands to your usermode on channel, op '@', halfop '%', "+" voice or other */
static char *expando_cumode(SERVER_REC *server, void *item, int *free_ret)
{
	if (IS_IRC_CHANNEL(item) && CHANNEL(item)->ownnick) {
		char other = NICK(CHANNEL(item)->ownnick)->other;
		if (other != '\0') {
			char *cumode = g_malloc(2);
			cumode[0] = other;
			cumode[1] = '\0';
			*free_ret = TRUE;
			return cumode;
		}

		return NICK(CHANNEL(item)->ownnick)->op ? "@" :
		       NICK(CHANNEL(item)->ownnick)->halfop ? "%" :
		       NICK(CHANNEL(item)->ownnick)->voice ? "+" : "";
	}
	return "";
}
开发者ID:svn2github,项目名称:irssi,代码行数:19,代码来源:irc-expandos.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ IS_IRC_SERVER函数代码示例发布时间:2022-05-30
下一篇:
C++ IS_IP_ACQUIRED函数代码示例发布时间: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