1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Merge branch 'master' into inp-utf8

This commit is contained in:
James Booth 2015-01-15 01:31:23 +00:00
commit 6beeec03d4
4 changed files with 16 additions and 12 deletions

View File

@ -77,7 +77,6 @@ prof_run(const int disable_tls, char *log_level, char *account_name)
_init(disable_tls, log_level); _init(disable_tls, log_level);
char inp[INP_WIN_MAX]; char inp[INP_WIN_MAX];
int size = 0;
char *pref_connect_account = prefs_get_string(PREF_CONNECT_ACCOUNT); char *pref_connect_account = prefs_get_string(PREF_CONNECT_ACCOUNT);
if (account_name != NULL) { if (account_name != NULL) {
@ -94,18 +93,20 @@ prof_run(const int disable_tls, char *log_level, char *account_name)
log_info("Starting main event loop"); log_info("Starting main event loop");
jabber_conn_status_t conn_status = jabber_get_connection_status(); jabber_conn_status_t conn_status = jabber_get_connection_status();
int size = 0;
gboolean read_input = TRUE;
gboolean cmd_result = TRUE; gboolean cmd_result = TRUE;
while(cmd_result == TRUE) {
wint_t ch = ERR;
size = 0;
while(ch != '\n') { while(cmd_result == TRUE) {
size = 0;
read_input = TRUE;
while(read_input) {
conn_status = jabber_get_connection_status(); conn_status = jabber_get_connection_status();
if (conn_status == JABBER_CONNECTED) { if (conn_status == JABBER_CONNECTED) {
_handle_idle_time(); _handle_idle_time();
} }
ch = ui_get_char(inp, &size); read_input = ui_get_char(inp, &size);
#ifdef HAVE_LIBOTR #ifdef HAVE_LIBOTR
otr_poll(); otr_poll();
@ -115,7 +116,6 @@ prof_run(const int disable_tls, char *log_level, char *account_name)
ui_update(); ui_update();
} }
inp[size++] = '\0';
cmd_result = process_input(inp); cmd_result = process_input(inp);
} }
} }

View File

@ -174,7 +174,7 @@ ui_close(void)
endwin(); endwin();
} }
wint_t gboolean
ui_get_char(char *input, int *size) ui_get_char(char *input, int *size)
{ {
int result = 0; int result = 0;
@ -193,7 +193,11 @@ ui_get_char(char *input, int *size)
ui_input_nonblocking(FALSE); ui_input_nonblocking(FALSE);
} }
return ch; if (ch == '\n') {
input[*size++] = '\0';
}
return (ch != '\n');
} }
void void

View File

@ -229,7 +229,7 @@ void ui_update_presence(const resource_presence_t resource_presence,
void ui_about(void); void ui_about(void);
void ui_statusbar_new(const int win); void ui_statusbar_new(const int win);
wint_t ui_get_char(char *input, int *size); gboolean ui_get_char(char *input, int *size);
void ui_input_clear(void); void ui_input_clear(void);
void ui_input_nonblocking(gboolean); void ui_input_nonblocking(gboolean);
void ui_replace_input(char *input, const char * const new_input, int *size); void ui_replace_input(char *input, const char * const new_input, int *size);

View File

@ -323,9 +323,9 @@ void ui_update_presence(const resource_presence_t resource_presence,
void ui_about(void) {} void ui_about(void) {}
void ui_statusbar_new(const int win) {} void ui_statusbar_new(const int win) {}
wint_t ui_get_char(char *input, int *size) gboolean ui_get_char(char *input, int *size)
{ {
return 0; return FALSE;
} }
void ui_input_clear(void) {} void ui_input_clear(void) {}