Thu, 21 May 2020 21:21:54 -0500
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
|
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 | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
24 | #include "internal.h" |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
25 | |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
26 | #include "account.h" |
|
34706
02cb08146888
Renamed blist.[ch] to buddylist.[ch]
Ankit Vani <a@nevitus.org>
parents:
34645
diff
changeset
|
27 | #include "buddylist.h" |
| 5563 | 28 | #include "connection.h" |
| 5717 | 29 | #include "debug.h" |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
30 | #include "enums.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
31 | #include "log.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
32 | #include "notify.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
33 | #include "prefs.h" |
|
14900
4af8b81519b6
[gaim-migrate @ 17607]
Mark Doliner <markdoliner@pidgin.im>
parents:
14814
diff
changeset
|
34 | #include "proxy.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
|
35 | #include "purpleprivate.h" |
|
40339
54813fd13c13
Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40195
diff
changeset
|
36 | #include "purpleprotocolfactory.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
37 | #include "request.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
38 | #include "server.h" |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
39 | #include "signals.h" |
|
6106
1dc08be40f0a
[gaim-migrate @ 6567]
Mark Doliner <markdoliner@pidgin.im>
parents:
6076
diff
changeset
|
40 | #include "util.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
41 | |
|
37961
2ee4c67768f4
connection: Support PurpleConnectionError GErrors
Mike Ruprecht <cmaiku@gmail.com>
parents:
37959
diff
changeset
|
42 | G_DEFINE_QUARK(purple-connection-error-quark, purple_connection_error); |
|
2ee4c67768f4
connection: Support PurpleConnectionError GErrors
Mike Ruprecht <cmaiku@gmail.com>
parents:
37959
diff
changeset
|
43 | |
|
39549
ee61762c3ebe
Use G_DECLARE* for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39520
diff
changeset
|
44 | /** |
|
ee61762c3ebe
Use G_DECLARE* for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39520
diff
changeset
|
45 | * PurpleConnection: |
|
ee61762c3ebe
Use G_DECLARE* for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39520
diff
changeset
|
46 | * |
|
ee61762c3ebe
Use G_DECLARE* for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39520
diff
changeset
|
47 | * Represents an active connection on an account. |
|
ee61762c3ebe
Use G_DECLARE* for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39520
diff
changeset
|
48 | */ |
|
ee61762c3ebe
Use G_DECLARE* for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39520
diff
changeset
|
49 | struct _PurpleConnection |
|
ee61762c3ebe
Use G_DECLARE* for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39520
diff
changeset
|
50 | { |
|
ee61762c3ebe
Use G_DECLARE* for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39520
diff
changeset
|
51 | GObject gparent; |
|
ee61762c3ebe
Use G_DECLARE* for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39520
diff
changeset
|
52 | }; |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
53 | |
|
35458
385156e1b493
Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
54 | /* Private data for a connection */ |
|
39556
622bf98df0ac
Remove unnecessary struct tags.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39549
diff
changeset
|
55 | typedef struct |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
56 | { |
| 37069 | 57 | PurpleProtocol *protocol; /* The protocol. */ |
|
35458
385156e1b493
Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
58 | PurpleConnectionFlags flags; /* Connection flags. */ |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
59 | |
|
35458
385156e1b493
Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
60 | PurpleConnectionState state; /* The connection state. */ |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
61 | |
|
35458
385156e1b493
Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
62 | 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
|
63 | char *password; /* The password used. */ |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
64 | |
|
35458
385156e1b493
Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
65 | 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
|
66 | (#PurpleChatConversation structs). */ |
| 35097 | 67 | |
| 68 | /* 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
|
69 | void *proto_data; /* Protocol-specific data. */ |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
70 | |
|
35458
385156e1b493
Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
71 | 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
|
72 | GSource *keepalive; /* Keep-alive. */ |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
73 | |
|
35458
385156e1b493
Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
74 | /* 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
|
75 | * 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
|
76 | * 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
|
77 | * 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
|
78 | * setting it themselves. |
|
35458
385156e1b493
Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
79 | * See purple_connection_error_is_fatal() |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
80 | */ |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
81 | gboolean wants_to_die; |
|
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
82 | |
|
35458
385156e1b493
Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
83 | 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
|
84 | |
|
35458
385156e1b493
Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
85 | /* The connection error and its description if an error occured */ |
|
35042
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
86 | PurpleConnectionErrorInfo *error_info; |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
87 | |
|
35458
385156e1b493
Fix some gtk-doc warnings from account to connection
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
88 | 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
|
89 | } PurpleConnectionPrivate; |
|
34748
02efb47ea4f4
Added GObject boilerplate code for PurpleConnection
Ankit Vani <a@nevitus.org>
parents:
34746
diff
changeset
|
90 | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
91 | /* GObject property enums */ |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
92 | enum |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
93 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
94 | PROP_0, |
|
36366
202c60d1300f
Refactored connection, conversation, conversationtypes to use the initial GObject plugin API
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
95 | PROP_PROTOCOL, |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
96 | PROP_FLAGS, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
97 | PROP_STATE, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
98 | PROP_ACCOUNT, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
99 | PROP_PASSWORD, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
100 | PROP_DISPLAY_NAME, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
101 | PROP_LAST |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
102 | }; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
103 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
104 | static GParamSpec *properties[PROP_LAST]; |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
105 | |
| 5563 | 106 | static GList *connections = NULL; |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
107 | static GList *connections_connecting = NULL; |
| 15884 | 108 | static PurpleConnectionUiOps *connection_ui_ops = NULL; |
| 5563 | 109 | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
110 | static int connections_handle; |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5859
diff
changeset
|
111 | |
|
35042
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
112 | static PurpleConnectionErrorInfo * |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
113 | purple_connection_error_info_new(PurpleConnectionError type, |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
114 | const gchar *description); |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
115 | |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
116 | G_DEFINE_TYPE_WITH_PRIVATE(PurpleConnection, purple_connection, G_TYPE_OBJECT) |
|
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
117 | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
118 | /************************************************************************** |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
119 | * Connection API |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
120 | **************************************************************************/ |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
121 | static gboolean |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
122 | send_keepalive(gpointer data) |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
123 | { |
| 15884 | 124 | PurpleConnection *gc = data; |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
125 | PurpleConnectionPrivate *priv = purple_connection_get_instance_private(gc); |
|
22277
7c386db62c81
Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@pidgin.im>
parents:
22163
diff
changeset
|
126 | |
| 36719 | 127 | purple_protocol_server_iface_keepalive(priv->protocol, gc); |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
128 | |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
129 | return TRUE; |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
130 | } |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
131 | |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
132 | static void |
| 15884 | 133 | update_keepalive(PurpleConnection *gc, gboolean on) |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
134 | { |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
135 | PurpleConnectionPrivate *priv = purple_connection_get_instance_private(gc); |
|
14545
f8b45a0ddac5
[gaim-migrate @ 17202]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
136 | |
|
39759
ea1401483849
Rename *_GET_*_IFACE to more standard *_GET_IFACE.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39659
diff
changeset
|
137 | if (!PURPLE_PROTOCOL_IMPLEMENTS(priv->protocol, SERVER, keepalive)) |
|
14545
f8b45a0ddac5
[gaim-migrate @ 17202]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
138 | return; |
|
f8b45a0ddac5
[gaim-migrate @ 17202]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
139 | |
| 34752 | 140 | if (on && !priv->keepalive) |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
141 | { |
|
39518
6141cf90e5b8
libpurple: Make keepalive interval configurable
Petteri Pitkänen <petepitk@gmail.com>
parents:
39517
diff
changeset
|
142 | int interval = purple_protocol_server_iface_get_keepalive_interval(priv->protocol); |
|
6141cf90e5b8
libpurple: Make keepalive interval configurable
Petteri Pitkänen <petepitk@gmail.com>
parents:
39517
diff
changeset
|
143 | purple_debug_info("connection", "Activating keepalive to %d seconds.", interval); |
|
39520
7f9952eeb6a7
libpurple: Refactor keepalive mechanism to use GSource pointers
Petteri Pitkänen <petepitk@gmail.com>
parents:
39518
diff
changeset
|
144 | priv->keepalive = g_main_context_find_source_by_id(NULL, g_timeout_add_seconds(interval, send_keepalive, gc)); |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
145 | } |
|
39520
7f9952eeb6a7
libpurple: Refactor keepalive mechanism to use GSource pointers
Petteri Pitkänen <petepitk@gmail.com>
parents:
39518
diff
changeset
|
146 | else if (!on && priv->keepalive) |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
147 | { |
| 15884 | 148 | purple_debug_info("connection", "Deactivating keepalive.\n"); |
|
39520
7f9952eeb6a7
libpurple: Refactor keepalive mechanism to use GSource pointers
Petteri Pitkänen <petepitk@gmail.com>
parents:
39518
diff
changeset
|
149 | g_source_destroy(priv->keepalive); |
|
7f9952eeb6a7
libpurple: Refactor keepalive mechanism to use GSource pointers
Petteri Pitkänen <petepitk@gmail.com>
parents:
39518
diff
changeset
|
150 | priv->keepalive = NULL; |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
151 | } |
| 5563 | 152 | } |
| 153 | ||
| 154 | /* | |
|
8130
58e4e51f514b
[gaim-migrate @ 8835]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
155 | * d:)->-< |
| 5563 | 156 | * |
| 157 | * d:O-\-< | |
|
8130
58e4e51f514b
[gaim-migrate @ 8835]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
158 | * |
| 5563 | 159 | * d:D-/-< |
| 160 | * | |
| 161 | * d8D->-< DANCE! | |
| 162 | */ | |
| 163 | ||
| 164 | void | |
| 15884 | 165 | purple_connection_set_state(PurpleConnection *gc, PurpleConnectionState state) |
| 5563 | 166 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
167 | PurpleConnectionPrivate *priv = NULL; |
| 15884 | 168 | PurpleConnectionUiOps *ops; |
|
5885
223ac977eed2
[gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents:
5883
diff
changeset
|
169 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
170 | g_return_if_fail(PURPLE_IS_CONNECTION(gc)); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
171 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
172 | priv = purple_connection_get_instance_private(gc); |
| 5563 | 173 | |
| 34752 | 174 | if (priv->state == state) |
|
5784
4c9046760b5b
[gaim-migrate @ 6209]
Christian Hammond <chipx86@chipx86.com>
parents:
5741
diff
changeset
|
175 | return; |
|
4c9046760b5b
[gaim-migrate @ 6209]
Christian Hammond <chipx86@chipx86.com>
parents:
5741
diff
changeset
|
176 | |
| 34752 | 177 | priv->state = state; |
| 5563 | 178 | |
| 15884 | 179 | ops = purple_connections_get_ui_ops(); |
|
5885
223ac977eed2
[gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents:
5883
diff
changeset
|
180 | |
| 34752 | 181 | if (priv->state == PURPLE_CONNECTION_CONNECTING) { |
|
5905
62a6bdbc09b7
[gaim-migrate @ 6337]
Robert McQueen <robot101@debian.org>
parents:
5885
diff
changeset
|
182 | connections_connecting = g_list_append(connections_connecting, gc); |
|
62a6bdbc09b7
[gaim-migrate @ 6337]
Robert McQueen <robot101@debian.org>
parents:
5885
diff
changeset
|
183 | } |
|
62a6bdbc09b7
[gaim-migrate @ 6337]
Robert McQueen <robot101@debian.org>
parents:
5885
diff
changeset
|
184 | else { |
|
5885
223ac977eed2
[gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents:
5883
diff
changeset
|
185 | connections_connecting = g_list_remove(connections_connecting, gc); |
|
5905
62a6bdbc09b7
[gaim-migrate @ 6337]
Robert McQueen <robot101@debian.org>
parents:
5885
diff
changeset
|
186 | } |
|
5885
223ac977eed2
[gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents:
5883
diff
changeset
|
187 | |
| 34752 | 188 | if (priv->state == PURPLE_CONNECTION_CONNECTED) { |
| 15884 | 189 | PurpleAccount *account; |
| 190 | PurplePresence *presence; | |
|
10052
329dad7e2da3
[gaim-migrate @ 11013]
Dave West <kat@users.sourceforge.net>
parents:
9944
diff
changeset
|
191 | |
| 15884 | 192 | account = purple_connection_get_account(gc); |
| 193 | presence = purple_account_get_presence(account); | |
| 5563 | 194 | |
| 195 | /* Set the time the account came online */ | |
| 15884 | 196 | purple_presence_set_login_time(presence, time(NULL)); |
| 5563 | 197 | |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15890
diff
changeset
|
198 | if (purple_prefs_get_bool("/purple/logging/log_system")) |
|
11698
afbf0d8bdacf
[gaim-migrate @ 13989]
Mark Doliner <markdoliner@pidgin.im>
parents:
11562
diff
changeset
|
199 | { |
| 15884 | 200 | PurpleLog *log = purple_account_get_log(account, TRUE); |
|
13508
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
201 | |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
202 | if (log != NULL) |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
203 | { |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
204 | char *msg = g_strdup_printf(_("+++ %s signed on"), |
| 15884 | 205 | purple_account_get_username(account)); |
|
38621
1412d6b993e9
Use GDateTime in purple_log_write.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
206 | GDateTime *dt = g_date_time_new_from_unix_local(purple_presence_get_login_time(presence)); |
| 15884 | 207 | purple_log_write(log, PURPLE_MESSAGE_SYSTEM, |
|
38621
1412d6b993e9
Use GDateTime in purple_log_write.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
208 | purple_account_get_username(account), |
|
1412d6b993e9
Use GDateTime in purple_log_write.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
209 | dt, msg); |
|
1412d6b993e9
Use GDateTime in purple_log_write.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
210 | g_date_time_unref(dt); |
|
13508
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
211 | g_free(msg); |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
212 | } |
|
10301
fd24ab69574a
[gaim-migrate @ 11486]
Mark Doliner <markdoliner@pidgin.im>
parents:
10193
diff
changeset
|
213 | } |
|
fd24ab69574a
[gaim-migrate @ 11486]
Mark Doliner <markdoliner@pidgin.im>
parents:
10193
diff
changeset
|
214 | |
| 5563 | 215 | if (ops != NULL && ops->connected != NULL) |
| 216 | ops->connected(gc); | |
| 217 | ||
| 15884 | 218 | purple_blist_add_account(account); |
| 5563 | 219 | |
| 15884 | 220 | purple_signal_emit(purple_connections_get_handle(), "signed-on", gc); |
|
30039
9cd7672bae4f
Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents:
28577
diff
changeset
|
221 | purple_signal_emit_return_1(purple_connections_get_handle(), "autojoin", gc); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
222 | |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35458
diff
changeset
|
223 | purple_serv_set_permit_deny(gc); |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
224 | |
|
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
225 | update_keepalive(gc, TRUE); |
| 5563 | 226 | } |
| 34752 | 227 | else if (priv->state == PURPLE_CONNECTION_DISCONNECTED) { |
| 15884 | 228 | PurpleAccount *account = purple_connection_get_account(gc); |
| 8573 | 229 | |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15890
diff
changeset
|
230 | if (purple_prefs_get_bool("/purple/logging/log_system")) |
|
11698
afbf0d8bdacf
[gaim-migrate @ 13989]
Mark Doliner <markdoliner@pidgin.im>
parents:
11562
diff
changeset
|
231 | { |
| 15884 | 232 | PurpleLog *log = purple_account_get_log(account, FALSE); |
|
13508
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
233 | |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
234 | if (log != NULL) |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
235 | { |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
236 | char *msg = g_strdup_printf(_("+++ %s signed off"), |
| 15884 | 237 | purple_account_get_username(account)); |
|
38621
1412d6b993e9
Use GDateTime in purple_log_write.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
238 | GDateTime *dt = g_date_time_new_now_utc(); |
| 15884 | 239 | purple_log_write(log, PURPLE_MESSAGE_SYSTEM, |
|
38621
1412d6b993e9
Use GDateTime in purple_log_write.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
240 | purple_account_get_username(account), |
|
1412d6b993e9
Use GDateTime in purple_log_write.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
241 | dt, msg); |
|
1412d6b993e9
Use GDateTime in purple_log_write.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
242 | g_date_time_unref(dt); |
|
13508
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
243 | g_free(msg); |
|
3c66c5a0ca7c
[gaim-migrate @ 15883]
Richard Laager <rlaager@pidgin.im>
parents:
12412
diff
changeset
|
244 | } |
| 8573 | 245 | } |
| 246 | ||
| 15884 | 247 | purple_account_destroy_log(account); |
| 8573 | 248 | |
|
5885
223ac977eed2
[gaim-migrate @ 6317]
Christian Hammond <chipx86@chipx86.com>
parents:
5883
diff
changeset
|
249 | if (ops != NULL && ops->disconnected != NULL) |
| 9190 | 250 | ops->disconnected(gc); |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
251 | } |
|
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
|
252 | |
|
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
|
253 | if (!priv->is_finalizing) |
|
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
|
254 | g_object_notify_by_pspec(G_OBJECT(gc), properties[PROP_STATE]); |
| 5563 | 255 | } |
| 256 | ||
| 257 | void | |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
258 | purple_connection_set_flags(PurpleConnection *gc, PurpleConnectionFlags flags) |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
259 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
260 | PurpleConnectionPrivate *priv = NULL; |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
261 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
262 | g_return_if_fail(PURPLE_IS_CONNECTION(gc)); |
| 34752 | 263 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
264 | priv = purple_connection_get_instance_private(gc); |
| 34752 | 265 | priv->flags = flags; |
|
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
|
266 | |
|
36059
c568fcefdb82
Imgupload: hook newly created connections
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35597
diff
changeset
|
267 | if (!priv->is_finalizing) |
|
c568fcefdb82
Imgupload: hook newly created connections
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35597
diff
changeset
|
268 | g_object_notify_by_pspec(G_OBJECT(gc), properties[PROP_FLAGS]); |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
269 | } |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
270 | |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
271 | void |
| 15884 | 272 | purple_connection_set_display_name(PurpleConnection *gc, const char *name) |
| 5563 | 273 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
274 | PurpleConnectionPrivate *priv = NULL; |
| 5563 | 275 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
276 | g_return_if_fail(PURPLE_IS_CONNECTION(gc)); |
| 34752 | 277 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
278 | priv = purple_connection_get_instance_private(gc); |
| 34752 | 279 | g_free(priv->display_name); |
| 280 | priv->display_name = g_strdup(name); | |
|
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
|
281 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
282 | g_object_notify_by_pspec(G_OBJECT(gc), properties[PROP_DISPLAY_NAME]); |
| 5563 | 283 | } |
| 284 | ||
|
24937
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
285 | void |
| 34752 | 286 | purple_connection_set_protocol_data(PurpleConnection *gc, void *proto_data) |
| 287 | { | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
288 | PurpleConnectionPrivate *priv = NULL; |
|
24937
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
289 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
290 | g_return_if_fail(PURPLE_IS_CONNECTION(gc)); |
| 34752 | 291 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
292 | priv = purple_connection_get_instance_private(gc); |
| 34752 | 293 | 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
|
294 | } |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
295 | |
| 15884 | 296 | PurpleConnectionState |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
297 | purple_connection_get_state(PurpleConnection *gc) |
| 5563 | 298 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
299 | PurpleConnectionPrivate *priv = NULL; |
| 5563 | 300 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
301 | g_return_val_if_fail(PURPLE_IS_CONNECTION(gc), PURPLE_CONNECTION_DISCONNECTED); |
| 34752 | 302 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
303 | priv = purple_connection_get_instance_private(gc); |
| 34752 | 304 | return priv->state; |
| 5563 | 305 | } |
| 306 | ||
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
307 | PurpleConnectionFlags |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
308 | purple_connection_get_flags(PurpleConnection *gc) |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
309 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
310 | PurpleConnectionPrivate *priv = NULL; |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
311 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
312 | g_return_val_if_fail(PURPLE_IS_CONNECTION(gc), 0); |
| 34752 | 313 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
314 | priv = purple_connection_get_instance_private(gc); |
| 34752 | 315 | return priv->flags; |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
316 | } |
|
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
317 | |
|
36067
df9f5de00ea2
PurpleSocket: fix a crash
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36059
diff
changeset
|
318 | gboolean |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
319 | purple_connection_is_disconnecting(PurpleConnection *gc) |
|
36067
df9f5de00ea2
PurpleSocket: fix a crash
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36059
diff
changeset
|
320 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
321 | PurpleConnectionPrivate *priv = NULL; |
|
36067
df9f5de00ea2
PurpleSocket: fix a crash
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36059
diff
changeset
|
322 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
323 | g_return_val_if_fail(PURPLE_IS_CONNECTION(gc), TRUE); |
|
36067
df9f5de00ea2
PurpleSocket: fix a crash
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36059
diff
changeset
|
324 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
325 | priv = purple_connection_get_instance_private(gc); |
|
36067
df9f5de00ea2
PurpleSocket: fix a crash
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36059
diff
changeset
|
326 | return priv->is_finalizing; |
|
df9f5de00ea2
PurpleSocket: fix a crash
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36059
diff
changeset
|
327 | } |
|
df9f5de00ea2
PurpleSocket: fix a crash
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36059
diff
changeset
|
328 | |
| 15884 | 329 | PurpleAccount * |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
330 | purple_connection_get_account(PurpleConnection *gc) |
| 5563 | 331 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
332 | PurpleConnectionPrivate *priv = NULL; |
| 5563 | 333 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
334 | g_return_val_if_fail(PURPLE_IS_CONNECTION(gc), NULL); |
| 34752 | 335 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
336 | priv = purple_connection_get_instance_private(gc); |
| 34752 | 337 | return priv->account; |
| 5563 | 338 | } |
| 339 | ||
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36477
diff
changeset
|
340 | PurpleProtocol * |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
341 | purple_connection_get_protocol(PurpleConnection *gc) |
|
22336
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22324
diff
changeset
|
342 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
343 | PurpleConnectionPrivate *priv = NULL; |
|
22336
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22324
diff
changeset
|
344 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
345 | g_return_val_if_fail(PURPLE_IS_CONNECTION(gc), NULL); |
| 34752 | 346 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
347 | priv = purple_connection_get_instance_private(gc); |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36477
diff
changeset
|
348 | 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
|
349 | } |
|
ac905bb0a8ec
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22324
diff
changeset
|
350 | |
| 5563 | 351 | const char * |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
352 | purple_connection_get_password(PurpleConnection *gc) |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
353 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
354 | PurpleConnectionPrivate *priv = NULL; |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
355 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
356 | g_return_val_if_fail(PURPLE_IS_CONNECTION(gc), NULL); |
| 34752 | 357 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
358 | priv = purple_connection_get_instance_private(gc); |
| 34752 | 359 | return priv->password; |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
360 | } |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
361 | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
362 | GSList * |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
363 | purple_connection_get_active_chats(PurpleConnection *gc) |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
364 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
365 | PurpleConnectionPrivate *priv = NULL; |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
366 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
367 | g_return_val_if_fail(PURPLE_IS_CONNECTION(gc), NULL); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
368 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
369 | priv = purple_connection_get_instance_private(gc); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
370 | return priv->active_chats; |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
371 | } |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
372 | |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
373 | const char * |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
374 | purple_connection_get_display_name(PurpleConnection *gc) |
| 5563 | 375 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
376 | PurpleConnectionPrivate *priv = NULL; |
| 5563 | 377 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
378 | g_return_val_if_fail(PURPLE_IS_CONNECTION(gc), NULL); |
| 34752 | 379 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
380 | priv = purple_connection_get_instance_private(gc); |
| 34752 | 381 | return priv->display_name; |
| 5563 | 382 | } |
| 383 | ||
|
24937
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
384 | void * |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
385 | purple_connection_get_protocol_data(PurpleConnection *gc) |
| 34752 | 386 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
387 | PurpleConnectionPrivate *priv = NULL; |
|
24937
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
388 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
389 | g_return_val_if_fail(PURPLE_IS_CONNECTION(gc), NULL); |
| 34752 | 390 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
391 | priv = purple_connection_get_instance_private(gc); |
| 34752 | 392 | 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
|
393 | } |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
394 | |
| 5563 | 395 | void |
|
34755
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
396 | _purple_connection_add_active_chat(PurpleConnection *gc, PurpleChatConversation *chat) |
|
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
397 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
398 | PurpleConnectionPrivate *priv = NULL; |
|
34755
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
399 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
400 | g_return_if_fail(PURPLE_IS_CONNECTION(gc)); |
|
34755
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
401 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
402 | priv = purple_connection_get_instance_private(gc); |
|
34755
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
403 | priv->active_chats = g_slist_append(priv->active_chats, chat); |
|
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
404 | } |
|
24937
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
405 | |
|
34755
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
406 | void |
|
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
407 | _purple_connection_remove_active_chat(PurpleConnection *gc, PurpleChatConversation *chat) |
|
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
408 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
409 | PurpleConnectionPrivate *priv = NULL; |
|
34755
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
410 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
411 | g_return_if_fail(PURPLE_IS_CONNECTION(gc)); |
|
34755
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
412 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
413 | priv = purple_connection_get_instance_private(gc); |
|
34755
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
414 | priv->active_chats = g_slist_remove(priv->active_chats, chat); |
|
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
415 | } |
|
9336815f86b6
Refactored the remaining libpurple to use the initial GObject connection API
Ankit Vani <a@nevitus.org>
parents:
34753
diff
changeset
|
416 | |
|
34877
5b3c720b9077
Added missing internal function, used by account.c
Ankit Vani <a@nevitus.org>
parents:
34866
diff
changeset
|
417 | gboolean |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
418 | _purple_connection_wants_to_die(PurpleConnection *gc) |
|
34877
5b3c720b9077
Added missing internal function, used by account.c
Ankit Vani <a@nevitus.org>
parents:
34866
diff
changeset
|
419 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
420 | PurpleConnectionPrivate *priv = NULL; |
|
34877
5b3c720b9077
Added missing internal function, used by account.c
Ankit Vani <a@nevitus.org>
parents:
34866
diff
changeset
|
421 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
422 | g_return_val_if_fail(PURPLE_IS_CONNECTION(gc), FALSE); |
|
34877
5b3c720b9077
Added missing internal function, used by account.c
Ankit Vani <a@nevitus.org>
parents:
34866
diff
changeset
|
423 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
424 | priv = purple_connection_get_instance_private(gc); |
|
34877
5b3c720b9077
Added missing internal function, used by account.c
Ankit Vani <a@nevitus.org>
parents:
34866
diff
changeset
|
425 | 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
|
426 | } |
|
3664132c36c8
Added purple_connection_set_protocol_data and purple_connection_get_protocol_data
Gary Kramlich <grim@reaperworld.com>
parents:
22336
diff
changeset
|
427 | |
| 5563 | 428 | void |
| 15884 | 429 | purple_connection_update_progress(PurpleConnection *gc, const char *text, |
| 5563 | 430 | size_t step, size_t count) |
| 431 | { | |
| 15884 | 432 | PurpleConnectionUiOps *ops; |
| 5563 | 433 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34967
diff
changeset
|
434 | g_return_if_fail(PURPLE_IS_CONNECTION(gc)); |
| 5563 | 435 | g_return_if_fail(text != NULL); |
| 436 | g_return_if_fail(step < count); | |
| 437 | g_return_if_fail(count > 1); | |
| 438 | ||
| 15884 | 439 | ops = purple_connections_get_ui_ops(); |
| 5563 | 440 | |
| 441 | if (ops != NULL && ops->connect_progress != NULL) | |
| 442 | ops->connect_progress(gc, text, step, count); | |
| 443 | } | |
| 444 | ||
| 445 | void | |
| 15884 | 446 | purple_connection_notice(PurpleConnection *gc, const char *text) |
|
5571
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
447 | { |
| 15884 | 448 | PurpleConnectionUiOps *ops; |
|
5571
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
449 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34967
diff
changeset
|
450 | g_return_if_fail(PURPLE_IS_CONNECTION(gc)); |
|
5571
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
451 | g_return_if_fail(text != NULL); |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
452 | |
| 15884 | 453 | ops = purple_connections_get_ui_ops(); |
|
5571
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
454 | |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
455 | if (ops != NULL && ops->notice != NULL) |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
456 | ops->notice(gc, text); |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
457 | } |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
458 | |
|
12412
8abe3226695e
[gaim-migrate @ 14719]
Richard Laager <rlaager@pidgin.im>
parents:
12272
diff
changeset
|
459 | static gboolean |
| 15884 | 460 | purple_connection_disconnect_cb(gpointer data) |
|
10742
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
461 | { |
|
27336
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
462 | PurpleAccount *account; |
|
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
463 | PurpleConnection *gc; |
|
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
464 | |
|
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
465 | account = data; |
|
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
466 | gc = purple_account_get_connection(account); |
|
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
467 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
468 | if (PURPLE_IS_CONNECTION(gc)) { |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
469 | PurpleConnectionPrivate *priv; |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
470 | priv = purple_connection_get_instance_private(gc); |
| 34752 | 471 | priv->disconnect_timeout = 0; |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
472 | } |
|
27336
7b4e3682e5a1
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
473 | |
| 15884 | 474 | purple_account_disconnect(account); |
|
10742
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
475 | return FALSE; |
|
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
476 | } |
|
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
477 | |
|
5571
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
478 | void |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
32156
diff
changeset
|
479 | purple_connection_error (PurpleConnection *gc, |
|
35042
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
480 | PurpleConnectionError reason, |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
481 | const char *description) |
|
20430
bb30dff3da21
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <resiak@pidgin.im>
parents:
19897
diff
changeset
|
482 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
483 | PurpleConnectionPrivate *priv = NULL; |
| 15884 | 484 | PurpleConnectionUiOps *ops; |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
485 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
486 | g_return_if_fail(PURPLE_IS_CONNECTION(gc)); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
487 | priv = purple_connection_get_instance_private(gc); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
488 | |
| 21279 | 489 | /* This sanity check relies on PURPLE_CONNECTION_ERROR_OTHER_ERROR |
| 490 | * being the last member of the PurpleConnectionError enum in | |
| 491 | * connection.h; if other reasons are added after it, this check should | |
| 492 | * be updated. | |
|
21278
19f6ce8ee4ad
rlaager suggested using the last element of the PurpleDisconnectReason enum
Will Thompson <resiak@pidgin.im>
parents:
21154
diff
changeset
|
493 | */ |
| 21279 | 494 | 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
|
495 | purple_debug_error("connection", |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
32156
diff
changeset
|
496 | "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
|
497 | "valid reason\n", reason); |
| 21279 | 498 | 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
|
499 | } |
|
15848
44463a06e833
Change connection.c:gaim_connection_error() to still work even if the
Mark Doliner <markdoliner@pidgin.im>
parents:
15537
diff
changeset
|
500 | |
|
20430
bb30dff3da21
Create PurpleConnectionUiOps.report_disconnect_reason and
Will Thompson <resiak@pidgin.im>
parents:
19897
diff
changeset
|
501 | if (description == NULL) { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
32156
diff
changeset
|
502 | 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
|
503 | 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
|
504 | } |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
505 | |
| 6393 | 506 | /* If we've already got one error, we don't need any more */ |
|
35042
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
507 | if (purple_connection_get_error_info(gc)) |
| 6393 | 508 | return; |
| 509 | ||
| 34752 | 510 | 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
|
511 | |
|
28091
03d2cecdb234
Log the reason for disconnection to the debug log, so that we might
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27336
diff
changeset
|
512 | purple_debug_info("connection", "Connection error on %p (reason: %u description: %s)\n", |
|
03d2cecdb234
Log the reason for disconnection to the debug log, so that we might
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27336
diff
changeset
|
513 | gc, reason, description); |
|
03d2cecdb234
Log the reason for disconnection to the debug log, so that we might
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27336
diff
changeset
|
514 | |
| 15884 | 515 | ops = purple_connections_get_ui_ops(); |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
516 | |
|
32153
121f15699f88
Rename the report_disconnect_reason cb function to report_disconnect
Mark Doliner <markdoliner@pidgin.im>
parents:
32152
diff
changeset
|
517 | if (ops && ops->report_disconnect) |
|
121f15699f88
Rename the report_disconnect_reason cb function to report_disconnect
Mark Doliner <markdoliner@pidgin.im>
parents:
32152
diff
changeset
|
518 | ops->report_disconnect(gc, reason, description); |
| 5727 | 519 | |
|
35042
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
520 | priv->error_info = purple_connection_error_info_new(reason, description); |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
521 | |
|
21285
ca8cb8706802
I figured a signal firing on a connection error would be useful.
Will Thompson <resiak@pidgin.im>
parents:
21279
diff
changeset
|
522 | purple_signal_emit(purple_connections_get_handle(), "connection-error", |
|
ca8cb8706802
I figured a signal firing on a connection error would be useful.
Will Thompson <resiak@pidgin.im>
parents:
21279
diff
changeset
|
523 | gc, reason, description); |
| 5727 | 524 | |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38140
diff
changeset
|
525 | priv->disconnect_timeout = g_timeout_add(0, purple_connection_disconnect_cb, |
| 15884 | 526 | purple_connection_get_account(gc)); |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
527 | } |
|
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
528 | |
|
35042
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
529 | PurpleConnectionErrorInfo * |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
530 | purple_connection_get_error_info(PurpleConnection *gc) |
|
35042
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
531 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
532 | PurpleConnectionPrivate *priv = NULL; |
|
35042
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
533 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
534 | g_return_val_if_fail(PURPLE_IS_CONNECTION(gc), NULL); |
|
35042
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
535 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
536 | priv = purple_connection_get_instance_private(gc); |
|
35042
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
537 | return priv->error_info; |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
538 | } |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
539 | |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
540 | void |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
541 | purple_connection_ssl_error (PurpleConnection *gc, |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
542 | PurpleSslErrorType ssl_error) |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
543 | { |
| 21279 | 544 | PurpleConnectionError reason; |
|
40347
1d7bfb35d82f
Move SSL connection error codes in connection.h.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40339
diff
changeset
|
545 | const gchar *message; |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
546 | |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
547 | switch (ssl_error) { |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
548 | case PURPLE_SSL_HANDSHAKE_FAILED: |
|
40347
1d7bfb35d82f
Move SSL connection error codes in connection.h.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40339
diff
changeset
|
549 | message = _("SSL Handshake Failed"); |
|
22162
1e0f1dbe89da
Adjust some network error fatalities and things
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21865
diff
changeset
|
550 | reason = PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR; |
|
1e0f1dbe89da
Adjust some network error fatalities and things
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21865
diff
changeset
|
551 | break; |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
552 | case PURPLE_SSL_CONNECT_FAILED: |
|
40347
1d7bfb35d82f
Move SSL connection error codes in connection.h.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40339
diff
changeset
|
553 | message = _("SSL Connection Failed"); |
|
22162
1e0f1dbe89da
Adjust some network error fatalities and things
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21865
diff
changeset
|
554 | reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
555 | break; |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
556 | case PURPLE_SSL_CERTIFICATE_INVALID: |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
557 | /* TODO: maybe PURPLE_SSL_* should be more specific? */ |
|
40347
1d7bfb35d82f
Move SSL connection error codes in connection.h.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40339
diff
changeset
|
558 | message = _("SSL peer presented an invalid certificate"); |
|
22163
186613d5bc34
Huh, you want to be able to compile? I clearly (or not so clearly) need new
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22162
diff
changeset
|
559 | reason = PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR; |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
560 | break; |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
561 | default: |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
562 | g_assert_not_reached (); |
|
40347
1d7bfb35d82f
Move SSL connection error codes in connection.h.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40339
diff
changeset
|
563 | message = _("Unknown SSL error"); |
|
22163
186613d5bc34
Huh, you want to be able to compile? I clearly (or not so clearly) need new
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22162
diff
changeset
|
564 | reason = PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR; |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
565 | } |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
566 | |
|
40347
1d7bfb35d82f
Move SSL connection error codes in connection.h.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40339
diff
changeset
|
567 | purple_connection_error(gc, reason, message); |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
568 | } |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20442
diff
changeset
|
569 | |
|
37666
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
570 | void |
|
37958
e03cbceed96a
connection: Drop description argument from purple_connection_g_error()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37669
diff
changeset
|
571 | purple_connection_g_error(PurpleConnection *pc, 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
|
572 | { |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
573 | PurpleConnectionError reason; |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
574 | |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
575 | if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
576 | /* 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
|
577 | return; |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
578 | } |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
579 | |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
580 | if (error->domain == G_TLS_ERROR) { |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
581 | 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
|
582 | 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
|
583 | 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
|
584 | break; |
|
37666
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
585 | 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
|
586 | 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
|
587 | 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
|
588 | break; |
|
37666
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
589 | 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
|
590 | 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
|
591 | 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
|
592 | break; |
|
37666
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
593 | 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
|
594 | 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
|
595 | default: |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
596 | 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
|
597 | } |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
598 | } 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
|
599 | reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
|
37961
2ee4c67768f4
connection: Support PurpleConnectionError GErrors
Mike Ruprecht <cmaiku@gmail.com>
parents:
37959
diff
changeset
|
600 | } else if (error->domain == PURPLE_CONNECTION_ERROR) { |
|
2ee4c67768f4
connection: Support PurpleConnectionError GErrors
Mike Ruprecht <cmaiku@gmail.com>
parents:
37959
diff
changeset
|
601 | 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
|
602 | } else { |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
603 | 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
|
604 | } |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
605 | |
|
37958
e03cbceed96a
connection: Drop description argument from purple_connection_g_error()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37669
diff
changeset
|
606 | purple_connection_error(pc, 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
|
607 | } |
|
08ec2e6e0174
libpurple: Add purple_connection_g_error() to simplify handling G_IO_ERRORs
Mike Ruprecht <cmaiku@gmail.com>
parents:
37148
diff
changeset
|
608 | |
|
37959
e76677ed819c
connection: Add purple_connection_take_error()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37958
diff
changeset
|
609 | void |
|
e76677ed819c
connection: Add purple_connection_take_error()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37958
diff
changeset
|
610 | purple_connection_take_error(PurpleConnection *pc, GError *error) |
|
e76677ed819c
connection: Add purple_connection_take_error()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37958
diff
changeset
|
611 | { |
|
e76677ed819c
connection: Add purple_connection_take_error()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37958
diff
changeset
|
612 | purple_connection_g_error(pc, error); |
|
e76677ed819c
connection: Add purple_connection_take_error()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37958
diff
changeset
|
613 | g_error_free(error); |
|
e76677ed819c
connection: Add purple_connection_take_error()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37958
diff
changeset
|
614 | } |
|
e76677ed819c
connection: Add purple_connection_take_error()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37958
diff
changeset
|
615 | |
|
20431
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
616 | gboolean |
| 21279 | 617 | purple_connection_error_is_fatal (PurpleConnectionError reason) |
|
20431
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
618 | { |
|
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
619 | switch (reason) |
|
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
620 | { |
| 21279 | 621 | case PURPLE_CONNECTION_ERROR_NETWORK_ERROR: |
|
22162
1e0f1dbe89da
Adjust some network error fatalities and things
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21865
diff
changeset
|
622 | case PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR: |
|
21508
0ae51085309d
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <resiak@pidgin.im>
parents:
21507
diff
changeset
|
623 | return FALSE; |
|
0ae51085309d
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <resiak@pidgin.im>
parents:
21507
diff
changeset
|
624 | 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
|
625 | case PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED: |
| 21279 | 626 | 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
|
627 | 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
|
628 | 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
|
629 | case PURPLE_CONNECTION_ERROR_INVALID_SETTINGS: |
|
0ae51085309d
Consensus on #pidgin is that certificate errors and AUTHENTICATION_IMPOSSIBLE
Will Thompson <resiak@pidgin.im>
parents:
21507
diff
changeset
|
630 | case PURPLE_CONNECTION_ERROR_OTHER_ERROR: |
| 21279 | 631 | case PURPLE_CONNECTION_ERROR_CERT_NOT_PROVIDED: |
| 632 | case PURPLE_CONNECTION_ERROR_CERT_UNTRUSTED: | |
| 633 | case PURPLE_CONNECTION_ERROR_CERT_EXPIRED: | |
| 634 | case PURPLE_CONNECTION_ERROR_CERT_NOT_ACTIVATED: | |
| 635 | case PURPLE_CONNECTION_ERROR_CERT_HOSTNAME_MISMATCH: | |
| 636 | case PURPLE_CONNECTION_ERROR_CERT_FINGERPRINT_MISMATCH: | |
| 637 | case PURPLE_CONNECTION_ERROR_CERT_SELF_SIGNED: | |
| 638 | case PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR: | |
|
20431
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
639 | 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
|
640 | default: |
|
610a45545a40
datallah pointed out that using g_return_if_fail() is preferable to
Will Thompson <resiak@pidgin.im>
parents:
21149
diff
changeset
|
641 | 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
|
642 | } |
|
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
643 | } |
|
49979e453876
Create purple_connection_reason_is_fatal, which is basically a replacement for
Will Thompson <resiak@pidgin.im>
parents:
20430
diff
changeset
|
644 | |
|
32679
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
645 | void purple_connection_update_last_received(PurpleConnection *gc) |
|
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
646 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
647 | PurpleConnectionPrivate *priv = NULL; |
|
32679
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
648 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
649 | g_return_if_fail(PURPLE_IS_CONNECTION(gc)); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
650 | priv = purple_connection_get_instance_private(gc); |
| 34752 | 651 | |
|
39517
dd799b5d4e50
libpurple: Keepalive mechanism fixes
Petteri Pitkänen <petepitk@gmail.com>
parents:
39436
diff
changeset
|
652 | /* |
|
dd799b5d4e50
libpurple: Keepalive mechanism fixes
Petteri Pitkänen <petepitk@gmail.com>
parents:
39436
diff
changeset
|
653 | * 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
|
654 | * keepalive mechanism is inactive. |
|
dd799b5d4e50
libpurple: Keepalive mechanism fixes
Petteri Pitkänen <petepitk@gmail.com>
parents:
39436
diff
changeset
|
655 | */ |
|
dd799b5d4e50
libpurple: Keepalive mechanism fixes
Petteri Pitkänen <petepitk@gmail.com>
parents:
39436
diff
changeset
|
656 | 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
|
657 | /* 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
|
658 | * #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
|
659 | * 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
|
660 | * 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
|
661 | * 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
|
662 | */ |
|
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
|
663 | gint64 seconds_from_now = purple_protocol_server_iface_get_keepalive_interval(priv->protocol); |
|
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
|
664 | |
|
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
|
665 | g_source_set_ready_time( |
|
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
|
666 | priv->keepalive, |
|
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
|
667 | 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
|
668 | ); |
|
39517
dd799b5d4e50
libpurple: Keepalive mechanism fixes
Petteri Pitkänen <petepitk@gmail.com>
parents:
39436
diff
changeset
|
669 | } |
|
32679
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
670 | } |
|
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
671 | |
|
35042
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
672 | static PurpleConnectionErrorInfo * |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
673 | purple_connection_error_info_new(PurpleConnectionError type, |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
674 | const gchar *description) |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
675 | { |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
676 | PurpleConnectionErrorInfo *err; |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
677 | |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
678 | g_return_val_if_fail(description != NULL, NULL); |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
679 | |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
680 | err = g_new(PurpleConnectionErrorInfo, 1); |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
681 | |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
682 | err->type = type; |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
683 | err->description = g_strdup(description); |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
684 | |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
685 | return err; |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
686 | } |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
687 | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
688 | /************************************************************************** |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
689 | * GBoxed code |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
690 | **************************************************************************/ |
| 35572 | 691 | static PurpleConnectionUiOps * |
| 692 | purple_connection_ui_ops_copy(PurpleConnectionUiOps *ops) | |
| 693 | { | |
| 694 | PurpleConnectionUiOps *ops_new; | |
| 695 | ||
| 696 | g_return_val_if_fail(ops != NULL, NULL); | |
| 697 | ||
| 698 | ops_new = g_new(PurpleConnectionUiOps, 1); | |
| 699 | *ops_new = *ops; | |
| 700 | ||
| 701 | return ops_new; | |
| 702 | } | |
| 703 | ||
| 704 | GType | |
| 705 | purple_connection_ui_ops_get_type(void) | |
| 706 | { | |
| 707 | static GType type = 0; | |
| 708 | ||
| 709 | if (type == 0) { | |
| 710 | type = g_boxed_type_register_static("PurpleConnectionUiOps", | |
| 711 | (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
|
712 | (GBoxedFreeFunc)g_free); |
| 35572 | 713 | } |
| 714 | ||
| 715 | return type; | |
| 716 | } | |
| 717 | ||
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
718 | static PurpleConnectionErrorInfo * |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
719 | purple_connection_error_info_copy(PurpleConnectionErrorInfo *err) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
720 | { |
|
34787
d736bcb6c5a1
Check for NULL value in GBoxed functions
Ankit Vani <a@nevitus.org>
parents:
34786
diff
changeset
|
721 | g_return_val_if_fail(err != NULL, NULL); |
|
d736bcb6c5a1
Check for NULL value in GBoxed functions
Ankit Vani <a@nevitus.org>
parents:
34786
diff
changeset
|
722 | |
|
35042
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
723 | return purple_connection_error_info_new(err->type, err->description); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
724 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
725 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
726 | static void |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
727 | purple_connection_error_info_free(PurpleConnectionErrorInfo *err) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
728 | { |
|
34787
d736bcb6c5a1
Check for NULL value in GBoxed functions
Ankit Vani <a@nevitus.org>
parents:
34786
diff
changeset
|
729 | g_return_if_fail(err != NULL); |
|
d736bcb6c5a1
Check for NULL value in GBoxed functions
Ankit Vani <a@nevitus.org>
parents:
34786
diff
changeset
|
730 | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
731 | g_free(err->description); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
732 | g_free(err); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
733 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
734 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
735 | GType |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
736 | purple_connection_error_info_get_type(void) |
|
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 GType type = 0; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
739 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
740 | if (type == 0) { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
741 | type = g_boxed_type_register_static("PurpleConnectionErrorInfo", |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
742 | (GBoxedCopyFunc)purple_connection_error_info_copy, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
743 | (GBoxedFreeFunc)purple_connection_error_info_free); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
744 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
745 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
746 | return type; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
747 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
748 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
749 | /************************************************************************** |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
750 | * GObject code |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
751 | **************************************************************************/ |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
752 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
753 | /* Set method for GObject properties */ |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
754 | static void |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
755 | purple_connection_set_property(GObject *obj, guint param_id, const GValue *value, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
756 | GParamSpec *pspec) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
757 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
758 | PurpleConnection *gc = PURPLE_CONNECTION(obj); |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
759 | PurpleConnectionPrivate *priv = purple_connection_get_instance_private(gc); |
|
32679
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
760 | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
761 | switch (param_id) { |
|
36366
202c60d1300f
Refactored connection, conversation, conversationtypes to use the initial GObject plugin API
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
762 | case PROP_PROTOCOL: |
|
36549
735cd882faf7
Removed warnings from connection.c
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
763 | 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
|
764 | break; |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
765 | case PROP_FLAGS: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
766 | purple_connection_set_flags(gc, g_value_get_flags(value)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
767 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
768 | case PROP_STATE: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
769 | purple_connection_set_state(gc, g_value_get_enum(value)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
770 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
771 | case PROP_ACCOUNT: |
|
34985
f7ff90f6c9c6
Removed purple_connection_set_account()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
772 | priv->account = g_value_get_object(value); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
773 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
774 | case PROP_PASSWORD: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
775 | g_free(priv->password); |
|
39423
6b457e717666
Use g_value_dup_string where needed.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
776 | priv->password = g_value_dup_string(value); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
777 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
778 | case PROP_DISPLAY_NAME: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
779 | purple_connection_set_display_name(gc, g_value_get_string(value)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
780 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
781 | default: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
782 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
783 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
784 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
785 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
786 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
787 | /* Get method for GObject properties */ |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
788 | static void |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
789 | purple_connection_get_property(GObject *obj, guint param_id, GValue *value, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
790 | GParamSpec *pspec) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
791 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
792 | PurpleConnection *gc = PURPLE_CONNECTION(obj); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
793 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
794 | switch (param_id) { |
|
36366
202c60d1300f
Refactored connection, conversation, conversationtypes to use the initial GObject plugin API
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
795 | case PROP_PROTOCOL: |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36621
diff
changeset
|
796 | g_value_set_object(value, purple_connection_get_protocol(gc)); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
797 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
798 | case PROP_FLAGS: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
799 | g_value_set_flags(value, purple_connection_get_flags(gc)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
800 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
801 | case PROP_STATE: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
802 | g_value_set_enum(value, purple_connection_get_state(gc)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
803 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
804 | case PROP_ACCOUNT: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
805 | g_value_set_object(value, purple_connection_get_account(gc)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
806 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
807 | case PROP_PASSWORD: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
808 | g_value_set_string(value, purple_connection_get_password(gc)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
809 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
810 | case PROP_DISPLAY_NAME: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
811 | g_value_set_string(value, purple_connection_get_display_name(gc)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
812 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
813 | default: |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
814 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
815 | break; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
816 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
817 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
818 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
819 | /* GObject initialization function */ |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
820 | static void |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
821 | purple_connection_init(PurpleConnection *gc) |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
822 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
823 | purple_connection_set_state(gc, PURPLE_CONNECTION_CONNECTING); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
824 | connections = g_list_append(connections, gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
825 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
826 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
827 | /* Called when done constructing */ |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
828 | static void |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
829 | purple_connection_constructed(GObject *object) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
830 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
831 | PurpleConnection *gc = PURPLE_CONNECTION(object); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
832 | PurpleAccount *account; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
833 | |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
834 | G_OBJECT_CLASS(purple_connection_parent_class)->constructed(object); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
835 | |
|
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
|
836 | g_object_get(gc, "account", &account, NULL); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
837 | purple_account_set_connection(account, gc); |
|
34923
416a7736a401
Unref and free everything recieved from g_object_get
Ankit Vani <a@nevitus.org>
parents:
34904
diff
changeset
|
838 | g_object_unref(account); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
839 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
840 | purple_signal_emit(purple_connections_get_handle(), "signing-on", gc); |
|
32679
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
841 | } |
|
fd936a0b84f7
Add a purple_connection_update_last_received() function to update the
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
842 | |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34985
diff
changeset
|
843 | /* GObject finalize function */ |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
844 | static void |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34985
diff
changeset
|
845 | purple_connection_finalize(GObject *object) |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
846 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
847 | PurpleConnection *gc = PURPLE_CONNECTION(object); |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
848 | PurpleConnectionPrivate *priv = purple_connection_get_instance_private(gc); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
849 | PurpleAccount *account; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
850 | GSList *buddies; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
851 | gboolean remove = FALSE; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
852 | |
|
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
|
853 | priv->is_finalizing = TRUE; |
|
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
|
854 | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
855 | account = purple_connection_get_account(gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
856 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
857 | purple_debug_info("connection", "Disconnecting connection %p\n", gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
858 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
859 | if (purple_connection_get_state(gc) != PURPLE_CONNECTION_CONNECTING) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
860 | remove = TRUE; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
861 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
862 | purple_signal_emit(purple_connections_get_handle(), "signing-off", gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
863 | |
|
40052
cc03b5af25ea
Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents:
39863
diff
changeset
|
864 | g_slist_free_full(priv->active_chats, (GDestroyNotify)purple_chat_conversation_leave); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
865 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
866 | update_keepalive(gc, FALSE); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
867 | |
| 36855 | 868 | purple_protocol_class_close(priv->protocol, gc); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
869 | |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36626
diff
changeset
|
870 | /* Clear out the proto data that was freed in the protocol's close method */ |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
871 | buddies = purple_blist_find_buddies(account, NULL); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
872 | while (buddies != NULL) { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
873 | PurpleBuddy *buddy = buddies->data; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
874 | purple_buddy_set_protocol_data(buddy, NULL); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
875 | buddies = g_slist_delete_link(buddies, buddies); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
876 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
877 | |
| 35000 | 878 | purple_proxy_connect_cancel_with_handle(gc); |
| 879 | ||
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
880 | connections = g_list_remove(connections, gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
881 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
882 | purple_connection_set_state(gc, PURPLE_CONNECTION_DISCONNECTED); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
883 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
884 | if (remove) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
885 | purple_blist_remove_account(account); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
886 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
887 | purple_signal_emit(purple_connections_get_handle(), "signed-off", gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
888 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
889 | purple_account_request_close_with_account(account); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
890 | purple_request_close_with_handle(gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
891 | purple_notify_close_with_handle(gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
892 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
893 | purple_debug_info("connection", "Destroying connection %p\n", gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
894 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
895 | purple_account_set_connection(account, NULL); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
896 | |
|
35042
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
897 | if (priv->error_info) |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
898 | purple_connection_error_info_free(priv->error_info); |
|
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
899 | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
900 | if (priv->disconnect_timeout > 0) |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38140
diff
changeset
|
901 | g_source_remove(priv->disconnect_timeout); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
902 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
903 | purple_str_wipe(priv->password); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
904 | g_free(priv->display_name); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
905 | |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
906 | G_OBJECT_CLASS(purple_connection_parent_class)->finalize(object); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
907 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
908 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
909 | /* Class initializer function */ |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
910 | static void purple_connection_class_init(PurpleConnectionClass *klass) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
911 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
912 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
913 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
914 | obj_class->finalize = purple_connection_finalize; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
915 | obj_class->constructed = purple_connection_constructed; |
|
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 | /* Setup properties */ |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
918 | obj_class->get_property = purple_connection_get_property; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
919 | obj_class->set_property = purple_connection_set_property; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
920 | |
| 36959 | 921 | properties[PROP_PROTOCOL] = g_param_spec_object("protocol", "Protocol", |
| 36949 | 922 | "The protocol that the connection is using.", |
|
36549
735cd882faf7
Removed warnings from connection.c
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
923 | PURPLE_TYPE_PROTOCOL, |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
924 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
925 | G_PARAM_STATIC_STRINGS); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
926 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
927 | properties[PROP_FLAGS] = g_param_spec_flags("flags", "Connection flags", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35048
diff
changeset
|
928 | "The flags of the connection.", |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
929 | PURPLE_TYPE_CONNECTION_FLAGS, 0, |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
930 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
931 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
932 | properties[PROP_STATE] = g_param_spec_enum("state", "Connection state", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35048
diff
changeset
|
933 | "The current state of the connection.", |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
934 | PURPLE_TYPE_CONNECTION_STATE, PURPLE_CONNECTION_DISCONNECTED, |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
935 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
936 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
937 | properties[PROP_ACCOUNT] = g_param_spec_object("account", "Account", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35048
diff
changeset
|
938 | "The account using the connection.", PURPLE_TYPE_ACCOUNT, |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
939 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
940 | G_PARAM_STATIC_STRINGS); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
941 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
942 | properties[PROP_PASSWORD] = g_param_spec_string("password", "Password", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35048
diff
changeset
|
943 | "The password used for connection.", NULL, |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
944 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
945 | G_PARAM_STATIC_STRINGS); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
946 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
947 | properties[PROP_DISPLAY_NAME] = g_param_spec_string("display-name", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
948 | "Display name", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
949 | "Your name that appears to other people.", NULL, |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
950 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
951 | |
|
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
|
952 | 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
|
953 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
954 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
955 | void |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
956 | _purple_connection_new(PurpleAccount *account, gboolean regist, const char *password) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
957 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
958 | PurpleConnection *gc; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36477
diff
changeset
|
959 | PurpleProtocol *protocol; |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
960 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34967
diff
changeset
|
961 | g_return_if_fail(PURPLE_IS_ACCOUNT(account)); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
962 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
963 | if (!purple_account_is_disconnected(account)) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
964 | return; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
965 | |
|
36626
18fc361b3704
Renamed purple_find_protocol_info to purple_protocols_find
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
966 | protocol = purple_protocols_find(purple_account_get_protocol_id(account)); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
967 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36477
diff
changeset
|
968 | if (protocol == NULL) { |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
969 | gchar *message; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
970 | |
|
36691
92122af1f083
Some documentation updates with regard to 'protocol plugins' and 'protocols'
Ankit Vani <a@nevitus.org>
parents:
36688
diff
changeset
|
971 | message = g_strdup_printf(_("Missing protocol for %s"), |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
972 | purple_account_get_username(account)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
973 | purple_notify_error(NULL, regist ? _("Registration Error") : |
| 34955 | 974 | _("Connection Error"), message, NULL, |
| 975 | purple_request_cpar_from_account(account)); | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
976 | g_free(message); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
977 | return; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
978 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
979 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
980 | if (regist) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
981 | { |
|
39759
ea1401483849
Rename *_GET_*_IFACE to more standard *_GET_IFACE.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39659
diff
changeset
|
982 | if (!PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER, register_user)) |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
983 | return; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
984 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
985 | else |
|
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 | if (((password == NULL) || (*password == '\0')) && |
|
36607
7ad7681dcfd8
Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
988 | !(purple_protocol_get_options(protocol) & OPT_PROTO_NO_PASSWORD) && |
|
7ad7681dcfd8
Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
989 | !(purple_protocol_get_options(protocol) & OPT_PROTO_PASSWORD_OPTIONAL)) |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
990 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
991 | purple_debug_error("connection", "Cannot connect to account %s without " |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
992 | "a password.\n", purple_account_get_username(account)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
993 | return; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
994 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
995 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
996 | |
|
40339
54813fd13c13
Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40195
diff
changeset
|
997 | if(PURPLE_IS_PROTOCOL_FACTORY(protocol)) { |
|
54813fd13c13
Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40195
diff
changeset
|
998 | gc = purple_protocol_factory_connection_new( |
|
54813fd13c13
Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40195
diff
changeset
|
999 | PURPLE_PROTOCOL_FACTORY(protocol), account, password); |
|
54813fd13c13
Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40195
diff
changeset
|
1000 | } else { |
|
36728
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36720
diff
changeset
|
1001 | gc = g_object_new(PURPLE_TYPE_CONNECTION, |
| 36872 | 1002 | "protocol", protocol, |
| 1003 | "account", account, | |
| 1004 | "password", password, | |
|
36728
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36720
diff
changeset
|
1005 | NULL); |
|
40339
54813fd13c13
Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40195
diff
changeset
|
1006 | } |
|
36728
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36720
diff
changeset
|
1007 | |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36720
diff
changeset
|
1008 | g_return_if_fail(gc != NULL); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1009 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1010 | if (regist) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1011 | { |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
1012 | PurpleConnectionPrivate *priv; |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1013 | purple_debug_info("connection", "Registering. gc = %p\n", gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1014 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1015 | /* set this so we don't auto-reconnect after registering */ |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
1016 | priv = purple_connection_get_instance_private(gc); |
|
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
1017 | priv->wants_to_die = TRUE; |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1018 | |
| 36719 | 1019 | purple_protocol_server_iface_register_user(protocol, account); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1020 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1021 | else |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1022 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1023 | purple_debug_info("connection", "Connecting. gc = %p\n", gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1024 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1025 | purple_signal_emit(purple_accounts_get_handle(), "account-connecting", account); |
| 36719 | 1026 | purple_protocol_class_login(protocol, account); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1027 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1028 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1029 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1030 | void |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1031 | _purple_connection_new_unregister(PurpleAccount *account, const char *password, |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1032 | PurpleAccountUnregistrationCb cb, void *user_data) |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1033 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1034 | /* Lots of copy/pasted code to avoid API changes. You might want to integrate that into the previous function when posssible. */ |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1035 | PurpleConnection *gc; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36477
diff
changeset
|
1036 | PurpleProtocol *protocol; |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1037 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34967
diff
changeset
|
1038 | g_return_if_fail(PURPLE_IS_ACCOUNT(account)); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1039 | |
|
36626
18fc361b3704
Renamed purple_find_protocol_info to purple_protocols_find
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
1040 | protocol = purple_protocols_find(purple_account_get_protocol_id(account)); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1041 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36477
diff
changeset
|
1042 | if (protocol == NULL) { |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1043 | gchar *message; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1044 | |
|
36691
92122af1f083
Some documentation updates with regard to 'protocol plugins' and 'protocols'
Ankit Vani <a@nevitus.org>
parents:
36688
diff
changeset
|
1045 | message = g_strdup_printf(_("Missing protocol for %s"), |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1046 | purple_account_get_username(account)); |
| 34955 | 1047 | purple_notify_error(NULL, _("Unregistration Error"), message, |
| 1048 | NULL, purple_request_cpar_from_account(account)); | |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1049 | g_free(message); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1050 | return; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1051 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1052 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1053 | if (!purple_account_is_disconnected(account)) { |
| 36719 | 1054 | purple_protocol_server_iface_unregister_user(protocol, account, cb, user_data); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1055 | return; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1056 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1057 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1058 | if (((password == NULL) || (*password == '\0')) && |
|
36607
7ad7681dcfd8
Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
1059 | !(purple_protocol_get_options(protocol) & OPT_PROTO_NO_PASSWORD) && |
|
7ad7681dcfd8
Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
1060 | !(purple_protocol_get_options(protocol) & OPT_PROTO_PASSWORD_OPTIONAL)) |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1061 | { |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1062 | purple_debug_error("connection", "Cannot connect to account %s without " |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1063 | "a password.\n", purple_account_get_username(account)); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1064 | return; |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1065 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1066 | |
|
40339
54813fd13c13
Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40195
diff
changeset
|
1067 | if(PURPLE_IS_PROTOCOL_FACTORY(protocol)) { |
|
54813fd13c13
Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40195
diff
changeset
|
1068 | gc = purple_protocol_factory_connection_new( |
|
54813fd13c13
Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40195
diff
changeset
|
1069 | PURPLE_PROTOCOL_FACTORY(protocol), account, password); |
|
54813fd13c13
Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40195
diff
changeset
|
1070 | } else { |
|
36728
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36720
diff
changeset
|
1071 | gc = g_object_new(PURPLE_TYPE_CONNECTION, |
| 36872 | 1072 | "protocol", protocol, |
| 1073 | "account", account, | |
| 1074 | "password", password, | |
|
36728
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36720
diff
changeset
|
1075 | NULL); |
|
40339
54813fd13c13
Pull PurpleProtocolFactory out to it's own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40195
diff
changeset
|
1076 | } |
|
36728
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36720
diff
changeset
|
1077 | |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36720
diff
changeset
|
1078 | g_return_if_fail(gc != NULL); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1079 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1080 | purple_debug_info("connection", "Unregistering. gc = %p\n", gc); |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1081 | |
| 36719 | 1082 | purple_protocol_server_iface_unregister_user(protocol, account, cb, user_data); |
|
34753
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1083 | } |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1084 | |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1085 | /************************************************************************** |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1086 | * Connections API |
|
b2c73469c1be
GObjectified the PurpleConnection source
Ankit Vani <a@nevitus.org>
parents:
34752
diff
changeset
|
1087 | **************************************************************************/ |
|
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
|
1088 | |
|
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36067
diff
changeset
|
1089 | void |
|
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36067
diff
changeset
|
1090 | _purple_assert_connection_is_valid(PurpleConnection *gc, |
|
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36067
diff
changeset
|
1091 | const gchar *file, int line) |
|
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36067
diff
changeset
|
1092 | { |
|
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36067
diff
changeset
|
1093 | if (gc && g_list_find(purple_connections_get_all(), gc)) |
|
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36067
diff
changeset
|
1094 | return; |
|
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36067
diff
changeset
|
1095 | |
|
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36067
diff
changeset
|
1096 | 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
|
1097 | " failed at %s:%d", gc, file, line); |
|
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36067
diff
changeset
|
1098 | 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
|
1099 | } |
|
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36067
diff
changeset
|
1100 | |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
1101 | void |
| 15884 | 1102 | purple_connections_disconnect_all(void) |
| 5563 | 1103 | { |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
1104 | GList *l; |
| 15884 | 1105 | PurpleConnection *gc; |
| 34752 | 1106 | PurpleConnectionPrivate *priv; |
| 5563 | 1107 | |
| 15884 | 1108 | while ((l = purple_connections_get_all()) != NULL) { |
|
6113
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6111
diff
changeset
|
1109 | gc = l->data; |
|
39433
f033955d125a
Use G_DEFINE_TYPE_WITH_PRIVATE for PurpleConnection.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
1110 | priv = purple_connection_get_instance_private(gc); |
| 34752 | 1111 | priv->wants_to_die = TRUE; |
| 1112 | purple_account_disconnect(priv->account); | |
|
6113
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6111
diff
changeset
|
1113 | } |
| 5563 | 1114 | } |
| 1115 | ||
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
1116 | GList * |
| 15884 | 1117 | purple_connections_get_all(void) |
| 5563 | 1118 | { |
| 1119 | return connections; | |
| 1120 | } | |
| 1121 | ||
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
1122 | GList * |
| 15884 | 1123 | purple_connections_get_connecting(void) |
|
5788
dd6e33a59151
[gaim-migrate @ 6213]
Christian Hammond <chipx86@chipx86.com>
parents:
5784
diff
changeset
|
1124 | { |
|
dd6e33a59151
[gaim-migrate @ 6213]
Christian Hammond <chipx86@chipx86.com>
parents:
5784
diff
changeset
|
1125 | return connections_connecting; |
|
dd6e33a59151
[gaim-migrate @ 6213]
Christian Hammond <chipx86@chipx86.com>
parents:
5784
diff
changeset
|
1126 | } |
|
dd6e33a59151
[gaim-migrate @ 6213]
Christian Hammond <chipx86@chipx86.com>
parents:
5784
diff
changeset
|
1127 | |
| 5563 | 1128 | void |
| 15884 | 1129 | purple_connections_set_ui_ops(PurpleConnectionUiOps *ops) |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1130 | { |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1131 | connection_ui_ops = ops; |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1132 | } |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1133 | |
| 15884 | 1134 | PurpleConnectionUiOps * |
| 1135 | purple_connections_get_ui_ops(void) | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1136 | { |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1137 | return connection_ui_ops; |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1138 | } |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1139 | |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1140 | void |
| 15884 | 1141 | purple_connections_init(void) |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1142 | { |
| 15884 | 1143 | void *handle = purple_connections_get_handle(); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1144 | |
| 15884 | 1145 | 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
|
1146 | 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
|
1147 | PURPLE_TYPE_CONNECTION); |
|
6564
a7a2c1927544
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6533
diff
changeset
|
1148 | |
| 15884 | 1149 | 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
|
1150 | 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
|
1151 | PURPLE_TYPE_CONNECTION); |
|
6564
a7a2c1927544
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6533
diff
changeset
|
1152 | |
| 15884 | 1153 | 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
|
1154 | 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
|
1155 | PURPLE_TYPE_CONNECTION); |
|
6564
a7a2c1927544
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6533
diff
changeset
|
1156 | |
| 15884 | 1157 | 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
|
1158 | 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
|
1159 | 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
|
1160 | |
|
ca8cb8706802
I figured a signal firing on a connection error would be useful.
Will Thompson <resiak@pidgin.im>
parents:
21279
diff
changeset
|
1161 | 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
|
1162 | 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
|
1163 | 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
|
1164 | 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
|
1165 | |
|
30039
9cd7672bae4f
Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents:
28577
diff
changeset
|
1166 | 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
|
1167 | 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
|
1168 | PURPLE_TYPE_CONNECTION); |
|
30039
9cd7672bae4f
Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents:
28577
diff
changeset
|
1169 | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1170 | } |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1171 | |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1172 | void |
| 15884 | 1173 | purple_connections_uninit(void) |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1174 | { |
| 15884 | 1175 | purple_signals_unregister_by_instance(purple_connections_get_handle()); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1176 | } |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1177 | |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1178 | void * |
| 15884 | 1179 | purple_connections_get_handle(void) |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1180 | { |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1181 | return &connections_handle; |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6468
diff
changeset
|
1182 | } |