summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2004-01-25 17:32:50 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2004-01-25 17:32:50 +0000
commitd94a55a38b50f13b846b8f9b506a8614a5f2d485 (patch)
treeec3b796dde625df07f43c3223e4e6aaea070b341 /src
parent662c4d30ab29c6ceca2f2ffa1774c2212157e924 (diff)
downloadirssi-d94a55a38b50f13b846b8f9b506a8614a5f2d485.zip
/SET whois_hide_safe_channel_id - removes the ugly IDs for !channels in
/WHOIS (default) git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3218 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/fe-common/irc/fe-events-numeric.c46
1 files changed, 45 insertions, 1 deletions
diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c
index 67f84d2a..1488a34e 100644
--- a/src/fe-common/irc/fe-events-numeric.c
+++ b/src/fe-common/irc/fe-events-numeric.c
@@ -587,6 +587,46 @@ static void event_whowas(IRC_SERVER_REC *server, const char *data)
g_free(params);
}
+static void hide_safe_channel_id(IRC_SERVER_REC *server, char *chans)
+{
+ const char *idchan;
+ char *p, *dest, *end, id;
+ int count, length;
+
+ if (!server->isupport_sent)
+ idchan = "!:5";
+ else {
+ idchan = g_hash_table_lookup(server->isupport, "IDCHAN");
+ if (idchan == NULL)
+ return;
+ }
+
+ while (*idchan != '\0') {
+ id = *idchan;
+ if (idchan[1] != ':')
+ return;
+
+ length = strtoul(idchan+2, &end, 10);
+ if (*end == ',')
+ end++;
+ else if (*end != '\0')
+ return;
+ idchan = end;
+
+ count = 0;
+ for (dest = p = chans; *p != '\0'; p++) {
+ if (count > 0)
+ count--;
+ else {
+ if (*p == id)
+ count = length;
+ *dest++ = *p;
+ }
+ }
+ *dest = '\0';
+ }
+}
+
static void event_whois_channels(IRC_SERVER_REC *server, const char *data)
{
char *params, *nick, *chans;
@@ -599,7 +639,9 @@ static void event_whois_channels(IRC_SERVER_REC *server, const char *data)
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. */
- chans = show_lowascii(chans);
+ chans = show_lowascii(chans);
+ if (settings_get_bool("whois_hide_safe_channel_id"))
+ hide_safe_channel_id(server, chans);
printformat(server, nick, MSGLEVEL_CRAP,
IRCTXT_WHOIS_CHANNELS, nick, chans);
g_free(chans);
@@ -882,6 +924,8 @@ void fe_events_numeric_init(void)
last_away_nick = NULL;
last_away_msg = NULL;
+ settings_add_bool("lookandfeel", "whois_hide_safe_channel_id", TRUE);
+
signal_add("event 221", (SIGNAL_FUNC) event_user_mode);
signal_add("event 303", (SIGNAL_FUNC) event_ison);
signal_add("event 353", (SIGNAL_FUNC) event_names_list);