mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
(zZzZ) wasn't displayed in statusbar if you didn't have any user mode set.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@426 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
6c9655a513
commit
e4a63db280
@ -127,67 +127,59 @@ static int statusbar_clock_timeout(void)
|
|||||||
/* redraw nick */
|
/* redraw nick */
|
||||||
static void statusbar_nick(SBAR_ITEM_REC *item, int ypos)
|
static void statusbar_nick(SBAR_ITEM_REC *item, int ypos)
|
||||||
{
|
{
|
||||||
CHANNEL_REC *channel;
|
CHANNEL_REC *channel;
|
||||||
IRC_SERVER_REC *server;
|
IRC_SERVER_REC *server;
|
||||||
NICK_REC *nickrec;
|
NICK_REC *nickrec;
|
||||||
int size_needed;
|
int size_needed;
|
||||||
int umode_size;
|
int umode_size;
|
||||||
gchar nick[10];
|
char nick[10];
|
||||||
|
|
||||||
server = (IRC_SERVER_REC *) (active_win == NULL ? NULL : active_win->active_server);
|
server = (IRC_SERVER_REC *) (active_win == NULL ? NULL : active_win->active_server);
|
||||||
|
|
||||||
umode_size = server == NULL || server->usermode == NULL ? 0 : strlen(server->usermode)+3;
|
umode_size = server == NULL || server->usermode == NULL ? 0 : strlen(server->usermode)+3;
|
||||||
|
|
||||||
/* nick */
|
/* nick */
|
||||||
if (server == NULL || server->nick == NULL)
|
if (server == NULL || server->nick == NULL) {
|
||||||
{
|
nick[0] = '\0';
|
||||||
nick[0] = '\0';
|
nickrec = NULL;
|
||||||
nickrec = NULL;
|
} else {
|
||||||
}
|
strncpy(nick, server->nick, 9);
|
||||||
else
|
nick[9] = '\0';
|
||||||
{
|
|
||||||
strncpy(nick, server->nick, 9);
|
|
||||||
nick[9] = '\0';
|
|
||||||
|
|
||||||
channel = irc_item_channel(active_win->active);
|
channel = irc_item_channel(active_win->active);
|
||||||
nickrec = channel == NULL ? NULL : nicklist_find(channel, server->nick);
|
nickrec = channel == NULL ? NULL : nicklist_find(channel, server->nick);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_needed = 2 + strlen(nick) + umode_size +
|
size_needed = 2 + strlen(nick) + umode_size +
|
||||||
(server != NULL && server->usermode_away ? 7 : 0) +
|
(server != NULL && server->usermode_away ? 7 : 0) +
|
||||||
(nickrec != NULL && (nickrec->op || nickrec->voice) ? 1 : 0); /* @ + */
|
(nickrec != NULL && (nickrec->op || nickrec->voice) ? 1 : 0); /* @ + */
|
||||||
|
|
||||||
if (item->size != size_needed)
|
if (item->size != size_needed) {
|
||||||
{
|
/* we need more (or less..) space! */
|
||||||
/* we need more (or less..) space! */
|
statusbar_item_resize(item, size_needed);
|
||||||
statusbar_item_resize(item, size_needed);
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* size ok, draw the nick */
|
/* size ok, draw the nick */
|
||||||
move(ypos, item->xpos);
|
move(ypos, item->xpos);
|
||||||
|
|
||||||
set_color((1 << 4)+3); addch('[');
|
set_color((1 << 4)+3); addch('[');
|
||||||
if (nickrec != NULL && (nickrec->op || nickrec->voice))
|
if (nickrec != NULL && (nickrec->op || nickrec->voice))
|
||||||
{
|
set_color((1 << 4)+15); addch(nickrec->op ? '@' : '+');
|
||||||
set_color((1 << 4)+15); addch(nickrec->op ? '@' : '+');
|
set_color((1 << 4)+7); addstr(nick);
|
||||||
}
|
if (umode_size) {
|
||||||
set_color((1 << 4)+7); addstr(nick);
|
set_color((1 << 4)+15); addch('(');
|
||||||
if (umode_size)
|
set_color((1 << 4)+3); addch('+');
|
||||||
{
|
set_color((1 << 4)+7); addstr(server->usermode);
|
||||||
set_color((1 << 4)+15); addch('(');
|
set_color((1 << 4)+15); addch(')');
|
||||||
set_color((1 << 4)+3); addch('+');
|
}
|
||||||
set_color((1 << 4)+7); addstr(server->usermode);
|
if (server->usermode_away) {
|
||||||
set_color((1 << 4)+15); addch(')');
|
set_color((1 << 4)+7); addstr(" (");
|
||||||
if (server->usermode_away)
|
set_color((1 << 4)+10); addstr("zZzZ");
|
||||||
{
|
set_color((1 << 4)+7); addch(')');
|
||||||
set_color((1 << 4)+7); addstr(" (");
|
}
|
||||||
set_color((1 << 4)+10); addstr("zZzZ");
|
set_color((1 << 4)+3); addch(']');
|
||||||
set_color((1 << 4)+7); addch(')');
|
screen_refresh();
|
||||||
}
|
|
||||||
}
|
|
||||||
set_color((1 << 4)+3); addch(']');
|
|
||||||
screen_refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sig_statusbar_nick_redraw(void)
|
static void sig_statusbar_nick_redraw(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user