コード例 #1
0
ファイル: irc-mode.c プロジェクト: LucentW/ngircd
/**
 * Delete entries from channel invite, ban and exception lists.
 *
 * @param what Can be 'I' for invite, 'b' for ban, and 'e' for exception list.
 * @param Prefix The originator of the command.
 * @param Client The sender of the command.
 * @param Channel The channel of which the list should be modified.
 * @param Pattern The pattern to add to the list.
 * @return CONNECTED or DISCONNECTED.
 */
static bool
Del_From_List(char what, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel,
	      const char *Pattern)
{
	char mask[MASK_LEN];
	struct list_head *list = NULL;

	assert(Client != NULL);
	assert(Channel != NULL);
	assert(Pattern != NULL);
	assert(what == 'I' || what == 'b' || what == 'e');

	Lists_MakeMask(Pattern, mask, sizeof(mask));

	switch (what) {
		case 'I':
			list = Channel_GetListInvites(Channel);
			break;
		case 'b':
			list = Channel_GetListBans(Channel);
			break;
		case 'e':
			list = Channel_GetListExcepts(Channel);
			break;
	}

	if (!Lists_CheckDupeMask(list, mask))
		return CONNECTED;
	Lists_Del(list, mask);

	return Send_ListChange(false, what, Prefix, Client, Channel, mask);
}
コード例 #2
0
ファイル: class.c プロジェクト: briancollins/ngircd
GLOBAL void
Class_DeleteMask(const int Class, const char *Mask)
{
	assert(Class < CLASS_COUNT);
	assert(Mask != NULL);

	Lists_Del(&My_Classes[Class], Lists_MakeMask(Mask));
}