Esempio n. 1
0
static void mbb_session_free(struct mbb_session *ss)
{
	session_vars_fini(ss);

	if (ss->user != NULL)
		mbb_user_unref(ss->user);

	g_free(ss->kill_msg);
	g_free(ss->peer);
}
Esempio n. 2
0
static void mbb_task_free(struct mbb_task *task)
{
	mbb_plock_writer_lock();

	if (ht != NULL)
		g_hash_table_remove(ht, GINT_TO_POINTER(task->id));

	mbb_plock_writer_unlock();

	mbb_module_unuse(task->mod);
	mbb_user_unref(task->user);

	g_mutex_free(task->mutex);
	g_cond_free(task->cond);
	g_free(task);
}
Esempio n. 3
0
gboolean mbb_session_auth(struct mbb_session *ss, gchar *login, gchar *secret,
			  gchar *type)
{
	MbbUser *user;

	mbb_lock_reader_lock();
	user = mbb_auth(login, secret, type);
	if (user != NULL) {
		if (ss->user != NULL)
			mbb_user_unref(ss->user);

		ss->user = mbb_user_ref(user);
		mbb_log("auth as %s", user->name);
	}
	mbb_lock_reader_unlock();

	return user != NULL;
}