Sat, 14 Sep 2013 15:46:27 +0530
Updated protocol iface calls
| 5563 | 1 | /** |
| 2 | * @file connection.c Connection API | |
| 3 | * @ingroup core | |
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19897
diff
changeset
|
4 | */ |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19897
diff
changeset
|
5 | |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19897
diff
changeset
|
6 | /* purple |
| 5563 | 7 | * |
| 15884 | 8 | * Purple is the legal property of its developers, whose names are too numerous |
| 8046 | 9 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 10 | * source distribution. | |
| 5631 | 11 | * |
| 5563 | 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by | |
| 14 | * the Free Software Foundation; either version 2 of the License, or | |
| 15 | * (at your option) any later version. | |
| 16 | * | |
| 17 | * This program is distributed in the hope that it will be useful, | |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 20 | * GNU General Public License for more details. | |
| 21 | * | |
| 22 | * You should have received a copy of the GNU General Public License | |
| 23 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 5563 | 25 | */ |
|
24569
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
26 | #define _PURPLE_CONNECTION_C_ |
|
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
27 | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
28 | #include "internal.h" |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
29 | #include "account.h" |
|
34706
02cb08146888
Renamed blist.[ch] to buddylist.[ch]
Ankit Vani <a@nevitus.org>
parents:
34645
diff
changeset
|
30 | #include "buddylist.h" |
| 5563 | 31 | #include "connection.h" |
|
11146
c56333373e3c
[gaim-migrate @ 13217]
Piotr Zielinski <zielaj@users.sourceforge.net>
parents:
11033
diff
changeset
|
32 | #include "dbus-maybe.h" |
| 5717 | 33 | #include "debug.h" |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
34 | #include "enums.h" |
|
33427
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32679
diff
changeset
|
35 | #include "http.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
36 | #include "log.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
37 | #include "notify.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
38 | #include "prefs.h" |
|
14900
4af8b81519b6
[gaim-migrate @ 17607]
Mark Doliner <markdoliner@pidgin.im>
parents:
14814
diff
changeset
|
39 | #include "proxy.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
40 | #include "request.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
41 | #include "server.h" |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
42 | #include "signals.h" |
|
6106
1dc08be40f0a
[gaim-migrate @ 6567]
Mark Doliner <markdoliner@pidgin.im>
parents:
6076
diff
changeset
|
43 | #include "util.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
44 | |
|
21865
59b1c56633d1
De-magic number the prpl_info->keepalive interval, and document it.
Will Thompson <resiak@pidgin.im>
parents:
21831
diff
changeset
|
45 | #define KEEPALIVE_INTERVAL 30 |
|
59b1c56633d1
De-magic number the prpl_info->keepalive interval, and document it.
Will Thompson <resiak@pidgin.im>
parents:
21831
diff
changeset
|
46 | |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
47 | #define PURPLE_CONNECTION_GET_PRIVATE(obj) \ |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
48 | (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_CONNECTION, PurpleConnectionPrivate)) |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
49 | |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
50 | /** @copydoc _PurpleConnectionPrivate */ |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
51 | typedef struct _PurpleConnectionPrivate PurpleConnectionPrivate; |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
52 | |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
53 | /** Private data for a connection */ |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
54 | struct _PurpleConnectionPrivate |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
55 | { |
|
36549
735cd882faf7
Removed warnings from connection.c
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
56 | PurpleProtocol *protocol; /**< The protocol. */ |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
57 | PurpleConnectionFlags flags; /**< Connection flags. */ |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
58 | |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
59 | PurpleConnectionState state; /**< The connection state. */ |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
60 | |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
61 | PurpleAccount *account; /**< The account being connected to. */ |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
62 | char *password; /**< The password used. */ |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
63 | |
|
34750
826c1611ef90
Refactored protocols to use the initial GObject connection API.
Ankit Vani <a@nevitus.org>
parents:
34748
diff
changeset
|
64 | GSList *active_chats; /**< A list of active chats |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
65 | (#PurpleChatConversation structs). */ |
|
36710
16a60fe59d22
Backed out changeset 7cf0bf5b9a40
Ankit Vani <a@nevitus.org>
parents:
36709
diff
changeset
|
66 | void *proto_data; /**< Protocol-specific data. |
|
16a60fe59d22
Backed out changeset 7cf0bf5b9a40
Ankit Vani <a@nevitus.org>
parents:
36709
diff
changeset
|
67 | TODO Remove this, and use |
|
16a60fe59d22
Backed out changeset 7cf0bf5b9a40
Ankit Vani <a@nevitus.org>
parents:
36709
diff
changeset
|
68 | protocol-specific subclasses */ |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
69 | |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
70 | char *display_name; /**< How you appear to other people. */ |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
71 | guint keepalive; /**< Keep-alive. */ |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
72 | |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
73 | /** Wants to Die state. This is set when the user chooses to log out, or |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
74 | * when the protocol is disconnected and should not be automatically |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36626
diff
changeset
|
75 | * reconnected (incorrect password, etc.). Protocols should rely on |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
76 | * purple_connection_error() to set this for them rather than |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
77 | * setting it themselves. |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
78 | * @see purple_connection_error_is_fatal |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
79 | */ |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
80 | gboolean wants_to_die; |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
81 | |
|
34763
ca1f4c23d6fa
Removed unnecessary reminder and warning
Ankit Vani <a@nevitus.org>
parents:
34762
diff
changeset
|
82 | guint disconnect_timeout; /**< Timer used for nasty stack tricks */ |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
83 | time_t last_received; /**< When we last received a packet. Set by the |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36626
diff
changeset
|
84 | protocols to avoid sending unneeded keepalives */ |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
85 | }; |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
86 | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
87 | /* GObject property enums */ |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
88 | enum |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
89 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
90 | PROP_0, |
|
36366
202c60d1300f
Refactored connection, conversation, conversationtypes to use the initial GObject plugin API
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
91 | PROP_PROTOCOL, |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
92 | PROP_FLAGS, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
93 | PROP_STATE, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
94 | PROP_ACCOUNT, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
95 | PROP_PASSWORD, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
96 | PROP_DISPLAY_NAME, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
97 | PROP_LAST |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
98 | }; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
99 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
100 | static GObjectClass *parent_class; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
101 | |
| 5563 | 102 | static GList *connections = NULL; |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
103 | static GList *connections_connecting = NULL; |
| 15884 | 104 | static PurpleConnectionUiOps *connection_ui_ops = NULL; |
| 5563 | 105 | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
106 | static int connections_handle; |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
107 | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
108 | /************************************************************************** |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
109 | * Connection API |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
110 | **************************************************************************/ |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
111 | static gboolean |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
112 | send_keepalive(gpointer data) |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
113 | { |
| 15884 | 114 | PurpleConnection *gc = data; |
| 34752 | 115 | PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc); |
|
22277
7c386db62c81
Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@pidgin.im>
parents:
22163
diff
changeset
|
116 | |
|
7c386db62c81
Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@pidgin.im>
parents:
22163
diff
changeset
|
117 | /* Only send keep-alives if we haven't heard from the |
|
22324
ca786d5fa291
send_keepalive needs to return TRUE to ensure it'll get called again, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22277
diff
changeset
|
118 | * server in a while. |
|
ca786d5fa291
send_keepalive needs to return TRUE to ensure it'll get called again, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22277
diff
changeset
|
119 | */ |
| 34752 | 120 | if ((time(NULL) - priv->last_received) < KEEPALIVE_INTERVAL) |
|
22324
ca786d5fa291
send_keepalive needs to return TRUE to ensure it'll get called again, and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22277
diff
changeset
|
121 | return TRUE; |
|
22277
7c386db62c81
Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@pidgin.im>
parents:
22163
diff
changeset
|
122 | |
| 36719 | 123 | purple_protocol_server_iface_keepalive(priv->protocol, gc); |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
124 | |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
125 | return TRUE; |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
126 | } |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
127 | |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
128 | static void |
| 15884 | 129 | update_keepalive(PurpleConnection *gc, gboolean on) |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
130 | { |
| 34752 | 131 | PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc); |
|
14545
f8b45a0ddac5
[gaim-migrate @ 17202]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
132 | |
|
36366
202c60d1300f
Refactored connection, conversation, conversationtypes to use the initial GObject plugin API
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
133 | g_return_if_fail(priv != NULL); |
|
14545
f8b45a0ddac5
[gaim-migrate @ 17202]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
134 | |
|
36620
c76013b145f4
Added PURPLE_PROTOCOL_IMPLEMENTS(protocol,func) to check if a protocol implements a function
Ankit Vani <a@nevitus.org>
parents:
36610
diff
changeset
|
135 | if (!PURPLE_PROTOCOL_IMPLEMENTS(priv->protocol, keepalive)) |
|
14545
f8b45a0ddac5
[gaim-migrate @ 17202]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
136 | return; |
|
f8b45a0ddac5
[gaim-migrate @ 17202]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
137 | |
| 34752 | 138 | if (on && !priv->keepalive) |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
139 | { |
| 15884 | 140 | purple_debug_info("connection", "Activating keepalive.\n"); |
| 34752 | 141 | priv->keepalive = purple_timeout_add_seconds(KEEPALIVE_INTERVAL, send_keepalive, gc); |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
142 | } |
| 34752 | 143 | else if (!on && priv->keepalive > 0) |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
144 | { |
| 15884 | 145 | purple_debug_info("connection", "Deactivating keepalive.\n"); |
| 34752 | 146 | purple_timeout_remove(priv->keepalive); |
| 147 | priv->keepalive = 0; | |
|
18912
606597744812
Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <am@adiumx.com>
parents:
18186
diff
changeset
|
148 | } |
|
6029
85d6afa168fb
[gaim-migrate @ 6479]
Mark Doliner <markdoliner@pidgin.im>
parents:
6018
diff
changeset
|
149 | } |
|
85d6afa168fb
[gaim-migrate @ 6479]
Mark Doliner <markdoliner@pidgin.im>
parents:
6018
diff
changeset
|
150 | |
| 5563 | 151 | /* |
|
8130
58e4e51f514b
[gaim-migrate @ 8835]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
152 | * d:)->-< |
| 5563 | 153 | * |
| 154 | * d:O-\-< | |
|
8130
58e4e51f514b
[gaim-migrate @ 8835]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
155 | * |
| 5563 | 156 | * d:D-/-< |
| 157 | * | |
| 158 | * d8D->-< DANCE! | |
| 159 | */ | |
| 160 | ||
| 161 | void | |
| 15884 | 162 | purple_connection_set_state(PurpleConnection *gc, PurpleConnectionState state) |
| 5563 | 163 | { |
| 15884 | 164 | PurpleConnectionUiOps *ops; |
| 34752 | 165 | PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc); |
|
5885
223ac977eed2
[gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents:
5883
diff
changeset
|
166 | |
| 34752 | 167 | g_return_if_fail(priv != NULL); |
| 5563 | 168 | |
| 34752 | 169 | if (priv->state == state) |
|
5784
4c9046760b5b
[gaim-migrate @ 6209]
Christian Hammond <chipx86@chipx86.com>
parents:
5741
diff
changeset
|
170 | return; |
|
4c9046760b5b
[gaim-migrate @ 6209]
Christian Hammond <chipx86@chipx86.com>
parents:
5741
diff
changeset
|
171 | |
| 34752 | 172 | priv->state = state; |
| 5563 | 173 | |
| 15884 | 174 | ops = purple_connections_get_ui_ops(); |
|
5885
223ac977eed2
[gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents:
5883
diff
changeset
|
175 | |
| 34752 | 176 | if (priv->state == PURPLE_CONNECTION_CONNECTING) { |
|
5905
62a6bdbc09b7
[gaim-migrate @ 6337]
Robert McQueen <robot101@debian.org>
parents:
5885
diff
changeset
|
177 | connections_connecting = g_list_append(connections_connecting, gc); |
|
62a6bdbc09b7
[gaim-migrate @ 6337]
Robert McQueen <robot101@debian.org>
parents:
5885
diff
changeset
|
178 | } |
|
62a6bdbc09b7
[gaim-migrate @ 6337]
Robert McQueen <robot101@debian.org>
parents:
5885
diff
changeset
|
179 | else { |
|
5885
223ac977eed2
[gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents:
5883
diff
changeset
|
180 | connections_connecting = g_list_remove(connections_connecting, gc); |
|
5905
62a6bdbc09b7
[gaim-migrate @ 6337]
Robert McQueen <robot101@debian.org>
parents:
5885
diff
changeset
|
181 | } |
|
5885
223ac977eed2
[gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents:
5883
diff
changeset
|
182 | |
| 34752 | 183 | if (priv->state == PURPLE_CONNECTION_CONNECTED) { |
| 15884 | 184 | PurpleAccount *account; |
| 185 | PurplePresence *presence; | |
|
10052
329dad7e2da3
[gaim-migrate @ 11013]
Dave West <kat@users.sourceforge.net>
parents:
9944
diff
changeset
|
186 | |
| 15884 | 187 | account = purple_connection_get_account(gc); |
| 188 | presence = purple_account_get_presence(account); | |
| 5563 | 189 | |
| 190 | /* Set the time the account came online */ | |
| 15884 | 191 | purple_presence_set_login_time(presence, time(NULL)); |
| 5563 | 192 | |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15890
diff
changeset
|
193 | if (purple_prefs_get_bool("/purple/logging/log_system")) |
|
11698
afbf0d8bdacf
[gaim-migrate @ 13989]
Mark Doliner <markdoliner@pidgin.im>
parents:
11562
diff
changeset
|
194 | { |
| 15884 | 195 | PurpleLog *log = purple_account_get_log(account, TRUE); |
|
13508
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
196 | |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
197 | if (log != NULL) |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
198 | { |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
199 | char *msg = g_strdup_printf(_("+++ %s signed on"), |
| 15884 | 200 | purple_account_get_username(account)); |
| 201 | purple_log_write(log, PURPLE_MESSAGE_SYSTEM, | |
| 202 | purple_account_get_username(account), | |
| 203 | purple_presence_get_login_time(presence), | |
|
13508
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
204 | msg); |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
205 | g_free(msg); |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
206 | } |
|
10301
fd24ab69574a
[gaim-migrate @ 11486]
Mark Doliner <markdoliner@pidgin.im>
parents:
10193
diff
changeset
|
207 | } |
|
fd24ab69574a
[gaim-migrate @ 11486]
Mark Doliner <markdoliner@pidgin.im>
parents:
10193
diff
changeset
|
208 | |
| 5563 | 209 | if (ops != NULL && ops->connected != NULL) |
| 210 | ops->connected(gc); | |
| 211 | ||
| 15884 | 212 | purple_blist_add_account(account); |
| 5563 | 213 | |
| 15884 | 214 | purple_signal_emit(purple_connections_get_handle(), "signed-on", gc); |
|
30039
9cd7672bae4f
Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents:
28577
diff
changeset
|
215 | purple_signal_emit_return_1(purple_connections_get_handle(), "autojoin", gc); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
216 | |
| 5563 | 217 | serv_set_permit_deny(gc); |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
218 | |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
219 | update_keepalive(gc, TRUE); |
| 5563 | 220 | } |
| 34752 | 221 | else if (priv->state == PURPLE_CONNECTION_DISCONNECTED) { |
| 15884 | 222 | PurpleAccount *account = purple_connection_get_account(gc); |
| 8573 | 223 | |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15890
diff
changeset
|
224 | if (purple_prefs_get_bool("/purple/logging/log_system")) |
|
11698
afbf0d8bdacf
[gaim-migrate @ 13989]
Mark Doliner <markdoliner@pidgin.im>
parents:
11562
diff
changeset
|
225 | { |
| 15884 | 226 | PurpleLog *log = purple_account_get_log(account, FALSE); |
|
13508
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
227 | |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
228 | if (log != NULL) |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
229 | { |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
230 | char *msg = g_strdup_printf(_("+++ %s signed off"), |
| 15884 | 231 | purple_account_get_username(account)); |
| 232 | purple_log_write(log, PURPLE_MESSAGE_SYSTEM, | |
| 233 | purple_account_get_username(account), time(NULL), | |
|
13508
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
234 | msg); |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
235 | g_free(msg); |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
236 | } |
| 8573 | 237 | } |
| 238 | ||
| 15884 | 239 | purple_account_destroy_log(account); |
| 8573 | 240 | |
|
5885
223ac977eed2
[gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents:
5883
diff
changeset
|
241 | if (ops != NULL && ops->disconnected != NULL) |
| 9190 | 242 | ops->disconnected(gc); |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
243 | } |
| 5563 | 244 | } |
| 245 | ||
| 246 | void | |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
247 | purple_connection_set_flags(PurpleConnection *gc, PurpleConnectionFlags flags) |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
248 | { |
| 34752 | 249 | PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc); |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
250 | |
| 34752 | 251 | g_return_if_fail(priv != NULL); |
| 252 | ||
| 253 | priv->flags = flags; | |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
254 | } |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
255 | |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
256 | void |
| 15884 | 257 | purple_connection_set_account(PurpleConnection *gc, PurpleAccount *account) |
| 5563 | 258 | { |
| 34752 | 259 | PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc); |
| 260 | ||
| 261 | g_return_if_fail(priv != NULL); | |
| 5563 | 262 | g_return_if_fail(account != NULL); |
| 263 | ||
| 34752 | 264 | priv->account = account; |
| 5563 | 265 | } |
| 266 | ||
| 267 | void | |
| 15884 | 268 | purple_connection_set_display_name(PurpleConnection *gc, const char *name) |
| 5563 | 269 | { |
| 34752 | 270 | PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc); |
| 5563 | 271 | |
| 34752 | 272 | g_return_if_fail(priv != NULL); |
| 273 | ||
| 274 | g_free(priv->display_name); | |
| 275 | priv->display_name = g_strdup(name); | |
| 5563 | 276 | } |
| 277 | ||
|
36710
16a60fe59d22
Backed out changeset 7cf0bf5b9a40
Ankit Vani <a@nevitus.org>
parents:
36709
diff
changeset
|
278 | void |
|
16a60fe59d22
Backed out changeset 7cf0bf5b9a40
Ankit Vani <a@nevitus.org>
parents:
36709
diff
changeset
|
279 | purple_connection_set_protocol_data(PurpleConnection *gc, void *proto_data) |
|
16a60fe59d22
Backed out changeset 7cf0bf5b9a40
Ankit Vani <a@nevitus.org>
parents:
36709
diff
changeset
|
280 | { |
|
16a60fe59d22
Backed out changeset 7cf0bf5b9a40
Ankit Vani <a@nevitus.org>
parents:
36709
diff
changeset
|
281 | PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc); |
|
16a60fe59d22
Backed out changeset 7cf0bf5b9a40
Ankit Vani <a@nevitus.org>
parents:
36709
diff
changeset
|
282 | |
|
16a60fe59d22
Backed out changeset 7cf0bf5b9a40
Ankit Vani <a@nevitus.org>
parents:
36709
diff
changeset
|
283 | g_return_if_fail(priv != NULL); |
|
16a60fe59d22
Backed out changeset 7cf0bf5b9a40
Ankit Vani <a@nevitus.org>
parents:
36709
diff
changeset
|
284 | |
|
16a60fe59d22
Backed out changeset 7cf0bf5b9a40
Ankit Vani <a@nevitus.org>
parents:
36709
diff
changeset
|
285 | priv->proto_data = proto_data; |
|
16a60fe59d22
Backed out changeset 7cf0bf5b9a40
Ankit Vani <a@nevitus.org>
parents:
36709
diff
changeset
|
286 | } |
|
16a60fe59d22
Backed out changeset 7cf0bf5b9a40
Ankit Vani <a@nevitus.org>
parents:
36709
diff
changeset
|
287 | |
| 15884 | 288 | PurpleConnectionState |
| 289 | purple_connection_get_state(const PurpleConnection *gc) | |
| 5563 | 290 | { |
| 34752 | 291 | PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc); |
| 5563 | 292 | |
| 34752 | 293 | g_return_val_if_fail(priv != NULL, PURPLE_CONNECTION_DISCONNECTED); |
| 294 | ||
| 295 | return priv->state; | |
| 5563 | 296 | } |
| 297 | ||
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
298 | PurpleConnectionFlags |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
299 | purple_connection_get_flags(const PurpleConnection *gc) |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
300 | { |
| 34752 | 301 | PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc); |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
302 | |
| 34752 | 303 | g_return_val_if_fail(priv != NULL, 0); |
| 304 | ||
| 305 | return priv->flags; | |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
306 | } |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
307 | |
| 15884 | 308 | PurpleAccount * |
| 309 | purple_connection_get_account(const PurpleConnection *gc) | |
| 5563 | 310 | { |
| 34752 | 311 | PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc); |
| 5563 | 312 | |
| 34752 | 313 | g_return_val_if_fail(priv != NULL, NULL); |
| 314 | ||
| 315 | return priv->account; | |
| 5563 | 316 | } |
| 317 | ||
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36477
diff
changeset
|
318 | PurpleProtocol * |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36621
diff
changeset
|
319 | purple_connection_get_protocol(const PurpleConnection *gc) |
|
22336
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22324
diff
changeset
|
320 | { |
| 34752 | 321 | PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc); |
|
22336
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22324
diff
changeset
|
322 | |
| 34752 | 323 | g_return_val_if_fail(priv != NULL, NULL); |
| 324 | ||
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36477
diff
changeset
|
325 | return priv->protocol; |
|
22336
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22324
diff
changeset
|
326 | } |
|
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22324
diff
changeset
|
327 | |
| 5563 | 328 | const char * |
| 15884 | 329 | purple_connection_get_password(const PurpleConnection *gc) |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
330 | { |
| 34752 | 331 | PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc); |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
332 | |
| 34752 | 333 | g_return_val_if_fail(priv != NULL, NULL); |
| 334 | ||
| 335 | return priv->password; | |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
336 | } |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
337 | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
338 | GSList * |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
339 | purple_connection_get_active_chats(const PurpleConnection *gc) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
340 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
341 | PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
342 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
343 | g_return_val_if_fail(priv != NULL, NULL); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
344 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
345 | return priv->active_chats; |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
346 | } |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
347 | |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
348 | const char * |
| 15884 | 349 | purple_connection_get_display_name(const PurpleConnection *gc) |
| 5563 | 350 | { |
| 34752 | 351 | PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc); |
| 5563 | 352 | |
| 34752 | 353 | g_return_val_if_fail(priv != NULL, NULL); |
| 354 | ||
| 355 | return priv->display_name; | |
| 5563 | 356 | } |
| 357 | ||
|
36710
16a60fe59d22
Backed out changeset 7cf0bf5b9a40
Ankit Vani <a@nevitus.org>
parents:
36709
diff
changeset
|
358 | void * |
|
16a60fe59d22
Backed out changeset 7cf0bf5b9a40
Ankit Vani <a@nevitus.org>
parents:
36709
diff
changeset
|
359 | purple_connection_get_protocol_data(const PurpleConnection *gc) |
|
16a60fe59d22
Backed out changeset 7cf0bf5b9a40
Ankit Vani <a@nevitus.org>
parents:
36709
diff
changeset
|
360 | { |
|
16a60fe59d22
Backed out changeset 7cf0bf5b9a40
Ankit Vani <a@nevitus.org>
parents:
36709
diff
changeset
|
361 | PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc); |
|
16a60fe59d22
Backed out changeset 7cf0bf5b9a40
Ankit Vani <a@nevitus.org>
parents:
36709
diff
changeset
|
362 | |
|
16a60fe59d22
Backed out changeset 7cf0bf5b9a40
Ankit Vani <a@nevitus.org>
parents:
36709
diff
changeset
|
363 | g_return_val_if_fail(priv != NULL, NULL); |
|
16a60fe59d22
Backed out changeset 7cf0bf5b9a40
Ankit Vani <a@nevitus.org>
parents:
36709
diff
changeset
|
364 | |
|
16a60fe59d22
Backed out changeset 7cf0bf5b9a40
Ankit Vani <a@nevitus.org>
parents:
36709
diff
changeset
|
365 | return priv->proto_data; |
|
16a60fe59d22
Backed out changeset 7cf0bf5b9a40
Ankit Vani <a@nevitus.org>
parents:
36709
diff
changeset
|
366 | } |
|
16a60fe59d22
Backed out changeset 7cf0bf5b9a40
Ankit Vani <a@nevitus.org>
parents:
36709
diff
changeset
|
367 | |
| 5563 | 368 | void |
|
34755
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
369 | _purple_connection_add_active_chat(PurpleConnection *gc, PurpleChatConversation *chat) |
|
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
370 | { |
|
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
371 | PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc); |
|
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
372 | |
|
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
373 | g_return_if_fail(priv != NULL); |
|
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
374 | |
|
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
375 | priv->active_chats = g_slist_append(priv->active_chats, chat); |
|
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
376 | } |
|
24937
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
377 | |
|
34755
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
378 | void |
|
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
379 | _purple_connection_remove_active_chat(PurpleConnection *gc, PurpleChatConversation *chat) |
|
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
380 | { |
|
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
381 | PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc); |
|
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
382 | |
|
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
383 | g_return_if_fail(priv != NULL); |
|
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
384 | |
|
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
385 | priv->active_chats = g_slist_remove(priv->active_chats, chat); |
|
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
386 | } |
|
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
387 | |
|
34877
5b3c720b9077
Added missing internal function, used by account.c
Ankit Vani <a@nevitus.org>
parents:
34866
diff
changeset
|
388 | gboolean |
|
5b3c720b9077
Added missing internal function, used by account.c
Ankit Vani <a@nevitus.org>
parents:
34866
diff
changeset
|
389 | _purple_connection_wants_to_die(const PurpleConnection *gc) |
|
5b3c720b9077
Added missing internal function, used by account.c
Ankit Vani <a@nevitus.org>
parents:
34866
diff
changeset
|
390 | { |
|
5b3c720b9077
Added missing internal function, used by account.c
Ankit Vani <a@nevitus.org>
parents:
34866
diff
changeset
|
391 | PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc); |
|
5b3c720b9077
Added missing internal function, used by account.c
Ankit Vani <a@nevitus.org>
parents:
34866
diff
changeset
|
392 | |
|
34879
9dc3f5a25202
Return FALSE if assertion fails
Ankit Vani <a@nevitus.org>
parents:
34877
diff
changeset
|
393 | g_return_val_if_fail(priv != NULL, FALSE); |
|
34877
5b3c720b9077
Added missing internal function, used by account.c
Ankit Vani <a@nevitus.org>
parents:
34866
diff
changeset
|
394 | |
|
5b3c720b9077
Added missing internal function, used by account.c
Ankit Vani <a@nevitus.org>
parents:
34866
diff
changeset
|
395 | return priv->wants_to_die; |
|
24937
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
396 | } |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
397 | |
| 5563 | 398 | void |
| 15884 | 399 | purple_connection_update_progress(PurpleConnection *gc, const char *text, |
| 5563 | 400 | size_t step, size_t count) |
| 401 | { | |
| 15884 | 402 | PurpleConnectionUiOps *ops; |
| 5563 | 403 | |
| 404 | g_return_if_fail(gc != NULL); | |
| 405 | g_return_if_fail(text != NULL); | |
| 406 | g_return_if_fail(step < count); | |
| 407 | g_return_if_fail(count > 1); | |
| 408 | ||
| 15884 | 409 | ops = purple_connections_get_ui_ops(); |
| 5563 | 410 | |
| 411 | if (ops != NULL && ops->connect_progress != NULL) | |
| 412 | ops->connect_progress(gc, text, step, count); | |
| 413 | } | |
| 414 | ||
| 415 | void | |
| 15884 | 416 | purple_connection_notice(PurpleConnection *gc, const char *text) |
|
5571
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
417 | { |
| 15884 | 418 | PurpleConnectionUiOps *ops; |
|
5571
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
419 | |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
420 | g_return_if_fail(gc != NULL); |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
421 | g_return_if_fail(text != NULL); |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
422 | |
| 15884 | 423 | ops = purple_connections_get_ui_ops(); |
|
5571
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
424 | |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
425 | if (ops != NULL && ops->notice != NULL) |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
426 | ops->notice(gc, text); |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
427 | } |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
428 | |
|
12412
8abe3226695e
[gaim-migrate @ 14719]
Richard Laager <rlaager@pidgin.im>
parents:
12272
diff
changeset
|
429 | static gboolean |
| 15884 | 430 | purple_connection_disconnect_cb(gpointer data) |
|
10742
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
431 | { |
|
27336
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
432 | PurpleAccount *account; |
|
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
433 | PurpleConnection *gc; |
| 34752 | 434 | PurpleConnectionPrivate *priv; |
|
27336
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
435 | |
|
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
436 | account = data; |
|
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
437 | gc = purple_account_get_connection(account); |
| 34752 | 438 | priv = PURPLE_CONNECTION_GET_PRIVATE(gc); |
|
27336
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
439 | |
| 34752 | 440 | if (priv != NULL) |
| 441 | priv->disconnect_timeout = 0; | |
|
27336
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
442 | |
| 15884 | 443 | purple_account_disconnect(account); |
|
10742
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
444 | return FALSE; |
|
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
445 | } |
|
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
446 | |
|
5571
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
447 | void |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
32156
diff
changeset
|
448 | purple_connection_error (PurpleConnection *gc, |
| 21279 | 449 | PurpleConnectionError reason, |
|
20430
bb30dff3da21
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <resiak@pidgin.im>
parents:
19897
diff
changeset
|
450 | const char *description) |
|
bb30dff3da21
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <resiak@pidgin.im>
parents:
19897
diff
changeset
|
451 | { |
| 15884 | 452 | PurpleConnectionUiOps *ops; |
| 34752 | 453 | PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc); |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
454 | |
| 34752 | 455 | g_return_if_fail(priv != NULL); |
| 21279 | 456 | /* This sanity check relies on PURPLE_CONNECTION_ERROR_OTHER_ERROR |
| 457 | * being the last member of the PurpleConnectionError enum in | |
| 458 | * connection.h; if other reasons are added after it, this check should | |
| 459 | * be updated. | |
|
21278
19f6ce8ee4ad
rlaager suggested using the last element of the PurpleDisconnectReason enum
Will Thompson <resiak@pidgin.im>
parents:
21154
diff
changeset
|
460 | */ |
| 21279 | 461 | if (reason > PURPLE_CONNECTION_ERROR_OTHER_ERROR) { |
|
21278
19f6ce8ee4ad
rlaager suggested using the last element of the PurpleDisconnectReason enum
Will Thompson <resiak@pidgin.im>
parents:
21154
diff
changeset
|
462 | purple_debug_error("connection", |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
32156
diff
changeset
|
463 | "purple_connection_error: reason %u isn't a " |
|
21278
19f6ce8ee4ad
rlaager suggested using the last element of the PurpleDisconnectReason enum
Will Thompson <resiak@pidgin.im>
parents:
21154
diff
changeset
|
464 | "valid reason\n", reason); |
| 21279 | 465 | reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; |
|
21278
19f6ce8ee4ad
rlaager suggested using the last element of the PurpleDisconnectReason enum
Will Thompson <resiak@pidgin.im>
parents:
21154
diff
changeset
|
466 | } |
|
15848
44463a06e833
Change connection.c:gaim_connection_error() to still work even if the
Mark Doliner <markdoliner@pidgin.im>
parents:
15537
diff
changeset
|
467 | |
|
20430
bb30dff3da21
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <resiak@pidgin.im>
parents:
19897
diff
changeset
|
468 | if (description == NULL) { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
32156
diff
changeset
|
469 | purple_debug_error("connection", "purple_connection_error called with NULL description\n"); |
|
20430
bb30dff3da21
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <resiak@pidgin.im>
parents:
19897
diff
changeset
|
470 | description = _("Unknown error"); |
|
15848
44463a06e833
Change connection.c:gaim_connection_error() to still work even if the
Mark Doliner <markdoliner@pidgin.im>
parents:
15537
diff
changeset
|
471 | } |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
472 | |
| 6393 | 473 | /* If we've already got one error, we don't need any more */ |
| 34752 | 474 | if (priv->disconnect_timeout > 0) |
| 6393 | 475 | return; |
| 476 | ||
| 34752 | 477 | priv->wants_to_die = purple_connection_error_is_fatal (reason); |
|
21149
160a0845b527
rlaager pointed out that purple_connection_error_reason should be setting
Will Thompson <resiak@pidgin.im>
parents:
20882
diff
changeset
|
478 | |
|
28091
03d2cecdb234
Log the reason for disconnection to the debug log, so that we might
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27336
diff
changeset
|
479 | purple_debug_info("connection", "Connection error on %p (reason: %u description: %s)\n", |
|
03d2cecdb234
Log the reason for disconnection to the debug log, so that we might
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27336
diff
changeset
|
480 | gc, reason, description); |
|
03d2cecdb234
Log the reason for disconnection to the debug log, so that we might
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27336
diff
changeset
|
481 | |
| 15884 | 482 | ops = purple_connections_get_ui_ops(); |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
483 | |
|
32153
121f15699f88
Rename the report_disconnect_reason cb function to report_disconnect
Mark Doliner <markdoliner@pidgin.im>
parents:
32152
diff
changeset
|
484 | if (ops && ops->report_disconnect) |
|
121f15699f88
Rename the report_disconnect_reason cb function to report_disconnect
Mark Doliner <markdoliner@pidgin.im>
parents:
32152
diff
changeset
|
485 | ops->report_disconnect(gc, reason, description); |
| 5727 | 486 | |
|
21285
ca8cb8706802
I figured a signal firing on a connection error would be useful.
Will Thompson <resiak@pidgin.im>
parents:
21279
diff
changeset
|
487 | purple_signal_emit(purple_connections_get_handle(), "connection-error", |
|
ca8cb8706802
I figured a signal firing on a connection error would be useful.
Will Thompson <resiak@pidgin.im>
parents:
21279
diff
changeset
|
488 | gc, reason, description); |
| 5727 | 489 | |
| 34752 | 490 | priv->disconnect_timeout = purple_timeout_add(0, purple_connection_disconnect_cb, |
| 15884 | 491 | purple_connection_get_account(gc)); |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
492 | } |
|
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
493 | |
|
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
494 | void |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
495 | purple_connection_ssl_error (PurpleConnection *gc, |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
496 | PurpleSslErrorType ssl_error) |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
497 | { |
| 21279 | 498 | PurpleConnectionError reason; |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
499 | |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
500 | switch (ssl_error) { |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
501 | case PURPLE_SSL_HANDSHAKE_FAILED: |
|
22162
1e0f1dbe89da
Adjust some network error fatalities and things
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21865
diff
changeset
|
502 | reason = PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR; |
|
1e0f1dbe89da
Adjust some network error fatalities and things
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21865
diff
changeset
|
503 | break; |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
504 | case PURPLE_SSL_CONNECT_FAILED: |
|
22162
1e0f1dbe89da
Adjust some network error fatalities and things
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21865
diff
changeset
|
505 | reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
506 | break; |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
507 | case PURPLE_SSL_CERTIFICATE_INVALID: |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
508 | /* TODO: maybe PURPLE_SSL_* should be more specific? */ |
|
22163
186613d5bc34
Huh, you want to be able to compile? I clearly (or not so clearly) need new
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22162
diff
changeset
|
509 | reason = PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR; |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
510 | break; |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
511 | default: |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
512 | g_assert_not_reached (); |
|
22163
186613d5bc34
Huh, you want to be able to compile? I clearly (or not so clearly) need new
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22162
diff
changeset
|
513 | reason = PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR; |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
514 | } |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
515 | |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
32156
diff
changeset
|
516 | purple_connection_error (gc, reason, |
| 21279 | 517 | purple_ssl_strerror(ssl_error)); |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
518 | } |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
519 | |
|
20431
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
520 | gboolean |
| 21279 | 521 | purple_connection_error_is_fatal (PurpleConnectionError reason) |
|
20431
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
522 | { |
|
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
523 | switch (reason) |
|
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
524 | { |
| 21279 | 525 | case PURPLE_CONNECTION_ERROR_NETWORK_ERROR: |
|
22162
1e0f1dbe89da
Adjust some network error fatalities and things
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21865
diff
changeset
|
526 | case PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR: |
|
21508
0ae51085309d
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <resiak@pidgin.im>
parents:
21507
diff
changeset
|
527 | return FALSE; |
|
0ae51085309d
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <resiak@pidgin.im>
parents:
21507
diff
changeset
|
528 | case PURPLE_CONNECTION_ERROR_INVALID_USERNAME: |
|
0ae51085309d
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <resiak@pidgin.im>
parents:
21507
diff
changeset
|
529 | case PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED: |
| 21279 | 530 | case PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE: |
|
21508
0ae51085309d
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <resiak@pidgin.im>
parents:
21507
diff
changeset
|
531 | case PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT: |
|
0ae51085309d
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <resiak@pidgin.im>
parents:
21507
diff
changeset
|
532 | case PURPLE_CONNECTION_ERROR_NAME_IN_USE: |
|
0ae51085309d
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <resiak@pidgin.im>
parents:
21507
diff
changeset
|
533 | case PURPLE_CONNECTION_ERROR_INVALID_SETTINGS: |
|
0ae51085309d
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <resiak@pidgin.im>
parents:
21507
diff
changeset
|
534 | case PURPLE_CONNECTION_ERROR_OTHER_ERROR: |
| 21279 | 535 | case PURPLE_CONNECTION_ERROR_CERT_NOT_PROVIDED: |
| 536 | case PURPLE_CONNECTION_ERROR_CERT_UNTRUSTED: | |
| 537 | case PURPLE_CONNECTION_ERROR_CERT_EXPIRED: | |
| 538 | case PURPLE_CONNECTION_ERROR_CERT_NOT_ACTIVATED: | |
| 539 | case PURPLE_CONNECTION_ERROR_CERT_HOSTNAME_MISMATCH: | |
| 540 | case PURPLE_CONNECTION_ERROR_CERT_FINGERPRINT_MISMATCH: | |
| 541 | case PURPLE_CONNECTION_ERROR_CERT_SELF_SIGNED: | |
| 542 | case PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR: | |
|
20431
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
543 | return TRUE; |
|
21153
610a45545a40
datallah pointed out that using g_return_if_fail() is preferable to
Will Thompson <resiak@pidgin.im>
parents:
21149
diff
changeset
|
544 | default: |
|
610a45545a40
datallah pointed out that using g_return_if_fail() is preferable to
Will Thompson <resiak@pidgin.im>
parents:
21149
diff
changeset
|
545 | g_return_val_if_reached(TRUE); |
|
20431
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
546 | } |
|
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
547 | } |
|
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
548 | |
|
32679
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
549 | void purple_connection_update_last_received(PurpleConnection *gc) |
|
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
550 | { |
| 34752 | 551 | PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc); |
|
32679
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
552 | |
| 34752 | 553 | g_return_if_fail(priv != NULL); |
| 554 | ||
| 555 | priv->last_received = time(NULL); | |
|
32679
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
556 | } |
|
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
557 | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
558 | /************************************************************************** |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
559 | * GBoxed code |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
560 | **************************************************************************/ |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
561 | static PurpleConnectionErrorInfo * |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
562 | purple_connection_error_info_copy(PurpleConnectionErrorInfo *err) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
563 | { |
|
34787
d736bcb6c5a1
Check for NULL value in GBoxed functions
Ankit Vani <a@nevitus.org>
parents:
34786
diff
changeset
|
564 | PurpleConnectionErrorInfo *newerr; |
|
d736bcb6c5a1
Check for NULL value in GBoxed functions
Ankit Vani <a@nevitus.org>
parents:
34786
diff
changeset
|
565 | |
|
d736bcb6c5a1
Check for NULL value in GBoxed functions
Ankit Vani <a@nevitus.org>
parents:
34786
diff
changeset
|
566 | g_return_val_if_fail(err != NULL, NULL); |
|
d736bcb6c5a1
Check for NULL value in GBoxed functions
Ankit Vani <a@nevitus.org>
parents:
34786
diff
changeset
|
567 | |
|
d736bcb6c5a1
Check for NULL value in GBoxed functions
Ankit Vani <a@nevitus.org>
parents:
34786
diff
changeset
|
568 | newerr = g_new(PurpleConnectionErrorInfo, 1); |
|
34788
38d1b844ddb6
Updated GBoxed functions. Boxing is intended to be temporary for buddy list, saved status, plugins, status.
Ankit Vani <a@nevitus.org>
parents:
34787
diff
changeset
|
569 | newerr->type = err->type; |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
570 | newerr->description = g_strdup(err->description); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
571 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
572 | return newerr; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
573 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
574 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
575 | static void |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
576 | purple_connection_error_info_free(PurpleConnectionErrorInfo *err) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
577 | { |
|
34787
d736bcb6c5a1
Check for NULL value in GBoxed functions
Ankit Vani <a@nevitus.org>
parents:
34786
diff
changeset
|
578 | g_return_if_fail(err != NULL); |
|
d736bcb6c5a1
Check for NULL value in GBoxed functions
Ankit Vani <a@nevitus.org>
parents:
34786
diff
changeset
|
579 | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
580 | g_free(err->description); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
581 | g_free(err); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
582 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
583 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
584 | GType |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
585 | purple_connection_error_info_get_type(void) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
586 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
587 | static GType type = 0; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
588 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
589 | if (type == 0) { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
590 | type = g_boxed_type_register_static("PurpleConnectionErrorInfo", |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
591 | (GBoxedCopyFunc)purple_connection_error_info_copy, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
592 | (GBoxedFreeFunc)purple_connection_error_info_free); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
593 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
594 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
595 | return type; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
596 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
597 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
598 | /************************************************************************** |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
599 | * GObject code |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
600 | **************************************************************************/ |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
601 | /* GObject Property names */ |
|
36366
202c60d1300f
Refactored connection, conversation, conversationtypes to use the initial GObject plugin API
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
602 | #define PROP_PROTOCOL_S "protocol" |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
603 | #define PROP_FLAGS_S "flags" |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
604 | #define PROP_STATE_S "state" |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
605 | #define PROP_ACCOUNT_S "account" |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
606 | #define PROP_PASSWORD_S "password" |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
607 | #define PROP_DISPLAY_NAME_S "display-name" |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
608 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
609 | /* Set method for GObject properties */ |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
610 | static void |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
611 | purple_connection_set_property(GObject *obj, guint param_id, const GValue *value, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
612 | GParamSpec *pspec) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
613 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
614 | PurpleConnection *gc = PURPLE_CONNECTION(obj); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
615 | PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc); |
|
32679
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
616 | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
617 | switch (param_id) { |
|
36366
202c60d1300f
Refactored connection, conversation, conversationtypes to use the initial GObject plugin API
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
618 | case PROP_PROTOCOL: |
|
36549
735cd882faf7
Removed warnings from connection.c
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
619 | priv->protocol = g_value_get_object(value); |
|
34756
7a11ecbb92d3
Added setting of property "prpl" in PurpleConnection -- only settable during construction
Ankit Vani <a@nevitus.org>
parents:
34755
diff
changeset
|
620 | break; |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
621 | case PROP_FLAGS: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
622 | purple_connection_set_flags(gc, g_value_get_flags(value)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
623 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
624 | case PROP_STATE: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
625 | purple_connection_set_state(gc, g_value_get_enum(value)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
626 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
627 | case PROP_ACCOUNT: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
628 | purple_connection_set_account(gc, g_value_get_object(value)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
629 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
630 | case PROP_PASSWORD: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
631 | g_free(priv->password); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
632 | priv->password = g_strdup(g_value_get_string(value)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
633 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
634 | case PROP_DISPLAY_NAME: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
635 | purple_connection_set_display_name(gc, g_value_get_string(value)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
636 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
637 | default: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
638 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
639 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
640 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
641 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
642 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
643 | /* Get method for GObject properties */ |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
644 | static void |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
645 | purple_connection_get_property(GObject *obj, guint param_id, GValue *value, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
646 | GParamSpec *pspec) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
647 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
648 | PurpleConnection *gc = PURPLE_CONNECTION(obj); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
649 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
650 | switch (param_id) { |
|
36366
202c60d1300f
Refactored connection, conversation, conversationtypes to use the initial GObject plugin API
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
651 | case PROP_PROTOCOL: |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36621
diff
changeset
|
652 | g_value_set_object(value, purple_connection_get_protocol(gc)); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
653 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
654 | case PROP_FLAGS: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
655 | g_value_set_flags(value, purple_connection_get_flags(gc)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
656 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
657 | case PROP_STATE: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
658 | g_value_set_enum(value, purple_connection_get_state(gc)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
659 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
660 | case PROP_ACCOUNT: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
661 | g_value_set_object(value, purple_connection_get_account(gc)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
662 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
663 | case PROP_PASSWORD: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
664 | g_value_set_string(value, purple_connection_get_password(gc)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
665 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
666 | case PROP_DISPLAY_NAME: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
667 | g_value_set_string(value, purple_connection_get_display_name(gc)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
668 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
669 | default: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
670 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
671 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
672 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
673 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
674 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
675 | /* GObject initialization function */ |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
676 | static void |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
677 | purple_connection_init(GTypeInstance *instance, gpointer klass) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
678 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
679 | PurpleConnection *gc = PURPLE_CONNECTION(instance); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
680 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
681 | purple_connection_set_state(gc, PURPLE_CONNECTION_CONNECTING); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
682 | connections = g_list_append(connections, gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
683 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
684 | PURPLE_DBUS_REGISTER_POINTER(gc, PurpleConnection); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
685 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
686 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
687 | /* Called when done constructing */ |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
688 | static void |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
689 | purple_connection_constructed(GObject *object) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
690 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
691 | PurpleConnection *gc = PURPLE_CONNECTION(object); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
692 | PurpleAccount *account; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
693 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
694 | G_OBJECT_CLASS(parent_class)->constructed(object); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
695 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
696 | g_object_get(gc, PROP_ACCOUNT_S, &account, NULL); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
697 | purple_account_set_connection(account, gc); |
|
34923
416a7736a401
Unref and free everything recieved from g_object_get
Ankit Vani <a@nevitus.org>
parents:
34904
diff
changeset
|
698 | g_object_unref(account); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
699 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
700 | purple_signal_emit(purple_connections_get_handle(), "signing-on", gc); |
|
32679
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
701 | } |
|
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
702 | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
703 | /* GObject dispose function */ |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
704 | static void |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
705 | purple_connection_dispose(GObject *object) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
706 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
707 | PurpleConnection *gc = PURPLE_CONNECTION(object); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
708 | PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
709 | PurpleAccount *account; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
710 | GSList *buddies; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
711 | gboolean remove = FALSE; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
712 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
713 | account = purple_connection_get_account(gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
714 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
715 | purple_debug_info("connection", "Disconnecting connection %p\n", gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
716 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
717 | if (purple_connection_get_state(gc) != PURPLE_CONNECTION_CONNECTING) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
718 | remove = TRUE; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
719 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
720 | purple_signal_emit(purple_connections_get_handle(), "signing-off", gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
721 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
722 | while (priv->active_chats) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
723 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
724 | PurpleChatConversation *b = priv->active_chats->data; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
725 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
726 | priv->active_chats = g_slist_remove(priv->active_chats, b); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
727 | purple_chat_conversation_leave(b); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
728 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
729 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
730 | update_keepalive(gc, FALSE); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
731 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
732 | purple_http_conn_cancel_all(gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
733 | purple_proxy_connect_cancel_with_handle(gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
734 | |
| 36719 | 735 | purple_protocol_class_close_connection(priv->protocol, gc); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
736 | |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36626
diff
changeset
|
737 | /* Clear out the proto data that was freed in the protocol's close method */ |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
738 | buddies = purple_blist_find_buddies(account, NULL); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
739 | while (buddies != NULL) { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
740 | PurpleBuddy *buddy = buddies->data; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
741 | purple_buddy_set_protocol_data(buddy, NULL); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
742 | buddies = g_slist_delete_link(buddies, buddies); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
743 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
744 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
745 | connections = g_list_remove(connections, gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
746 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
747 | purple_connection_set_state(gc, PURPLE_CONNECTION_DISCONNECTED); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
748 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
749 | if (remove) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
750 | purple_blist_remove_account(account); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
751 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
752 | purple_signal_emit(purple_connections_get_handle(), "signed-off", gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
753 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
754 | purple_account_request_close_with_account(account); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
755 | purple_request_close_with_handle(gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
756 | purple_notify_close_with_handle(gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
757 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
758 | purple_debug_info("connection", "Destroying connection %p\n", gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
759 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
760 | purple_account_set_connection(account, NULL); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
761 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
762 | if (priv->disconnect_timeout > 0) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
763 | purple_timeout_remove(priv->disconnect_timeout); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
764 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
765 | PURPLE_DBUS_UNREGISTER_POINTER(gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
766 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
767 | G_OBJECT_CLASS(parent_class)->dispose(object); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
768 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
769 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
770 | /* GObject finalize function */ |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
771 | static void |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
772 | purple_connection_finalize(GObject *object) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
773 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
774 | PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(object); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
775 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
776 | purple_str_wipe(priv->password); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
777 | g_free(priv->display_name); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
778 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
779 | G_OBJECT_CLASS(parent_class)->finalize(object); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
780 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
781 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
782 | /* Class initializer function */ |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
783 | static void purple_connection_class_init(PurpleConnectionClass *klass) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
784 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
785 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
786 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
787 | parent_class = g_type_class_peek_parent(klass); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
788 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
789 | obj_class->dispose = purple_connection_dispose; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
790 | obj_class->finalize = purple_connection_finalize; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
791 | obj_class->constructed = purple_connection_constructed; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
792 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
793 | /* Setup properties */ |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
794 | obj_class->get_property = purple_connection_get_property; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
795 | obj_class->set_property = purple_connection_set_property; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
796 | |
|
36366
202c60d1300f
Refactored connection, conversation, conversationtypes to use the initial GObject plugin API
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
797 | g_object_class_install_property(obj_class, PROP_PROTOCOL, |
|
36549
735cd882faf7
Removed warnings from connection.c
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
798 | g_param_spec_object(PROP_PROTOCOL_S, _("Protocol"), |
|
735cd882faf7
Removed warnings from connection.c
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
799 | _("The protocol that the connection is using."), |
|
735cd882faf7
Removed warnings from connection.c
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
800 | PURPLE_TYPE_PROTOCOL, |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
801 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
802 | ); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
803 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
804 | g_object_class_install_property(obj_class, PROP_FLAGS, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
805 | g_param_spec_flags(PROP_FLAGS_S, _("Connection flags"), |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
806 | _("The flags of the connection."), |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
807 | PURPLE_TYPE_CONNECTION_FLAGS, 0, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
808 | G_PARAM_READWRITE) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
809 | ); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
810 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
811 | g_object_class_install_property(obj_class, PROP_STATE, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
812 | g_param_spec_enum(PROP_STATE_S, _("Connection state"), |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
813 | _("The current state of the connection."), |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
814 | PURPLE_TYPE_CONNECTION_STATE, PURPLE_CONNECTION_DISCONNECTED, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
815 | G_PARAM_READWRITE) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
816 | ); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
817 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
818 | g_object_class_install_property(obj_class, PROP_ACCOUNT, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
819 | g_param_spec_object(PROP_ACCOUNT_S, _("Account"), |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
820 | _("The account using the connection."), PURPLE_TYPE_ACCOUNT, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
821 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
822 | ); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
823 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
824 | g_object_class_install_property(obj_class, PROP_PASSWORD, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
825 | g_param_spec_string(PROP_PASSWORD_S, _("Password"), |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
826 | _("The password used for connection."), NULL, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
827 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
828 | ); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
829 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
830 | g_object_class_install_property(obj_class, PROP_DISPLAY_NAME, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
831 | g_param_spec_string(PROP_DISPLAY_NAME_S, _("Display name"), |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
832 | _("Your name that appears to other people."), NULL, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
833 | G_PARAM_READWRITE) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
834 | ); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
835 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
836 | g_type_class_add_private(klass, sizeof(PurpleConnectionPrivate)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
837 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
838 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
839 | GType |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
840 | purple_connection_get_type(void) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
841 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
842 | static GType type = 0; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
843 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
844 | if(type == 0) { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
845 | static const GTypeInfo info = { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
846 | sizeof(PurpleConnectionClass), |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
847 | NULL, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
848 | NULL, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
849 | (GClassInitFunc)purple_connection_class_init, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
850 | NULL, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
851 | NULL, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
852 | sizeof(PurpleConnection), |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
853 | 0, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
854 | (GInstanceInitFunc)purple_connection_init, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
855 | NULL, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
856 | }; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
857 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
858 | type = g_type_register_static(G_TYPE_OBJECT, "PurpleConnection", |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
859 | &info, 0); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
860 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
861 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
862 | return type; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
863 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
864 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
865 | void |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
866 | _purple_connection_new(PurpleAccount *account, gboolean regist, const char *password) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
867 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
868 | PurpleConnection *gc; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36477
diff
changeset
|
869 | PurpleProtocol *protocol; |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
870 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
871 | g_return_if_fail(account != NULL); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
872 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
873 | if (!purple_account_is_disconnected(account)) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
874 | return; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
875 | |
|
36626
18fc361b3704
Renamed purple_find_protocol_info to purple_protocols_find
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
876 | protocol = purple_protocols_find(purple_account_get_protocol_id(account)); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
877 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36477
diff
changeset
|
878 | if (protocol == NULL) { |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
879 | gchar *message; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
880 | |
|
36691
92122af1f083
Some documentation updates with regard to 'protocol plugins' and 'protocols'
Ankit Vani <a@nevitus.org>
parents:
36688
diff
changeset
|
881 | message = g_strdup_printf(_("Missing protocol for %s"), |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
882 | purple_account_get_username(account)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
883 | purple_notify_error(NULL, regist ? _("Registration Error") : |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
884 | _("Connection Error"), message, NULL); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
885 | g_free(message); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
886 | return; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
887 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
888 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
889 | if (regist) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
890 | { |
|
36620
c76013b145f4
Added PURPLE_PROTOCOL_IMPLEMENTS(protocol,func) to check if a protocol implements a function
Ankit Vani <a@nevitus.org>
parents:
36610
diff
changeset
|
891 | if (!PURPLE_PROTOCOL_IMPLEMENTS(protocol, register_user)) |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
892 | return; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
893 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
894 | else |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
895 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
896 | if (((password == NULL) || (*password == '\0')) && |
|
36607
7ad7681dcfd8
Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
897 | !(purple_protocol_get_options(protocol) & OPT_PROTO_NO_PASSWORD) && |
|
7ad7681dcfd8
Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
898 | !(purple_protocol_get_options(protocol) & OPT_PROTO_PASSWORD_OPTIONAL)) |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
899 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
900 | purple_debug_error("connection", "Cannot connect to account %s without " |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
901 | "a password.\n", purple_account_get_username(account)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
902 | return; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
903 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
904 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
905 | |
|
36709
6e915db4db35
Backed out changeset 7b1fefd1e2ee
Ankit Vani <a@nevitus.org>
parents:
36695
diff
changeset
|
906 | gc = g_object_new(PURPLE_TYPE_CONNECTION, |
|
6e915db4db35
Backed out changeset 7b1fefd1e2ee
Ankit Vani <a@nevitus.org>
parents:
36695
diff
changeset
|
907 | PROP_PROTOCOL_S, protocol, |
|
6e915db4db35
Backed out changeset 7b1fefd1e2ee
Ankit Vani <a@nevitus.org>
parents:
36695
diff
changeset
|
908 | PROP_PASSWORD_S, password, |
|
6e915db4db35
Backed out changeset 7b1fefd1e2ee
Ankit Vani <a@nevitus.org>
parents:
36695
diff
changeset
|
909 | PROP_ACCOUNT_S, account, |
|
6e915db4db35
Backed out changeset 7b1fefd1e2ee
Ankit Vani <a@nevitus.org>
parents:
36695
diff
changeset
|
910 | NULL); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
911 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
912 | if (regist) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
913 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
914 | purple_debug_info("connection", "Registering. gc = %p\n", gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
915 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
916 | /* set this so we don't auto-reconnect after registering */ |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
917 | PURPLE_CONNECTION_GET_PRIVATE(gc)->wants_to_die = TRUE; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
918 | |
| 36719 | 919 | purple_protocol_server_iface_register_user(protocol, account); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
920 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
921 | else |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
922 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
923 | purple_debug_info("connection", "Connecting. gc = %p\n", gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
924 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
925 | purple_signal_emit(purple_accounts_get_handle(), "account-connecting", account); |
| 36719 | 926 | purple_protocol_class_login(protocol, account); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
927 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
928 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
929 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
930 | void |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
931 | _purple_connection_new_unregister(PurpleAccount *account, const char *password, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
932 | PurpleAccountUnregistrationCb cb, void *user_data) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
933 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
934 | /* Lots of copy/pasted code to avoid API changes. You might want to integrate that into the previous function when posssible. */ |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
935 | PurpleConnection *gc; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36477
diff
changeset
|
936 | PurpleProtocol *protocol; |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
937 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
938 | g_return_if_fail(account != NULL); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
939 | |
|
36626
18fc361b3704
Renamed purple_find_protocol_info to purple_protocols_find
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
940 | protocol = purple_protocols_find(purple_account_get_protocol_id(account)); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
941 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36477
diff
changeset
|
942 | if (protocol == NULL) { |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
943 | gchar *message; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
944 | |
|
36691
92122af1f083
Some documentation updates with regard to 'protocol plugins' and 'protocols'
Ankit Vani <a@nevitus.org>
parents:
36688
diff
changeset
|
945 | message = g_strdup_printf(_("Missing protocol for %s"), |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
946 | purple_account_get_username(account)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
947 | purple_notify_error(NULL, _("Unregistration Error"), message, NULL); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
948 | g_free(message); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
949 | return; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
950 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
951 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
952 | if (!purple_account_is_disconnected(account)) { |
| 36719 | 953 | purple_protocol_server_iface_unregister_user(protocol, account, cb, user_data); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
954 | return; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
955 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
956 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
957 | if (((password == NULL) || (*password == '\0')) && |
|
36607
7ad7681dcfd8
Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
958 | !(purple_protocol_get_options(protocol) & OPT_PROTO_NO_PASSWORD) && |
|
7ad7681dcfd8
Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
959 | !(purple_protocol_get_options(protocol) & OPT_PROTO_PASSWORD_OPTIONAL)) |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
960 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
961 | purple_debug_error("connection", "Cannot connect to account %s without " |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
962 | "a password.\n", purple_account_get_username(account)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
963 | return; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
964 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
965 | |
|
36709
6e915db4db35
Backed out changeset 7b1fefd1e2ee
Ankit Vani <a@nevitus.org>
parents:
36695
diff
changeset
|
966 | gc = g_object_new(PURPLE_TYPE_CONNECTION, |
|
6e915db4db35
Backed out changeset 7b1fefd1e2ee
Ankit Vani <a@nevitus.org>
parents:
36695
diff
changeset
|
967 | PROP_PROTOCOL_S, protocol, |
|
6e915db4db35
Backed out changeset 7b1fefd1e2ee
Ankit Vani <a@nevitus.org>
parents:
36695
diff
changeset
|
968 | PROP_PASSWORD_S, password, |
|
6e915db4db35
Backed out changeset 7b1fefd1e2ee
Ankit Vani <a@nevitus.org>
parents:
36695
diff
changeset
|
969 | PROP_ACCOUNT_S, account, |
|
6e915db4db35
Backed out changeset 7b1fefd1e2ee
Ankit Vani <a@nevitus.org>
parents:
36695
diff
changeset
|
970 | NULL); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
971 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
972 | purple_debug_info("connection", "Unregistering. gc = %p\n", gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
973 | |
| 36719 | 974 | purple_protocol_server_iface_unregister_user(protocol, account, cb, user_data); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
975 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
976 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
977 | /************************************************************************** |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
978 | * Connections API |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
979 | **************************************************************************/ |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
980 | void |
| 15884 | 981 | purple_connections_disconnect_all(void) |
| 5563 | 982 | { |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
983 | GList *l; |
| 15884 | 984 | PurpleConnection *gc; |
| 34752 | 985 | PurpleConnectionPrivate *priv; |
| 5563 | 986 | |
| 15884 | 987 | while ((l = purple_connections_get_all()) != NULL) { |
|
6113
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6111
diff
changeset
|
988 | gc = l->data; |
| 34752 | 989 | priv = PURPLE_CONNECTION_GET_PRIVATE(gc); |
| 990 | priv->wants_to_die = TRUE; | |
| 991 | purple_account_disconnect(priv->account); | |
|
6113
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6111
diff
changeset
|
992 | } |
| 5563 | 993 | } |
| 994 | ||
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
995 | GList * |
| 15884 | 996 | purple_connections_get_all(void) |
| 5563 | 997 | { |
| 998 | return connections; | |
| 999 | } | |
| 1000 | ||
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
1001 | GList * |
| 15884 | 1002 | purple_connections_get_connecting(void) |
|
5788
dd6e33a59151
[gaim-migrate @ 6213]
Christian Hammond <chipx86@chipx86.com>
parents:
5784
diff
changeset
|
1003 | { |
|
dd6e33a59151
[gaim-migrate @ 6213]
Christian Hammond <chipx86@chipx86.com>
parents:
5784
diff
changeset
|
1004 | return connections_connecting; |
|
dd6e33a59151
[gaim-migrate @ 6213]
Christian Hammond <chipx86@chipx86.com>
parents:
5784
diff
changeset
|
1005 | } |
|
dd6e33a59151
[gaim-migrate @ 6213]
Christian Hammond <chipx86@chipx86.com>
parents:
5784
diff
changeset
|
1006 | |
| 5563 | 1007 | void |
| 15884 | 1008 | purple_connections_set_ui_ops(PurpleConnectionUiOps *ops) |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1009 | { |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1010 | connection_ui_ops = ops; |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1011 | } |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1012 | |
| 15884 | 1013 | PurpleConnectionUiOps * |
| 1014 | purple_connections_get_ui_ops(void) | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1015 | { |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1016 | return connection_ui_ops; |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1017 | } |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1018 | |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1019 | void |
| 15884 | 1020 | purple_connections_init(void) |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1021 | { |
| 15884 | 1022 | void *handle = purple_connections_get_handle(); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1023 | |
| 15884 | 1024 | purple_signal_register(handle, "signing-on", |
|
34814
759ea31715dd
Refactored cmds and connection to use GType instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34788
diff
changeset
|
1025 | purple_marshal_VOID__POINTER, G_TYPE_NONE, 1, |
|
759ea31715dd
Refactored cmds and connection to use GType instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34788
diff
changeset
|
1026 | PURPLE_TYPE_CONNECTION); |
|
6564
a7a2c1927544
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6533
diff
changeset
|
1027 | |
| 15884 | 1028 | purple_signal_register(handle, "signed-on", |
|
34814
759ea31715dd
Refactored cmds and connection to use GType instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34788
diff
changeset
|
1029 | purple_marshal_VOID__POINTER, G_TYPE_NONE, 1, |
|
759ea31715dd
Refactored cmds and connection to use GType instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34788
diff
changeset
|
1030 | PURPLE_TYPE_CONNECTION); |
|
6564
a7a2c1927544
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6533
diff
changeset
|
1031 | |
| 15884 | 1032 | purple_signal_register(handle, "signing-off", |
|
34814
759ea31715dd
Refactored cmds and connection to use GType instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34788
diff
changeset
|
1033 | purple_marshal_VOID__POINTER, G_TYPE_NONE, 1, |
|
759ea31715dd
Refactored cmds and connection to use GType instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34788
diff
changeset
|
1034 | PURPLE_TYPE_CONNECTION); |
|
6564
a7a2c1927544
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6533
diff
changeset
|
1035 | |
| 15884 | 1036 | purple_signal_register(handle, "signed-off", |
|
34814
759ea31715dd
Refactored cmds and connection to use GType instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34788
diff
changeset
|
1037 | purple_marshal_VOID__POINTER, G_TYPE_NONE, 1, |
|
759ea31715dd
Refactored cmds and connection to use GType instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34788
diff
changeset
|
1038 | PURPLE_TYPE_CONNECTION); |
|
21285
ca8cb8706802
I figured a signal firing on a connection error would be useful.
Will Thompson <resiak@pidgin.im>
parents:
21279
diff
changeset
|
1039 | |
|
ca8cb8706802
I figured a signal firing on a connection error would be useful.
Will Thompson <resiak@pidgin.im>
parents:
21279
diff
changeset
|
1040 | purple_signal_register(handle, "connection-error", |
|
34814
759ea31715dd
Refactored cmds and connection to use GType instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34788
diff
changeset
|
1041 | purple_marshal_VOID__POINTER_INT_POINTER, |
|
759ea31715dd
Refactored cmds and connection to use GType instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34788
diff
changeset
|
1042 | G_TYPE_NONE, 3, PURPLE_TYPE_CONNECTION, |
|
759ea31715dd
Refactored cmds and connection to use GType instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34788
diff
changeset
|
1043 | PURPLE_TYPE_CONNECTION_ERROR, G_TYPE_STRING); |
|
21285
ca8cb8706802
I figured a signal firing on a connection error would be useful.
Will Thompson <resiak@pidgin.im>
parents:
21279
diff
changeset
|
1044 | |
|
30039
9cd7672bae4f
Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents:
28577
diff
changeset
|
1045 | purple_signal_register(handle, "autojoin", |
|
34814
759ea31715dd
Refactored cmds and connection to use GType instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34788
diff
changeset
|
1046 | purple_marshal_BOOLEAN__POINTER, G_TYPE_NONE, 1, |
|
759ea31715dd
Refactored cmds and connection to use GType instead of PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34788
diff
changeset
|
1047 | PURPLE_TYPE_CONNECTION); |
|
30039
9cd7672bae4f
Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents:
28577
diff
changeset
|
1048 | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1049 | } |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1050 | |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1051 | void |
| 15884 | 1052 | purple_connections_uninit(void) |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1053 | { |
| 15884 | 1054 | purple_signals_unregister_by_instance(purple_connections_get_handle()); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1055 | } |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1056 | |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1057 | void * |
| 15884 | 1058 | purple_connections_get_handle(void) |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1059 | { |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1060 | return &connections_handle; |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1061 | } |