Re: Hiding channel key from statusbar?

Jochen Eisinger <[email protected]> Wed, 29 Oct 2003 21:00:03 +0100
Newsgroups gmane.network.irc.irssi.devel
Message-ID <[email protected]>
Hi,

attached a patch that gives you a setting chanmode_verbose (defaults to
ON). if you set it to OFF everything from the first " " will be cut of
the channel mode, like

 +knls 1234 key -> +knls

maybe you need to repaint the window (either switch it or press ^L)

Telling ppl to piss off when they become noisy is the other solution...
http://bash.org/?8814

regards
-- jochen (aka c0ffee)

Dario Freni wrote:
> Hi guys,
> it seems there is no way to hide a channel key from the statusbar
> (without hiding entire statusbar, obviously). I'm not a paranoid, but it
> sounds quite annoying when chatting from a public place such as
> university... I was asking if it's possible to implement a variable to
> toggle the viewing of the key. I never seen irssi's code, with some
> advice from you maybe I can write a little patch.
> 
> Let me know! :)
> 
> Bye and thanks,
> Dario
>
src.core.expandos.c.orig (text/plain, 963 B)
--- ./src/core/expandos.c.orig	2003-10-29 19:48:12.000000000 +0100
+++ ./src/core/expandos.c	2003-10-29 19:52:09.000000000 +0100
@@ -333,8 +333,23 @@
 
 /* modes of current channel, if any */
 static char *expando_chanmode(SERVER_REC *server, void *item, int *free_ret)
-{
-	return !IS_CHANNEL(item) ? NULL : CHANNEL(item)->mode;
+{ 
+	char *cmode;
+
+	*free_ret = FALSE;
+
+	if (!IS_CHANNEL(item))
+		return NULL;
+
+        if (settings_get_bool("chanmode_verbose"))
+		return CHANNEL(item)->mode;
+
+	*free_ret = TRUE;
+	cmode = g_strdup(CHANNEL(item)->mode);
+	if (strchr(cmode, ' ') != NULL)
+		*(strchr(cmode, ' ')) = 0;
+
+	return cmode;
 }
 
 /* current nickname */
@@ -559,6 +574,7 @@
 #endif
 	settings_add_str("misc", "STATUS_OPER", "*");
 	settings_add_str("lookandfeel", "timestamp_format", "%H:%M");
+	settings_add_bool("lookandfeel", "chanmode_verbose", TRUE);
 
 	client_start_time = time(NULL);
 	last_sent_msg = NULL; last_sent_msg_body = NULL;