mirror of
https://github.com/weechat/weechat.git
synced 2026-07-08 02:33:12 +02:00
irc: track realnames using extended-join and WHO
This commit is contained in:
@@ -624,7 +624,7 @@ irc_nick_nicklist_set_color_all ()
|
||||
struct t_irc_nick *
|
||||
irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel,
|
||||
const char *nickname, const char *host, const char *prefixes,
|
||||
int away, const char *account)
|
||||
int away, const char *account, const char *realname)
|
||||
{
|
||||
struct t_irc_nick *new_nick, *ptr_nick;
|
||||
int length;
|
||||
@@ -648,6 +648,9 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel,
|
||||
if (ptr_nick->account)
|
||||
free (ptr_nick->account);
|
||||
ptr_nick->account = (account) ? strdup (account) : NULL;
|
||||
if (ptr_nick->realname)
|
||||
free (ptr_nick->realname);
|
||||
ptr_nick->realname = (realname) ? strdup (realname) : NULL;
|
||||
|
||||
/* add new nick in nicklist */
|
||||
irc_nick_nicklist_add (server, channel, ptr_nick);
|
||||
@@ -663,6 +666,7 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel,
|
||||
new_nick->name = strdup (nickname);
|
||||
new_nick->host = (host) ? strdup (host) : NULL;
|
||||
new_nick->account = (account) ? strdup (account) : NULL;
|
||||
new_nick->realname = (realname) ? strdup (realname) : NULL;
|
||||
length = strlen (irc_server_get_prefix_chars (server));
|
||||
new_nick->prefixes = malloc (length + 1);
|
||||
if (!new_nick->name || !new_nick->prefixes)
|
||||
@@ -673,6 +677,8 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel,
|
||||
free (new_nick->host);
|
||||
if (new_nick->account)
|
||||
free (new_nick->account);
|
||||
if (new_nick->realname)
|
||||
free (new_nick->realname);
|
||||
if (new_nick->prefixes)
|
||||
free (new_nick->prefixes);
|
||||
free (new_nick);
|
||||
@@ -815,6 +821,8 @@ irc_nick_free (struct t_irc_server *server, struct t_irc_channel *channel,
|
||||
free (nick->prefixes);
|
||||
if (nick->account)
|
||||
free (nick->account);
|
||||
if (nick->realname)
|
||||
free (nick->realname);
|
||||
if (nick->color)
|
||||
free (nick->color);
|
||||
|
||||
@@ -1135,6 +1143,7 @@ irc_nick_hdata_nick_cb (void *data, const char *hdata_name)
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, prefix, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, away, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, account, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, realname, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, color, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, prev_nick, POINTER, 0, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, next_nick, POINTER, 0, NULL, hdata_name);
|
||||
@@ -1175,6 +1184,8 @@ irc_nick_add_to_infolist (struct t_infolist *infolist,
|
||||
return 0;
|
||||
if (!weechat_infolist_new_var_string (ptr_item, "account", nick->account))
|
||||
return 0;
|
||||
if (!weechat_infolist_new_var_string (ptr_item, "realname", nick->realname))
|
||||
return 0;
|
||||
if (!weechat_infolist_new_var_string (ptr_item, "color", nick->color))
|
||||
return 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user