void ui_find(int next) { int item = -1; static char findstr[MAX_FIELD_LEN]; int search_fields[] = {NAME, EMAIL, NICK, -1}; clear_statusline(); if(next) { if(!*findstr) return; } else { char *s; s = ui_readline("/", findstr, MAX_FIELD_LEN - 1, 0); refresh_screen(); if(s == NULL) { return; /* user cancelled (ctrl-G) */ } else { strncpy(findstr, s, MAX_FIELD_LEN); free(s); } } if( (item = find_item(findstr, list_get_curitem() + !!next, search_fields)) < 0 && (item = find_item(findstr, 0, search_fields)) >= 0) statusline_addstr(_("Search hit bottom, continuing at top")); if(item >= 0) { list_set_curitem(item); refresh_list(); } }
void prof_run(char *log_level, char *account_name) { _init(log_level); _connect_default(account_name); ui_update(); log_info("Starting main event loop"); activity_state = ACTIVITY_ST_ACTIVE; saved_status = NULL; char *line = NULL; while(cont) { log_stderr_handler(); _check_autoaway(); line = ui_readline(); if (line) { ProfWin *window = wins_get_current(); cont = cmd_process_input(window, line); free(line); line = NULL; } else { cont = TRUE; } #ifdef HAVE_LIBOTR otr_poll(); #endif notify_remind(); jabber_process_events(10); ui_update(); } }
void prof_run(const int disable_tls, char *log_level, char *account_name) { _init(disable_tls, log_level); _connect_default(account_name); ui_update(); char *line = NULL; gboolean cmd_result = TRUE; log_info("Starting main event loop"); while(cmd_result) { while(!line) { _check_autoaway(); line = ui_readline(); #ifdef HAVE_LIBOTR otr_poll(); #endif notify_remind(); jabber_process_events(); ui_update(); } cmd_result = cmd_process_input(line); ui_input_clear(); FREE_SET_NULL(line); } }
char * ask_filename(const char *prompt) { char *buf = NULL; clear_statusline(); buf = ui_readline(prompt, NULL, -1, 1); return buf; }