summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-06-26 19:27:26 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-06-26 19:27:26 +0000
commitaf4d6bebe377eba8fb1a67a11a63a13953a4a51e (patch)
treeb0f4cefd97ce0b60e488f6658b442fc228492118
parent740f041c266c92d905754bbcb342b1e69d0770fe (diff)
downloadirssi-af4d6bebe377eba8fb1a67a11a63a13953a4a51e.zip
Added $cumode expando which works like $P, but prints voices/halfops also.
Changed statusbar to use $cumode. Patch by fuchs. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1567 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--docs/special_vars.txt1
-rw-r--r--src/fe-text/statusbar-items.c2
-rw-r--r--src/irc/core/irc-expandos.c18
3 files changed, 20 insertions, 1 deletions
diff --git a/docs/special_vars.txt b/docs/special_vars.txt
index ae9701b5..2f0e12af 100644
--- a/docs/special_vars.txt
+++ b/docs/special_vars.txt
@@ -84,6 +84,7 @@ $A .. $Z is important.
$sysarch system architecture (eg. i686)
$topic channel topic
$usermode user mode
+ $cumode own channel user mode
$tag server tag
$chatnet chat network of server
$winref window reference number
diff --git a/src/fe-text/statusbar-items.c b/src/fe-text/statusbar-items.c
index 7c72e47b..ff10434e 100644
--- a/src/fe-text/statusbar-items.c
+++ b/src/fe-text/statusbar-items.c
@@ -159,7 +159,7 @@ static int statusbar_clock_timeout(void)
static void statusbar_nick(SBAR_ITEM_REC *item, int get_size_only)
{
item_default(item, get_size_only,
- "{sb $P$N{sbmode $usermode}{sbaway $A}}", "");
+ "{sb $cumode$N{sbmode $usermode}{sbaway $A}}", "");
}
static void sig_statusbar_nick_redraw(void)
diff --git a/src/irc/core/irc-expandos.c b/src/irc/core/irc-expandos.c
index 95f3695d..22902bef 100644
--- a/src/irc/core/irc-expandos.c
+++ b/src/irc/core/irc-expandos.c
@@ -25,6 +25,8 @@
#include "irc.h"
#include "irc-servers.h"
+#include "channels.h"
+#include "nicklist.h"
static char *last_join;
@@ -81,6 +83,17 @@ static char *expando_usermode(SERVER_REC *server, void *item, int *free_ret)
return IS_IRC_SERVER(server) ? IRC_SERVER(server)->usermode : "";
}
+/* expands to your usermode on channel, op '@', halfop '%', "+" voice */
+static char *expando_cumode(SERVER_REC *server, void *item, int *free_ret)
+{
+ if (IS_CHANNEL(item) && CHANNEL(item)->ownnick) {
+ return NICK(CHANNEL(item)->ownnick)->op ? "@" :
+ NICK(CHANNEL(item)->ownnick)->halfop ? "%" :
+ NICK(CHANNEL(item)->ownnick)->voice ? "+" : "";
+ }
+ return "";
+}
+
static void event_join(IRC_SERVER_REC *server, const char *data,
const char *nick, const char *address)
{
@@ -110,6 +123,10 @@ void irc_expandos_init(void)
"window changed", EXPANDO_ARG_NONE,
"window server changed", EXPANDO_ARG_WINDOW,
"user mode changed", EXPANDO_ARG_WINDOW, NULL);
+ expando_create("cumode", expando_cumode,
+ "window changed", EXPANDO_ARG_NONE,
+ "window item changed", EXPANDO_ARG_WINDOW,
+ "nick mode changed", EXPANDO_ARG_WINDOW_ITEM, NULL);
expando_add_signal("I", "event invite", EXPANDO_ARG_SERVER);
@@ -125,6 +142,7 @@ void irc_expandos_deinit(void)
expando_destroy("S", expando_servername);
expando_destroy("X", expando_userhost);
expando_destroy("usermode", expando_usermode);
+ expando_destroy("cumode", expando_cumode);
signal_remove("event join", (SIGNAL_FUNC) event_join);
}