From 579594a8bf985928c308e5571cec5624877ad78a Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 4 Oct 2012 21:25:19 +0100 Subject: [PATCH 01/12] Offline contacts presence notifications now in contact list Can send messages to offline contacts --- src/profanity.c | 2 +- src/windows.c | 69 ++++++++++++++++++++++++++----------------------- 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/src/profanity.c b/src/profanity.c index 0c5477af..4d7bc397 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -157,7 +157,7 @@ prof_handle_contact_online(char *contact, char *show, char *status) void prof_handle_contact_offline(char *contact, char *show, char *status) { - gboolean result = contact_list_remove(contact); + gboolean result = contact_list_add(contact, "offline", status); if (result) { win_contact_offline(contact, show, status); } diff --git a/src/windows.c b/src/windows.c index 6bdc17d1..fca84286 100644 --- a/src/windows.c +++ b/src/windows.c @@ -563,43 +563,46 @@ cons_show_online_contacts(GSList *list) while(curr) { PContact contact = curr->data; - _win_show_time(_cons_win); const char *show = p_contact_show(contact); + + if (strcmp(show, "offline") != 0) { + _win_show_time(_cons_win); - if (strcmp(show, "online") == 0) { - wattron(_cons_win, COLOUR_ONLINE); - } else if (strcmp(show, "away") == 0) { - wattron(_cons_win, COLOUR_AWAY); - } else if (strcmp(show, "chat") == 0) { - wattron(_cons_win, COLOUR_CHAT); - } else if (strcmp(show, "dnd") == 0) { - wattron(_cons_win, COLOUR_DND); - } else if (strcmp(show, "xa") == 0) { - wattron(_cons_win, COLOUR_XA); - } else { - wattron(_cons_win, COLOUR_OFFLINE); - } + if (strcmp(show, "online") == 0) { + wattron(_cons_win, COLOUR_ONLINE); + } else if (strcmp(show, "away") == 0) { + wattron(_cons_win, COLOUR_AWAY); + } else if (strcmp(show, "chat") == 0) { + wattron(_cons_win, COLOUR_CHAT); + } else if (strcmp(show, "dnd") == 0) { + wattron(_cons_win, COLOUR_DND); + } else if (strcmp(show, "xa") == 0) { + wattron(_cons_win, COLOUR_XA); + } else { + wattron(_cons_win, COLOUR_OFFLINE); + } - wprintw(_cons_win, "%s", p_contact_name(contact)); - wprintw(_cons_win, " is %s", show); - - if (p_contact_status(contact)) - wprintw(_cons_win, ", \"%s\"", p_contact_status(contact)); - - wprintw(_cons_win, "\n"); + wprintw(_cons_win, "%s", p_contact_name(contact)); + wprintw(_cons_win, " is %s", show); + + if (p_contact_status(contact)) + wprintw(_cons_win, ", \"%s\"", p_contact_status(contact)); + + wprintw(_cons_win, "\n"); - if (strcmp(show, "online") == 0) { - wattroff(_cons_win, COLOUR_ONLINE); - } else if (strcmp(show, "away") == 0) { - wattroff(_cons_win, COLOUR_AWAY); - } else if (strcmp(show, "chat") == 0) { - wattroff(_cons_win, COLOUR_CHAT); - } else if (strcmp(show, "dnd") == 0) { - wattroff(_cons_win, COLOUR_DND); - } else if (strcmp(show, "xa") == 0) { - wattroff(_cons_win, COLOUR_XA); - } else { - wattroff(_cons_win, COLOUR_OFFLINE); + if (strcmp(show, "online") == 0) { + wattroff(_cons_win, COLOUR_ONLINE); + } else if (strcmp(show, "away") == 0) { + wattroff(_cons_win, COLOUR_AWAY); + } else if (strcmp(show, "chat") == 0) { + wattroff(_cons_win, COLOUR_CHAT); + } else if (strcmp(show, "dnd") == 0) { + wattroff(_cons_win, COLOUR_DND); + } else if (strcmp(show, "xa") == 0) { + wattroff(_cons_win, COLOUR_XA); + } else { + wattroff(_cons_win, COLOUR_OFFLINE); + } } curr = g_slist_next(curr); From 65022b3c2f437b118c92622aff5115bcf4568323 Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 4 Oct 2012 21:31:09 +0100 Subject: [PATCH 02/12] Users added to contact list when no precense notification The user is added from the roster --- src/jabber.c | 1 + src/profanity.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/jabber.c b/src/jabber.c index b51d5f68..da606132 100644 --- a/src/jabber.c +++ b/src/jabber.c @@ -301,6 +301,7 @@ _connection_handler(xmpp_conn_t * const conn, jabber_conn.conn_status = JABBER_CONNECTED; jabber_conn.presence = PRESENCE_ONLINE; + jabber_roster_request(); } else { // received close stream response from server after disconnect diff --git a/src/profanity.c b/src/profanity.c index 4d7bc397..f57b0ca9 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -176,6 +176,11 @@ prof_handle_roster(GSList *roster) } else { cons_show("%s", entry->jid); } + + // if contact not in contact list add them as offline + if (find_contact(entry->jid) == NULL) { + contact_list_add(entry->jid, "offline", NULL); + } roster = g_slist_next(roster); From dcf5e9ef169aba102b9035f05b55e338de2001a8 Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 4 Oct 2012 22:09:33 +0100 Subject: [PATCH 03/12] Removed /ros command --- src/command.c | 23 ----------------------- src/profanity.c | 11 +---------- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/src/command.c b/src/command.c index 240220c6..524c6c04 100644 --- a/src/command.c +++ b/src/command.c @@ -63,7 +63,6 @@ static gboolean _cmd_quit(const char * const inp, struct cmd_help_t help); static gboolean _cmd_help(const char * const inp, struct cmd_help_t help); static gboolean _cmd_prefs(const char * const inp, struct cmd_help_t help); static gboolean _cmd_who(const char * const inp, struct cmd_help_t help); -static gboolean _cmd_ros(const char * const inp, struct cmd_help_t help); static gboolean _cmd_connect(const char * const inp, struct cmd_help_t help); static gboolean _cmd_msg(const char * const inp, struct cmd_help_t help); static gboolean _cmd_tiny(const char * const inp, struct cmd_help_t help); @@ -153,15 +152,6 @@ static struct cmd_t main_commands[] = "Example : /tiny http://www.google.com", NULL } } }, - { "/ros", - _cmd_ros, - { "/ros", "List all contacts.", - { "/ros", - "----", - "List all contact currently on the chat hosts roster.", - "See /who for a more useful list of contacts who are currently online.", - NULL } } }, - { "/who", _cmd_who, { "/who", "Find out who is online.", @@ -560,19 +550,6 @@ _cmd_prefs(const char * const inp, struct cmd_help_t help) return TRUE; } -static gboolean -_cmd_ros(const char * const inp, struct cmd_help_t help) -{ - jabber_conn_status_t conn_status = jabber_get_connection_status(); - - if (conn_status != JABBER_CONNECTED) - cons_show("You are not currently connected."); - else - jabber_roster_request(); - - return TRUE; -} - static gboolean _cmd_who(const char * const inp, struct cmd_help_t help) { diff --git a/src/profanity.c b/src/profanity.c index f57b0ca9..329acb70 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -167,24 +167,15 @@ prof_handle_contact_offline(char *contact, char *show, char *status) void prof_handle_roster(GSList *roster) { - cons_show("Roster:"); while (roster != NULL) { jabber_roster_entry *entry = roster->data; - if (entry->name != NULL) { - cons_show("%s (%s)", entry->name, entry->jid); - - } else { - cons_show("%s", entry->jid); - } - + // if contact not in contact list add them as offline if (find_contact(entry->jid) == NULL) { contact_list_add(entry->jid, "offline", NULL); } roster = g_slist_next(roster); - - win_page_off(); } g_slist_free_full(roster, (GDestroyNotify)_free_roster_entry); From 9e2306098617dad0683e7024dc9c0695a428a29a Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 4 Oct 2012 22:48:41 +0100 Subject: [PATCH 04/12] Added argument to /who command to specify status --- src/command.c | 66 ++++++++++++++++++++++++++++++++++++++++++++-- src/ui.h | 2 +- src/windows.c | 73 ++++++++++++++++++++++++--------------------------- 3 files changed, 99 insertions(+), 42 deletions(-) diff --git a/src/command.c b/src/command.c index 524c6c04..45f4f00c 100644 --- a/src/command.c +++ b/src/command.c @@ -27,6 +27,7 @@ #include "command.h" #include "common.h" +#include "contact.h" #include "contact_list.h" #include "chat_log.h" #include "history.h" @@ -558,8 +559,69 @@ _cmd_who(const char * const inp, struct cmd_help_t help) if (conn_status != JABBER_CONNECTED) { cons_show("You are not currently connected."); } else { - GSList *list = get_contact_list(); - cons_show_online_contacts(list); + // copy input + char inp_cpy[strlen(inp) + 1]; + strcpy(inp_cpy, inp); + + // get show + strtok(inp_cpy, " "); + char *show = strtok(NULL, " "); + + // bad arg + if ((show != NULL) + && (strcmp(show, "online") != 0) + && (strcmp(show, "offline") != 0) + && (strcmp(show, "away") != 0) + && (strcmp(show, "chat") != 0) + && (strcmp(show, "xa") != 0) + && (strcmp(show, "dnd") != 0)) { + cons_show("Usage: %s", help.usage); + + // valid arg + } else { + GSList *list = get_contact_list(); + + // no arg, show all contacts + if (show == NULL) { + cons_show("All contacts:"); + cons_show_contacts(list); + + // online, show all status that indicate online + } else if (strcmp("online", show) == 0) { + cons_show("Contacts (%s):", show); + GSList *filtered = NULL; + + while (list != NULL) { + PContact contact = list->data; + const char * const contact_show = (p_contact_show(contact)); + if ((strcmp(contact_show, "online") == 0) + || (strcmp(contact_show, "away") == 0) + || (strcmp(contact_show, "dnd") == 0) + || (strcmp(contact_show, "xa") == 0) + || (strcmp(contact_show, "chat") == 0)) { + filtered = g_slist_append(filtered, contact); + } + list = g_slist_next(list); + } + + cons_show_contacts(filtered); + + // show specific status + } else { + cons_show("Contacts (%s):", show); + GSList *filtered = NULL; + + while (list != NULL) { + PContact contact = list->data; + if (strcmp(p_contact_show(contact), show) == 0) { + filtered = g_slist_append(filtered, contact); + } + list = g_slist_next(list); + } + + cons_show_contacts(filtered); + } + } } return TRUE; diff --git a/src/ui.h b/src/ui.h index 08c6bee9..df1eab66 100644 --- a/src/ui.h +++ b/src/ui.h @@ -107,7 +107,7 @@ void cons_bad_command(const char * const cmd); void cons_show(const char * const cmd, ...); void cons_bad_show(const char * const cmd); void cons_highlight_show(const char * const cmd); -void cons_show_online_contacts(GSList * list); +void cons_show_contacts(GSList * list); // status bar actions void status_bar_refresh(void); diff --git a/src/windows.c b/src/windows.c index fca84286..724a904f 100644 --- a/src/windows.c +++ b/src/windows.c @@ -554,55 +554,50 @@ cons_help(void) } void -cons_show_online_contacts(GSList *list) +cons_show_contacts(GSList *list) { - _win_show_time(_cons_win); - wprintw(_cons_win, "Online contacts:\n"); - GSList *curr = list; while(curr) { PContact contact = curr->data; const char *show = p_contact_show(contact); - if (strcmp(show, "offline") != 0) { - _win_show_time(_cons_win); + _win_show_time(_cons_win); - if (strcmp(show, "online") == 0) { - wattron(_cons_win, COLOUR_ONLINE); - } else if (strcmp(show, "away") == 0) { - wattron(_cons_win, COLOUR_AWAY); - } else if (strcmp(show, "chat") == 0) { - wattron(_cons_win, COLOUR_CHAT); - } else if (strcmp(show, "dnd") == 0) { - wattron(_cons_win, COLOUR_DND); - } else if (strcmp(show, "xa") == 0) { - wattron(_cons_win, COLOUR_XA); - } else { - wattron(_cons_win, COLOUR_OFFLINE); - } + if (strcmp(show, "online") == 0) { + wattron(_cons_win, COLOUR_ONLINE); + } else if (strcmp(show, "away") == 0) { + wattron(_cons_win, COLOUR_AWAY); + } else if (strcmp(show, "chat") == 0) { + wattron(_cons_win, COLOUR_CHAT); + } else if (strcmp(show, "dnd") == 0) { + wattron(_cons_win, COLOUR_DND); + } else if (strcmp(show, "xa") == 0) { + wattron(_cons_win, COLOUR_XA); + } else { + wattron(_cons_win, COLOUR_OFFLINE); + } - wprintw(_cons_win, "%s", p_contact_name(contact)); - wprintw(_cons_win, " is %s", show); - - if (p_contact_status(contact)) - wprintw(_cons_win, ", \"%s\"", p_contact_status(contact)); - - wprintw(_cons_win, "\n"); + wprintw(_cons_win, "%s", p_contact_name(contact)); + wprintw(_cons_win, " is %s", show); + + if (p_contact_status(contact)) + wprintw(_cons_win, ", \"%s\"", p_contact_status(contact)); + + wprintw(_cons_win, "\n"); - if (strcmp(show, "online") == 0) { - wattroff(_cons_win, COLOUR_ONLINE); - } else if (strcmp(show, "away") == 0) { - wattroff(_cons_win, COLOUR_AWAY); - } else if (strcmp(show, "chat") == 0) { - wattroff(_cons_win, COLOUR_CHAT); - } else if (strcmp(show, "dnd") == 0) { - wattroff(_cons_win, COLOUR_DND); - } else if (strcmp(show, "xa") == 0) { - wattroff(_cons_win, COLOUR_XA); - } else { - wattroff(_cons_win, COLOUR_OFFLINE); - } + if (strcmp(show, "online") == 0) { + wattroff(_cons_win, COLOUR_ONLINE); + } else if (strcmp(show, "away") == 0) { + wattroff(_cons_win, COLOUR_AWAY); + } else if (strcmp(show, "chat") == 0) { + wattroff(_cons_win, COLOUR_CHAT); + } else if (strcmp(show, "dnd") == 0) { + wattroff(_cons_win, COLOUR_DND); + } else if (strcmp(show, "xa") == 0) { + wattroff(_cons_win, COLOUR_XA); + } else { + wattroff(_cons_win, COLOUR_OFFLINE); } curr = g_slist_next(curr); From e486114e05b30357a96076c98d8423e962d8f491 Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 4 Oct 2012 23:18:48 +0100 Subject: [PATCH 05/12] Now checks for exitence of contact before sending message --- src/command.c | 10 ++++++---- src/contact_list.c | 18 ++++++++++++++++++ src/contact_list.h | 3 +++ src/windows.c | 25 +++++++++++++++++-------- 4 files changed, 44 insertions(+), 12 deletions(-) diff --git a/src/command.c b/src/command.c index 45f4f00c..cdb0c384 100644 --- a/src/command.c +++ b/src/command.c @@ -155,10 +155,12 @@ static struct cmd_t main_commands[] = { "/who", _cmd_who, - { "/who", "Find out who is online.", - { "/who", - "----", - "Show the list of all online contacts with their current status message.", + { "/who [status]", "Show contacts with chosen status.", + { "/who [status]", + "-------------", + "Show contacts with the specified status, no status shows all contacts.", + "Possible statuses are: online, offline, away, dnd, xa, chat.", + "online includes: chat, dnd, away, xa.", NULL } } }, { "/close", diff --git a/src/contact_list.c b/src/contact_list.c index 328b8d04..22a52659 100644 --- a/src/contact_list.c +++ b/src/contact_list.c @@ -20,6 +20,8 @@ * */ +#include + #include "contact.h" #include "prof_autocomplete.h" @@ -70,3 +72,19 @@ find_contact(char *search_str) { return p_autocomplete_complete(ac, search_str); } + +PContact +contact_list_get_contact(const char const *jid) +{ + GSList *contacts = get_contact_list(); + + while (contacts != NULL) { + PContact contact = contacts->data; + if (strcmp(p_contact_name(contact), jid) == 0) { + return contact; + } + contacts = g_slist_next(contacts); + } + + return NULL; +} diff --git a/src/contact_list.h b/src/contact_list.h index 4790a286..7d89b88c 100644 --- a/src/contact_list.h +++ b/src/contact_list.h @@ -25,6 +25,8 @@ #include +#include "contact.h" + void contact_list_init(void); void contact_list_clear(void); void reset_search_attempts(void); @@ -33,5 +35,6 @@ gboolean contact_list_add(const char * const name, const char * const show, gboolean contact_list_remove(const char * const name); GSList * get_contact_list(void); char * find_contact(char *search_str); +PContact contact_list_get_contact(const char const *jid); #endif diff --git a/src/windows.c b/src/windows.c index 724a904f..872a3617 100644 --- a/src/windows.c +++ b/src/windows.c @@ -38,6 +38,7 @@ #include "command.h" #include "contact.h" +#include "contact_list.h" #include "log.h" #include "preferences.h" #include "ui.h" @@ -357,15 +358,23 @@ void win_show_outgoing_msg(const char * const from, const char * const to, const char * const message) { - int win_index = _find_prof_win_index(to); - if (win_index == NUM_WINS) - win_index = _new_prof_win(to); + // if the contact is offline, show a message + PContact contact = contact_list_get_contact(to); + + if (contact == NULL) { + cons_show("%s is not one of your contacts."); + } else { + int win_index = _find_prof_win_index(to); - WINDOW *win = _wins[win_index].win; - _win_show_time(win); - _win_show_user(win, from, 0); - _win_show_message(win, message); - _win_switch_if_active(win_index); + if (win_index == NUM_WINS) + win_index = _new_prof_win(to); + + WINDOW *win = _wins[win_index].win; + _win_show_time(win); + _win_show_user(win, from, 0); + _win_show_message(win, message); + _win_switch_if_active(win_index); + } } void From 9f08744ec0b11123a610b82ab0f596e125098ba1 Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 4 Oct 2012 23:33:38 +0100 Subject: [PATCH 06/12] Show warning when sending message to offline contact --- src/windows.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/windows.c b/src/windows.c index 872a3617..c2c07015 100644 --- a/src/windows.c +++ b/src/windows.c @@ -370,6 +370,13 @@ win_show_outgoing_msg(const char * const from, const char * const to, win_index = _new_prof_win(to); WINDOW *win = _wins[win_index].win; + + if (strcmp(p_contact_show(contact), "offline") == 0) { + const char const *show = p_contact_show(contact); + const char const *status = p_contact_status(contact); + _show_status_string(win, to, show, status, "--", "offline"); + } + _win_show_time(win); _win_show_user(win, from, 0); _win_show_message(win, message); @@ -898,7 +905,7 @@ _show_status_string(WINDOW *win, const char * const from, const char * const default_show) { _win_show_time(win); - + if (show != NULL) { if (strcmp(show, "away") == 0) { wattron(win, COLOUR_AWAY); @@ -926,8 +933,8 @@ _show_status_string(WINDOW *win, const char * const from, wprintw(win, ", \"%s\"", status); wprintw(win, "\n"); - - if (show != NULL) { + + if (show != NULL) { if (strcmp(show, "away") == 0) { wattroff(win, COLOUR_AWAY); } else if (strcmp(show, "chat") == 0) { From c9afe7b3462aafe898b90cad2febd7bc8ae06682 Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 4 Oct 2012 23:38:01 +0100 Subject: [PATCH 07/12] Use colour prefs for offline message warning --- src/windows.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/windows.c b/src/windows.c index c2c07015..effd7e6a 100644 --- a/src/windows.c +++ b/src/windows.c @@ -915,6 +915,10 @@ _show_status_string(WINDOW *win, const char * const from, wattron(win, COLOUR_DND); } else if (strcmp(show, "xa") == 0) { wattron(win, COLOUR_XA); + } else if (strcmp(show, "online") == 0) { + wattron(win, COLOUR_ONLINE); + } else { + wattron(win, COLOUR_OFFLINE); } } else if (strcmp(default_show, "online") == 0) { wattron(win, COLOUR_ONLINE); @@ -943,6 +947,10 @@ _show_status_string(WINDOW *win, const char * const from, wattroff(win, COLOUR_DND); } else if (strcmp(show, "xa") == 0) { wattroff(win, COLOUR_XA); + } else if (strcmp(show, "online") == 0) { + wattroff(win, COLOUR_ONLINE); + } else { + wattroff(win, COLOUR_OFFLINE); } } else if (strcmp(default_show, "online") == 0) { wattroff(win, COLOUR_ONLINE); From d493975d54b70060e618212c69fe7d9bdb8dda22 Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 4 Oct 2012 23:55:15 +0100 Subject: [PATCH 08/12] Only show offline warning once --- src/windows.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/windows.c b/src/windows.c index effd7e6a..0c249b9a 100644 --- a/src/windows.c +++ b/src/windows.c @@ -365,16 +365,19 @@ win_show_outgoing_msg(const char * const from, const char * const to, cons_show("%s is not one of your contacts."); } else { int win_index = _find_prof_win_index(to); + WINDOW *win = NULL; - if (win_index == NUM_WINS) + if (win_index == NUM_WINS) { win_index = _new_prof_win(to); + win = _wins[win_index].win; - WINDOW *win = _wins[win_index].win; - - if (strcmp(p_contact_show(contact), "offline") == 0) { - const char const *show = p_contact_show(contact); - const char const *status = p_contact_status(contact); - _show_status_string(win, to, show, status, "--", "offline"); + if (strcmp(p_contact_show(contact), "offline") == 0) { + const char const *show = p_contact_show(contact); + const char const *status = p_contact_status(contact); + _show_status_string(win, to, show, status, "--", "offline"); + } + } else { + win = _wins[win_index].win; } _win_show_time(win); From a6467e17c7bd7be398c2f096190f7aaee9ffe76b Mon Sep 17 00:00:00 2001 From: James Booth Date: Fri, 5 Oct 2012 00:12:11 +0100 Subject: [PATCH 09/12] Decreased non blocking input delay --- src/input_win.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/input_win.c b/src/input_win.c index be030f29..308d4046 100644 --- a/src/input_win.c +++ b/src/input_win.c @@ -110,7 +110,7 @@ inp_clear(void) void inp_non_block(void) { - wtimeout(inp_win, 500); + wtimeout(inp_win, 20); } void From 8ecd93049f2125473cad3270928fde297bbf6f3b Mon Sep 17 00:00:00 2001 From: James Booth Date: Fri, 5 Oct 2012 00:42:02 +0100 Subject: [PATCH 10/12] Set no blocking delay to 100ms --- src/input_win.c | 2 +- src/profanity.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/input_win.c b/src/input_win.c index 308d4046..15f095bf 100644 --- a/src/input_win.c +++ b/src/input_win.c @@ -110,7 +110,7 @@ inp_clear(void) void inp_non_block(void) { - wtimeout(inp_win, 20); + wtimeout(inp_win, 100); } void diff --git a/src/profanity.c b/src/profanity.c index 329acb70..521b277e 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -55,10 +55,12 @@ prof_run(const int disable_tls, char *log_level) GTimer *timer = g_timer_new(); gboolean cmd_result = TRUE; + char inp[INP_WIN_MAX]; + int size = 0; + while(cmd_result == TRUE) { int ch = ERR; - char inp[INP_WIN_MAX]; - int size = 0; + size = 0; while(ch != '\n') { From 47fd81d5b9bff3219407a8c21795149882f191a6 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sat, 6 Oct 2012 00:16:53 +0100 Subject: [PATCH 11/12] Fixed memory leak --- src/status_bar.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/status_bar.c b/src/status_bar.c index 3a22d3db..d9ae4aee 100644 --- a/src/status_bar.c +++ b/src/status_bar.c @@ -74,7 +74,6 @@ status_bar_refresh(void) if (elapsed >= 60000000) { dirty = TRUE; - g_date_time_unref(now_time); last_time = g_date_time_new_now_local(); } @@ -84,6 +83,8 @@ status_bar_refresh(void) inp_put_back(); dirty = FALSE; } + + g_date_time_unref(now_time); } void From ee463894863f4101d73bfb848edd7c46e45ded67 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sat, 6 Oct 2012 00:20:50 +0100 Subject: [PATCH 12/12] Decreased non blocking delay --- src/input_win.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/input_win.c b/src/input_win.c index 15f095bf..308d4046 100644 --- a/src/input_win.c +++ b/src/input_win.c @@ -110,7 +110,7 @@ inp_clear(void) void inp_non_block(void) { - wtimeout(inp_win, 100); + wtimeout(inp_win, 20); } void