예제 #1
0
파일: modes.c 프로젝트: svn2github/irssi
/* SYNTAX: DEOP <nicks> */
static void cmd_deop(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, 1, -1, &channel);
	if (nicks != NULL && *nicks != '\0')
		channel_set_singlemode(channel, nicks, "-o");
	g_free_not_null(nicks);
}
예제 #2
0
파일: modes.c 프로젝트: svn2github/irssi
/* 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);
}
예제 #3
0
파일: bans.c 프로젝트: irssi/irssi
void ban_set(IRC_CHANNEL_REC *channel, const char *bans, int ban_type)
{
	char *masks;

	g_return_if_fail(bans != NULL);

	if (ban_type <= 0)
		ban_type = default_ban_type;

	masks = ban_get_masks(channel, bans, ban_type);
	channel_set_singlemode(channel, masks, "+b");
        g_free(masks);
}
예제 #4
0
파일: bans.c 프로젝트: irssi/irssi
void ban_remove(IRC_CHANNEL_REC *channel, const char *bans)
{
	GString *str;
	GSList *tmp;
	BAN_REC *rec;
	char **ban, **banlist;
        int found;

	g_return_if_fail(bans != NULL);

	str = g_string_new(NULL);
	banlist = g_strsplit(bans, " ", -1);
	for (ban = banlist; *ban != NULL; ban++) {
                found = FALSE;
		for (tmp = channel->banlist; tmp != NULL; tmp = tmp->next) {
			rec = tmp->data;

			if (match_wildcards(*ban, rec->ban)) {
				g_string_append_printf(str, "%s ", rec->ban);
                                found = TRUE;
			}
		}

		if (!found) {
			rec = NULL;
			if (!g_ascii_strcasecmp(*ban, BAN_LAST)) {
				/* unnbanning last set ban */
				rec = g_slist_nth_data(channel->banlist,
							g_slist_length(channel->banlist) - 1);
			}
			else if (is_numeric(*ban, '\0')) {
				/* unbanning with ban# */
				rec = g_slist_nth_data(channel->banlist,
							atoi(*ban)-1);
			}
			if (rec != NULL)
				g_string_append_printf(str, "%s ", rec->ban);
			else if (!channel->synced)
				g_warning("channel %s is not synced", channel->name);
		}
	}
	g_strfreev(banlist);

	if (str->len > 0)
		channel_set_singlemode(channel, str->str, "-b");
	g_string_free(str, TRUE);
}