Пример #1
0
int
userlist_add_hostname (struct session *sess, char *nick, char *hostname,
							  char *realname, char *servername, char *account, unsigned int away)
{
	struct User *user;

	user = userlist_find (sess, nick);
	if (user)
	{
		if (!user->hostname && hostname)
			user->hostname = strdup (hostname);
		if (!user->realname && realname)
			user->realname = strdup (realname);
		if (!user->servername && servername)
			user->servername = strdup (servername);
		if (!user->account && account && strcmp (account, "0") != 0)
			user->account = strdup (account);

		if (away != 0xff)
		{
			if (prefs.hex_gui_ulist_show_hosts || user->away != away)
			{
				user->away = away;
				fe_userlist_rehash (sess, user);
			}
			user->away = away;
		}

		fe_userlist_update (sess, user);

		return 1;
	}
	return 0;
}
Пример #2
0
int
userlist_add_hostname (struct session *sess, char *nick, char *hostname,
							  char *realname, char *servername, unsigned int away)
{
	struct User *user;

	user = userlist_find (sess, nick);
	if (user)
	{
		if (!user->hostname && hostname)
			user->hostname = strdup (hostname);
		if (!user->realname && realname)
			user->realname = strdup (realname);
		if (!user->servername && servername)
			user->servername = strdup (servername);

		if (away != 0xff)
		{
			if (prefs.showhostname_in_userlist || user->away != away)
			{
				user->away = away;
				fe_userlist_rehash (sess, user);
			}
			user->away = away;
		}

		fe_userlist_update (sess, user);

		return 1;
	}
	return 0;
}
Пример #3
0
void
userlist_set_away (struct session *sess, const char nick[], bool away)
{
	auto user = userlist_find (sess, nick);
	if (user)
	{
		if (user->away != away)
		{
			user->away = away;
			/* rehash GUI */
			fe_userlist_rehash (sess, user);
			if (away)
				fe_userlist_update (sess, user);
		}
	}
}
Пример #4
0
void
userlist_set_away (struct session *sess, char *nick, unsigned int away)
{
	struct User *user;

	user = userlist_find (sess, nick);
	if (user)
	{
		if (user->away != away)
		{
			user->away = away;
			/* rehash GUI */
			fe_userlist_rehash (sess, user);
			if (away)
				fe_userlist_update (sess, user);
		}
	}
}
Пример #5
0
bool
userlist_add_hostname (struct session *sess, const char nick[], const char hostname[],
							const char realname[], const char servername[], const char account[], unsigned int away)
{
	auto user = userlist_find (sess, nick);
	if (user)
	{
		bool do_rehash = false;
		if (!user->hostname && hostname)
		{
			if (prefs.hex_gui_ulist_show_hosts)
				do_rehash = true;
			user->hostname = hostname;
		}
		if (!user->realname && realname && *realname)
			user->realname = std::string(realname);
		if (!user->servername && servername)
			user->servername = std::string(servername);
		if (!user->account && account && strcmp (account, "0") != 0)
			user->account = std::string(account);
		if (away != 0xff)
		{
			bool actually_away = !!away;
			if (user->away != actually_away)
				do_rehash = true;
			user->away = actually_away;
		}

		fe_userlist_update (sess, user);
		if (do_rehash)
			fe_userlist_rehash (sess, user);

		return true;
	}
	return false;
}
Пример #6
0
static int
rehash_cb (struct User *user, session *sess)
{
	fe_userlist_rehash (sess, user);
	return TRUE;
}
Пример #7
0
void
userlist_rehash (session *sess)
{
	for (auto & user : sess->usertree_alpha)
		fe_userlist_rehash(sess, user);
}