Release 1.25.0 -- Buddy Idle Time, RTF
[siplcs.git] / src / purple / purple-connection.c
blob32d6074a239ac42439e67de7d86af2379e7fff5b
1 /**
2 * @file purple-connection.c
4 * pidgin-sipe
6 * Copyright (C) 2010-2019 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 #ifdef HAVE_CONFIG_H
24 #include "config.h"
25 #endif
27 #include "glib.h"
29 #include "connection.h"
31 #include "sipe-backend.h"
32 #include "sipe-core.h"
34 #include "purple-private.h"
36 #if PURPLE_VERSION_CHECK(3,0,0)
37 #else
38 #define PURPLE_CONNECTION_CONNECTED PURPLE_CONNECTED
39 #define purple_account_is_disconnecting(a) a->disconnecting
40 #define purple_connection_error(g, e, m) purple_connection_error_reason(g, e, m)
41 #endif
43 void sipe_backend_connection_completed(struct sipe_core_public *sipe_public)
45 purple_connection_set_state(sipe_public->backend_private->gc,
46 PURPLE_CONNECTION_CONNECTED);
49 static const guint map[SIPE_CONNECTION_ERROR_LAST] = {
50 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
51 PURPLE_CONNECTION_ERROR_INVALID_USERNAME,
52 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS,
53 PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED,
54 PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE,
57 void sipe_backend_connection_error(struct sipe_core_public *sipe_public,
58 sipe_connection_error error,
59 const gchar *msg)
61 purple_connection_error(sipe_public->backend_private->gc,
62 map[error],
63 msg);
66 gboolean sipe_backend_connection_is_disconnecting(struct sipe_core_public *sipe_public)
68 return(purple_account_is_disconnecting(sipe_public->backend_private->account));
71 gboolean sipe_backend_connection_is_valid(struct sipe_core_public *sipe_public)
73 return PURPLE_CONNECTION_IS_CONNECTED(sipe_public->backend_private->gc);
77 Local Variables:
78 mode: c
79 c-file-style: "bsd"
80 indent-tabs-mode: t
81 tab-width: 8
82 End: