Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/commands.c @ 2129:32f1bbf5917e
Slightly rework room_topic -u implementation
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Tue, 24 Jun 2014 19:42:41 +0200 |
parents | adcff2d51ecb |
children | a6b93960109e |
comparison
equal
deleted
inserted
replaced
2128:adcff2d51ecb | 2129:32f1bbf5917e |
---|---|
2940 // If arg is not NULL & option is set, unescape it | 2940 // If arg is not NULL & option is set, unescape it |
2941 if (arg) { | 2941 if (arg) { |
2942 char *unescaped_topic = NULL; | 2942 char *unescaped_topic = NULL; |
2943 | 2943 |
2944 if (!strncmp(arg, "-u ", 3)) { | 2944 if (!strncmp(arg, "-u ", 3)) { |
2945 char *tmp; | 2945 char *tmp = arg; |
2946 tmp = g_strdup(arg + 3); | 2946 arg = g_strdup(arg + 3); |
2947 g_free(arg); | 2947 g_free(tmp); |
2948 arg = tmp; | |
2949 unescaped_topic = ut_unescape_tabs_cr(arg); | 2948 unescaped_topic = ut_unescape_tabs_cr(arg); |
2950 } | 2949 |
2951 | 2950 // We must not free() if the original string was returned |
2952 // We must not free() if the original string was returned | 2951 if (unescaped_topic == arg) { |
2953 if (unescaped_topic == arg) | 2952 unescaped_topic = NULL; |
2954 unescaped_topic = NULL; | 2953 } else if (unescaped_topic != NULL) { |
2955 | 2954 g_free(arg); |
2956 if (unescaped_topic != NULL) { | 2955 arg = unescaped_topic; |
2957 g_free(arg); | 2956 } |
2958 arg = unescaped_topic; | |
2959 } | 2957 } |
2960 } | 2958 } |
2961 | 2959 |
2962 // Set the topic | 2960 // Set the topic |
2963 xmpp_send_msg(buddy_getjid(bud), NULL, ROSTER_TYPE_ROOM, arg ? arg : "", | 2961 xmpp_send_msg(buddy_getjid(bud), NULL, ROSTER_TYPE_ROOM, arg ? arg : "", |