summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2006-01-21 11:56:58 +0000
committerSebastien Helleu <flashcode@flashtux.org>2006-01-21 11:56:58 +0000
commit5aeb7921fee0a79e49e0b9d0d0bd4bce2c674a90 (patch)
treef3f3efaa2ce239ee18f65b4bc5aaf4695f0c3ee7 /src/irc
parente907b3b7a5dc3ad95741142d7477c3868da78c47 (diff)
downloadweechat-5aeb7921fee0a79e49e0b9d0d0bd4bce2c674a90.zip
Added option "irc_show_away_once", to show away message only once in pv
Diffstat (limited to 'src/irc')
-rw-r--r--src/irc/irc-channel.c4
-rw-r--r--src/irc/irc-recv.c27
-rw-r--r--src/irc/irc.h1
3 files changed, 24 insertions, 8 deletions
diff --git a/src/irc/irc-channel.c b/src/irc/irc-channel.c
index 7fb18b02c..93d8f05c0 100644
--- a/src/irc/irc-channel.c
+++ b/src/irc/irc-channel.c
@@ -66,6 +66,7 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name)
new_channel->key = NULL;
new_channel->nicks_count = 0;
new_channel->checking_away = 0;
+ new_channel->away_message = NULL;
new_channel->nicks = NULL;
new_channel->last_nick = NULL;
@@ -119,6 +120,8 @@ channel_free (t_irc_server *server, t_irc_channel *channel)
if (channel->topic)
free (channel->topic);
nick_free_all (channel);
+ if (channel->away_message)
+ free (channel->away_message);
free (channel);
server->channels = new_channels;
}
@@ -481,6 +484,7 @@ channel_print_log (t_irc_channel *channel)
weechat_log_printf (" limit. . . . : %d\n", channel->limit);
weechat_log_printf (" key. . . . . : '%s'\n", channel->key);
weechat_log_printf (" checking_away: %d\n", channel->checking_away);
+ weechat_log_printf (" away_message : '%s'\n", channel->away_message);
weechat_log_printf (" nicks. . . . : 0x%X\n", channel->nicks);
weechat_log_printf (" last_nick. . : 0x%X\n", channel->last_nick);
weechat_log_printf (" buffer . . . : 0x%X\n", channel->buffer);
diff --git a/src/irc/irc-recv.c b/src/irc/irc-recv.c
index f521d581e..f7d52b2cc 100644
--- a/src/irc/irc-recv.c
+++ b/src/irc/irc-recv.c
@@ -2564,14 +2564,25 @@ irc_cmd_recv_301 (t_irc_server *server, char *host, char *nick, char *arguments)
{
/* look for private buffer to display message */
ptr_channel = channel_search (server, pos_nick);
- ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer;
- irc_display_prefix (server, ptr_buffer, PREFIX_INFO);
- gui_printf (ptr_buffer,
- _("%s%s%s is away: %s\n"),
- GUI_COLOR(COLOR_WIN_CHAT_NICK),
- pos_nick,
- GUI_COLOR(COLOR_WIN_CHAT),
- pos_message);
+ if (!cfg_irc_show_away_once || !ptr_channel ||
+ !(ptr_channel->away_message) ||
+ (strcmp (ptr_channel->away_message, pos_message) != 0))
+ {
+ ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer;
+ irc_display_prefix (server, ptr_buffer, PREFIX_INFO);
+ gui_printf (ptr_buffer,
+ _("%s%s%s is away: %s\n"),
+ GUI_COLOR(COLOR_WIN_CHAT_NICK),
+ pos_nick,
+ GUI_COLOR(COLOR_WIN_CHAT),
+ pos_message);
+ if (ptr_channel)
+ {
+ if (ptr_channel->away_message)
+ free (ptr_channel->away_message);
+ ptr_channel->away_message = strdup (pos_message);
+ }
+ }
}
}
}
diff --git a/src/irc/irc.h b/src/irc/irc.h
index b15f67af3..d0997221c 100644
--- a/src/irc/irc.h
+++ b/src/irc/irc.h
@@ -110,6 +110,7 @@ struct t_irc_channel
char *key; /* channel key (NULL if no key is set) */
int nicks_count; /* # nicks on channel (0 if dcc/pv) */
int checking_away; /* = 1 if checking away with WHO cmd */
+ char *away_message; /* to display away only once in private */
t_irc_nick *nicks; /* nicks on the channel */
t_irc_nick *last_nick; /* last nick on the channel */
t_gui_buffer *buffer; /* GUI buffer allocated for channel */