ConnectionManager: Reset hard simult connection limit if it blocks for too long.
[thrasher.git] / thconnection.c
blobd1c329d5e19e1df8839e8e6d71792bf92756e619
1 /*
2 * Thrasher Bird - XMPP transport via libpurple
3 * Copyright (C) 2008 Barracuda Networks, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with Thrasher Bird; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
19 #include <glib.h>
20 #include <signal.h>
21 #include <stdio.h>
23 #include "connection.h"
24 #include "thrasher.h"
25 #include "thconnection.h"
26 #include "thperl.h"
28 void thrasher_connection_error (PurpleConnection *gc,
29 PurpleConnectionError err,
30 const gchar *desc);
33 void thrasher_connection_error (PurpleConnection *gc,
34 PurpleConnectionError err,
35 const gchar *desc)
37 PurpleAccount *account;
39 /* Bail if we can't get what the error is for. */
40 g_return_if_fail(gc != NULL);
42 /* Set account and verify */
43 account = purple_connection_get_account(gc);
44 g_return_if_fail(account != NULL);
46 thrasher_wrapper_connection_error(thrasher_account_get_jid(account),
47 err,
48 g_strdup(desc));
51 gpointer thrasher_connection_get_handle ()
53 static int handle;
54 return &handle;
58 void thrasher_connection_init ()
60 purple_signal_connect_priority
61 (purple_connections_get_handle(),
62 "connection-error",
63 thrasher_connection_get_handle(),
64 PURPLE_CALLBACK(thrasher_connection_error),
65 NULL,
66 10); // We want this to be called after the one in account.c,
67 // which has a priority of 0 (PURPLE_SIGNAL_PRIORITY_DEFAULT)