diff --git a/src/fe-text/statusbar-items.c b/src/fe-text/statusbar-items.c index 8e4a3420..a19232d2 100644 --- a/src/fe-text/statusbar-items.c +++ b/src/fe-text/statusbar-items.c @@ -590,13 +590,14 @@ static void statusbar_topic(SBAR_ITEM_REC *item, int ypos) query = irc_item_query(active_win->active); if (channel != NULL && channel->topic != NULL) topic = channel->topic; if (query != NULL && query->address != NULL) topic = query->address; - if (topic == NULL) return; - topic = strip_codes(topic); - str = g_strdup_printf("%.*s", item->size, topic); - set_color((1<<4)+15); addstr(str); - g_free(str); - g_free(topic); + if (topic != NULL) { + topic = strip_codes(topic); + str = g_strdup_printf("%.*s", item->size, topic); + set_color((1<<4)+15); addstr(str); + g_free(str); + g_free(topic); + } screen_refresh(); } diff --git a/src/irc/core/irc-commands.c b/src/irc/core/irc-commands.c index fe2a6281..59d85da3 100644 --- a/src/irc/core/irc-commands.c +++ b/src/irc/core/irc-commands.c @@ -334,16 +334,18 @@ static void cmd_kick(const char *data, IRC_SERVER_REC *server, WI_IRC_REC *item) static void cmd_topic(const char *data, IRC_SERVER_REC *server, WI_IRC_REC *item) { - char *params, *channame, *topic; + char *params, *args, *channame, *topic; g_return_if_fail(data != NULL); if (server == NULL || !server->connected || !irc_server_check(server)) cmd_return_error(CMDERR_NOT_CONNECTED); - params = cmd_get_params(data, 2 | PARAM_FLAG_OPTCHAN | PARAM_FLAG_GETREST, item, &channame, &topic); + params = cmd_get_params(data, 3 | PARAM_FLAG_OPTCHAN | + PARAM_FLAG_OPTARGS | PARAM_FLAG_GETREST, + item, &args, &channame, &topic); - irc_send_cmdv(server, *topic == '\0' ? "TOPIC %s" : "TOPIC %s :%s", - channame, topic); + irc_send_cmdv(server, *topic == '\0' && strstr(args, "-d") == NULL ? + "TOPIC %s" : "TOPIC %s :%s", channame, topic); g_free(params); }