示例#1
0
文件: channel.c 项目: 3l13/APE_Server
void rmchan(CHANNEL *chan, acetables *g_ape)
{
	if (chan->head != NULL) {
		struct userslist *head = chan->head;
		chan->flags |= CHANNEL_NONINTERACTIVE; /* Force to be non interactive (don't send LEFT raw) */
		chan->flags &= ~CHANNEL_AUTODESTROY; /* Don't destroy it */
		
		while(head != NULL) {
			struct userslist *thead = head->next;
			left(head->userinfo, chan, g_ape);
			head = thead;
		}
	}
	
	FIRE_EVENT_NULL(rmchan, chan, g_ape);
	
	rmallban(chan);
		
	hashtbl_erase(g_ape->hLusers, chan->name);
	
	clear_properties(&chan->properties);
	
	destroy_pipe(chan->pipe, g_ape);
	
	free(chan);
	chan = NULL;
}
示例#2
0
void deluser(USERS *user, acetables *g_ape)
{

	if (user == NULL) {
		return;
	}

	FIRE_EVENT_NULL(deluser, user, user->istmp, g_ape);

	left_all(user, g_ape);

	char *uin = GET_UIN_FROM_USER(user);

	/* kill all users connections */
	
	clear_subusers(user, g_ape);

	hashtbl_erase(g_ape->hSessid, user->sessid);
	if (uin != NULL && GET_USER_TBL(g_ape) != NULL) {
		hashtbl_erase(GET_USER_TBL(g_ape), uin);
	}
	if (uin != NULL && GET_ONLINE_TBL(g_ape) != NULL) {
		hashtbl_erase(GET_ONLINE_TBL(g_ape), uin);
	}

	if (user->istmp == 0) g_ape->nConnected--;
	
	if (user->prev == NULL) {
		g_ape->uHead = user->next;
	} else {
		user->prev->next = user->next;
	}
	if (user->next != NULL) {
		user->next->prev = user->prev;
	}

	clear_sessions(user);
	clear_properties(&user->properties);

	destroy_pipe(user->pipe, g_ape);
	
	HOOK_EVENT(deluser, user, g_ape);

	/* TODO Add Event */
	free(user);

}
示例#3
0
void rmchan(CHANNEL *chan, acetables *g_ape)
{

	if (chan->head != NULL) {
		return;
	}
	rmallban(chan);

		
	hashtbl_erase(g_ape->hLusers, chan->name);
	
	clear_properties(&chan->properties);
	
	destroy_pipe(chan->pipe, g_ape);
	
	free(chan);
	chan = NULL;
}
示例#4
0
文件: users.c 项目: jabis/APE_Server
void deluser(USERS *user, acetables *g_ape)
{

	if (user == NULL) {
		return;
	}

	FIRE_EVENT_NULL(deluser, user, g_ape);
	

	left_all(user, g_ape);
	
	/* kill all users connections */
	
	clear_subusers(user);

	hashtbl_erase(g_ape->hSessid, user->sessid);

	
	g_ape->nConnected--;

	
	if (user->prev == NULL) {
		g_ape->uHead = user->next;
	} else {
		user->prev->next = user->next;
	}
	if (user->next != NULL) {
		user->next->prev = user->prev;
	}

	clear_sessions(user);
	clear_properties(&user->properties);
	destroy_pipe(user->pipe, g_ape);
	
	free(user);

	user = NULL;
}
示例#5
0
void delsubuser(subuser **current, acetables *g_ape)
{
	subuser *del = *current;
	
	FIRE_EVENT_NONSTOP(delsubuser, del, g_ape);
	((*current)->user->nsub)--;
	
	*current = (*current)->next;	
	
	destroy_raw_pool(del->raw_pools.low.rawhead);
	destroy_raw_pool(del->raw_pools.high.rawhead);
	
	clear_properties(&del->properties);
	
	if (del->state == ALIVE) {
		del->wait_for_free = 1;
		do_died(del);
	} else {
		free(del);
	}
	
}
示例#6
0
void delsubuser(subuser **current, acetables *g_ape)
{
	
	subuser *del = *current;
	USERS *user = (*current)->user;

	FIRE_EVENT_NULL(delsubuser, del, g_ape);
	((*current)->user->nsub)--;
	
	*current = (*current)->next;
	
	destroy_raw_pool(del->raw_pools.low.rawhead);
	destroy_raw_pool(del->raw_pools.high.rawhead);
	del->raw_pools.low.rawhead = del->raw_pools.low.rawfoot = NULL;
	del->raw_pools.high.rawhead = del->raw_pools.high.rawfoot = NULL;
	del->raw_pools.nraw = 0;
	del->client->attach = NULL;
	
	clear_properties(&del->properties);
	
	if (del->state == ALIVE) {
		del->wait_for_free = 1;
		do_died(del);
	} else {
		free(del);
	}

	/*
	 * If this is the last subuser, del the user 
	 */
	if (user->nsub <= 0) {
		user->idle = time(NULL) - (TIMEOUT_SEC - USRLEFT_SEC);
	}

	HOOK_EVENT(delsubuser, del, g_ape);
}