diff options
author | Timo Sirainen <cras@irssi.org> | 2000-07-04 19:03:57 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-07-04 19:03:57 +0000 |
commit | e4a63db2806c833625aa51ad41c788d36d30188f (patch) | |
tree | 1352ce83faa33b0c675dbebb709ea7cdf68de396 /src/fe-text | |
parent | 6c9655a5139be78d7e92957d32af685b54f0908a (diff) | |
download | irssi-e4a63db2806c833625aa51ad41c788d36d30188f.zip |
(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
Diffstat (limited to 'src/fe-text')
-rw-r--r-- | src/fe-text/statusbar-items.c | 98 |
1 files changed, 45 insertions, 53 deletions
diff --git a/src/fe-text/statusbar-items.c b/src/fe-text/statusbar-items.c index 57cbd1a9..476665d2 100644 --- a/src/fe-text/statusbar-items.c +++ b/src/fe-text/statusbar-items.c @@ -127,67 +127,59 @@ static int statusbar_clock_timeout(void) /* redraw nick */ static void statusbar_nick(SBAR_ITEM_REC *item, int ypos) { - CHANNEL_REC *channel; - IRC_SERVER_REC *server; - NICK_REC *nickrec; - int size_needed; - int umode_size; - gchar nick[10]; + CHANNEL_REC *channel; + IRC_SERVER_REC *server; + NICK_REC *nickrec; + int size_needed; + int umode_size; + 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 */ - if (server == NULL || server->nick == NULL) - { - nick[0] = '\0'; - nickrec = NULL; - } - else - { - strncpy(nick, server->nick, 9); - nick[9] = '\0'; + /* nick */ + if (server == NULL || server->nick == NULL) { + nick[0] = '\0'; + nickrec = NULL; + } else { + strncpy(nick, server->nick, 9); + nick[9] = '\0'; - channel = irc_item_channel(active_win->active); - nickrec = channel == NULL ? NULL : nicklist_find(channel, server->nick); - } + channel = irc_item_channel(active_win->active); + nickrec = channel == NULL ? NULL : nicklist_find(channel, server->nick); + } - size_needed = 2 + strlen(nick) + umode_size + - (server != NULL && server->usermode_away ? 7 : 0) + - (nickrec != NULL && (nickrec->op || nickrec->voice) ? 1 : 0); /* @ + */ + size_needed = 2 + strlen(nick) + umode_size + + (server != NULL && server->usermode_away ? 7 : 0) + + (nickrec != NULL && (nickrec->op || nickrec->voice) ? 1 : 0); /* @ + */ - if (item->size != size_needed) - { - /* we need more (or less..) space! */ - statusbar_item_resize(item, size_needed); - return; - } + if (item->size != size_needed) { + /* we need more (or less..) space! */ + statusbar_item_resize(item, size_needed); + return; + } - /* size ok, draw the nick */ - move(ypos, item->xpos); + /* size ok, draw the nick */ + move(ypos, item->xpos); - set_color((1 << 4)+3); addch('['); - if (nickrec != NULL && (nickrec->op || nickrec->voice)) - { - set_color((1 << 4)+15); addch(nickrec->op ? '@' : '+'); - } - set_color((1 << 4)+7); addstr(nick); - if (umode_size) - { - set_color((1 << 4)+15); addch('('); - set_color((1 << 4)+3); addch('+'); - set_color((1 << 4)+7); addstr(server->usermode); - set_color((1 << 4)+15); addch(')'); - if (server->usermode_away) - { - set_color((1 << 4)+7); addstr(" ("); - set_color((1 << 4)+10); addstr("zZzZ"); - set_color((1 << 4)+7); addch(')'); - } - } - set_color((1 << 4)+3); addch(']'); - screen_refresh(); + set_color((1 << 4)+3); addch('['); + if (nickrec != NULL && (nickrec->op || nickrec->voice)) + set_color((1 << 4)+15); addch(nickrec->op ? '@' : '+'); + set_color((1 << 4)+7); addstr(nick); + if (umode_size) { + set_color((1 << 4)+15); addch('('); + set_color((1 << 4)+3); addch('+'); + set_color((1 << 4)+7); addstr(server->usermode); + set_color((1 << 4)+15); addch(')'); + } + if (server->usermode_away) { + set_color((1 << 4)+7); addstr(" ("); + set_color((1 << 4)+10); addstr("zZzZ"); + set_color((1 << 4)+7); addch(')'); + } + set_color((1 << 4)+3); addch(']'); + screen_refresh(); } static void sig_statusbar_nick_redraw(void) |