Mercurial > ~mikael > mcabber > hg
changeset 2122:b41719d57dac
reimplement 'unescape_topic' option as '/room topic -u' switch
author | sh!zeeg <shizeeque@gmail.com> |
---|---|
date | Wed, 14 May 2014 10:47:56 +0400 |
parents | 9c791e2a437a |
children | 300e7bf4416a |
files | mcabber/mcabber/commands.c mcabber/mcabberrc.example |
diffstat | 2 files changed, 20 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/mcabber/mcabber/commands.c Tue May 13 21:18:22 2014 +0400 +++ b/mcabber/mcabber/commands.c Wed May 14 10:47:56 2014 +0400 @@ -2935,16 +2935,30 @@ } // If arg is "-", let's clear the topic - if (!strcmp(arg, "-")) + if (!g_strcmp0(arg, "-")) arg = NULL; arg = to_utf8(arg); // if arg is not NULL & option is set, unescape it - if (arg && settings_opt_get_int("unescape_topic")) { - gchar *tmp; - tmp = g_strcompress(arg); - g_free(arg); - arg = tmp; + if (arg) { + char *unescaped_topic = NULL; + + if (!strncmp(arg, "-u ", 3)) { + char *tmp; + tmp = g_strdup(arg + 3); + g_free(arg); + arg = tmp; + unescaped_topic = ut_unescape_tabs_cr(arg); + } + + // We must not free() if the original string was returned + if (unescaped_topic == arg) + unescaped_topic = NULL; + + if (unescaped_topic != NULL) { + free(arg); + arg = unescaped_topic; + } } // Set the topic
--- a/mcabber/mcabberrc.example Tue May 13 21:18:22 2014 +0400 +++ b/mcabber/mcabberrc.example Wed May 14 10:47:56 2014 +0400 @@ -497,12 +497,6 @@ # Values: 0: disable (default) 1: enable #set show_room_occupants_count = 0 # -# To enable C-escape sequences support in /room topic -# set 'unescape_topic' to 1 -# \n - new line` -# \t - tab character -#set unescape_topic = 0 -# # Set 'log_display_sender' to 1 to display the message sender's JID in the # log window (default: 0, no) #set log_display_sender = 0