void window_update_prompt(void) { const char *special; char *prompt, *text; int var_used; special = settings_get_str(active_win->active != NULL ? "prompt" : "prompt_window"); if (*special == '\0') { gui_entry_set_prompt(""); return; } prompt = parse_special_string(special, active_win->active_server, active_win->active, "", &var_used, PARSE_FLAG_ISSET_ANY); if (!var_used && strchr(special, '$') != NULL) { /* none of the $vars had non-empty values, use empty prompt */ *prompt = '\0'; } /* set prompt */ text = show_lowascii(prompt); gui_entry_set_prompt(text); g_free(text); g_free(prompt); }
void window_update_prompt(WINDOW_REC *window) { WI_ITEM_REC *item; char *text, *str; if (window != active_win) return; item = window->active; if (item != NULL) text = item->name; else if (window->name != NULL) text = window->name; else { gui_entry_set_prompt(""); return; } /* set prompt */ text = show_lowascii(text); str = g_strdup_printf("[%1.17s] ", text); g_free(text); gui_entry_set_prompt(str); if (*str != '\0') g_free(str); }
static void sig_message_invite(SERVER_REC *server, const char *channel, const char *nick, const char *address) { char *str; str = show_lowascii(channel); printformat(server, NULL, MSGLEVEL_INVITES, TXT_INVITE, nick, str, address); g_free(str); }
static void event_whois_channels(IRC_SERVER_REC *server, const char *data) { char *params, *nick, *chans; g_return_if_fail(data != NULL); params = event_get_params(data, 3, NULL, &nick, &chans); /* sure - we COULD print the channel names as-is, but since the colors, bolds, etc. are mostly just to fool people, I think we should show the channel names as they REALLY are so they could even be joined without any extra tricks. */ chans = show_lowascii(chans); printformat(server, nick, MSGLEVEL_CRAP, IRCTXT_WHOIS_CHANNELS, nick, chans); g_free(chans); g_free(params); }
/* redraw channel */ static void statusbar_channel(SBAR_ITEM_REC *item, int ypos) { WINDOW_REC *window; WI_ITEM_REC *witem; CHANNEL_REC *channel; SERVER_REC *server; gchar channame[21], winnum[MAX_INT_STRLEN], *tmpname; int size_needed; int mode_size; window = item->bar->pos != STATUSBAR_POS_MIDDLE ? active_win : mainwindow_find_sbar(item); server = window == NULL ? NULL : window->active_server; ltoa(winnum, window == NULL ? 0 : window->refnum); witem = window != NULL && (IS_CHANNEL(window->active) || IS_QUERY(window->active)) ? window->active : NULL; if (witem == NULL) { /* display server tag */ channame[0] = '\0'; mode_size = 0; channel = NULL; size_needed = 3 + strlen(winnum) + (server == NULL ? 0 : (17+strlen(server->tag))); } else { /* display channel + mode */ tmpname = show_lowascii(witem->name); strncpy(channame, tmpname, 20); channame[20] = '\0'; g_free(tmpname); channel = CHANNEL(witem); if (channel == NULL) { mode_size = 0; } else { mode_size = strlen(channel->mode); if (mode_size > 0) mode_size += 3; /* (+) */ } size_needed = 3 + strlen(winnum) + strlen(channame) + mode_size; } if (item->size != size_needed) { /* we need more (or less..) space! */ statusbar_item_resize(item, size_needed); return; } move(ypos, item->xpos); set_color(stdscr, sbar_color_dim); addch('['); /* window number */ set_color(stdscr, sbar_color_normal); addstr(winnum); set_color(stdscr, sbar_color_dim); addch(':'); if (channame[0] == '\0' && server != NULL) { /* server tag */ set_color(stdscr, sbar_color_normal); addstr(server->tag); addstr(" (change with ^X)"); } else if (channame[0] != '\0') { /* channel + mode */ set_color(stdscr, sbar_color_normal); addstr(channame); if (mode_size) { set_color(stdscr, sbar_color_bold); addch('('); set_color(stdscr, sbar_color_dim); addch('+'); set_color(stdscr, sbar_color_normal); addstr(channel->mode); set_color(stdscr, sbar_color_bold); addch(')'); } } set_color(stdscr, sbar_color_dim); addch(']'); screen_refresh(NULL); }