summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-06-30 19:54:34 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-06-30 19:54:34 +0000
commit39282a342f7f333ee24c5bad8fa5f48d8ebf3dbb (patch)
tree622e3a8c425b648d754a655f3546b88facbfd6aa /src/core
parent58397c1ca91c31c785971c874c7d124e9d1aa29b (diff)
downloadirssi-39282a342f7f333ee24c5bad8fa5f48d8ebf3dbb.zip
If joined channel had some low-ascii (color codes), they were displayed
wrong in statusbar and prompt. Also, if you're invited to some channel, print the lowascii so that you can see them (^B, etc.) git-svn-id: http://svn.irssi.org/repos/irssi/trunk@400 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core')
-rw-r--r--src/core/misc.c21
-rw-r--r--src/core/misc.h3
2 files changed, 24 insertions, 0 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