mirror of
https://github.com/weechat/weechat.git
synced 2026-06-27 05:16:38 +02:00
Added hostnames associeted to nicks (available for /ban completion)
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2006-04-04
|
||||
|
||||
ChangeLog - 2006-04-08
|
||||
|
||||
Version 0.1.9 (under dev!):
|
||||
* added hostnames associeted to nicks (available for /ban completion)
|
||||
* added "+p" mode for channels, fixed mode display in status bar
|
||||
* added nick alignment options
|
||||
* fixed crash when closing DCC chat buffer
|
||||
* fixed /names command: now displays result when not on a channel
|
||||
* fixed refresh bug (too many refresh) when terminal is resized
|
||||
* fixed nicklist display bugs when on top or bottom of chat window
|
||||
|
||||
@@ -2009,6 +2009,10 @@ plugin->msg_handler_add (plugin, "KICK", &msg_kick, NULL, NULL);
|
||||
<entry><literal>%n</literal></entry>
|
||||
<entry>nicks of current channel</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>%N</literal></entry>
|
||||
<entry>nicks and hostnames of current channel</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>%o</literal></entry>
|
||||
<entry>setup options</entry>
|
||||
|
||||
@@ -2050,6 +2050,13 @@ plugin->msg_handler_add (plugin, "KICK", &msg_kick, NULL, NULL);
|
||||
<entry><literal>%n</literal></entry>
|
||||
<entry>pseudos du canal courant</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>%N</literal></entry>
|
||||
<entry>
|
||||
pseudos et noms de machines du canal
|
||||
courant
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>%o</literal></entry>
|
||||
<entry>options de configuration</entry>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -340,11 +340,11 @@ channel_remove_away (t_irc_channel *channel)
|
||||
*/
|
||||
|
||||
void
|
||||
channel_check_away (t_irc_server *server, t_irc_channel *channel)
|
||||
channel_check_away (t_irc_server *server, t_irc_channel *channel, int force)
|
||||
{
|
||||
if (channel->type == CHANNEL_TYPE_CHANNEL)
|
||||
{
|
||||
if ((cfg_irc_away_check_max_nicks == 0) ||
|
||||
if (force || (cfg_irc_away_check_max_nicks == 0) ||
|
||||
(channel->nicks_count <= cfg_irc_away_check_max_nicks))
|
||||
{
|
||||
channel->checking_away++;
|
||||
|
||||
@@ -52,7 +52,7 @@ t_irc_command irc_commands[] =
|
||||
N_("[channel] [nickname [nickname ...]]"),
|
||||
N_(" channel: channel for ban\n"
|
||||
"nickname: user or host to ban"),
|
||||
"", 0, MAX_ARGS, 1, NULL, irc_cmd_send_ban, NULL },
|
||||
"%N", 0, MAX_ARGS, 1, NULL, irc_cmd_send_ban, NULL },
|
||||
{ "ctcp", N_("send a CTCP message (Client-To-Client Protocol)"),
|
||||
N_("nickname type [arguments]"),
|
||||
N_(" nickname: user to send CTCP to\n"
|
||||
|
||||
+14
-5
@@ -192,6 +192,7 @@ nick_new (t_irc_server *server, t_irc_channel *channel, char *nick_name,
|
||||
|
||||
/* initialize new nick */
|
||||
new_nick->nick = strdup (nick_name);
|
||||
new_nick->host = NULL;
|
||||
new_nick->flags = 0;
|
||||
NICK_SET_FLAG(new_nick, is_chanowner, NICK_CHANOWNER);
|
||||
NICK_SET_FLAG(new_nick, is_chanadmin, NICK_CHANADMIN);
|
||||
@@ -278,12 +279,14 @@ nick_free (t_irc_channel *channel, t_irc_nick *nick)
|
||||
|
||||
if (nick->next_nick)
|
||||
(nick->next_nick)->prev_nick = nick->prev_nick;
|
||||
|
||||
|
||||
channel->nicks_count--;
|
||||
|
||||
/* free data */
|
||||
if (nick->nick)
|
||||
free (nick->nick);
|
||||
if (nick->host)
|
||||
free (nick->host);
|
||||
free (nick);
|
||||
channel->nicks = new_nicks;
|
||||
}
|
||||
@@ -389,11 +392,16 @@ nick_get_max_length (t_irc_channel *channel)
|
||||
void
|
||||
nick_set_away (t_irc_channel *channel, t_irc_nick *nick, int is_away)
|
||||
{
|
||||
if (((is_away) && (!(nick->flags & NICK_AWAY))) ||
|
||||
((!is_away) && (nick->flags & NICK_AWAY)))
|
||||
if ((cfg_irc_away_check > 0)
|
||||
&& ((cfg_irc_away_check_max_nicks == 0) ||
|
||||
(channel->nicks_count <= cfg_irc_away_check_max_nicks)))
|
||||
{
|
||||
NICK_SET_FLAG(nick, is_away, NICK_AWAY);
|
||||
gui_draw_buffer_nick (channel->buffer, 0);
|
||||
if (((is_away) && (!(nick->flags & NICK_AWAY))) ||
|
||||
((!is_away) && (nick->flags & NICK_AWAY)))
|
||||
{
|
||||
NICK_SET_FLAG(nick, is_away, NICK_AWAY);
|
||||
gui_draw_buffer_nick (channel->buffer, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -405,6 +413,7 @@ void
|
||||
nick_print_log (t_irc_nick *nick)
|
||||
{
|
||||
weechat_log_printf ("=> nick %s (addr:0x%X)]\n", nick->nick, nick);
|
||||
weechat_log_printf (" host . . . . . : %s\n", nick->host);
|
||||
weechat_log_printf (" flags. . . . . : %d\n", nick->flags);
|
||||
weechat_log_printf (" color. . . . . : %d\n", nick->color);
|
||||
weechat_log_printf (" prev_nick. . . : 0x%X\n", nick->prev_nick);
|
||||
|
||||
+16
-5
@@ -402,6 +402,7 @@ int
|
||||
irc_cmd_recv_join (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
t_irc_channel *ptr_channel;
|
||||
t_irc_nick *ptr_nick;
|
||||
char *pos;
|
||||
|
||||
command_ignored |= ignore_check (host, "join", arguments, server->name);
|
||||
@@ -422,9 +423,9 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *nick, char *arguments
|
||||
BUFFER_TYPE_STANDARD, 1);
|
||||
}
|
||||
|
||||
pos = strchr (host, '!');
|
||||
if (!command_ignored)
|
||||
{
|
||||
pos = strchr (host, '!');
|
||||
irc_display_prefix (server, ptr_channel->buffer, PREFIX_JOIN);
|
||||
gui_printf (ptr_channel->buffer,
|
||||
_("%s%s %s(%s%s%s)%s has joined %s%s\n"),
|
||||
@@ -432,13 +433,15 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *nick, char *arguments
|
||||
nick,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HOST),
|
||||
(pos) ? pos + 1 : "",
|
||||
(pos) ? pos + 1 : host,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
arguments);
|
||||
}
|
||||
(void) nick_new (server, ptr_channel, nick, 0, 0, 0, 0, 0);
|
||||
ptr_nick = nick_new (server, ptr_channel, nick, 0, 0, 0, 0, 0);
|
||||
if (ptr_nick)
|
||||
ptr_nick->host = strdup ((pos) ? pos + 1 : host);
|
||||
gui_draw_buffer_nick (ptr_channel->buffer, 1);
|
||||
gui_draw_buffer_status (ptr_channel->buffer, 1);
|
||||
return 0;
|
||||
@@ -4373,6 +4376,7 @@ irc_cmd_recv_352 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
char *pos_channel, *pos_user, *pos_host, *pos_server, *pos_nick;
|
||||
char *pos_attr, *pos_hopcount, *pos_realname;
|
||||
int length;
|
||||
t_irc_channel *ptr_channel;
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
@@ -4443,8 +4447,16 @@ irc_cmd_recv_352 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
ptr_nick = nick_search (ptr_channel, pos_nick);
|
||||
if (ptr_nick)
|
||||
{
|
||||
if (ptr_nick->host)
|
||||
free (ptr_nick->host);
|
||||
length = strlen (pos_user) + 1 + strlen (pos_host) + 1;
|
||||
ptr_nick->host = (char *) malloc (length);
|
||||
if (ptr_nick->host)
|
||||
snprintf (ptr_nick->host, length, "%s@%s", pos_user, pos_host);
|
||||
nick_set_away (ptr_channel, ptr_nick,
|
||||
(pos_attr[0] == 'G') ? 1 : 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4744,8 +4756,7 @@ irc_cmd_recv_366 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK));
|
||||
}
|
||||
irc_cmd_send_mode (server, NULL, ptr_channel->name);
|
||||
if (cfg_irc_away_check > 0)
|
||||
channel_check_away (server, ptr_channel);
|
||||
channel_check_away (server, ptr_channel, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1837,7 +1837,7 @@ server_check_away ()
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHANNEL_TYPE_CHANNEL)
|
||||
channel_check_away (ptr_server, ptr_channel);
|
||||
channel_check_away (ptr_server, ptr_channel, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -69,6 +69,7 @@ typedef struct t_irc_nick t_irc_nick;
|
||||
struct t_irc_nick
|
||||
{
|
||||
char *nick; /* nickname */
|
||||
char *host; /* full hostname */
|
||||
int flags; /* chanowner/chanadmin (unrealircd), */
|
||||
/* op, halfop, voice, away */
|
||||
int color; /* color for nickname in chat window */
|
||||
@@ -359,7 +360,7 @@ extern char *channel_get_charset_encode (t_irc_server *, t_irc_channel *);
|
||||
extern char *channel_iconv_decode (t_irc_server *, t_irc_channel *, char *);
|
||||
extern char *channel_iconv_encode (t_irc_server *, t_irc_channel *, char *);
|
||||
extern void channel_remove_away (t_irc_channel *);
|
||||
extern void channel_check_away (t_irc_server *, t_irc_channel *);
|
||||
extern void channel_check_away (t_irc_server *, t_irc_channel *, int);
|
||||
extern void channel_set_away (t_irc_channel *, char *, int);
|
||||
extern int channel_create_dcc (t_irc_dcc *);
|
||||
extern void channel_remove_dcc (t_irc_dcc *);
|
||||
|
||||
+3
-2
@@ -1,12 +1,13 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2006-04-04
|
||||
|
||||
ChangeLog - 2006-04-08
|
||||
|
||||
Version 0.1.9 (under dev!):
|
||||
* added hostnames associeted to nicks (available for /ban completion)
|
||||
* added "+p" mode for channels, fixed mode display in status bar
|
||||
* added nick alignment options
|
||||
* fixed crash when closing DCC chat buffer
|
||||
* fixed /names command: now displays result when not on a channel
|
||||
* fixed refresh bug (too many refresh) when terminal is resized
|
||||
* fixed nicklist display bugs when on top or bottom of chat window
|
||||
|
||||
@@ -2009,6 +2009,10 @@ plugin->msg_handler_add (plugin, "KICK", &msg_kick, NULL, NULL);
|
||||
<entry><literal>%n</literal></entry>
|
||||
<entry>nicks of current channel</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>%N</literal></entry>
|
||||
<entry>nicks and hostnames of current channel</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>%o</literal></entry>
|
||||
<entry>setup options</entry>
|
||||
|
||||
@@ -2050,6 +2050,13 @@ plugin->msg_handler_add (plugin, "KICK", &msg_kick, NULL, NULL);
|
||||
<entry><literal>%n</literal></entry>
|
||||
<entry>pseudos du canal courant</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>%N</literal></entry>
|
||||
<entry>
|
||||
pseudos et noms de machines du canal
|
||||
courant
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>%o</literal></entry>
|
||||
<entry>options de configuration</entry>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -340,11 +340,11 @@ channel_remove_away (t_irc_channel *channel)
|
||||
*/
|
||||
|
||||
void
|
||||
channel_check_away (t_irc_server *server, t_irc_channel *channel)
|
||||
channel_check_away (t_irc_server *server, t_irc_channel *channel, int force)
|
||||
{
|
||||
if (channel->type == CHANNEL_TYPE_CHANNEL)
|
||||
{
|
||||
if ((cfg_irc_away_check_max_nicks == 0) ||
|
||||
if (force || (cfg_irc_away_check_max_nicks == 0) ||
|
||||
(channel->nicks_count <= cfg_irc_away_check_max_nicks))
|
||||
{
|
||||
channel->checking_away++;
|
||||
|
||||
@@ -52,7 +52,7 @@ t_irc_command irc_commands[] =
|
||||
N_("[channel] [nickname [nickname ...]]"),
|
||||
N_(" channel: channel for ban\n"
|
||||
"nickname: user or host to ban"),
|
||||
"", 0, MAX_ARGS, 1, NULL, irc_cmd_send_ban, NULL },
|
||||
"%N", 0, MAX_ARGS, 1, NULL, irc_cmd_send_ban, NULL },
|
||||
{ "ctcp", N_("send a CTCP message (Client-To-Client Protocol)"),
|
||||
N_("nickname type [arguments]"),
|
||||
N_(" nickname: user to send CTCP to\n"
|
||||
|
||||
@@ -192,6 +192,7 @@ nick_new (t_irc_server *server, t_irc_channel *channel, char *nick_name,
|
||||
|
||||
/* initialize new nick */
|
||||
new_nick->nick = strdup (nick_name);
|
||||
new_nick->host = NULL;
|
||||
new_nick->flags = 0;
|
||||
NICK_SET_FLAG(new_nick, is_chanowner, NICK_CHANOWNER);
|
||||
NICK_SET_FLAG(new_nick, is_chanadmin, NICK_CHANADMIN);
|
||||
@@ -278,12 +279,14 @@ nick_free (t_irc_channel *channel, t_irc_nick *nick)
|
||||
|
||||
if (nick->next_nick)
|
||||
(nick->next_nick)->prev_nick = nick->prev_nick;
|
||||
|
||||
|
||||
channel->nicks_count--;
|
||||
|
||||
/* free data */
|
||||
if (nick->nick)
|
||||
free (nick->nick);
|
||||
if (nick->host)
|
||||
free (nick->host);
|
||||
free (nick);
|
||||
channel->nicks = new_nicks;
|
||||
}
|
||||
@@ -389,11 +392,16 @@ nick_get_max_length (t_irc_channel *channel)
|
||||
void
|
||||
nick_set_away (t_irc_channel *channel, t_irc_nick *nick, int is_away)
|
||||
{
|
||||
if (((is_away) && (!(nick->flags & NICK_AWAY))) ||
|
||||
((!is_away) && (nick->flags & NICK_AWAY)))
|
||||
if ((cfg_irc_away_check > 0)
|
||||
&& ((cfg_irc_away_check_max_nicks == 0) ||
|
||||
(channel->nicks_count <= cfg_irc_away_check_max_nicks)))
|
||||
{
|
||||
NICK_SET_FLAG(nick, is_away, NICK_AWAY);
|
||||
gui_draw_buffer_nick (channel->buffer, 0);
|
||||
if (((is_away) && (!(nick->flags & NICK_AWAY))) ||
|
||||
((!is_away) && (nick->flags & NICK_AWAY)))
|
||||
{
|
||||
NICK_SET_FLAG(nick, is_away, NICK_AWAY);
|
||||
gui_draw_buffer_nick (channel->buffer, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -405,6 +413,7 @@ void
|
||||
nick_print_log (t_irc_nick *nick)
|
||||
{
|
||||
weechat_log_printf ("=> nick %s (addr:0x%X)]\n", nick->nick, nick);
|
||||
weechat_log_printf (" host . . . . . : %s\n", nick->host);
|
||||
weechat_log_printf (" flags. . . . . : %d\n", nick->flags);
|
||||
weechat_log_printf (" color. . . . . : %d\n", nick->color);
|
||||
weechat_log_printf (" prev_nick. . . : 0x%X\n", nick->prev_nick);
|
||||
|
||||
@@ -402,6 +402,7 @@ int
|
||||
irc_cmd_recv_join (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
t_irc_channel *ptr_channel;
|
||||
t_irc_nick *ptr_nick;
|
||||
char *pos;
|
||||
|
||||
command_ignored |= ignore_check (host, "join", arguments, server->name);
|
||||
@@ -422,9 +423,9 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *nick, char *arguments
|
||||
BUFFER_TYPE_STANDARD, 1);
|
||||
}
|
||||
|
||||
pos = strchr (host, '!');
|
||||
if (!command_ignored)
|
||||
{
|
||||
pos = strchr (host, '!');
|
||||
irc_display_prefix (server, ptr_channel->buffer, PREFIX_JOIN);
|
||||
gui_printf (ptr_channel->buffer,
|
||||
_("%s%s %s(%s%s%s)%s has joined %s%s\n"),
|
||||
@@ -432,13 +433,15 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *nick, char *arguments
|
||||
nick,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HOST),
|
||||
(pos) ? pos + 1 : "",
|
||||
(pos) ? pos + 1 : host,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
arguments);
|
||||
}
|
||||
(void) nick_new (server, ptr_channel, nick, 0, 0, 0, 0, 0);
|
||||
ptr_nick = nick_new (server, ptr_channel, nick, 0, 0, 0, 0, 0);
|
||||
if (ptr_nick)
|
||||
ptr_nick->host = strdup ((pos) ? pos + 1 : host);
|
||||
gui_draw_buffer_nick (ptr_channel->buffer, 1);
|
||||
gui_draw_buffer_status (ptr_channel->buffer, 1);
|
||||
return 0;
|
||||
@@ -4373,6 +4376,7 @@ irc_cmd_recv_352 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
char *pos_channel, *pos_user, *pos_host, *pos_server, *pos_nick;
|
||||
char *pos_attr, *pos_hopcount, *pos_realname;
|
||||
int length;
|
||||
t_irc_channel *ptr_channel;
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
@@ -4443,8 +4447,16 @@ irc_cmd_recv_352 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
ptr_nick = nick_search (ptr_channel, pos_nick);
|
||||
if (ptr_nick)
|
||||
{
|
||||
if (ptr_nick->host)
|
||||
free (ptr_nick->host);
|
||||
length = strlen (pos_user) + 1 + strlen (pos_host) + 1;
|
||||
ptr_nick->host = (char *) malloc (length);
|
||||
if (ptr_nick->host)
|
||||
snprintf (ptr_nick->host, length, "%s@%s", pos_user, pos_host);
|
||||
nick_set_away (ptr_channel, ptr_nick,
|
||||
(pos_attr[0] == 'G') ? 1 : 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4744,8 +4756,7 @@ irc_cmd_recv_366 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK));
|
||||
}
|
||||
irc_cmd_send_mode (server, NULL, ptr_channel->name);
|
||||
if (cfg_irc_away_check > 0)
|
||||
channel_check_away (server, ptr_channel);
|
||||
channel_check_away (server, ptr_channel, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1837,7 +1837,7 @@ server_check_away ()
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHANNEL_TYPE_CHANNEL)
|
||||
channel_check_away (ptr_server, ptr_channel);
|
||||
channel_check_away (ptr_server, ptr_channel, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@ typedef struct t_irc_nick t_irc_nick;
|
||||
struct t_irc_nick
|
||||
{
|
||||
char *nick; /* nickname */
|
||||
char *host; /* full hostname */
|
||||
int flags; /* chanowner/chanadmin (unrealircd), */
|
||||
/* op, halfop, voice, away */
|
||||
int color; /* color for nickname in chat window */
|
||||
@@ -359,7 +360,7 @@ extern char *channel_get_charset_encode (t_irc_server *, t_irc_channel *);
|
||||
extern char *channel_iconv_decode (t_irc_server *, t_irc_channel *, char *);
|
||||
extern char *channel_iconv_encode (t_irc_server *, t_irc_channel *, char *);
|
||||
extern void channel_remove_away (t_irc_channel *);
|
||||
extern void channel_check_away (t_irc_server *, t_irc_channel *);
|
||||
extern void channel_check_away (t_irc_server *, t_irc_channel *, int);
|
||||
extern void channel_set_away (t_irc_channel *, char *, int);
|
||||
extern int channel_create_dcc (t_irc_dcc *);
|
||||
extern void channel_remove_dcc (t_irc_dcc *);
|
||||
|
||||
Reference in New Issue
Block a user