示例#1
0
u_short
del_user_from_channel(user_t *user, channel *chan)
{
	member *tmp, **all;

	if (!user || !chan)
		return 0;
	for (all = &chan->members; (tmp = *all); all = &((*all)->next))
		if (tmp->user == user) {
			chan->nmembers--;
			*all = tmp->next;
			leetfree(tmp, sizeof(member));
			if (chan->nmembers == 0)
				del_channel(chan);
			return 1;
		}
	return 0;
}
示例#2
0
void hCREATE(struct user *from, char *channels, time_t *ts) {
	int i;
	struct manyargs chlist;
	struct channel *c;

	VERIFY_USER(from);

	split(&chlist, channels, ',');
	for (i = 0; i < chlist.c; i++) {
		c = get_channel_by_name(chlist.v[i]);
		if (c) {
			logfmt(LOG_WARNING, "CREATE for existing channel: %s. Deleting.", chlist.v[i]);
			del_channel(c);
		}
		c = add_channel(chlist.v[i], *ts);
		chanusers_join(from, c);
		channel_plsprefix(c, from, 'o');
	}
}
示例#3
0
void hDESTRUCT(struct entity *from, struct channel *chan, time_t *ts) {
	VERIFY_CHANNEL(chan);
	if (chan->ts != *ts)
		logfmt(LOG_WARNING, "DESTRUCT for channel with mismatched ts (mine: %ld, theirs: %ld)", chan->ts, *ts);
	del_channel(chan);
}