summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/misc.c21
-rw-r--r--src/core/misc.h3
-rw-r--r--src/fe-common/irc/fe-events-numeric.c14
-rw-r--r--src/fe-common/irc/fe-events.c6
-rw-r--r--src/fe-text/gui-windows.c3
-rw-r--r--src/fe-text/statusbar-items.c7
6 files changed, 40 insertions, 14 deletions
diff --git a/src/core/misc.c b/src/core/misc.c
index 952c7149..3a3b76bb 100644
--- a/src/core/misc.c
+++ b/src/core/misc.c
@@ -506,3 +506,24 @@ int dec2octal(int decimal)
return octal;
}
+
+/* convert all low-ascii (<32) to ^<A..> combinations */
+char *show_lowascii(const char *channel)
+{
+ char *str, *p;
+
+ str = p = g_malloc(strlen(channel)*2+1);
+ while (*channel != '\0') {
+ if ((unsigned char) *channel >= 32)
+ *p++ = *channel;
+ else {
+ *p++ = '^';
+ *p++ = *channel + 'A'-1;
+ }
+ channel++;
+ }
+ *p = '\0';
+
+ return str;
+}
+
diff --git a/src/core/misc.h b/src/core/misc.h
index 7fa866df..37a19c07 100644
--- a/src/core/misc.h
+++ b/src/core/misc.h
@@ -65,4 +65,7 @@ char *replace_chars(char *str, char from, char to);
int octal2dec(int octal);
int dec2octal(int decimal);
+/* convert all low-ascii (<32) to ^<A..> combinations */
+char *show_lowascii(const char *channel);
+
#endif
diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c
index ddfa04c8..6d48988b 100644
--- a/src/fe-common/irc/fe-events-numeric.c
+++ b/src/fe-common/irc/fe-events-numeric.c
@@ -447,19 +447,11 @@ static void event_whois_channels(const char *data, IRC_SERVER_REC *server)
colors, bolds, etc. are mostly just to fool people, I think we
should show the channel names as they REALLY are so they could
even be joined without any extra tricks. */
- str = g_string_new(NULL);
- for (; *chans != '\0'; chans++) {
- if ((unsigned char) *chans >= 32)
- g_string_append_c(str, *chans);
- else {
- g_string_append_c(str, '^');
- g_string_append_c(str, *chans+'A'-1);
- }
- }
+ chans = show_lowascii(chans);
+ printformat(server, nick, MSGLEVEL_CRAP, IRCTXT_WHOIS_CHANNELS, nick, chans);
+ g_free(chans);
- printformat(server, nick, MSGLEVEL_CRAP, IRCTXT_WHOIS_CHANNELS, nick, str->str);
g_free(params);
- g_string_free(str, TRUE);
}
static void event_whois_away(const char *data, IRC_SERVER_REC *server)
diff --git a/src/fe-common/irc/fe-events.c b/src/fe-common/irc/fe-events.c
index d67e5775..d37ef8b5 100644
--- a/src/fe-common/irc/fe-events.c
+++ b/src/fe-common/irc/fe-events.c
@@ -21,6 +21,7 @@
#include "module.h"
#include "module-formats.h"
#include "signals.h"
+#include "misc.h"
#include "settings.h"
#include "irc.h"
@@ -388,8 +389,11 @@ static void event_invite(const char *data, IRC_SERVER_REC *server, const char *n
g_return_if_fail(data != NULL);
params = event_get_params(data, 2, NULL, &channel);
- if (*channel != '\0' && !ignore_check(server, nick, addr, channel, NULL, MSGLEVEL_INVITES))
+ if (*channel != '\0' && !ignore_check(server, nick, addr, channel, NULL, MSGLEVEL_INVITES)) {
+ channel = show_lowascii(channel);
printformat(server, NULL, MSGLEVEL_INVITES, IRCTXT_INVITE, nick, channel);
+ g_free(channel);
+ }
g_free(params);
}
diff --git a/src/fe-text/gui-windows.c b/src/fe-text/gui-windows.c
index 53f94416..3435cb85 100644
--- a/src/fe-text/gui-windows.c
+++ b/src/fe-text/gui-windows.c
@@ -627,7 +627,10 @@ void window_update_prompt(WINDOW_REC *window)
}
/* set prompt */
+ text = show_lowascii(text);
str = g_strdup_printf("[%1.17s] ", text);
+ g_free(text);
+
gui_entry_set_prompt(str);
if (*str != '\0') g_free(str);
}
diff --git a/src/fe-text/statusbar-items.c b/src/fe-text/statusbar-items.c
index 4705cc64..57cbd1a9 100644
--- a/src/fe-text/statusbar-items.c
+++ b/src/fe-text/statusbar-items.c
@@ -37,6 +37,7 @@
#include "printtext.h"
#include "statusbar.h"
#include "gui-windows.h"
+#include "gui-printtext.h"
/* how often to redraw lagging time (seconds) */
#define LAG_REFRESH_TIME 10
@@ -215,7 +216,7 @@ static void statusbar_channel(SBAR_ITEM_REC *item, int ypos)
WI_ITEM_REC *witem;
CHANNEL_REC *channel;
SERVER_REC *server;
- gchar channame[21], winnum[MAX_INT_STRLEN], *mode;
+ gchar channame[21], winnum[MAX_INT_STRLEN], *mode, *tmpname;
int size_needed;
int mode_size;
@@ -239,7 +240,9 @@ static void statusbar_channel(SBAR_ITEM_REC *item, int ypos)
else
{
/* display channel + mode */
- strncpy(channame, witem->name, 20); channame[20] = '\0';
+ tmpname = show_lowascii(witem->name);
+ strncpy(channame, tmpname, 20); channame[20] = '\0';
+ g_free(tmpname);
channel = irc_item_channel(witem);
if (channel == NULL) {