Fix #222: SIPE crashes when groupchat session expires (VI)
[siplcs.git] / src / purple / purple-connection.c
blob8ed026e2ff5baed11a83ac5d0747b72313a9b820
1 /**
2 * @file purple-connection.c
4 * pidgin-sipe
6 * Copyright (C) 2010 SIPE Project <http://sipe.sourceforge.net/>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "glib.h"
25 #include "connection.h"
26 #include "version.h"
28 #include "sipe-backend.h"
29 #include "sipe-core.h"
31 #include "purple-private.h"
33 void sipe_backend_connection_completed(struct sipe_core_public *sipe_public)
35 purple_connection_set_state(sipe_public->backend_private->gc,
36 PURPLE_CONNECTED);
39 static const guint map[SIPE_CONNECTION_ERROR_LAST] = {
40 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
41 PURPLE_CONNECTION_ERROR_INVALID_USERNAME,
42 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS,
43 PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED,
44 PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE,
47 void sipe_backend_connection_error(struct sipe_core_public *sipe_public,
48 sipe_connection_error error,
49 const gchar *msg)
51 #if PURPLE_VERSION_CHECK(3,0,0)
52 purple_connection_error(
53 #else
54 purple_connection_error_reason(
55 #endif
56 sipe_public->backend_private->gc,
57 map[error],
58 msg);
61 gboolean sipe_backend_connection_is_disconnecting(struct sipe_core_public *sipe_public)
63 return sipe_public->backend_private->account->disconnecting;
66 gboolean sipe_backend_connection_is_valid(struct sipe_core_public *sipe_public)
68 return PURPLE_CONNECTION_IS_CONNECTED(sipe_public->backend_private->gc);
72 Local Variables:
73 mode: c
74 c-file-style: "bsd"
75 indent-tabs-mode: t
76 tab-width: 8
77 End: