Incoming statuses with characters 0x80-0xFF were double-escaped.
[thrasher.git] / thconnection.c
blob3928a17ad4ca8188808adde8861ee53fa20d3f02
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;
57 void
58 thrasher_connection_update_progress(PurpleConnection *gc,
59 const char *text,
60 size_t step,
61 size_t step_count) {
62 g_return_if_fail(gc != NULL);
63 g_return_if_fail(text != NULL);
64 PurpleAccount *account = purple_connection_get_account(gc);
65 purple_debug_info("thrasher connection",
66 "%s: %s (step %d of %d)\n",
67 thrasher_account_get_jid(account),
68 text,
69 step + 1,
70 step_count);
73 void thrasher_connection_init ()
75 purple_signal_connect_priority
76 (purple_connections_get_handle(),
77 "connection-error",
78 thrasher_connection_get_handle(),
79 PURPLE_CALLBACK(thrasher_connection_error),
80 NULL,
81 10); // We want this to be called after the one in account.c,
82 // which has a priority of 0 (PURPLE_SIGNAL_PRIORITY_DEFAULT)