Thu, 20 Jul 2006 08:11:54 +0000
[gaim-migrate @ 16525]
A bunch of little things
* Use GAIM_CONNECTION_IS_VALID(gc) in a lot of places where
we were doing g_list_find(gaim_connections_get_all(), gc)
* Get rid of a lot of places where we were doing
g_list_find(gaim_connections_get_all(), gc). The handle used
by the request API ensures that the ok and cancel callback
functions won't be called if the gc is destroyed. However,
GAIM_CONNECTION_IS_VALID(gc) is still very important for
callback functions where we can't cancel the request.
For example, gaim_proxy_connect() callback functions.
* "Added" a function to Yahoo! that should help us notice
when our buddies change their buddy icon/display picture
* Some comments in a few places
* Changed GAIM_CONNECTION_IS_VALID(gc) to only look through
the list of "all" connections and not the list of
"connecting" connections. Some time ago we changed how
this was done so that the list of "all" connections now
includes the "connection" connections.
| 5563 | 1 | /** |
| 2 | * @file connection.h Connection API | |
| 3 | * @ingroup core | |
| 4 | * | |
| 5 | * gaim | |
| 6 | * | |
| 8046 | 7 | * Gaim is the legal property of its developers, whose names are too numerous |
| 8 | * to list here. Please refer to the COPYRIGHT file distributed with this | |
| 9 | * source distribution. | |
|
6460
fc288e7221ca
[gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents:
6393
diff
changeset
|
10 | * |
| 5563 | 11 | * This program is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by | |
| 13 | * the Free Software Foundation; either version 2 of the License, or | |
| 14 | * (at your option) any later version. | |
| 15 | * | |
| 16 | * This program is distributed in the hope that it will be useful, | |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 19 | * GNU General Public License for more details. | |
| 20 | * | |
| 21 | * You should have received a copy of the GNU General Public License | |
| 22 | * along with this program; if not, write to the Free Software | |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
|
6724
e1d416a4a4bc
[gaim-migrate @ 7251]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
24 | * |
|
e1d416a4a4bc
[gaim-migrate @ 7251]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
25 | * @see @ref connection-signals |
| 5563 | 26 | */ |
| 27 | #ifndef _GAIM_CONNECTION_H_ | |
| 28 | #define _GAIM_CONNECTION_H_ | |
| 29 | ||
| 30 | typedef struct _GaimConnection GaimConnection; | |
| 31 | ||
|
6622
277eb0b14653
[gaim-migrate @ 7146]
Robert McQueen <robot101@debian.org>
parents:
6605
diff
changeset
|
32 | /** |
|
277eb0b14653
[gaim-migrate @ 7146]
Robert McQueen <robot101@debian.org>
parents:
6605
diff
changeset
|
33 | * Flags to change behavior of the client for a given connection. |
|
277eb0b14653
[gaim-migrate @ 7146]
Robert McQueen <robot101@debian.org>
parents:
6605
diff
changeset
|
34 | */ |
|
277eb0b14653
[gaim-migrate @ 7146]
Robert McQueen <robot101@debian.org>
parents:
6605
diff
changeset
|
35 | typedef enum |
|
277eb0b14653
[gaim-migrate @ 7146]
Robert McQueen <robot101@debian.org>
parents:
6605
diff
changeset
|
36 | { |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6724
diff
changeset
|
37 | GAIM_CONNECTION_HTML = 0x0001, /**< Connection sends/receives in 'HTML'. */ |
|
8735
01248ea222d3
[gaim-migrate @ 9490]
Jonathan Champ <royanee@users.sourceforge.net>
parents:
8691
diff
changeset
|
38 | GAIM_CONNECTION_NO_BGCOLOR = 0x0002, /**< Connection does not send/receive |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6724
diff
changeset
|
39 | background colors. */ |
| 8677 | 40 | GAIM_CONNECTION_AUTO_RESP = 0x0004, /**< Send auto responses when away. */ |
| 41 | GAIM_CONNECTION_FORMATTING_WBFO = 0x0008, /**< The text buffer must be formatted as a whole */ | |
| 8691 | 42 | GAIM_CONNECTION_NO_NEWLINES = 0x0010, /**< No new lines are allowed in outgoing messages */ |
| 9041 | 43 | GAIM_CONNECTION_NO_FONTSIZE = 0x0020, /**< Connection does not send/receive font sizes */ |
| 10665 | 44 | GAIM_CONNECTION_NO_URLDESC = 0x0040, /**< Connection does not support descriptions with links */ |
| 45 | GAIM_CONNECTION_NO_IMAGES = 0x0080, /**< Connection does not support sending of images */ | |
|
10008
1de3454a0dca
[gaim-migrate @ 10925]
Mark Doliner <markdoliner@pidgin.im>
parents:
9981
diff
changeset
|
46 | |
|
6622
277eb0b14653
[gaim-migrate @ 7146]
Robert McQueen <robot101@debian.org>
parents:
6605
diff
changeset
|
47 | } GaimConnectionFlags; |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5733
diff
changeset
|
48 | |
| 5563 | 49 | typedef enum |
| 50 | { | |
| 51 | GAIM_DISCONNECTED = 0, /**< Disconnected. */ | |
| 52 | GAIM_CONNECTED, /**< Connected. */ | |
| 53 | GAIM_CONNECTING /**< Connecting. */ | |
| 54 | ||
| 55 | } GaimConnectionState; | |
| 56 | ||
|
10021
5aa380278a15
[gaim-migrate @ 10946]
Mark Doliner <markdoliner@pidgin.im>
parents:
10008
diff
changeset
|
57 | #include <time.h> |
|
5aa380278a15
[gaim-migrate @ 10946]
Mark Doliner <markdoliner@pidgin.im>
parents:
10008
diff
changeset
|
58 | |
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
59 | #include "account.h" |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
60 | #include "plugin.h" |
| 10400 | 61 | #include "status.h" |
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
62 | |
| 5563 | 63 | typedef struct |
| 64 | { | |
| 65 | void (*connect_progress)(GaimConnection *gc, const char *text, | |
| 66 | size_t step, size_t step_count); | |
| 67 | void (*connected)(GaimConnection *gc); | |
|
6460
fc288e7221ca
[gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents:
6393
diff
changeset
|
68 | void (*disconnected)(GaimConnection *gc); |
|
5571
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
69 | void (*notice)(GaimConnection *gc, const char *text); |
|
6460
fc288e7221ca
[gaim-migrate @ 6969]
Christian Hammond <chipx86@chipx86.com>
parents:
6393
diff
changeset
|
70 | void (*report_disconnect)(GaimConnection *gc, const char *text); |
| 5563 | 71 | |
| 72 | } GaimConnectionUiOps; | |
| 73 | ||
| 74 | struct _GaimConnection | |
| 75 | { | |
| 76 | GaimPlugin *prpl; /**< The protocol plugin. */ | |
|
6622
277eb0b14653
[gaim-migrate @ 7146]
Robert McQueen <robot101@debian.org>
parents:
6605
diff
changeset
|
77 | GaimConnectionFlags flags; /**< Connection flags. */ |
| 5563 | 78 | |
| 79 | GaimConnectionState state; /**< The connection state. */ | |
| 80 | ||
| 81 | GaimAccount *account; /**< The account being connected to. */ | |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
82 | char *password; /**< The password used. */ |
| 5563 | 83 | int inpa; /**< The input watcher. */ |
| 84 | ||
| 85 | GSList *buddy_chats; /**< A list of active chats. */ | |
| 86 | void *proto_data; /**< Protocol-specific data. */ | |
| 87 | ||
| 88 | char *display_name; /**< The name displayed. */ | |
|
10745
04039e970a30
[gaim-migrate @ 12347]
Mark Doliner <markdoliner@pidgin.im>
parents:
10742
diff
changeset
|
89 | guint keepalive; /**< Keep-alive. */ |
| 5563 | 90 | |
| 91 | ||
| 92 | gboolean is_auto_away; /**< Whether or not it's auto-away. */ | |
| 93 | ||
|
8430
13694e7d1aaa
[gaim-migrate @ 9160]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
94 | gboolean wants_to_die; /**< Wants to Die state. This is set |
|
10272
29aff2eb9290
[gaim-migrate @ 11421]
Mark Doliner <markdoliner@pidgin.im>
parents:
10021
diff
changeset
|
95 | when the user chooses to log out, |
|
8430
13694e7d1aaa
[gaim-migrate @ 9160]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
96 | or when the protocol is |
|
13694e7d1aaa
[gaim-migrate @ 9160]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
97 | disconnected and should not be |
|
13694e7d1aaa
[gaim-migrate @ 9160]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
98 | automatically reconnected |
|
13694e7d1aaa
[gaim-migrate @ 9160]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
99 | (incorrect password, etc.) */ |
| 6393 | 100 | guint disconnect_timeout; /**< Timer used for nasty stack tricks */ |
| 5563 | 101 | }; |
| 102 | ||
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
103 | #ifdef __cplusplus |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
104 | extern "C" { |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
105 | #endif |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
106 | |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
107 | /**************************************************************************/ |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
108 | /** @name Connection API */ |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
109 | /**************************************************************************/ |
|
6488
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
110 | /*@{*/ |
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
111 | |
| 5563 | 112 | /** |
|
10742
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
113 | * This function should only be called by gaim_account_connect() |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
114 | * in account.c. If you're trying to sign on an account, use that |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
115 | * function instead. |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
116 | * |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
117 | * Creates a connection to the specified account and either connects |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
118 | * or attempts to register a new account. If you are logging in, |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
119 | * the connection uses the current active status for this account. |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
120 | * So if you want to sign on as "away," for example, you need to |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
121 | * have called gaim_account_set_status(account, "away"). |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
122 | * (And this will call gaim_account_connect() automatically). |
| 5563 | 123 | * |
|
10758
b4554ec8d126
[gaim-migrate @ 12361]
Mark Doliner <markdoliner@pidgin.im>
parents:
10745
diff
changeset
|
124 | * @param account The account the connection should be connecting to. |
|
b4554ec8d126
[gaim-migrate @ 12361]
Mark Doliner <markdoliner@pidgin.im>
parents:
10745
diff
changeset
|
125 | * @param regist Whether we are registering a new account or just |
|
b4554ec8d126
[gaim-migrate @ 12361]
Mark Doliner <markdoliner@pidgin.im>
parents:
10745
diff
changeset
|
126 | * trying to do a normal signon. |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
127 | * @param password The password to use. |
| 5563 | 128 | */ |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
129 | void gaim_connection_new(GaimAccount *account, gboolean regist, |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
130 | const char *password); |
| 5563 | 131 | |
| 132 | /** | |
|
13976
2543396bd00e
[gaim-migrate @ 16414]
Mark Doliner <markdoliner@pidgin.im>
parents:
12272
diff
changeset
|
133 | * Disconnects and destroys a GaimConnection. |
|
2543396bd00e
[gaim-migrate @ 16414]
Mark Doliner <markdoliner@pidgin.im>
parents:
12272
diff
changeset
|
134 | * |
|
10742
2783135f0ecf
[gaim-migrate @ 12344]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
135 | * This function should only be called by gaim_account_disconnect() |
|
13976
2543396bd00e
[gaim-migrate @ 16414]
Mark Doliner <markdoliner@pidgin.im>
parents:
12272
diff
changeset
|
136 | * in account.c. If you're trying to sign off an account, use that |
|
10738
63ca8277c234
[gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents:
10665
diff
changeset
|
137 | * function instead. |
|
63ca8277c234
[gaim-migrate @ 12340]
Mark Doliner <markdoliner@pidgin.im>
parents:
10665
diff
changeset
|
138 | * |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
139 | * @param gc The gaim connection to destroy. |
| 5563 | 140 | */ |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
141 | void gaim_connection_destroy(GaimConnection *gc); |
| 6581 | 142 | |
| 143 | /** | |
|
11718
90804d019837
[gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents:
10758
diff
changeset
|
144 | * Sets the connection state. PRPLs should call this and pass in |
|
90804d019837
[gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents:
10758
diff
changeset
|
145 | * the state "GAIM_CONNECTED" when the account is completely |
|
90804d019837
[gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents:
10758
diff
changeset
|
146 | * signed on. What does it mean to be completely signed on? If |
|
90804d019837
[gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents:
10758
diff
changeset
|
147 | * the core can call prpl->set_status, and it successfully changes |
|
90804d019837
[gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents:
10758
diff
changeset
|
148 | * your status, then the account is online. |
| 5563 | 149 | * |
| 150 | * @param gc The connection. | |
| 151 | * @param state The connection state. | |
| 152 | */ | |
| 153 | void gaim_connection_set_state(GaimConnection *gc, GaimConnectionState state); | |
| 154 | ||
| 155 | /** | |
| 156 | * Sets the connection's account. | |
| 157 | * | |
| 158 | * @param gc The connection. | |
| 159 | * @param account The account. | |
| 160 | */ | |
| 161 | void gaim_connection_set_account(GaimConnection *gc, GaimAccount *account); | |
| 162 | ||
| 163 | /** | |
| 164 | * Sets the connection's displayed name. | |
| 165 | * | |
| 166 | * @param gc The connection. | |
| 167 | * @param name The displayed name. | |
| 168 | */ | |
| 169 | void gaim_connection_set_display_name(GaimConnection *gc, const char *name); | |
| 170 | ||
| 171 | /** | |
| 172 | * Returns the connection state. | |
| 173 | * | |
| 174 | * @param gc The connection. | |
| 175 | * | |
| 176 | * @return The connection state. | |
| 177 | */ | |
| 178 | GaimConnectionState gaim_connection_get_state(const GaimConnection *gc); | |
| 179 | ||
| 180 | /** | |
|
9019
b9a333b36763
[gaim-migrate @ 9795]
Mark Doliner <markdoliner@pidgin.im>
parents:
8735
diff
changeset
|
181 | * Returns TRUE if the account is connected, otherwise returns FALSE. |
|
b9a333b36763
[gaim-migrate @ 9795]
Mark Doliner <markdoliner@pidgin.im>
parents:
8735
diff
changeset
|
182 | * |
|
b9a333b36763
[gaim-migrate @ 9795]
Mark Doliner <markdoliner@pidgin.im>
parents:
8735
diff
changeset
|
183 | * @return TRUE if the account is connected, otherwise returns FALSE. |
|
b9a333b36763
[gaim-migrate @ 9795]
Mark Doliner <markdoliner@pidgin.im>
parents:
8735
diff
changeset
|
184 | */ |
|
b9a333b36763
[gaim-migrate @ 9795]
Mark Doliner <markdoliner@pidgin.im>
parents:
8735
diff
changeset
|
185 | #define GAIM_CONNECTION_IS_CONNECTED(gc) \ |
|
b9a333b36763
[gaim-migrate @ 9795]
Mark Doliner <markdoliner@pidgin.im>
parents:
8735
diff
changeset
|
186 | (gc->state == GAIM_CONNECTED) |
|
b9a333b36763
[gaim-migrate @ 9795]
Mark Doliner <markdoliner@pidgin.im>
parents:
8735
diff
changeset
|
187 | |
|
b9a333b36763
[gaim-migrate @ 9795]
Mark Doliner <markdoliner@pidgin.im>
parents:
8735
diff
changeset
|
188 | /** |
| 5563 | 189 | * Returns the connection's account. |
| 190 | * | |
| 191 | * @param gc The connection. | |
| 192 | * | |
| 193 | * @return The connection's account. | |
| 194 | */ | |
| 195 | GaimAccount *gaim_connection_get_account(const GaimConnection *gc); | |
| 196 | ||
| 197 | /** | |
|
10740
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
198 | * Returns the connection's password. |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
199 | * |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
200 | * @param gc The connection. |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
201 | * |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
202 | * @return The connection's password. |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
203 | */ |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
204 | const char *gaim_connection_get_password(const GaimConnection *gc); |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
205 | |
|
a1cb6b819a21
[gaim-migrate @ 12342]
Mark Doliner <markdoliner@pidgin.im>
parents:
10738
diff
changeset
|
206 | /** |
| 5563 | 207 | * Returns the connection's displayed name. |
| 208 | * | |
| 209 | * @param gc The connection. | |
| 210 | * | |
| 211 | * @return The connection's displayed name. | |
| 212 | */ | |
| 213 | const char *gaim_connection_get_display_name(const GaimConnection *gc); | |
| 214 | ||
| 215 | /** | |
| 216 | * Updates the connection progress. | |
| 217 | * | |
| 218 | * @param gc The connection. | |
| 219 | * @param text Information on the current step. | |
| 220 | * @param step The current step. | |
| 221 | * @param count The total number of steps. | |
| 222 | */ | |
| 223 | void gaim_connection_update_progress(GaimConnection *gc, const char *text, | |
| 224 | size_t step, size_t count); | |
| 225 | ||
| 226 | /** | |
|
5571
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
227 | * Displays a connection-specific notice. |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
228 | * |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
229 | * @param gc The connection. |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
230 | * @param text The notice text. |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
231 | */ |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
232 | void gaim_connection_notice(GaimConnection *gc, const char *text); |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
233 | |
|
b709464f507e
[gaim-migrate @ 5973]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
234 | /** |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
235 | * Closes a connection with an error. |
|
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
236 | * |
|
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
237 | * @param gc The connection. |
|
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
238 | * @param reason The error text. |
|
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
239 | */ |
|
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
240 | void gaim_connection_error(GaimConnection *gc, const char *reason); |
|
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
241 | |
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
242 | /*@}*/ |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
243 | |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
244 | /**************************************************************************/ |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
245 | /** @name Connections API */ |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
246 | /**************************************************************************/ |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
247 | /*@{*/ |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
248 | |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
249 | /** |
| 5563 | 250 | * Disconnects from all connections. |
| 251 | */ | |
| 252 | void gaim_connections_disconnect_all(void); | |
| 253 | ||
| 254 | /** | |
|
10352
802e7ab5b838
[gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents:
10272
diff
changeset
|
255 | * Returns a list of all active connections. This does not |
|
802e7ab5b838
[gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents:
10272
diff
changeset
|
256 | * include connections that are in the process of connecting. |
| 5563 | 257 | * |
| 258 | * @return A list of all active connections. | |
| 259 | */ | |
| 260 | GList *gaim_connections_get_all(void); | |
| 261 | ||
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
262 | /** |
|
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
263 | * Returns a list of all connections in the process of connecting. |
|
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
264 | * |
|
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
265 | * @return A list of connecting connections. |
|
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
266 | */ |
|
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
267 | GList *gaim_connections_get_connecting(void); |
|
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
268 | |
| 9221 | 269 | /** |
| 270 | * Checks if gc is still a valid pointer to a gc. | |
| 271 | * | |
| 272 | * @return @c TRUE if gc is valid. | |
| 273 | */ | |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13976
diff
changeset
|
274 | #define GAIM_CONNECTION_IS_VALID(gc) (g_list_find(gaim_connections_get_all(), (gc))) |
| 9221 | 275 | |
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
276 | /*@}*/ |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
277 | |
| 5563 | 278 | /**************************************************************************/ |
|
7122
5f40c16a4ae4
[gaim-migrate @ 7689]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
279 | /** @name UI Registration Functions */ |
| 5563 | 280 | /**************************************************************************/ |
| 281 | /*@{*/ | |
| 282 | ||
| 283 | /** | |
| 284 | * Sets the UI operations structure to be used for connections. | |
| 285 | * | |
| 286 | * @param ops The UI operations structure. | |
| 287 | */ | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
288 | void gaim_connections_set_ui_ops(GaimConnectionUiOps *ops); |
| 5563 | 289 | |
| 290 | /** | |
| 291 | * Returns the UI operations structure used for connections. | |
| 292 | * | |
| 293 | * @return The UI operations structure in use. | |
| 294 | */ | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
295 | GaimConnectionUiOps *gaim_connections_get_ui_ops(void); |
| 5563 | 296 | |
| 297 | /*@}*/ | |
| 298 | ||
|
6488
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
299 | /**************************************************************************/ |
|
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
300 | /** @name Connections Subsystem */ |
|
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
301 | /**************************************************************************/ |
|
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
302 | /*@{*/ |
|
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
303 | |
|
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
304 | /** |
|
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
305 | * Initializes the connections subsystem. |
|
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
306 | */ |
|
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
307 | void gaim_connections_init(void); |
|
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
308 | |
|
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
309 | /** |
|
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
310 | * Uninitializes the connections subsystem. |
|
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
311 | */ |
|
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
312 | void gaim_connections_uninit(void); |
|
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
313 | |
|
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
314 | /** |
|
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
315 | * Returns the handle to the connections subsystem. |
|
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
316 | * |
|
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
317 | * @return The connections subsystem handle. |
|
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
318 | */ |
|
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
319 | void *gaim_connections_get_handle(void); |
|
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
320 | |
|
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
321 | /*@}*/ |
|
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
322 | |
|
6a47a95e4dbb
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
323 | |
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
324 | #ifdef __cplusplus |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
325 | } |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
326 | #endif |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
327 | |
| 5563 | 328 | #endif /* _GAIM_CONNECTION_H_ */ |