1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-15 04:28:09 -04:00

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
This commit is contained in:
Timo Sirainen 2000-06-30 19:54:34 +00:00 committed by cras
parent 58397c1ca9
commit 39282a342f
6 changed files with 40 additions and 14 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -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)

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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) {