Mercurial > pidgin
comparison libpurple/connection.h @ 15822:32c366eeeb99
sed -ie 's/gaim/purple/g'
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Mon, 19 Mar 2007 07:01:17 +0000 |
parents | 5fe8042783c1 |
children | 516f14bef90e |
comparison
equal
deleted
inserted
replaced
15821:84b0f9b23ede | 15822:32c366eeeb99 |
---|---|
1 /** | 1 /** |
2 * @file connection.h Connection API | 2 * @file connection.h Connection API |
3 * @ingroup core | 3 * @ingroup core |
4 * | 4 * |
5 * gaim | 5 * purple |
6 * | 6 * |
7 * Gaim is the legal property of its developers, whose names are too numerous | 7 * Purple 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 | 8 * to list here. Please refer to the COPYRIGHT file distributed with this |
9 * source distribution. | 9 * source distribution. |
10 * | 10 * |
11 * This program is free software; you can redistribute it and/or modify | 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 | 12 * it under the terms of the GNU General Public License as published by |
22 * along with this program; if not, write to the Free Software | 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 | 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
24 * | 24 * |
25 * @see @ref connection-signals | 25 * @see @ref connection-signals |
26 */ | 26 */ |
27 #ifndef _GAIM_CONNECTION_H_ | 27 #ifndef _PURPLE_CONNECTION_H_ |
28 #define _GAIM_CONNECTION_H_ | 28 #define _PURPLE_CONNECTION_H_ |
29 | 29 |
30 typedef struct _GaimConnection GaimConnection; | 30 typedef struct _PurpleConnection PurpleConnection; |
31 | 31 |
32 /** | 32 /** |
33 * Flags to change behavior of the client for a given connection. | 33 * Flags to change behavior of the client for a given connection. |
34 */ | 34 */ |
35 typedef enum | 35 typedef enum |
36 { | 36 { |
37 GAIM_CONNECTION_HTML = 0x0001, /**< Connection sends/receives in 'HTML'. */ | 37 PURPLE_CONNECTION_HTML = 0x0001, /**< Connection sends/receives in 'HTML'. */ |
38 GAIM_CONNECTION_NO_BGCOLOR = 0x0002, /**< Connection does not send/receive | 38 PURPLE_CONNECTION_NO_BGCOLOR = 0x0002, /**< Connection does not send/receive |
39 background colors. */ | 39 background colors. */ |
40 GAIM_CONNECTION_AUTO_RESP = 0x0004, /**< Send auto responses when away. */ | 40 PURPLE_CONNECTION_AUTO_RESP = 0x0004, /**< Send auto responses when away. */ |
41 GAIM_CONNECTION_FORMATTING_WBFO = 0x0008, /**< The text buffer must be formatted as a whole */ | 41 PURPLE_CONNECTION_FORMATTING_WBFO = 0x0008, /**< The text buffer must be formatted as a whole */ |
42 GAIM_CONNECTION_NO_NEWLINES = 0x0010, /**< No new lines are allowed in outgoing messages */ | 42 PURPLE_CONNECTION_NO_NEWLINES = 0x0010, /**< No new lines are allowed in outgoing messages */ |
43 GAIM_CONNECTION_NO_FONTSIZE = 0x0020, /**< Connection does not send/receive font sizes */ | 43 PURPLE_CONNECTION_NO_FONTSIZE = 0x0020, /**< Connection does not send/receive font sizes */ |
44 GAIM_CONNECTION_NO_URLDESC = 0x0040, /**< Connection does not support descriptions with links */ | 44 PURPLE_CONNECTION_NO_URLDESC = 0x0040, /**< Connection does not support descriptions with links */ |
45 GAIM_CONNECTION_NO_IMAGES = 0x0080, /**< Connection does not support sending of images */ | 45 PURPLE_CONNECTION_NO_IMAGES = 0x0080, /**< Connection does not support sending of images */ |
46 | 46 |
47 } GaimConnectionFlags; | 47 } PurpleConnectionFlags; |
48 | 48 |
49 typedef enum | 49 typedef enum |
50 { | 50 { |
51 GAIM_DISCONNECTED = 0, /**< Disconnected. */ | 51 PURPLE_DISCONNECTED = 0, /**< Disconnected. */ |
52 GAIM_CONNECTED, /**< Connected. */ | 52 PURPLE_CONNECTED, /**< Connected. */ |
53 GAIM_CONNECTING /**< Connecting. */ | 53 PURPLE_CONNECTING /**< Connecting. */ |
54 | 54 |
55 } GaimConnectionState; | 55 } PurpleConnectionState; |
56 | 56 |
57 #include <time.h> | 57 #include <time.h> |
58 | 58 |
59 #include "account.h" | 59 #include "account.h" |
60 #include "plugin.h" | 60 #include "plugin.h" |
61 #include "status.h" | 61 #include "status.h" |
62 | 62 |
63 typedef struct | 63 typedef struct |
64 { | 64 { |
65 void (*connect_progress)(GaimConnection *gc, const char *text, | 65 void (*connect_progress)(PurpleConnection *gc, const char *text, |
66 size_t step, size_t step_count); | 66 size_t step, size_t step_count); |
67 void (*connected)(GaimConnection *gc); | 67 void (*connected)(PurpleConnection *gc); |
68 void (*disconnected)(GaimConnection *gc); | 68 void (*disconnected)(PurpleConnection *gc); |
69 void (*notice)(GaimConnection *gc, const char *text); | 69 void (*notice)(PurpleConnection *gc, const char *text); |
70 void (*report_disconnect)(GaimConnection *gc, const char *text); | 70 void (*report_disconnect)(PurpleConnection *gc, const char *text); |
71 void (*network_connected)(); | 71 void (*network_connected)(); |
72 void (*network_disconnected)(); | 72 void (*network_disconnected)(); |
73 | 73 |
74 } GaimConnectionUiOps; | 74 } PurpleConnectionUiOps; |
75 | 75 |
76 struct _GaimConnection | 76 struct _PurpleConnection |
77 { | 77 { |
78 GaimPlugin *prpl; /**< The protocol plugin. */ | 78 PurplePlugin *prpl; /**< The protocol plugin. */ |
79 GaimConnectionFlags flags; /**< Connection flags. */ | 79 PurpleConnectionFlags flags; /**< Connection flags. */ |
80 | 80 |
81 GaimConnectionState state; /**< The connection state. */ | 81 PurpleConnectionState state; /**< The connection state. */ |
82 | 82 |
83 GaimAccount *account; /**< The account being connected to. */ | 83 PurpleAccount *account; /**< The account being connected to. */ |
84 char *password; /**< The password used. */ | 84 char *password; /**< The password used. */ |
85 int inpa; /**< The input watcher. */ | 85 int inpa; /**< The input watcher. */ |
86 | 86 |
87 GSList *buddy_chats; /**< A list of active chats. */ | 87 GSList *buddy_chats; /**< A list of active chats. */ |
88 void *proto_data; /**< Protocol-specific data. */ | 88 void *proto_data; /**< Protocol-specific data. */ |
108 /** @name Connection API */ | 108 /** @name Connection API */ |
109 /**************************************************************************/ | 109 /**************************************************************************/ |
110 /*@{*/ | 110 /*@{*/ |
111 | 111 |
112 /** | 112 /** |
113 * This function should only be called by gaim_account_connect() | 113 * This function should only be called by purple_account_connect() |
114 * in account.c. If you're trying to sign on an account, use that | 114 * in account.c. If you're trying to sign on an account, use that |
115 * function instead. | 115 * function instead. |
116 * | 116 * |
117 * Creates a connection to the specified account and either connects | 117 * Creates a connection to the specified account and either connects |
118 * or attempts to register a new account. If you are logging in, | 118 * or attempts to register a new account. If you are logging in, |
119 * the connection uses the current active status for this account. | 119 * the connection uses the current active status for this account. |
120 * So if you want to sign on as "away," for example, you need to | 120 * So if you want to sign on as "away," for example, you need to |
121 * have called gaim_account_set_status(account, "away"). | 121 * have called purple_account_set_status(account, "away"). |
122 * (And this will call gaim_account_connect() automatically). | 122 * (And this will call purple_account_connect() automatically). |
123 * | 123 * |
124 * @param account The account the connection should be connecting to. | 124 * @param account The account the connection should be connecting to. |
125 * @param regist Whether we are registering a new account or just | 125 * @param regist Whether we are registering a new account or just |
126 * trying to do a normal signon. | 126 * trying to do a normal signon. |
127 * @param password The password to use. | 127 * @param password The password to use. |
128 */ | 128 */ |
129 void gaim_connection_new(GaimAccount *account, gboolean regist, | 129 void purple_connection_new(PurpleAccount *account, gboolean regist, |
130 const char *password); | 130 const char *password); |
131 | 131 |
132 /** | 132 /** |
133 * Disconnects and destroys a GaimConnection. | 133 * Disconnects and destroys a PurpleConnection. |
134 * | 134 * |
135 * This function should only be called by gaim_account_disconnect() | 135 * This function should only be called by purple_account_disconnect() |
136 * in account.c. If you're trying to sign off an account, use that | 136 * in account.c. If you're trying to sign off an account, use that |
137 * function instead. | 137 * function instead. |
138 * | 138 * |
139 * @param gc The gaim connection to destroy. | 139 * @param gc The purple connection to destroy. |
140 */ | 140 */ |
141 void gaim_connection_destroy(GaimConnection *gc); | 141 void purple_connection_destroy(PurpleConnection *gc); |
142 | 142 |
143 /** | 143 /** |
144 * Sets the connection state. PRPLs should call this and pass in | 144 * Sets the connection state. PRPLs should call this and pass in |
145 * the state "GAIM_CONNECTED" when the account is completely | 145 * the state "PURPLE_CONNECTED" when the account is completely |
146 * signed on. What does it mean to be completely signed on? If | 146 * signed on. What does it mean to be completely signed on? If |
147 * the core can call prpl->set_status, and it successfully changes | 147 * the core can call prpl->set_status, and it successfully changes |
148 * your status, then the account is online. | 148 * your status, then the account is online. |
149 * | 149 * |
150 * @param gc The connection. | 150 * @param gc The connection. |
151 * @param state The connection state. | 151 * @param state The connection state. |
152 */ | 152 */ |
153 void gaim_connection_set_state(GaimConnection *gc, GaimConnectionState state); | 153 void purple_connection_set_state(PurpleConnection *gc, PurpleConnectionState state); |
154 | 154 |
155 /** | 155 /** |
156 * Sets the connection's account. | 156 * Sets the connection's account. |
157 * | 157 * |
158 * @param gc The connection. | 158 * @param gc The connection. |
159 * @param account The account. | 159 * @param account The account. |
160 */ | 160 */ |
161 void gaim_connection_set_account(GaimConnection *gc, GaimAccount *account); | 161 void purple_connection_set_account(PurpleConnection *gc, PurpleAccount *account); |
162 | 162 |
163 /** | 163 /** |
164 * Sets the connection's displayed name. | 164 * Sets the connection's displayed name. |
165 * | 165 * |
166 * @param gc The connection. | 166 * @param gc The connection. |
167 * @param name The displayed name. | 167 * @param name The displayed name. |
168 */ | 168 */ |
169 void gaim_connection_set_display_name(GaimConnection *gc, const char *name); | 169 void purple_connection_set_display_name(PurpleConnection *gc, const char *name); |
170 | 170 |
171 /** | 171 /** |
172 * Returns the connection state. | 172 * Returns the connection state. |
173 * | 173 * |
174 * @param gc The connection. | 174 * @param gc The connection. |
175 * | 175 * |
176 * @return The connection state. | 176 * @return The connection state. |
177 */ | 177 */ |
178 GaimConnectionState gaim_connection_get_state(const GaimConnection *gc); | 178 PurpleConnectionState purple_connection_get_state(const PurpleConnection *gc); |
179 | 179 |
180 /** | 180 /** |
181 * Returns TRUE if the account is connected, otherwise returns FALSE. | 181 * Returns TRUE if the account is connected, otherwise returns FALSE. |
182 * | 182 * |
183 * @return TRUE if the account is connected, otherwise returns FALSE. | 183 * @return TRUE if the account is connected, otherwise returns FALSE. |
184 */ | 184 */ |
185 #define GAIM_CONNECTION_IS_CONNECTED(gc) \ | 185 #define PURPLE_CONNECTION_IS_CONNECTED(gc) \ |
186 (gc->state == GAIM_CONNECTED) | 186 (gc->state == PURPLE_CONNECTED) |
187 | 187 |
188 /** | 188 /** |
189 * Returns the connection's account. | 189 * Returns the connection's account. |
190 * | 190 * |
191 * @param gc The connection. | 191 * @param gc The connection. |
192 * | 192 * |
193 * @return The connection's account. | 193 * @return The connection's account. |
194 */ | 194 */ |
195 GaimAccount *gaim_connection_get_account(const GaimConnection *gc); | 195 PurpleAccount *purple_connection_get_account(const PurpleConnection *gc); |
196 | 196 |
197 /** | 197 /** |
198 * Returns the connection's password. | 198 * Returns the connection's password. |
199 * | 199 * |
200 * @param gc The connection. | 200 * @param gc The connection. |
201 * | 201 * |
202 * @return The connection's password. | 202 * @return The connection's password. |
203 */ | 203 */ |
204 const char *gaim_connection_get_password(const GaimConnection *gc); | 204 const char *purple_connection_get_password(const PurpleConnection *gc); |
205 | 205 |
206 /** | 206 /** |
207 * Returns the connection's displayed name. | 207 * Returns the connection's displayed name. |
208 * | 208 * |
209 * @param gc The connection. | 209 * @param gc The connection. |
210 * | 210 * |
211 * @return The connection's displayed name. | 211 * @return The connection's displayed name. |
212 */ | 212 */ |
213 const char *gaim_connection_get_display_name(const GaimConnection *gc); | 213 const char *purple_connection_get_display_name(const PurpleConnection *gc); |
214 | 214 |
215 /** | 215 /** |
216 * Updates the connection progress. | 216 * Updates the connection progress. |
217 * | 217 * |
218 * @param gc The connection. | 218 * @param gc The connection. |
219 * @param text Information on the current step. | 219 * @param text Information on the current step. |
220 * @param step The current step. | 220 * @param step The current step. |
221 * @param count The total number of steps. | 221 * @param count The total number of steps. |
222 */ | 222 */ |
223 void gaim_connection_update_progress(GaimConnection *gc, const char *text, | 223 void purple_connection_update_progress(PurpleConnection *gc, const char *text, |
224 size_t step, size_t count); | 224 size_t step, size_t count); |
225 | 225 |
226 /** | 226 /** |
227 * Displays a connection-specific notice. | 227 * Displays a connection-specific notice. |
228 * | 228 * |
229 * @param gc The connection. | 229 * @param gc The connection. |
230 * @param text The notice text. | 230 * @param text The notice text. |
231 */ | 231 */ |
232 void gaim_connection_notice(GaimConnection *gc, const char *text); | 232 void purple_connection_notice(PurpleConnection *gc, const char *text); |
233 | 233 |
234 /** | 234 /** |
235 * Closes a connection with an error. | 235 * Closes a connection with an error. |
236 * | 236 * |
237 * @param gc The connection. | 237 * @param gc The connection. |
238 * @param reason The error text. | 238 * @param reason The error text. |
239 */ | 239 */ |
240 void gaim_connection_error(GaimConnection *gc, const char *reason); | 240 void purple_connection_error(PurpleConnection *gc, const char *reason); |
241 | 241 |
242 /*@}*/ | 242 /*@}*/ |
243 | 243 |
244 /**************************************************************************/ | 244 /**************************************************************************/ |
245 /** @name Connections API */ | 245 /** @name Connections API */ |
247 /*@{*/ | 247 /*@{*/ |
248 | 248 |
249 /** | 249 /** |
250 * Disconnects from all connections. | 250 * Disconnects from all connections. |
251 */ | 251 */ |
252 void gaim_connections_disconnect_all(void); | 252 void purple_connections_disconnect_all(void); |
253 | 253 |
254 /** | 254 /** |
255 * Returns a list of all active connections. This does not | 255 * Returns a list of all active connections. This does not |
256 * include connections that are in the process of connecting. | 256 * include connections that are in the process of connecting. |
257 * | 257 * |
258 * @return A list of all active connections. | 258 * @return A list of all active connections. |
259 */ | 259 */ |
260 GList *gaim_connections_get_all(void); | 260 GList *purple_connections_get_all(void); |
261 | 261 |
262 /** | 262 /** |
263 * Returns a list of all connections in the process of connecting. | 263 * Returns a list of all connections in the process of connecting. |
264 * | 264 * |
265 * @return A list of connecting connections. | 265 * @return A list of connecting connections. |
266 */ | 266 */ |
267 GList *gaim_connections_get_connecting(void); | 267 GList *purple_connections_get_connecting(void); |
268 | 268 |
269 /** | 269 /** |
270 * Checks if gc is still a valid pointer to a gc. | 270 * Checks if gc is still a valid pointer to a gc. |
271 * | 271 * |
272 * @return @c TRUE if gc is valid. | 272 * @return @c TRUE if gc is valid. |
273 */ | 273 */ |
274 /* | 274 /* |
275 * TODO: Eventually this bad boy will be removed, because it is | 275 * TODO: Eventually this bad boy will be removed, because it is |
276 * a gross fix for a crashy problem. | 276 * a gross fix for a crashy problem. |
277 */ | 277 */ |
278 #define GAIM_CONNECTION_IS_VALID(gc) (g_list_find(gaim_connections_get_all(), (gc))) | 278 #define PURPLE_CONNECTION_IS_VALID(gc) (g_list_find(purple_connections_get_all(), (gc))) |
279 | 279 |
280 /*@}*/ | 280 /*@}*/ |
281 | 281 |
282 /**************************************************************************/ | 282 /**************************************************************************/ |
283 /** @name UI Registration Functions */ | 283 /** @name UI Registration Functions */ |
287 /** | 287 /** |
288 * Sets the UI operations structure to be used for connections. | 288 * Sets the UI operations structure to be used for connections. |
289 * | 289 * |
290 * @param ops The UI operations structure. | 290 * @param ops The UI operations structure. |
291 */ | 291 */ |
292 void gaim_connections_set_ui_ops(GaimConnectionUiOps *ops); | 292 void purple_connections_set_ui_ops(PurpleConnectionUiOps *ops); |
293 | 293 |
294 /** | 294 /** |
295 * Returns the UI operations structure used for connections. | 295 * Returns the UI operations structure used for connections. |
296 * | 296 * |
297 * @return The UI operations structure in use. | 297 * @return The UI operations structure in use. |
298 */ | 298 */ |
299 GaimConnectionUiOps *gaim_connections_get_ui_ops(void); | 299 PurpleConnectionUiOps *purple_connections_get_ui_ops(void); |
300 | 300 |
301 /*@}*/ | 301 /*@}*/ |
302 | 302 |
303 /**************************************************************************/ | 303 /**************************************************************************/ |
304 /** @name Connections Subsystem */ | 304 /** @name Connections Subsystem */ |
306 /*@{*/ | 306 /*@{*/ |
307 | 307 |
308 /** | 308 /** |
309 * Initializes the connections subsystem. | 309 * Initializes the connections subsystem. |
310 */ | 310 */ |
311 void gaim_connections_init(void); | 311 void purple_connections_init(void); |
312 | 312 |
313 /** | 313 /** |
314 * Uninitializes the connections subsystem. | 314 * Uninitializes the connections subsystem. |
315 */ | 315 */ |
316 void gaim_connections_uninit(void); | 316 void purple_connections_uninit(void); |
317 | 317 |
318 /** | 318 /** |
319 * Returns the handle to the connections subsystem. | 319 * Returns the handle to the connections subsystem. |
320 * | 320 * |
321 * @return The connections subsystem handle. | 321 * @return The connections subsystem handle. |
322 */ | 322 */ |
323 void *gaim_connections_get_handle(void); | 323 void *purple_connections_get_handle(void); |
324 | 324 |
325 /*@}*/ | 325 /*@}*/ |
326 | 326 |
327 | 327 |
328 #ifdef __cplusplus | 328 #ifdef __cplusplus |
329 } | 329 } |
330 #endif | 330 #endif |
331 | 331 |
332 #endif /* _GAIM_CONNECTION_H_ */ | 332 #endif /* _PURPLE_CONNECTION_H_ */ |