diff options
author | Eion Robb <eion@robbmob.com> | 2011-01-16 01:49:11 +0300 |
---|---|---|
committer | Eion Robb <eion@robbmob.com> | 2011-01-16 01:49:11 +0300 |
commit | 110201bd8ff7a9ccbba929d96b7f917b9ffd145f (patch) | |
tree | 9cb221fba18ec365bc21cf357a05d675f301591b | |
parent | 9d2a1f6881a0b0f677d0fe0ea77f00425e9e9b3a (diff) |
Jiggle around the connection methods so that not connecting to Skype isn't fatal (so doesn't need the account to be re-enabled) and clean up some memory if connecting on X11
-rw-r--r-- | libskype.c | 22 | ||||
-rw-r--r-- | skype_events.c | 4 | ||||
-rw-r--r-- | skype_messaging_x11.c | 7 |
3 files changed, 20 insertions, 13 deletions
@@ -1545,7 +1545,7 @@ skype_login_cb(gpointer acct) { if (!is_skype_running()) { - purple_timeout_add_seconds(1, skype_login_cb, acct); + purple_timeout_add_seconds(5, skype_login_cb, acct); return FALSE; } skype_login(acct); @@ -1592,7 +1592,8 @@ skype_login(PurpleAccount *acct) test_account = find_acct(purple_plugin_get_id(this_plugin), NULL); if (test_account && test_account != acct) { - purple_connection_error(gc, errormsg = g_strconcat("\n",_("Only one Skype account allowed"), NULL)); + errormsg = g_strconcat("\n",_("Only one Skype account allowed"), NULL); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, errormsg); g_free(errormsg); return; } @@ -1618,13 +1619,13 @@ skype_login(PurpleAccount *acct) if (skype_started) { - purple_timeout_add_seconds(10, skype_login_cb, acct); + purple_timeout_add_seconds(20, skype_login_cb, acct); return; } return; } } - purple_timeout_add_seconds(1, (GSourceFunc) skype_login_retry, acct); + purple_timeout_add_seconds(10, (GSourceFunc) skype_login_retry, acct); return; } @@ -1641,9 +1642,10 @@ skype_login_retry(PurpleAccount *acct) if (retry_count++ == 3) { - gc->wants_to_die = TRUE; - purple_connection_error(gc, errormsg = g_strconcat("\n", _("Could not connect to Skype process.\nSkype not running?"), NULL)); + errormsg = g_strconcat("\n", _("Could not connect to Skype process.\nSkype not running?"), NULL); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, errormsg); g_free(errormsg); + return FALSE; } @@ -1675,8 +1677,7 @@ skype_login_part2(PurpleAccount *acct) #endif if (reply == NULL || strlen(reply) == 0) { - //purple_connection_error(gc, g_strconcat("\n",_("Skype client not ready"), NULL)); - purple_timeout_add_seconds(1, (GSourceFunc) skype_login_retry, acct); + purple_timeout_add_seconds(10, (GSourceFunc) skype_login_retry, acct); return FALSE; } if (g_str_equal(reply, "CONNSTATUS OFFLINE")) @@ -1692,8 +1693,7 @@ skype_login_part2(PurpleAccount *acct) reply = skype_send_message("PROTOCOL 7"); if (reply == NULL || strlen(reply) == 0) { - //purple_connection_error(gc, g_strconcat("\n",_("Skype client not ready"), NULL)); - purple_timeout_add_seconds(1, (GSourceFunc) skype_login_retry, acct); + purple_timeout_add_seconds(10, (GSourceFunc) skype_login_retry, acct); return FALSE; } g_free(reply); @@ -2500,7 +2500,7 @@ gboolean skype_check_keepalive(PurpleConnection *gc) { if (last_pong < last_ping) - purple_connection_error(gc, _("\nSkype not responding")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("\nSkype not responding")); return FALSE; } diff --git a/skype_events.c b/skype_events.c index 2c5c93d..bcb494a 100644 --- a/skype_events.c +++ b/skype_events.c @@ -139,7 +139,7 @@ skype_handle_received_message(char *message) { //need to make this synchronous :( if (gc != NULL) - purple_connection_error(gc, _("\nSkype program closed")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("\nSkype program closed")); //purple_timeout_add(0, (GSourceFunc)skype_sync_skype_close, gc); } } else if (g_str_equal(command, "USER")) @@ -1101,7 +1101,7 @@ gboolean skype_sync_skype_close(PurpleConnection *gc) { if (gc != NULL) - purple_connection_error(gc, _("\nSkype program closed")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("\nSkype program closed")); return FALSE; } diff --git a/skype_messaging_x11.c b/skype_messaging_x11.c index 67c099e..2090c18 100644 --- a/skype_messaging_x11.c +++ b/skype_messaging_x11.c @@ -73,6 +73,7 @@ skype_connect() XFlush(disp); if (win == -1) { + XCloseDisplay(disp); skype_debug_info("skype_x11", "Could not create X11 messaging window\n"); return FALSE; } @@ -80,6 +81,9 @@ skype_connect() skype_inst = XInternAtom(disp, "_SKYPE_INSTANCE", True); if (skype_inst == None) { + XDestroyWindow(disp, win); + XCloseDisplay(disp); + win = (Window)-1; skype_win = (Window)-1; skype_debug_info("skype_x11", "Could not create skype Atom\n"); return FALSE; @@ -88,6 +92,9 @@ skype_connect() status = XGetWindowProperty(disp, root, skype_inst, 0, 1, False, XA_WINDOW, &type_ret, &format_ret, &nitems_ret, &bytes_after_ret, &prop); if(status != Success || format_ret != 32 || nitems_ret < 1) { + XDestroyWindow(disp, win); + XCloseDisplay(disp); + win = (Window)-1; XFree(prop); skype_win = (Window)-1; skype_debug_info("skype", "Skype instance not found\n"); |