diff options
author | James Booth <boothj5@gmail.com> | 2015-01-15 01:21:24 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-01-15 01:21:24 +0000 |
commit | aec14848065765c0101f0ee09fbcf81c920a22d7 (patch) | |
tree | 5db660e7b8c040fdd561a8f6b1f94dcda436e6c7 /src | |
parent | 3b69ad7b610cbd9a5f77ebe0af5b9d58c32c4050 (diff) | |
download | profani-tty-aec14848065765c0101f0ee09fbcf81c920a22d7.tar.gz |
Removed ch from main loop
Diffstat (limited to 'src')
-rw-r--r-- | src/profanity.c | 11 | ||||
-rw-r--r-- | src/ui/core.c | 4 | ||||
-rw-r--r-- | src/ui/ui.h | 2 |
3 files changed, 9 insertions, 8 deletions
diff --git a/src/profanity.c b/src/profanity.c index ad074f6a..2a0901b3 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -77,7 +77,6 @@ prof_run(const int disable_tls, char *log_level, char *account_name) _init(disable_tls, log_level); char inp[INP_WIN_MAX]; - int size = 0; char *pref_connect_account = prefs_get_string(PREF_CONNECT_ACCOUNT); 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"); jabber_conn_status_t conn_status = jabber_get_connection_status(); + int size = 0; + gboolean read_input = TRUE; gboolean cmd_result = TRUE; + while(cmd_result == TRUE) { - wint_t ch = ERR; size = 0; - - while(ch != '\n') { + read_input = TRUE; + while(read_input) { conn_status = jabber_get_connection_status(); if (conn_status == JABBER_CONNECTED) { _handle_idle_time(); } - ch = ui_get_char(inp, &size); + read_input = ui_get_char(inp, &size); #ifdef HAVE_LIBOTR otr_poll(); diff --git a/src/ui/core.c b/src/ui/core.c index 6918a658..9668a7a3 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -174,7 +174,7 @@ ui_close(void) endwin(); } -wint_t +gboolean ui_get_char(char *input, int *size) { int result = 0; @@ -193,7 +193,7 @@ ui_get_char(char *input, int *size) ui_input_nonblocking(FALSE); } - return ch; + return (ch != '\n'); } void diff --git a/src/ui/ui.h b/src/ui/ui.h index 1e78ce40..a482826b 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -229,7 +229,7 @@ void ui_update_presence(const resource_presence_t resource_presence, void ui_about(void); 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_nonblocking(gboolean); void ui_replace_input(char *input, const char * const new_input, int *size); |