summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2009-01-05 11:19:00 +0100
committerSebastien Helleu <flashcode@flashtux.org>2009-01-05 11:19:00 +0100
commit8dde2dee859798877163849a70e61d64fc997ae4 (patch)
treec9598dc2a0fef96954f6b03aa196237a5f3c6b77
parentc2438ec222182c2c2892882c405ce3183b47f6f2 (diff)
downloadweechat-8dde2dee859798877163849a70e61d64fc997ae4.zip
Do not set unread marker on IRC server and channels when reconnecting to IRC server if self nick is away
-rw-r--r--src/plugins/irc/irc-command.c27
-rw-r--r--src/plugins/irc/irc-command.h3
-rw-r--r--src/plugins/irc/irc-protocol.c2
3 files changed, 18 insertions, 14 deletions
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index 1bc3f25be..46585a392 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -252,7 +252,8 @@ irc_command_amsg (void *data, struct t_gui_buffer *buffer, int argc,
*/
void
-irc_command_away_server (struct t_irc_server *server, const char *arguments)
+irc_command_away_server (struct t_irc_server *server, const char *arguments,
+ int reset_unread_marker)
{
char *string, buffer[4096];
time_t time_now, elapsed;
@@ -265,10 +266,8 @@ irc_command_away_server (struct t_irc_server *server, const char *arguments)
{
if (server->away_message)
free (server->away_message);
- server->away_message = malloc (strlen (arguments) + 1);
- if (server->away_message)
- strcpy (server->away_message, arguments);
-
+ server->away_message = strdup (arguments);
+
/* if server is connected, send away command now */
if (server->is_connected)
{
@@ -294,12 +293,15 @@ irc_command_away_server (struct t_irc_server *server, const char *arguments)
irc_server_set_away (server, server->nick, 1);
/* reset "unread" indicator on server and channels/pv buffers */
- if (!weechat_config_boolean (irc_config_look_one_server_buffer))
- weechat_buffer_set (server->buffer, "unread", "");
- for (ptr_channel = server->channels; ptr_channel;
- ptr_channel = ptr_channel->next_channel)
+ if (reset_unread_marker)
{
- weechat_buffer_set (ptr_channel->buffer, "unread", "");
+ if (!weechat_config_boolean (irc_config_look_one_server_buffer))
+ weechat_buffer_set (server->buffer, "unread", "");
+ for (ptr_channel = server->channels; ptr_channel;
+ ptr_channel = ptr_channel->next_channel)
+ {
+ weechat_buffer_set (ptr_channel->buffer, "unread", "");
+ }
}
}
else
@@ -393,7 +395,8 @@ irc_command_away (void *data, struct t_gui_buffer *buffer, int argc,
{
if (ptr_server->is_connected)
irc_command_away_server (ptr_server,
- (argc > 2) ? argv_eol[2] : NULL);
+ (argc > 2) ? argv_eol[2] : NULL,
+ 1);
}
weechat_buffer_set (NULL, "hotlist", "+");
}
@@ -403,7 +406,7 @@ irc_command_away (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_ERROR;
weechat_buffer_set (NULL, "hotlist", "-");
- irc_command_away_server (ptr_server, argv_eol[1]);
+ irc_command_away_server (ptr_server, argv_eol[1], 1);
weechat_buffer_set (NULL, "hotlist", "+");
}
diff --git a/src/plugins/irc/irc-command.h b/src/plugins/irc/irc-command.h
index cd6d33c4e..34557e260 100644
--- a/src/plugins/irc/irc-command.h
+++ b/src/plugins/irc/irc-command.h
@@ -31,7 +31,8 @@ struct t_irc_server;
extern void irc_command_away_server (struct t_irc_server *server,
- const char *arguments);
+ const char *arguments,
+ int reset_unread_marker);
extern void irc_command_join_server (struct t_irc_server *server,
const char *arguments);
extern void irc_command_mode_server (struct t_irc_server *server,
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index ff56e6a2c..f45b4ae91 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -2413,7 +2413,7 @@ irc_protocol_cmd_001 (struct t_irc_server *server, const char *command,
away_msg = strdup (server->away_message);
if (away_msg)
{
- irc_command_away_server (server, away_msg);
+ irc_command_away_server (server, away_msg, 0);
free (away_msg);
}
}