summaryrefslogtreecommitdiff
path: root/src/irc/irc-send.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/irc/irc-send.c')
-rw-r--r--src/irc/irc-send.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/irc/irc-send.c b/src/irc/irc-send.c
index 785f44369..bd45810c7 100644
--- a/src/irc/irc-send.c
+++ b/src/irc/irc-send.c
@@ -244,6 +244,11 @@ irc_send_away (t_irc_server *server, char *arguments)
if (arguments)
{
server->is_away = 1;
+ if (server->away_message)
+ free (server->away_message);
+ server->away_message = (char *) malloc (strlen (arguments) + 1);
+ if (server->away_message)
+ strcpy (server->away_message, arguments);
server->away_time = time (NULL);
server_sendf (server, "AWAY :%s\r\n", arguments);
if (cfg_irc_display_away != CFG_IRC_DISPLAY_AWAY_OFF)
@@ -272,6 +277,11 @@ irc_send_away (t_irc_server *server, char *arguments)
{
server_sendf (server, "AWAY\r\n");
server->is_away = 0;
+ if (server->away_message)
+ {
+ free (server->away_message);
+ server->away_message = NULL;
+ }
if (server->away_time != 0)
{
time_now = time (NULL);