diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common.c | 9 | ||||
-rw-r--r-- | src/common.h | 1 | ||||
-rw-r--r-- | src/config/preferences.c | 4 | ||||
-rw-r--r-- | src/config/theme.c | 5 | ||||
-rw-r--r-- | src/event/client_events.c | 2 | ||||
-rw-r--r-- | src/otr/otr.c | 8 | ||||
-rw-r--r-- | src/profanity.c | 2 | ||||
-rw-r--r-- | src/ui/windows.h | 2 | ||||
-rw-r--r-- | src/xmpp/connection.c | 9 | ||||
-rw-r--r-- | src/xmpp/xmpp.h | 2 |
10 files changed, 31 insertions, 13 deletions
diff --git a/src/common.c b/src/common.c index 772e24d3..4fa45608 100644 --- a/src/common.c +++ b/src/common.c @@ -57,6 +57,8 @@ struct curl_data_t size_t size; }; +static unsigned long unique_id = 0; + static size_t _data_callback(void *ptr, size_t size, size_t nmemb, void *data); // taken from glib 2.30.3 @@ -469,7 +471,6 @@ xdg_get_data_home(void) char * create_unique_id(char *prefix) { - static unsigned long unique_id; char *result = NULL; GString *result_str = g_string_new(""); @@ -485,6 +486,12 @@ create_unique_id(char *prefix) return result; } +void +reset_unique_id(void) +{ + unique_id = 0; +} + char * p_sha1_hash(char *str) { diff --git a/src/common.h b/src/common.h index 9521a701..c1aa532d 100644 --- a/src/common.h +++ b/src/common.h @@ -127,6 +127,7 @@ contact_presence_t contact_presence_from_resource_presence(resource_presence_t r char * p_sha1_hash(char *str); char * create_unique_id(char *prefix); +void reset_unique_id(void); int cmp_win_num(gconstpointer a, gconstpointer b); int get_next_available_win_num(GList *used); diff --git a/src/config/preferences.c b/src/config/preferences.c index b7ca113e..e892d796 100644 --- a/src/config/preferences.c +++ b/src/config/preferences.c @@ -82,7 +82,7 @@ prefs_load(void) { GError *err; - log_info("Loading preferences"); +// log_info("Loading preferences"); prefs_loc = _get_preferences_file(); if (g_file_test(prefs_loc, G_FILE_TEST_EXISTS)) { @@ -743,4 +743,4 @@ _get_default_string(preference_t pref) default: return NULL; } -} \ No newline at end of file +} diff --git a/src/config/theme.c b/src/config/theme.c index 537771b1..640b7298 100644 --- a/src/config/theme.c +++ b/src/config/theme.c @@ -207,12 +207,15 @@ theme_close(void) { if (theme) { g_key_file_free(theme); + theme = NULL; } if (theme_loc) { g_string_free(theme_loc, TRUE); + theme_loc = NULL; } if (bold_items) { g_hash_table_destroy(bold_items); + bold_items = NULL; } } @@ -614,4 +617,4 @@ theme_attrs(theme_item_t attrs) return result; } -} \ No newline at end of file +} diff --git a/src/event/client_events.c b/src/event/client_events.c index 3465d5ee..3feeeca1 100644 --- a/src/event/client_events.c +++ b/src/event/client_events.c @@ -107,4 +107,4 @@ cl_ev_send_priv_msg(ProfPrivateWin *privwin, const char * const msg) { message_send_private(privwin->fulljid, msg); ui_outgoing_private_msg(privwin, msg); -} \ No newline at end of file +} diff --git a/src/otr/otr.c b/src/otr/otr.c index e568af56..1f63c8f9 100644 --- a/src/otr/otr.c +++ b/src/otr/otr.c @@ -163,6 +163,8 @@ otr_init(void) log_info("Initialising OTR"); OTRL_INIT; + jid = NULL; + ops.policy = cb_policy; ops.is_logged_in = cb_is_logged_in; ops.inject_message = cb_inject_message; @@ -181,6 +183,7 @@ otr_shutdown(void) { if (jid) { free(jid); + jid = NULL; } } @@ -642,7 +645,8 @@ otr_get_their_fingerprint(const char * const recipient) prof_otrpolicy_t otr_get_policy(const char * const recipient) { - ProfAccount *account = accounts_get_account(jabber_get_account_name()); + char *account_name = jabber_get_account_name(); + ProfAccount *account = accounts_get_account(account_name); // check contact specific setting if (g_list_find_custom(account->otr_manual, recipient, (GCompareFunc)g_strcmp0)) { account_free(account); @@ -747,4 +751,4 @@ void otr_free_message(char *message) { otrl_message_free(message); -} \ No newline at end of file +} diff --git a/src/profanity.c b/src/profanity.c index 277fe4ad..7aee7a67 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -103,7 +103,7 @@ prof_run(const int disable_tls, char *log_level, char *account_name) otr_poll(); #endif notify_remind(); - jabber_process_events(); + jabber_process_events(10); ui_update(); } } diff --git a/src/ui/windows.h b/src/ui/windows.h index 97183d51..4cc527ca 100644 --- a/src/ui/windows.h +++ b/src/ui/windows.h @@ -35,6 +35,8 @@ #ifndef UI_WINDOWS_H #define UI_WINDOWS_H +#include "ui/window.h" + void wins_init(void); ProfWin * wins_new_xmlconsole(void); diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c index 70d49b7c..8fa83144 100644 --- a/src/xmpp/connection.c +++ b/src/xmpp/connection.c @@ -194,7 +194,7 @@ jabber_disconnect(void) xmpp_disconnect(jabber_conn.conn); while (jabber_get_connection_status() == JABBER_DISCONNECTING) { - jabber_process_events(); + jabber_process_events(10); } _connection_free_saved_account(); _connection_free_saved_details(); @@ -222,10 +222,11 @@ jabber_shutdown(void) _connection_free_session_data(); xmpp_shutdown(); free(jabber_conn.log); + jabber_conn.log = NULL; } void -jabber_process_events(void) +jabber_process_events(int millis) { int reconnect_sec; @@ -234,7 +235,7 @@ jabber_process_events(void) case JABBER_CONNECTED: case JABBER_CONNECTING: case JABBER_DISCONNECTING: - xmpp_run_once(jabber_conn.ctx, 10); + xmpp_run_once(jabber_conn.ctx, millis); break; case JABBER_DISCONNECTED: reconnect_sec = prefs_get_reconnect(); @@ -577,4 +578,4 @@ _xmpp_get_file_logger() file_log->userdata = &level; return file_log; -} \ No newline at end of file +} diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h index 80b680b0..26122d51 100644 --- a/src/xmpp/xmpp.h +++ b/src/xmpp/xmpp.h @@ -136,7 +136,7 @@ jabber_conn_status_t jabber_connect_with_details(const char * const jid, jabber_conn_status_t jabber_connect_with_account(const ProfAccount * const account); void jabber_disconnect(void); void jabber_shutdown(void); -void jabber_process_events(void); +void jabber_process_events(int millis); const char * jabber_get_fulljid(void); const char * jabber_get_domain(void); jabber_conn_status_t jabber_get_connection_status(void); |