mirror of
https://github.com/weechat/weechat.git
synced 2026-07-03 00:03:12 +02:00
Added hostnames associeted to nicks (available for /ban completion)
This commit is contained in:
@@ -368,6 +368,54 @@ completion_list_add_channel_nicks (t_completion *completion)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_list_add_channel_nicks_hosts: add channel nicks and hosts to completion list
|
||||
*/
|
||||
|
||||
void
|
||||
completion_list_add_channel_nicks_hosts (t_completion *completion)
|
||||
{
|
||||
t_irc_nick *ptr_nick;
|
||||
char *buf;
|
||||
int length;
|
||||
|
||||
if (completion->channel)
|
||||
{
|
||||
if (((t_irc_channel *)(completion->channel))->type == CHANNEL_TYPE_CHANNEL)
|
||||
{
|
||||
for (ptr_nick = ((t_irc_channel *)(completion->channel))->nicks;
|
||||
ptr_nick; ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
ptr_nick->nick);
|
||||
if (ptr_nick->host)
|
||||
{
|
||||
length = strlen (ptr_nick->nick) + 1 +
|
||||
strlen (ptr_nick->host) + 1;
|
||||
buf = (char *) malloc (length);
|
||||
if (buf)
|
||||
{
|
||||
snprintf (buf, length, "%s!%s",
|
||||
ptr_nick->nick, ptr_nick->host);
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
buf);
|
||||
free (buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (((t_irc_channel *)(completion->channel))->type == CHANNEL_TYPE_PRIVATE)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
((t_irc_channel *)(completion->channel))->name);
|
||||
}
|
||||
completion->arg_is_nick = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_list_add_option: add config option to completion list
|
||||
*/
|
||||
@@ -733,6 +781,9 @@ completion_build_list_template (t_completion *completion, char *template)
|
||||
case 'n': /* channel nicks */
|
||||
completion_list_add_channel_nicks (completion);
|
||||
break;
|
||||
case 'N': /* channel nicks and hosts */
|
||||
completion_list_add_channel_nicks_hosts (completion);
|
||||
break;
|
||||
case 'o': /* config option */
|
||||
completion_list_add_option (completion);
|
||||
break;
|
||||
|
||||
@@ -147,6 +147,7 @@ session_save_nick (FILE *file, t_irc_nick *nick)
|
||||
rc = rc && (session_write_str (file, SESSION_NICK_NICK, nick->nick));
|
||||
rc = rc && (session_write_int (file, SESSION_NICK_FLAGS, nick->flags));
|
||||
rc = rc && (session_write_int (file, SESSION_NICK_COLOR, nick->color));
|
||||
rc = rc && (session_write_str (file, SESSION_NICK_HOST, nick->host));
|
||||
rc = rc && (session_write_id (file, SESSION_NICK_END));
|
||||
return rc;
|
||||
}
|
||||
@@ -1126,6 +1127,9 @@ session_load_nick (FILE *file)
|
||||
case SESSION_NICK_COLOR:
|
||||
rc = rc && (session_read_int (file, &(nick->color)));
|
||||
break;
|
||||
case SESSION_NICK_HOST:
|
||||
rc = rc && (session_read_str (file, &(nick->host)));
|
||||
break;
|
||||
default:
|
||||
weechat_log_printf (_("session: warning: ignoring value from "
|
||||
"nick (object id: %d)\n"));
|
||||
|
||||
@@ -113,7 +113,8 @@ enum t_session_nick
|
||||
SESSION_NICK_END = 0,
|
||||
SESSION_NICK_NICK,
|
||||
SESSION_NICK_FLAGS,
|
||||
SESSION_NICK_COLOR
|
||||
SESSION_NICK_COLOR,
|
||||
SESSION_NICK_HOST
|
||||
};
|
||||
|
||||
enum t_session_dcc
|
||||
|
||||
Reference in New Issue
Block a user