Sun, 09 Oct 2022 04:43:37 -0500
Update PurpleProtocolClass->login to return a PurpleConnection
Testing Done:
Connected a demo, ircv3, and xmpp account.
Reviewed at https://reviews.imfreedom.org/r/1912/
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19897
diff
changeset
|
1 | /* purple |
| 5563 | 2 | * |
| 15884 | 3 | * Purple is the legal property of its developers, whose names are too numerous |
| 8046 | 4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 5 | * source distribution. | |
| 5631 | 6 | * |
| 5563 | 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by | |
| 9 | * the Free Software Foundation; either version 2 of the License, or | |
| 10 | * (at your option) any later version. | |
| 11 | * | |
| 12 | * This program is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU General Public License | |
| 18 | * 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
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 5563 | 20 | */ |
|
24569
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
22336
diff
changeset
|
21 | |
|
40441
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
22 | #include <glib/gi18n-lib.h> |
|
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
23 | |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
24 | #include "account.h" |
|
34706
02cb08146888
Renamed blist.[ch] to buddylist.[ch]
Ankit Vani <a@nevitus.org>
parents:
34645
diff
changeset
|
25 | #include "buddylist.h" |
| 5563 | 26 | #include "connection.h" |
| 5717 | 27 | #include "debug.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
28 | #include "notify.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
29 | #include "prefs.h" |
|
14900
4af8b81519b6
[gaim-migrate @ 17607]
Mark Doliner <markdoliner@pidgin.im>
parents:
14814
diff
changeset
|
30 | #include "proxy.h" |
|
41007
90d2dee9b3dc
Fix the includes for the purpleenums rename
Gary Kramlich <grim@reaperworld.com>
parents:
40813
diff
changeset
|
31 | #include "purpleenums.h" |
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
32 | #include "purpleprivate.h" |
|
41769
e5b2368ad3ad
Remove the server privacy api that was just proxying to PurpleProtocolPrivacy
Gary Kramlich <grim@reaperworld.com>
parents:
41719
diff
changeset
|
33 | #include "purpleprotocolprivacy.h" |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40654
diff
changeset
|
34 | #include "purpleprotocolserver.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
35 | #include "request.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
36 | #include "server.h" |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
37 | #include "signals.h" |
|
6106
1dc08be40f0a
[gaim-migrate @ 6567]
Mark Doliner <markdoliner@pidgin.im>
parents:
6076
diff
changeset
|
38 | #include "util.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
39 | |
|
39549
ee61762c3ebe
Use G_DECLARE* for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39520
diff
changeset
|
40 | /** |
|
ee61762c3ebe
Use G_DECLARE* for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39520
diff
changeset
|
41 | * PurpleConnection: |
|
ee61762c3ebe
Use G_DECLARE* for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39520
diff
changeset
|
42 | * |
|
ee61762c3ebe
Use G_DECLARE* for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39520
diff
changeset
|
43 | * Represents an active connection on an account. |
|
ee61762c3ebe
Use G_DECLARE* for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39520
diff
changeset
|
44 | */ |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
45 | typedef struct { |
|
39549
ee61762c3ebe
Use G_DECLARE* for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39520
diff
changeset
|
46 | GObject gparent; |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
47 | |
|
41300
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
48 | gchar *id; |
|
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
49 | |
| 37069 | 50 | PurpleProtocol *protocol; /* The protocol. */ |
|
35458
385156e1b493
Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
51 | PurpleConnectionFlags flags; /* Connection flags. */ |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
52 | |
|
35458
385156e1b493
Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
53 | PurpleConnectionState state; /* The connection state. */ |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
54 | |
|
35458
385156e1b493
Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
55 | PurpleAccount *account; /* The account being connected to. */ |
|
385156e1b493
Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
56 | char *password; /* The password used. */ |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
57 | |
|
35458
385156e1b493
Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
58 | 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
|
59 | (#PurpleChatConversation structs). */ |
| 35097 | 60 | |
| 61 | /* TODO Remove this and use protocol-specific subclasses. */ | |
|
35458
385156e1b493
Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
62 | void *proto_data; /* Protocol-specific data. */ |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
63 | |
|
35458
385156e1b493
Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
64 | char *display_name; /* How you appear to other people. */ |
|
39520
7f9952eeb6a7
libpurple: Refactor keepalive mechanism to use GSource pointers
Petteri Pitkänen <petepitk@gmail.com>
parents:
39518
diff
changeset
|
65 | GSource *keepalive; /* Keep-alive. */ |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
66 | |
|
35458
385156e1b493
Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
67 | /* Wants to Die state. This is set when the user chooses to log out, or |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
68 | * 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
|
69 | * 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
|
70 | * 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
|
71 | * setting it themselves. |
|
35458
385156e1b493
Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
72 | * See purple_connection_error_is_fatal() |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
73 | */ |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
74 | gboolean wants_to_die; |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
75 | |
|
35458
385156e1b493
Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
76 | gboolean is_finalizing; /* The object is being destroyed. */ |
|
35130
2033f0755d68
Fix a glib warning, by not calling g_object_notify while the connection object is being destroyed. There may be a better fix possible, though
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35097
diff
changeset
|
77 | |
|
41083
590d533cf290
Fix several typos in libpurple
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41007
diff
changeset
|
78 | /* The connection error and its description if an error occurred. */ |
|
35042
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
79 | PurpleConnectionErrorInfo *error_info; |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
80 | |
|
41083
590d533cf290
Fix several typos in libpurple
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41007
diff
changeset
|
81 | guint disconnect_timeout; /* Timer used for nasty stack tricks. */ |
|
39549
ee61762c3ebe
Use G_DECLARE* for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39520
diff
changeset
|
82 | } PurpleConnectionPrivate; |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
83 | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
84 | enum { |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
85 | PROP_0, |
|
41300
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
86 | PROP_ID, |
|
36366
202c60d1300f
Refactored connection, conversation, conversationtypes to use the initial GObject plugin API
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
87 | PROP_PROTOCOL, |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
88 | PROP_FLAGS, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
89 | PROP_STATE, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
90 | PROP_ACCOUNT, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
91 | PROP_PASSWORD, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
92 | PROP_DISPLAY_NAME, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
93 | PROP_LAST |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
94 | }; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
95 | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
96 | static GParamSpec *properties[PROP_LAST] = {NULL, }; |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
97 | |
| 5563 | 98 | static GList *connections = NULL; |
|
40369
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
99 | static GList *connections_connected = NULL; |
| 15884 | 100 | static PurpleConnectionUiOps *connection_ui_ops = NULL; |
| 5563 | 101 | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
102 | static int connections_handle; |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
103 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
104 | G_DEFINE_TYPE_WITH_PRIVATE(PurpleConnection, purple_connection, G_TYPE_OBJECT) |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
105 | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
106 | /************************************************************************** |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
107 | * Connection API |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
108 | **************************************************************************/ |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
109 | static gboolean |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
110 | send_keepalive(gpointer data) { |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
111 | PurpleConnection *connection = data; |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
112 | PurpleConnectionPrivate *priv = NULL; |
|
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
|
113 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
114 | priv = purple_connection_get_instance_private(data); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
115 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
116 | purple_protocol_server_keepalive(PURPLE_PROTOCOL_SERVER(priv->protocol), |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
117 | connection); |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
118 | |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
119 | return TRUE; |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
120 | } |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
121 | |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
122 | static void |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
123 | update_keepalive(PurpleConnection *connection, gboolean on) { |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
124 | PurpleConnectionPrivate *priv = NULL; |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
125 | PurpleProtocolServer *server = NULL; |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
126 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
127 | priv = purple_connection_get_instance_private(connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
128 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
129 | if(!PURPLE_PROTOCOL_IMPLEMENTS(priv->protocol, SERVER, keepalive)) { |
|
14545
f8b45a0ddac5
[gaim-migrate @ 17202]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
130 | return; |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
131 | } |
|
14545
f8b45a0ddac5
[gaim-migrate @ 17202]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
132 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
133 | server = PURPLE_PROTOCOL_SERVER(priv->protocol); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
134 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
135 | if(on && !priv->keepalive) { |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
136 | int interval = purple_protocol_server_get_keepalive_interval(server); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
137 | int source = 0; |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
138 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
139 | purple_debug_info("connection", "Activating keepalive to %d seconds.", |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
140 | interval); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
141 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
142 | source = g_timeout_add_seconds(interval, send_keepalive, connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
143 | priv->keepalive = g_main_context_find_source_by_id(NULL, source); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
144 | } else if (!on && priv->keepalive) { |
| 15884 | 145 | purple_debug_info("connection", "Deactivating keepalive.\n"); |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
146 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
147 | g_source_destroy(priv->keepalive); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
148 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
149 | priv->keepalive = NULL; |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
150 | } |
| 5563 | 151 | } |
| 152 | ||
| 153 | /* | |
|
8130
58e4e51f514b
[gaim-migrate @ 8835]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
154 | * d:)->-< |
| 5563 | 155 | * |
| 156 | * d:O-\-< | |
|
8130
58e4e51f514b
[gaim-migrate @ 8835]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
157 | * |
| 5563 | 158 | * d:D-/-< |
| 159 | * | |
| 160 | * d8D->-< DANCE! | |
| 161 | */ | |
| 162 | ||
| 163 | void | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
164 | purple_connection_set_state(PurpleConnection *connection, |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
165 | PurpleConnectionState state) |
| 5563 | 166 | { |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
167 | PurpleConnectionPrivate *priv = NULL; |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
168 | PurpleConnectionUiOps *ops = NULL; |
|
5885
223ac977eed2
[gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents:
5883
diff
changeset
|
169 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
170 | g_return_if_fail(PURPLE_IS_CONNECTION(connection)); |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
171 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
172 | priv = purple_connection_get_instance_private(connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
173 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
174 | if(priv->state == state) { |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
175 | return; |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
176 | } |
| 5563 | 177 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
178 | priv->state = state; |
| 5563 | 179 | |
| 15884 | 180 | ops = purple_connections_get_ui_ops(); |
|
5885
223ac977eed2
[gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents:
5883
diff
changeset
|
181 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
182 | if(priv->state == PURPLE_CONNECTION_CONNECTED) { |
| 15884 | 183 | PurplePresence *presence; |
|
40369
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
184 | gboolean emit_online = FALSE; |
|
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
185 | gpointer handle = NULL; |
|
10052
329dad7e2da3
[gaim-migrate @ 11013]
Dave West <kat@users.sourceforge.net>
parents:
9944
diff
changeset
|
186 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
187 | presence = purple_account_get_presence(priv->account); |
| 5563 | 188 | |
| 189 | /* Set the time the account came online */ | |
| 15884 | 190 | purple_presence_set_login_time(presence, time(NULL)); |
| 5563 | 191 | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
192 | if(ops != NULL && ops->connected != NULL) { |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
193 | ops->connected(connection); |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
194 | } |
| 5563 | 195 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
196 | purple_blist_add_account(priv->account); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
197 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
198 | handle = purple_connections_get_handle(); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
199 | purple_signal_emit(handle, "signed-on", connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
200 | purple_signal_emit_return_1(handle, "autojoin", connection); |
| 5563 | 201 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
202 | if(PURPLE_IS_PROTOCOL_PRIVACY(priv->protocol)) { |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
203 | PurpleProtocolPrivacy *privacy = NULL; |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
204 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
205 | privacy = PURPLE_PROTOCOL_PRIVACY(priv->protocol); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
206 | purple_protocol_privacy_set_permit_deny(privacy, connection); |
|
41769
e5b2368ad3ad
Remove the server privacy api that was just proxying to PurpleProtocolPrivacy
Gary Kramlich <grim@reaperworld.com>
parents:
41719
diff
changeset
|
207 | } |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
208 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
209 | update_keepalive(connection, TRUE); |
|
40369
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
210 | |
|
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
211 | /* check if connections_connected is NULL, if so we need to emit the |
|
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
212 | * online signal. |
|
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
213 | */ |
|
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
214 | if(connections_connected == NULL) { |
|
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
215 | emit_online = TRUE; |
|
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
216 | } |
|
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
217 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
218 | connections_connected = g_list_append(connections_connected, |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
219 | connection); |
|
40369
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
220 | |
|
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
221 | if(emit_online) { |
|
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
222 | purple_signal_emit(handle, "online"); |
|
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
223 | } |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
224 | } else if(priv->state == PURPLE_CONNECTION_DISCONNECTED) { |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
225 | if(ops != NULL && ops->disconnected != NULL) { |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
226 | ops->disconnected(connection); |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
227 | } |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
228 | } |
|
35012
e07a9b9c6bda
Cleaned up properties and added g_object_notify calls for PurpleConnection and PurpleConversation's
Ankit Vani <a@nevitus.org>
parents:
35000
diff
changeset
|
229 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
230 | g_object_notify_by_pspec(G_OBJECT(connection), properties[PROP_STATE]); |
| 5563 | 231 | } |
| 232 | ||
| 233 | void | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
234 | purple_connection_set_flags(PurpleConnection *connection, |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
235 | PurpleConnectionFlags flags) |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
236 | { |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
237 | PurpleConnectionPrivate *priv = NULL; |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
238 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
239 | g_return_if_fail(PURPLE_IS_CONNECTION(connection)); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
240 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
241 | priv = purple_connection_get_instance_private(connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
242 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
243 | priv->flags = flags; |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
244 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
245 | g_object_notify_by_pspec(G_OBJECT(connection), properties[PROP_FLAGS]); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
246 | } |
| 34752 | 247 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
248 | void |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
249 | purple_connection_set_display_name(PurpleConnection *connection, |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
250 | const gchar *name) |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
251 | { |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
252 | PurpleConnectionPrivate *priv = NULL; |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
253 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
254 | g_return_if_fail(PURPLE_IS_CONNECTION(connection)); |
|
35012
e07a9b9c6bda
Cleaned up properties and added g_object_notify calls for PurpleConnection and PurpleConversation's
Ankit Vani <a@nevitus.org>
parents:
35000
diff
changeset
|
255 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
256 | priv = purple_connection_get_instance_private(connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
257 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
258 | g_clear_pointer(&priv->display_name, g_free); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
259 | priv->display_name = g_strdup(name); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
260 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
261 | g_object_notify_by_pspec(G_OBJECT(connection), |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
262 | properties[PROP_DISPLAY_NAME]); |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
263 | } |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
264 | |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
265 | void |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
266 | purple_connection_set_protocol_data(PurpleConnection *connection, |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
267 | void *proto_data) |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
268 | { |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
269 | PurpleConnectionPrivate *priv = NULL; |
|
35012
e07a9b9c6bda
Cleaned up properties and added g_object_notify calls for PurpleConnection and PurpleConversation's
Ankit Vani <a@nevitus.org>
parents:
35000
diff
changeset
|
270 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
271 | g_return_if_fail(PURPLE_IS_CONNECTION(connection)); |
| 5563 | 272 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
273 | priv = purple_connection_get_instance_private(connection); |
| 34752 | 274 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
275 | priv->proto_data = proto_data; |
|
24937
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
276 | } |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
277 | |
| 15884 | 278 | PurpleConnectionState |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
279 | purple_connection_get_state(PurpleConnection *connection) { |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
280 | PurpleConnectionPrivate *priv = NULL; |
| 34752 | 281 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
282 | g_return_val_if_fail(PURPLE_IS_CONNECTION(connection), |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
283 | PURPLE_CONNECTION_DISCONNECTED); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
284 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
285 | priv = purple_connection_get_instance_private(connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
286 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
287 | return priv->state; |
| 5563 | 288 | } |
| 289 | ||
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
290 | PurpleConnectionFlags |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
291 | purple_connection_get_flags(PurpleConnection *connection) { |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
292 | PurpleConnectionPrivate *priv = NULL; |
| 34752 | 293 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
294 | g_return_val_if_fail(PURPLE_IS_CONNECTION(connection), 0); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
295 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
296 | priv = purple_connection_get_instance_private(connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
297 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
298 | return priv->flags; |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
299 | } |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
300 | |
|
36067
df9f5de00ea2
PurpleSocket: fix a crash
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36059
diff
changeset
|
301 | gboolean |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
302 | purple_connection_is_disconnecting(PurpleConnection *connection) { |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
303 | PurpleConnectionPrivate *priv = NULL; |
|
36067
df9f5de00ea2
PurpleSocket: fix a crash
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36059
diff
changeset
|
304 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
305 | g_return_val_if_fail(PURPLE_IS_CONNECTION(connection), TRUE); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
306 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
307 | priv = purple_connection_get_instance_private(connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
308 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
309 | return priv->is_finalizing; |
|
36067
df9f5de00ea2
PurpleSocket: fix a crash
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36059
diff
changeset
|
310 | } |
|
df9f5de00ea2
PurpleSocket: fix a crash
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36059
diff
changeset
|
311 | |
| 15884 | 312 | PurpleAccount * |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
313 | purple_connection_get_account(PurpleConnection *connection) { |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
314 | PurpleConnectionPrivate *priv = NULL; |
| 34752 | 315 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
316 | g_return_val_if_fail(PURPLE_IS_CONNECTION(connection), NULL); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
317 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
318 | priv = purple_connection_get_instance_private(connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
319 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
320 | return priv->account; |
| 5563 | 321 | } |
| 322 | ||
|
41300
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
323 | const gchar * |
|
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
324 | purple_connection_get_id(PurpleConnection *connection) { |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
325 | PurpleConnectionPrivate *priv = NULL; |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
326 | |
|
41300
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
327 | g_return_val_if_fail(PURPLE_IS_CONNECTION(connection), NULL); |
|
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
328 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
329 | priv = purple_connection_get_instance_private(connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
330 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
331 | return priv->id; |
|
41300
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
332 | } |
|
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
333 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36477
diff
changeset
|
334 | PurpleProtocol * |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
335 | purple_connection_get_protocol(PurpleConnection *connection) { |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
336 | PurpleConnectionPrivate *priv = NULL; |
| 34752 | 337 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
338 | g_return_val_if_fail(PURPLE_IS_CONNECTION(connection), NULL); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
339 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
340 | priv = purple_connection_get_instance_private(connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
341 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
342 | 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
|
343 | } |
|
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22324
diff
changeset
|
344 | |
| 5563 | 345 | const char * |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
346 | purple_connection_get_password(PurpleConnection *connection) { |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
347 | PurpleConnectionPrivate *priv = NULL; |
| 34752 | 348 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
349 | g_return_val_if_fail(PURPLE_IS_CONNECTION(connection), NULL); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
350 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
351 | priv = purple_connection_get_instance_private(connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
352 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
353 | return priv->password; |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
354 | } |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
355 | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
356 | GSList * |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
357 | purple_connection_get_active_chats(PurpleConnection *connection) { |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
358 | PurpleConnectionPrivate *priv = NULL; |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
359 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
360 | g_return_val_if_fail(PURPLE_IS_CONNECTION(connection), NULL); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
361 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
362 | priv = purple_connection_get_instance_private(connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
363 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
364 | return priv->active_chats; |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
365 | } |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
366 | |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
367 | const char * |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
368 | purple_connection_get_display_name(PurpleConnection *connection) { |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
369 | PurpleConnectionPrivate *priv = NULL; |
| 34752 | 370 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
371 | g_return_val_if_fail(PURPLE_IS_CONNECTION(connection), NULL); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
372 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
373 | priv = purple_connection_get_instance_private(connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
374 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
375 | return priv->display_name; |
| 5563 | 376 | } |
| 377 | ||
|
24937
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
378 | void * |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
379 | purple_connection_get_protocol_data(PurpleConnection *connection) { |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
380 | PurpleConnectionPrivate *priv = NULL; |
| 34752 | 381 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
382 | g_return_val_if_fail(PURPLE_IS_CONNECTION(connection), NULL); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
383 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
384 | priv = purple_connection_get_instance_private(connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
385 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
386 | return priv->proto_data; |
|
24937
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
387 | } |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
388 | |
| 5563 | 389 | void |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
390 | _purple_connection_add_active_chat(PurpleConnection *connection, |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
391 | PurpleChatConversation *chat) |
|
34755
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
392 | { |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
393 | PurpleConnectionPrivate *priv = NULL; |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
394 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
395 | g_return_if_fail(PURPLE_IS_CONNECTION(connection)); |
|
34755
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
396 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
397 | priv = purple_connection_get_instance_private(connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
398 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
399 | priv->active_chats = g_slist_append(priv->active_chats, chat); |
|
34755
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
400 | } |
|
24937
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
401 | |
|
34755
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
402 | void |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
403 | _purple_connection_remove_active_chat(PurpleConnection *connection, |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
404 | PurpleChatConversation *chat) |
|
34755
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
405 | { |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
406 | PurpleConnectionPrivate *priv = NULL; |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
407 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
408 | g_return_if_fail(PURPLE_IS_CONNECTION(connection)); |
|
34755
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
409 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
410 | priv = purple_connection_get_instance_private(connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
411 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
412 | priv->active_chats = g_slist_remove(priv->active_chats, chat); |
|
34755
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
413 | } |
|
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
414 | |
|
34877
5b3c720b9077
Added missing internal function, used by account.c
Ankit Vani <a@nevitus.org>
parents:
34866
diff
changeset
|
415 | gboolean |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
416 | _purple_connection_wants_to_die(PurpleConnection *connection) { |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
417 | PurpleConnectionPrivate *priv = NULL; |
|
34877
5b3c720b9077
Added missing internal function, used by account.c
Ankit Vani <a@nevitus.org>
parents:
34866
diff
changeset
|
418 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
419 | g_return_val_if_fail(PURPLE_IS_CONNECTION(connection), FALSE); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
420 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
421 | priv = purple_connection_get_instance_private(connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
422 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
423 | 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
|
424 | } |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
425 | |
|
12412
8abe3226695e
[gaim-migrate @ 14719]
Richard Laager <rlaager@pidgin.im>
parents:
12272
diff
changeset
|
426 | static gboolean |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
427 | purple_connection_disconnect_cb(gpointer data) { |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
428 | PurpleAccount *account = data; |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
429 | PurpleConnection *connection; |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
430 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
431 | connection = purple_account_get_connection(account); |
|
27336
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
432 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
433 | if(PURPLE_IS_CONNECTION(connection)) { |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
434 | PurpleConnectionPrivate *priv = NULL; |
|
27336
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
435 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
436 | priv = purple_connection_get_instance_private(connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
437 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
438 | priv->disconnect_timeout = 0; |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
439 | } |
|
27336
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
440 | |
| 15884 | 441 | purple_account_disconnect(account); |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
442 | |
|
10742
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
443 | return FALSE; |
|
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
444 | } |
|
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
445 | |
|
5571
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
446 | void |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
447 | purple_connection_error(PurpleConnection *connection, |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
448 | PurpleConnectionError reason, |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
449 | const char *description) |
|
20430
bb30dff3da21
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <resiak@pidgin.im>
parents:
19897
diff
changeset
|
450 | { |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
451 | PurpleConnectionPrivate *priv = NULL; |
| 15884 | 452 | PurpleConnectionUiOps *ops; |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
453 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
454 | g_return_if_fail(PURPLE_IS_CONNECTION(connection)); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
455 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
456 | priv = purple_connection_get_instance_private(connection); |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
457 | |
| 21279 | 458 | /* This sanity check relies on PURPLE_CONNECTION_ERROR_OTHER_ERROR |
| 459 | * being the last member of the PurpleConnectionError enum in | |
| 460 | * connection.h; if other reasons are added after it, this check should | |
| 461 | * be updated. | |
|
21278
19f6ce8ee4ad
rlaager suggested using the last element of the PurpleDisconnectReason enum
Will Thompson <resiak@pidgin.im>
parents:
21154
diff
changeset
|
462 | */ |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
463 | 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
|
464 | purple_debug_error("connection", |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
32156
diff
changeset
|
465 | "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
|
466 | "valid reason\n", reason); |
| 21279 | 467 | 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
|
468 | } |
|
15848
44463a06e833
Change connection.c:gaim_connection_error() to still work even if the
Mark Doliner <markdoliner@pidgin.im>
parents:
15537
diff
changeset
|
469 | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
470 | if(description == NULL) { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
32156
diff
changeset
|
471 | 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
|
472 | 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
|
473 | } |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
474 | |
| 6393 | 475 | /* If we've already got one error, we don't need any more */ |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
476 | if(priv->error_info != NULL) { |
| 6393 | 477 | return; |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
478 | } |
| 6393 | 479 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
480 | 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
|
481 | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
482 | purple_debug_info("connection", |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
483 | "Connection error on %p (reason: %u description: %s)\n", |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
484 | connection, reason, description); |
|
28091
03d2cecdb234
Log the reason for disconnection to the debug log, so that we might
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27336
diff
changeset
|
485 | |
| 15884 | 486 | ops = purple_connections_get_ui_ops(); |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
487 | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
488 | if(ops && ops->report_disconnect) { |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
489 | ops->report_disconnect(connection, reason, description); |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
490 | } |
| 5727 | 491 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
492 | priv->error_info = purple_connection_error_info_new(reason, description); |
|
35042
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
493 | |
|
21285
ca8cb8706802
I figured a signal firing on a connection error would be useful.
Will Thompson <resiak@pidgin.im>
parents:
21279
diff
changeset
|
494 | purple_signal_emit(purple_connections_get_handle(), "connection-error", |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
495 | connection, reason, description); |
| 5727 | 496 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
497 | priv->disconnect_timeout = g_timeout_add(0, purple_connection_disconnect_cb, |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
498 | priv->account); |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
499 | } |
|
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
500 | |
|
35042
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
501 | PurpleConnectionErrorInfo * |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
502 | purple_connection_get_error_info(PurpleConnection *connection) { |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
503 | PurpleConnectionPrivate *priv = NULL; |
|
35042
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
504 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
505 | g_return_val_if_fail(PURPLE_IS_CONNECTION(connection), NULL); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
506 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
507 | priv = purple_connection_get_instance_private(connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
508 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
509 | return priv->error_info; |
|
35042
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
510 | } |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
511 | |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
512 | void |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
513 | purple_connection_g_error(PurpleConnection *connection, const GError *error) { |
|
37666
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
514 | PurpleConnectionError reason; |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
515 | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
516 | if(g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { |
|
37666
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
517 | /* Not a connection error. Ignore. */ |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
518 | return; |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
519 | } |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
520 | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
521 | if(error->domain == G_TLS_ERROR) { |
|
37666
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
522 | switch (error->code) { |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
523 | case G_TLS_ERROR_UNAVAILABLE: |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
524 | reason = PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT; |
|
37669
13cf92fa0198
connection: Taking breaks when coding helps reduce errors
Mike Ruprecht <cmaiku@gmail.com>
parents:
37666
diff
changeset
|
525 | break; |
|
37666
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
526 | case G_TLS_ERROR_NOT_TLS: |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
527 | case G_TLS_ERROR_HANDSHAKE: |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
528 | reason = PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR; |
|
37669
13cf92fa0198
connection: Taking breaks when coding helps reduce errors
Mike Ruprecht <cmaiku@gmail.com>
parents:
37666
diff
changeset
|
529 | break; |
|
37666
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
530 | case G_TLS_ERROR_BAD_CERTIFICATE: |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
531 | case G_TLS_ERROR_CERTIFICATE_REQUIRED: |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
532 | reason = PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR; |
|
37669
13cf92fa0198
connection: Taking breaks when coding helps reduce errors
Mike Ruprecht <cmaiku@gmail.com>
parents:
37666
diff
changeset
|
533 | break; |
|
37666
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
534 | case G_TLS_ERROR_EOF: |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
535 | case G_TLS_ERROR_MISC: |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
536 | default: |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
537 | reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
538 | } |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
539 | } else if (error->domain == G_IO_ERROR) { |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
540 | reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
|
37961
2ee4c67768f4
connection: Support PurpleConnectionError GErrors
Mike Ruprecht <cmaiku@gmail.com>
parents:
37959
diff
changeset
|
541 | } else if (error->domain == PURPLE_CONNECTION_ERROR) { |
|
2ee4c67768f4
connection: Support PurpleConnectionError GErrors
Mike Ruprecht <cmaiku@gmail.com>
parents:
37959
diff
changeset
|
542 | reason = error->code; |
|
37666
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
543 | } else { |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
544 | reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
545 | } |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
546 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
547 | purple_connection_error(connection, reason, error->message); |
|
37666
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
548 | } |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
549 | |
|
37959
e76677ed819c
connection: Add purple_connection_take_error()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37958
diff
changeset
|
550 | void |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
551 | purple_connection_take_error(PurpleConnection *connection, GError *error) { |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
552 | purple_connection_g_error(connection, error); |
|
37959
e76677ed819c
connection: Add purple_connection_take_error()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37958
diff
changeset
|
553 | g_error_free(error); |
|
e76677ed819c
connection: Add purple_connection_take_error()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37958
diff
changeset
|
554 | } |
|
e76677ed819c
connection: Add purple_connection_take_error()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37958
diff
changeset
|
555 | |
|
20431
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
556 | gboolean |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
557 | purple_connection_error_is_fatal(PurpleConnectionError reason) { |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
558 | switch (reason) { |
| 21279 | 559 | case PURPLE_CONNECTION_ERROR_NETWORK_ERROR: |
|
22162
1e0f1dbe89da
Adjust some network error fatalities and things
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21865
diff
changeset
|
560 | case PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR: |
|
41463
6b13615303cc
Add some custom connection errors
Gary Kramlich <grim@reaperworld.com>
parents:
41429
diff
changeset
|
561 | case PURPLE_CONNECTION_ERROR_CUSTOM_TEMPORARY: |
|
21508
0ae51085309d
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <resiak@pidgin.im>
parents:
21507
diff
changeset
|
562 | return FALSE; |
|
0ae51085309d
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <resiak@pidgin.im>
parents:
21507
diff
changeset
|
563 | 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
|
564 | case PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED: |
| 21279 | 565 | 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
|
566 | 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
|
567 | 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
|
568 | case PURPLE_CONNECTION_ERROR_INVALID_SETTINGS: |
| 21279 | 569 | case PURPLE_CONNECTION_ERROR_CERT_NOT_PROVIDED: |
| 570 | case PURPLE_CONNECTION_ERROR_CERT_UNTRUSTED: | |
| 571 | case PURPLE_CONNECTION_ERROR_CERT_EXPIRED: | |
| 572 | case PURPLE_CONNECTION_ERROR_CERT_NOT_ACTIVATED: | |
| 573 | case PURPLE_CONNECTION_ERROR_CERT_HOSTNAME_MISMATCH: | |
| 574 | case PURPLE_CONNECTION_ERROR_CERT_FINGERPRINT_MISMATCH: | |
| 575 | case PURPLE_CONNECTION_ERROR_CERT_SELF_SIGNED: | |
| 576 | case PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR: | |
|
41463
6b13615303cc
Add some custom connection errors
Gary Kramlich <grim@reaperworld.com>
parents:
41429
diff
changeset
|
577 | case PURPLE_CONNECTION_ERROR_CUSTOM_FATAL: |
|
6b13615303cc
Add some custom connection errors
Gary Kramlich <grim@reaperworld.com>
parents:
41429
diff
changeset
|
578 | case PURPLE_CONNECTION_ERROR_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
|
579 | 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
|
580 | default: |
|
610a45545a40
datallah pointed out that using g_return_if_fail() is preferable to
Will Thompson <resiak@pidgin.im>
parents:
21149
diff
changeset
|
581 | 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
|
582 | } |
|
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
583 | } |
|
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
584 | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
585 | void |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
586 | purple_connection_update_last_received(PurpleConnection *connection) { |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
587 | PurpleConnectionPrivate *priv = NULL; |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
588 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
589 | g_return_if_fail(PURPLE_IS_CONNECTION(connection)); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
590 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
591 | priv = purple_connection_get_instance_private(connection); |
| 34752 | 592 | |
|
39517
dd799b5d4e50
libpurple: Keepalive mechanism fixes
Petteri Pitkänen <petepitk@gmail.com>
parents:
39436
diff
changeset
|
593 | /* |
|
dd799b5d4e50
libpurple: Keepalive mechanism fixes
Petteri Pitkänen <petepitk@gmail.com>
parents:
39436
diff
changeset
|
594 | * For safety, actually this function shouldn't be called when the |
|
dd799b5d4e50
libpurple: Keepalive mechanism fixes
Petteri Pitkänen <petepitk@gmail.com>
parents:
39436
diff
changeset
|
595 | * keepalive mechanism is inactive. |
|
dd799b5d4e50
libpurple: Keepalive mechanism fixes
Petteri Pitkänen <petepitk@gmail.com>
parents:
39436
diff
changeset
|
596 | */ |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
597 | if(priv->keepalive) { |
|
39863
60a4930ea197
Fix some doc comments and move the comment about purple_timeout_reset to it's new home
Gary Kramlich <grim@reaperworld.com>
parents:
39860
diff
changeset
|
598 | /* The #GTimeoutSource API doesn't expose a function to reset when a |
|
60a4930ea197
Fix some doc comments and move the comment about purple_timeout_reset to it's new home
Gary Kramlich <grim@reaperworld.com>
parents:
39860
diff
changeset
|
599 | * #GTimeoutSource will dispatch the next time, but because it works to |
|
60a4930ea197
Fix some doc comments and move the comment about purple_timeout_reset to it's new home
Gary Kramlich <grim@reaperworld.com>
parents:
39860
diff
changeset
|
600 | * directly call g_source_set_ready_time() on a #GTimeoutSource, and since |
|
60a4930ea197
Fix some doc comments and move the comment about purple_timeout_reset to it's new home
Gary Kramlich <grim@reaperworld.com>
parents:
39860
diff
changeset
|
601 | * it seems unlikely that the implementation will change, we just do that |
|
60a4930ea197
Fix some doc comments and move the comment about purple_timeout_reset to it's new home
Gary Kramlich <grim@reaperworld.com>
parents:
39860
diff
changeset
|
602 | * for now as a workaround for this API shortcoming. |
|
60a4930ea197
Fix some doc comments and move the comment about purple_timeout_reset to it's new home
Gary Kramlich <grim@reaperworld.com>
parents:
39860
diff
changeset
|
603 | */ |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
604 | gint64 seconds_from_now = purple_protocol_server_get_keepalive_interval(PURPLE_PROTOCOL_SERVER(priv->protocol)); |
|
39860
10031444a7c6
remove purple_timeout_reset and put it's implementation in the one place it was used
Gary Kramlich <grim@reaperworld.com>
parents:
39782
diff
changeset
|
605 | |
|
10031444a7c6
remove purple_timeout_reset and put it's implementation in the one place it was used
Gary Kramlich <grim@reaperworld.com>
parents:
39782
diff
changeset
|
606 | g_source_set_ready_time( |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
607 | priv->keepalive, |
|
39860
10031444a7c6
remove purple_timeout_reset and put it's implementation in the one place it was used
Gary Kramlich <grim@reaperworld.com>
parents:
39782
diff
changeset
|
608 | g_get_monotonic_time() + (seconds_from_now * G_USEC_PER_SEC) |
|
10031444a7c6
remove purple_timeout_reset and put it's implementation in the one place it was used
Gary Kramlich <grim@reaperworld.com>
parents:
39782
diff
changeset
|
609 | ); |
|
39517
dd799b5d4e50
libpurple: Keepalive mechanism fixes
Petteri Pitkänen <petepitk@gmail.com>
parents:
39436
diff
changeset
|
610 | } |
|
32679
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
611 | } |
|
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
612 | |
|
34753
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 | * GBoxed code |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
615 | **************************************************************************/ |
| 35572 | 616 | static PurpleConnectionUiOps * |
| 617 | purple_connection_ui_ops_copy(PurpleConnectionUiOps *ops) | |
| 618 | { | |
| 619 | PurpleConnectionUiOps *ops_new; | |
| 620 | ||
| 621 | g_return_val_if_fail(ops != NULL, NULL); | |
| 622 | ||
| 623 | ops_new = g_new(PurpleConnectionUiOps, 1); | |
| 624 | *ops_new = *ops; | |
| 625 | ||
| 626 | return ops_new; | |
| 627 | } | |
| 628 | ||
| 629 | GType | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
630 | purple_connection_ui_ops_get_type(void) { |
| 35572 | 631 | static GType type = 0; |
| 632 | ||
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
633 | if(type == 0) { |
| 35572 | 634 | type = g_boxed_type_register_static("PurpleConnectionUiOps", |
| 635 | (GBoxedCopyFunc)purple_connection_ui_ops_copy, | |
|
35597
7fcfcf147b99
Use g_free as UiOps structures GBoxed free function
Ankit Vani <a@nevitus.org>
parents:
35572
diff
changeset
|
636 | (GBoxedFreeFunc)g_free); |
| 35572 | 637 | } |
| 638 | ||
| 639 | return type; | |
| 640 | } | |
| 641 | ||
|
41300
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
642 | /************************************************************************** |
|
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
643 | * Helpers |
|
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
644 | **************************************************************************/ |
|
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
645 | static void |
|
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
646 | purple_connection_set_id(PurpleConnection *connection, const gchar *id) { |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
647 | PurpleConnectionPrivate *priv = NULL; |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
648 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
649 | priv = purple_connection_get_instance_private(connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
650 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
651 | g_free(priv->id); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
652 | priv->id = g_strdup(id); |
|
41300
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
653 | |
|
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
654 | g_object_notify_by_pspec(G_OBJECT(connection), properties[PROP_ID]); |
|
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
655 | } |
|
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
656 | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
657 | /************************************************************************** |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
658 | * GObject code |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
659 | **************************************************************************/ |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
660 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
661 | static void |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
662 | purple_connection_set_property(GObject *obj, guint param_id, |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
663 | const GValue *value, GParamSpec *pspec) |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
664 | { |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
665 | PurpleConnection *connection = PURPLE_CONNECTION(obj); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
666 | PurpleConnectionPrivate *priv = NULL; |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
667 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
668 | priv = purple_connection_get_instance_private(connection); |
|
32679
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
669 | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
670 | switch (param_id) { |
|
41300
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
671 | case PROP_ID: |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
672 | purple_connection_set_id(connection, g_value_get_string(value)); |
|
41300
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
673 | break; |
|
36366
202c60d1300f
Refactored connection, conversation, conversationtypes to use the initial GObject plugin API
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
674 | case PROP_PROTOCOL: |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
675 | 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
|
676 | break; |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
677 | case PROP_FLAGS: |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
678 | purple_connection_set_flags(connection, g_value_get_flags(value)); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
679 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
680 | case PROP_STATE: |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
681 | purple_connection_set_state(connection, g_value_get_enum(value)); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
682 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
683 | case PROP_ACCOUNT: |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
684 | priv->account = g_value_get_object(value); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
685 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
686 | case PROP_PASSWORD: |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
687 | g_free(priv->password); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
688 | priv->password = g_value_dup_string(value); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
689 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
690 | case PROP_DISPLAY_NAME: |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
691 | purple_connection_set_display_name(connection, |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
692 | g_value_get_string(value)); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
693 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
694 | default: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
695 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
696 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
697 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
698 | } |
|
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 | static void |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
701 | purple_connection_get_property(GObject *obj, guint param_id, GValue *value, |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
702 | GParamSpec *pspec) |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
703 | { |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
704 | PurpleConnection *connection = PURPLE_CONNECTION(obj); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
705 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
706 | switch (param_id) { |
|
41300
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
707 | case PROP_ID: |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
708 | g_value_set_string(value, purple_connection_get_id(connection)); |
|
41300
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
709 | break; |
|
36366
202c60d1300f
Refactored connection, conversation, conversationtypes to use the initial GObject plugin API
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
710 | case PROP_PROTOCOL: |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
711 | g_value_set_object(value, |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
712 | purple_connection_get_protocol(connection)); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
713 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
714 | case PROP_FLAGS: |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
715 | g_value_set_flags(value, purple_connection_get_flags(connection)); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
716 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
717 | case PROP_STATE: |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
718 | g_value_set_enum(value, purple_connection_get_state(connection)); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
719 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
720 | case PROP_ACCOUNT: |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
721 | g_value_set_object(value, |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
722 | purple_connection_get_account(connection)); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
723 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
724 | case PROP_PASSWORD: |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
725 | g_value_set_string(value, |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
726 | purple_connection_get_password(connection)); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
727 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
728 | case PROP_DISPLAY_NAME: |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
729 | g_value_set_string(value, |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
730 | purple_connection_get_display_name(connection)); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
731 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
732 | default: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
733 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
734 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
735 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
736 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
737 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
738 | static void |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
739 | purple_connection_init(PurpleConnection *connection) { |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
740 | purple_connection_set_state(connection, PURPLE_CONNECTION_CONNECTING); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
741 | connections = g_list_append(connections, connection); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
742 | } |
|
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 | static void |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
745 | purple_connection_constructed(GObject *object) { |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
746 | PurpleConnection *connection = PURPLE_CONNECTION(object); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
747 | PurpleConnectionPrivate *priv = NULL; |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
748 | |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
749 | G_OBJECT_CLASS(purple_connection_parent_class)->constructed(object); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
750 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
751 | priv = purple_connection_get_instance_private(connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
752 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
753 | if(priv->id == NULL) { |
|
41300
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
754 | gchar *uuid = g_uuid_string_random(); |
|
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
755 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
756 | purple_connection_set_id(connection, uuid); |
|
41300
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
757 | |
|
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
758 | g_free(uuid); |
|
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
759 | } |
|
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
760 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
761 | purple_account_set_connection(priv->account, connection); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
762 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
763 | purple_signal_emit(purple_connections_get_handle(), "signing-on", |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
764 | connection); |
|
32679
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
765 | } |
|
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
766 | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
767 | static void |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
768 | purple_connection_finalize(GObject *object) { |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
769 | PurpleConnection *connection = PURPLE_CONNECTION(object); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
770 | PurpleConnectionPrivate *priv = NULL; |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
771 | GSList *buddies; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
772 | gboolean remove = FALSE; |
|
40369
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
773 | gpointer handle; |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
774 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
775 | priv = purple_connection_get_instance_private(connection); |
|
35130
2033f0755d68
Fix a glib warning, by not calling g_object_notify while the connection object is being destroyed. There may be a better fix possible, though
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35097
diff
changeset
|
776 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
777 | priv->is_finalizing = TRUE; |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
778 | |
|
40369
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
779 | handle = purple_connections_get_handle(); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
780 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
781 | purple_debug_info("connection", "Disconnecting connection %p", connection); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
782 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
783 | if(priv->state != PURPLE_CONNECTION_CONNECTING) { |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
784 | remove = TRUE; |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
785 | } |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
786 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
787 | purple_signal_emit(handle, "signing-off", connection); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
788 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
789 | g_slist_free_full(priv->active_chats, |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
790 | (GDestroyNotify)purple_chat_conversation_leave); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
791 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
792 | update_keepalive(connection, FALSE); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
793 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
794 | purple_protocol_close(priv->protocol, connection); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
795 | |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36626
diff
changeset
|
796 | /* Clear out the proto data that was freed in the protocol's close method */ |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
797 | buddies = purple_blist_find_buddies(priv->account, NULL); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
798 | while (buddies != NULL) { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
799 | PurpleBuddy *buddy = buddies->data; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
800 | purple_buddy_set_protocol_data(buddy, NULL); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
801 | buddies = g_slist_delete_link(buddies, buddies); |
|
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 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
804 | connections = g_list_remove(connections, connection); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
805 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
806 | purple_connection_set_state(connection, PURPLE_CONNECTION_DISCONNECTED); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
807 | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
808 | if(remove) { |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
809 | purple_blist_remove_account(priv->account); |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
810 | } |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
811 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
812 | purple_signal_emit(handle, "signed-off", connection); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
813 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
814 | purple_account_request_close_with_account(priv->account); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
815 | purple_request_close_with_handle(connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
816 | purple_notify_close_with_handle(connection); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
817 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
818 | connections_connected = g_list_remove(connections_connected, connection); |
|
40369
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
819 | if(connections_connected == NULL) { |
|
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
820 | purple_signal_emit(handle, "offline"); |
|
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
821 | } |
|
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
822 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
823 | purple_debug_info("connection", "Destroying connection %p", connection); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
824 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
825 | purple_account_set_connection(priv->account, NULL); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
826 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
827 | g_clear_pointer(&priv->error_info, purple_connection_error_info_free); |
|
35042
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
828 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
829 | if(priv->disconnect_timeout > 0) { |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
830 | g_source_remove(priv->disconnect_timeout); |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
831 | } |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
832 | |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
833 | purple_str_wipe(priv->password); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
834 | g_free(priv->display_name); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
835 | g_free(priv->id); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
836 | |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
837 | G_OBJECT_CLASS(purple_connection_parent_class)->finalize(object); |
|
34753
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 | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
840 | static void |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
841 | purple_connection_class_init(PurpleConnectionClass *klass) { |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
842 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
843 | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
844 | obj_class->get_property = purple_connection_get_property; |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
845 | obj_class->set_property = purple_connection_set_property; |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
846 | obj_class->finalize = purple_connection_finalize; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
847 | obj_class->constructed = purple_connection_constructed; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
848 | |
|
41300
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
849 | properties[PROP_ID] = g_param_spec_string( |
|
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
850 | "id", "id", |
|
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
851 | "The identifier of the account", |
|
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
852 | NULL, |
|
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
853 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); |
|
fa932768f319
Add an ID property to PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41156
diff
changeset
|
854 | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
855 | properties[PROP_PROTOCOL] = g_param_spec_object( |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
856 | "protocol", "Protocol", |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
857 | "The protocol that the connection is using.", |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
858 | PURPLE_TYPE_PROTOCOL, |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
859 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
860 | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
861 | properties[PROP_FLAGS] = g_param_spec_flags( |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
862 | "flags", "Connection flags", |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
863 | "The flags of the connection.", |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
864 | PURPLE_TYPE_CONNECTION_FLAGS, 0, |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
865 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
866 | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
867 | properties[PROP_STATE] = g_param_spec_enum( |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
868 | "state", "Connection state", |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
869 | "The current state of the connection.", |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
870 | PURPLE_TYPE_CONNECTION_STATE, PURPLE_CONNECTION_DISCONNECTED, |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
871 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
872 | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
873 | properties[PROP_ACCOUNT] = g_param_spec_object( |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
874 | "account", "Account", |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
875 | "The account using the connection.", PURPLE_TYPE_ACCOUNT, |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
876 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
877 | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
878 | properties[PROP_PASSWORD] = g_param_spec_string( |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
879 | "password", "Password", |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
880 | "The password used for connection.", NULL, |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
881 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
882 | |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
883 | properties[PROP_DISPLAY_NAME] = g_param_spec_string( |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
884 | "display-name", "Display name", |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
885 | "Your name that appears to other people.", NULL, |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
886 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
887 | |
|
35085
abab0adfa0ec
libpurple: use g_object_class_install_properties instead of repeated g_object_class_install_property
Ankit Vani <a@nevitus.org>
parents:
35080
diff
changeset
|
888 | g_object_class_install_properties(obj_class, PROP_LAST, properties); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
889 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
890 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
891 | void |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
892 | _purple_connection_new(PurpleAccount *account, gboolean is_registration, |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
893 | const gchar *password) |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
894 | { |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
895 | PurpleProtocol *protocol = NULL; |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
896 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34967
diff
changeset
|
897 | g_return_if_fail(PURPLE_IS_ACCOUNT(account)); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
898 | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
899 | if(!purple_account_is_disconnected(account)) { |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
900 | return; |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
901 | } |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
902 | |
|
40804
5496016b3c00
Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
903 | protocol = purple_account_get_protocol(account); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
904 | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
905 | if(protocol == NULL) { |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
906 | gchar *message; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
907 | |
|
36691
92122af1f083
Some documentation updates with regard to 'protocol plugins' and 'protocols'
Ankit Vani <a@nevitus.org>
parents:
36688
diff
changeset
|
908 | message = g_strdup_printf(_("Missing protocol for %s"), |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
909 | purple_account_get_username(account)); |
|
41083
590d533cf290
Fix several typos in libpurple
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41007
diff
changeset
|
910 | purple_notify_error(NULL, is_registration ? _("Registration Error") : |
| 34955 | 911 | _("Connection Error"), message, NULL, |
| 912 | purple_request_cpar_from_account(account)); | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
913 | g_free(message); |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
914 | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
915 | return; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
916 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
917 | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
918 | if(is_registration) { |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
919 | if(!PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER, register_user)) { |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
920 | return; |
|
41083
590d533cf290
Fix several typos in libpurple
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41007
diff
changeset
|
921 | } |
|
590d533cf290
Fix several typos in libpurple
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41007
diff
changeset
|
922 | } else { |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
923 | if(((password == NULL) || (*password == '\0')) && |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
924 | !(purple_protocol_get_options(protocol) & OPT_PROTO_NO_PASSWORD) && |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
925 | !(purple_protocol_get_options(protocol) & OPT_PROTO_PASSWORD_OPTIONAL)) |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
926 | { |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
927 | purple_debug_error("connection", "Cannot connect to account %s " |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
928 | "without a password.", |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
929 | purple_account_get_username(account)); |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
930 | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
931 | return; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
932 | } |
|
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 | |
|
41799
d567f89d6a9b
Update PurpleProtocolClass->login to return a PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41798
diff
changeset
|
935 | purple_protocol_login(protocol, account, password); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
936 | } |
|
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 | void |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
939 | _purple_connection_new_unregister(PurpleAccount *account, const char *password, |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
940 | PurpleAccountUnregistrationCb cb, |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
941 | gpointer user_data) |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
942 | { |
|
41083
590d533cf290
Fix several typos in libpurple
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41007
diff
changeset
|
943 | /* Lots of copy/pasted code to avoid API changes. You might want to integrate that into the previous function when possible. */ |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
944 | PurpleConnection *gc; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36477
diff
changeset
|
945 | PurpleProtocol *protocol; |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
946 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34967
diff
changeset
|
947 | g_return_if_fail(PURPLE_IS_ACCOUNT(account)); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
948 | |
|
40804
5496016b3c00
Port libpurple from purple_protocols_ to purple_protocol_manager_
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
949 | protocol = purple_account_get_protocol(account); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
950 | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
951 | if(protocol == NULL) { |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
952 | gchar *message; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
953 | |
|
36691
92122af1f083
Some documentation updates with regard to 'protocol plugins' and 'protocols'
Ankit Vani <a@nevitus.org>
parents:
36688
diff
changeset
|
954 | message = g_strdup_printf(_("Missing protocol for %s"), |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
955 | purple_account_get_username(account)); |
| 34955 | 956 | purple_notify_error(NULL, _("Unregistration Error"), message, |
| 957 | NULL, purple_request_cpar_from_account(account)); | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
958 | g_free(message); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
959 | return; |
|
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 | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
962 | if(!purple_account_is_disconnected(account)) { |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40654
diff
changeset
|
963 | purple_protocol_server_unregister_user(PURPLE_PROTOCOL_SERVER(protocol), |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40654
diff
changeset
|
964 | account, cb, user_data); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
965 | return; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
966 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
967 | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
968 | if(((password == NULL) || (*password == '\0')) && |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
969 | !(purple_protocol_get_options(protocol) & OPT_PROTO_NO_PASSWORD) && |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
970 | !(purple_protocol_get_options(protocol) & OPT_PROTO_PASSWORD_OPTIONAL)) |
|
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_error("connection", "Cannot connect to account %s without " |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
973 | "a password.\n", purple_account_get_username(account)); |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
974 | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
975 | return; |
|
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 | |
|
41713
aaab7ef540cf
Remove new_connection from PurpleProtocolFactory
Gary Kramlich <grim@reaperworld.com>
parents:
41710
diff
changeset
|
978 | gc = g_object_new( |
|
aaab7ef540cf
Remove new_connection from PurpleProtocolFactory
Gary Kramlich <grim@reaperworld.com>
parents:
41710
diff
changeset
|
979 | PURPLE_TYPE_CONNECTION, |
|
aaab7ef540cf
Remove new_connection from PurpleProtocolFactory
Gary Kramlich <grim@reaperworld.com>
parents:
41710
diff
changeset
|
980 | "protocol", protocol, |
|
aaab7ef540cf
Remove new_connection from PurpleProtocolFactory
Gary Kramlich <grim@reaperworld.com>
parents:
41710
diff
changeset
|
981 | "account", account, |
|
aaab7ef540cf
Remove new_connection from PurpleProtocolFactory
Gary Kramlich <grim@reaperworld.com>
parents:
41710
diff
changeset
|
982 | "password", password, |
|
aaab7ef540cf
Remove new_connection from PurpleProtocolFactory
Gary Kramlich <grim@reaperworld.com>
parents:
41710
diff
changeset
|
983 | NULL); |
|
36728
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36720
diff
changeset
|
984 | |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36720
diff
changeset
|
985 | g_return_if_fail(gc != NULL); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
986 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
987 | purple_debug_info("connection", "Unregistering. gc = %p\n", gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
988 | |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40654
diff
changeset
|
989 | purple_protocol_server_unregister_user(PURPLE_PROTOCOL_SERVER(protocol), |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40654
diff
changeset
|
990 | account, cb, user_data); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
991 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
992 | |
|
41799
d567f89d6a9b
Update PurpleProtocolClass->login to return a PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41798
diff
changeset
|
993 | PurpleConnection * |
|
d567f89d6a9b
Update PurpleProtocolClass->login to return a PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41798
diff
changeset
|
994 | purple_connection_new(PurpleProtocol *protocol, PurpleAccount *account, |
|
d567f89d6a9b
Update PurpleProtocolClass->login to return a PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41798
diff
changeset
|
995 | const char *password) |
|
d567f89d6a9b
Update PurpleProtocolClass->login to return a PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41798
diff
changeset
|
996 | { |
|
d567f89d6a9b
Update PurpleProtocolClass->login to return a PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41798
diff
changeset
|
997 | g_return_val_if_fail(PURPLE_IS_PROTOCOL(protocol), NULL); |
|
d567f89d6a9b
Update PurpleProtocolClass->login to return a PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41798
diff
changeset
|
998 | g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL); |
|
d567f89d6a9b
Update PurpleProtocolClass->login to return a PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41798
diff
changeset
|
999 | |
|
d567f89d6a9b
Update PurpleProtocolClass->login to return a PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41798
diff
changeset
|
1000 | return g_object_new( |
|
d567f89d6a9b
Update PurpleProtocolClass->login to return a PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41798
diff
changeset
|
1001 | PURPLE_TYPE_CONNECTION, |
|
d567f89d6a9b
Update PurpleProtocolClass->login to return a PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41798
diff
changeset
|
1002 | "protocol", protocol, |
|
d567f89d6a9b
Update PurpleProtocolClass->login to return a PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41798
diff
changeset
|
1003 | "account", account, |
|
d567f89d6a9b
Update PurpleProtocolClass->login to return a PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41798
diff
changeset
|
1004 | "password", password, |
|
d567f89d6a9b
Update PurpleProtocolClass->login to return a PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41798
diff
changeset
|
1005 | NULL); |
|
d567f89d6a9b
Update PurpleProtocolClass->login to return a PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41798
diff
changeset
|
1006 | } |
|
d567f89d6a9b
Update PurpleProtocolClass->login to return a PurpleConnection
Gary Kramlich <grim@reaperworld.com>
parents:
41798
diff
changeset
|
1007 | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1008 | /************************************************************************** |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1009 | * Connections API |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1010 | **************************************************************************/ |
|
36068
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36067
diff
changeset
|
1011 | |
|
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36067
diff
changeset
|
1012 | void |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
1013 | _purple_assert_connection_is_valid(PurpleConnection *gc, const gchar *file, |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
1014 | int line) |
|
36068
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36067
diff
changeset
|
1015 | { |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
1016 | if(gc && g_list_find(purple_connections_get_all(), gc)) { |
|
36068
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36067
diff
changeset
|
1017 | return; |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
1018 | } |
|
36068
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36067
diff
changeset
|
1019 | |
|
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36067
diff
changeset
|
1020 | purple_debug_fatal("connection", "PURPLE_ASSERT_CONNECTION_IS_VALID(%p)" |
|
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36067
diff
changeset
|
1021 | " failed at %s:%d", gc, file, line); |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
1022 | |
|
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
1023 | /* ugh - gk 2021-10-28 */ |
|
36068
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36067
diff
changeset
|
1024 | exit(-1); |
|
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36067
diff
changeset
|
1025 | } |
|
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36067
diff
changeset
|
1026 | |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1027 | void |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
1028 | purple_connections_disconnect_all(void) { |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
1029 | GList *l; |
| 5563 | 1030 | |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
1031 | while((l = purple_connections_get_all()) != NULL) { |
|
41792
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
1032 | PurpleConnection *connection = l->data; |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
1033 | PurpleConnectionPrivate *priv = NULL; |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
1034 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
1035 | priv = purple_connection_get_instance_private(connection); |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
1036 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
1037 | priv->wants_to_die = TRUE; |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
1038 | |
|
715d38814f5d
Make PurpleConnection derivable, which also means adding a private structure.
Gary Kramlich <grim@reaperworld.com>
parents:
41769
diff
changeset
|
1039 | purple_account_disconnect(priv->account); |
|
6113
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6111
diff
changeset
|
1040 | } |
| 5563 | 1041 | } |
| 1042 | ||
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
1043 | GList * |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
1044 | purple_connections_get_all(void) { |
| 5563 | 1045 | return connections; |
| 1046 | } | |
| 1047 | ||
|
40369
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
1048 | gboolean |
|
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
1049 | purple_connections_is_online(void) { |
|
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
1050 | return (connections_connected != NULL); |
|
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
1051 | } |
|
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
1052 | |
| 5563 | 1053 | void |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
1054 | purple_connections_set_ui_ops(PurpleConnectionUiOps *ops) { |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1055 | connection_ui_ops = ops; |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1056 | } |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1057 | |
| 15884 | 1058 | PurpleConnectionUiOps * |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
1059 | purple_connections_get_ui_ops(void) { |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1060 | return connection_ui_ops; |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1061 | } |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1062 | |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1063 | void |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
1064 | purple_connections_init(void) { |
| 15884 | 1065 | void *handle = purple_connections_get_handle(); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1066 | |
|
40369
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
1067 | purple_signal_register(handle, "online", purple_marshal_VOID, G_TYPE_NONE, |
|
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
1068 | 0); |
|
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
1069 | |
|
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
1070 | purple_signal_register(handle, "offline", purple_marshal_VOID, G_TYPE_NONE, |
|
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
1071 | 0); |
|
41733d530d58
Add online and offline signals that are emitted when the first account goes and the last account go offline.
Gary Kramlich <grim@reaperworld.com>
parents:
40347
diff
changeset
|
1072 | |
| 15884 | 1073 | 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
|
1074 | 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
|
1075 | PURPLE_TYPE_CONNECTION); |
|
6564
a7a2c1927544
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6533
diff
changeset
|
1076 | |
| 15884 | 1077 | 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
|
1078 | 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
|
1079 | PURPLE_TYPE_CONNECTION); |
|
6564
a7a2c1927544
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6533
diff
changeset
|
1080 | |
| 15884 | 1081 | 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
|
1082 | 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
|
1083 | PURPLE_TYPE_CONNECTION); |
|
6564
a7a2c1927544
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6533
diff
changeset
|
1084 | |
| 15884 | 1085 | 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
|
1086 | 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
|
1087 | 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
|
1088 | |
|
ca8cb8706802
I figured a signal firing on a connection error would be useful.
Will Thompson <resiak@pidgin.im>
parents:
21279
diff
changeset
|
1089 | 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
|
1090 | 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
|
1091 | 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
|
1092 | 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
|
1093 | |
|
30039
9cd7672bae4f
Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents:
28577
diff
changeset
|
1094 | 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
|
1095 | 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
|
1096 | PURPLE_TYPE_CONNECTION); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1097 | } |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1098 | |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1099 | void |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
1100 | purple_connections_uninit(void) { |
| 15884 | 1101 | purple_signals_unregister_by_instance(purple_connections_get_handle()); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1102 | } |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1103 | |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1104 | void * |
|
41156
268e57363246
Remove private data from PurpleConnection and fix up PURPLE_CONNECTION_ERROR
Gary Kramlich <grim@reaperworld.com>
parents:
41137
diff
changeset
|
1105 | purple_connections_get_handle(void) { |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1106 | return &connections_handle; |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1107 | } |