Пример #1
0
void
inbound_user_info (session * sess, char *chan, char *user, char *host,
                   char *servname, char *nick, char *realname,
                   unsigned int away)
{
    server *serv = sess->server;
    session *who_sess;
    GSList *list;
    char *uhost = NULL;

    if (user && host)
    {
        uhost = g_malloc (strlen (user) + strlen (host) + 2);
        sprintf (uhost, "%s@%s", user, host);
    }

    if (chan)
    {
        who_sess = find_channel (serv, chan);
        if (who_sess)
            userlist_add_hostname (who_sess, nick, uhost, realname,
                                   servname, away);
        else
        {
            if (serv->doing_dns && nick && host)
                do_dns (sess, nick, host);
        }
    }
    else
    {
        /* came from WHOIS, not channel specific */
        for (list = sess_list; list; list = list->next)
        {
            sess = list->data;
            if (sess->type == SESS_CHANNEL && sess->server == serv)
            {
                userlist_add_hostname (sess, nick, uhost, realname,
                                       servname, away);
            }
        }
    }

    g_free (uhost);
}
Пример #2
0
int
inbound_user_info (session *sess, char *chan, char *user, char *host,
						 char *servname, char *nick, char *realname,
						 unsigned int away)
{
	server *serv = sess->server;
	session *who_sess;
	char *uhost;

	who_sess = find_channel (serv, chan);
	if (who_sess)
	{
		if (user && host)
		{
			uhost = malloc (strlen (user) + strlen (host) + 2);
			sprintf (uhost, "%s@%s", user, host);
			if (!userlist_add_hostname (who_sess, nick, uhost, realname, servname, away))
			{
				if (!who_sess->doing_who)
				{
					free (uhost);
					return 0;
				}
			}
			free (uhost);
		} else
		{
			if (!userlist_add_hostname (who_sess, nick, NULL, realname, servname, away))
			{
				if (!who_sess->doing_who)
					return 0;
			}
		}
	} else
	{
		if (!serv->doing_dns)
			return 0;
		if (nick && host)
			do_dns (sess, nick, host);
	}
	return 1;
}