1
0
mirror of https://github.com/irssi/irssi.git synced 2024-06-30 06:45:25 +00:00

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
This commit is contained in:
Timo Sirainen 2001-06-26 19:27:26 +00:00 committed by cras
parent 740f041c26
commit af4d6bebe3
3 changed files with 20 additions and 1 deletions

View File

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

View File

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

View File

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