Example #1
0
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;
}
Example #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);

}
Example #3
0
void register_cmd(const char *cmd, unsigned int (*func)(callbackp *), unsigned int need, acetables *g_ape)
{
	callback *new_cmd, *old_cmd;
	
	new_cmd = (callback *) xmalloc(sizeof(*new_cmd));

	new_cmd->func = func;
	new_cmd->need = need;
	
	/* Unregister old cmd if exists */
	if ((old_cmd = (callback *)hashtbl_seek(g_ape->hCallback, cmd)) != NULL) {
		hashtbl_erase(g_ape->hCallback, cmd);
	}
	
	hashtbl_append(g_ape->hCallback, cmd, (void *)new_cmd);
	
}
Example #4
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;
}
Example #5
0
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;
}
Example #6
0
void unregister_cmd(const char *cmd, acetables *g_ape)
{
	hashtbl_erase(g_ape->hCallback, cmd);
}
Example #7
0
void destroy_pipe(transpipe *pipe, acetables *g_ape)
{
	unlink_all_pipe(pipe, g_ape);
	hashtbl_erase(g_ape->hPubid, pipe->pubid);
	free(pipe);
}