Mercurial > pidgin
comparison libpurple/connection.h @ 32672:3828a61c44da
A boring and large patch so I can merge heads.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Fri, 23 Dec 2011 08:21:58 +0000 |
parents | a5b556ac1de5 |
children |
comparison
equal
deleted
inserted
replaced
32671:0e69949b3e61 | 32672:3828a61c44da |
---|---|
57 | 57 |
58 } PurpleConnectionState; | 58 } PurpleConnectionState; |
59 | 59 |
60 /** | 60 /** |
61 * Possible errors that can cause a connection to be closed. | 61 * Possible errors that can cause a connection to be closed. |
62 * | |
63 * @since 2.3.0 | |
64 */ | 62 */ |
65 typedef enum | 63 typedef enum |
66 { | 64 { |
67 /** There was an error sending or receiving on the network socket, or | 65 /** There was an error sending or receiving on the network socket, or |
68 * there was some protocol error (such as the server sending malformed | 66 * there was some protocol error (such as the server sending malformed |
214 * @param reason why the connection ended, if known, or | 212 * @param reason why the connection ended, if known, or |
215 * #PURPLE_CONNECTION_ERROR_OTHER_ERROR, if not. | 213 * #PURPLE_CONNECTION_ERROR_OTHER_ERROR, if not. |
216 * @param text a localized message describing the disconnection | 214 * @param text a localized message describing the disconnection |
217 * in more detail to the user. | 215 * in more detail to the user. |
218 * @see #purple_connection_error | 216 * @see #purple_connection_error |
219 * | |
220 * @since 2.3.0 | |
221 */ | 217 */ |
222 void (*report_disconnect)(PurpleConnection *gc, | 218 void (*report_disconnect)(PurpleConnection *gc, |
223 PurpleConnectionError reason, | 219 PurpleConnectionError reason, |
224 const char *text); | 220 const char *text); |
225 | 221 |
237 | 233 |
238 PurpleConnectionState state; /**< The connection state. */ | 234 PurpleConnectionState state; /**< The connection state. */ |
239 | 235 |
240 PurpleAccount *account; /**< The account being connected to. */ | 236 PurpleAccount *account; /**< The account being connected to. */ |
241 char *password; /**< The password used. */ | 237 char *password; /**< The password used. */ |
242 int inpa; /**< The input watcher. */ | |
243 | 238 |
244 GSList *buddy_chats; /**< A list of active chats | 239 GSList *buddy_chats; /**< A list of active chats |
245 (#PurpleConversation structs of type | 240 (#PurpleConversation structs of type |
246 #PURPLE_CONV_TYPE_CHAT). */ | 241 #PURPLE_CONV_TYPE_CHAT). */ |
247 void *proto_data; /**< Protocol-specific data. */ | 242 void *proto_data; /**< Protocol-specific data. */ |
270 /**************************************************************************/ | 265 /**************************************************************************/ |
271 /** @name Connection API */ | 266 /** @name Connection API */ |
272 /**************************************************************************/ | 267 /**************************************************************************/ |
273 /*@{*/ | 268 /*@{*/ |
274 | 269 |
275 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_CONNECTION_C_) | |
276 /** | |
277 * This function should only be called by purple_account_connect() | |
278 * in account.c. If you're trying to sign on an account, use that | |
279 * function instead. | |
280 * | |
281 * Creates a connection to the specified account and either connects | |
282 * or attempts to register a new account. If you are logging in, | |
283 * the connection uses the current active status for this account. | |
284 * So if you want to sign on as "away," for example, you need to | |
285 * have called purple_account_set_status(account, "away"). | |
286 * (And this will call purple_account_connect() automatically). | |
287 * | |
288 * @param account The account the connection should be connecting to. | |
289 * @param regist Whether we are registering a new account or just | |
290 * trying to do a normal signon. | |
291 * @param password The password to use. | |
292 * | |
293 * @deprecated As this is internal, we should make it private in 3.0.0. | |
294 */ | |
295 void purple_connection_new(PurpleAccount *account, gboolean regist, | |
296 const char *password); | |
297 #endif | |
298 | |
299 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_CONNECTION_C_) | |
300 /** | |
301 * This function should only be called by purple_account_unregister() | |
302 * in account.c. | |
303 * | |
304 * Tries to unregister the account on the server. If the account is not | |
305 * connected, also creates a new connection. | |
306 * | |
307 * @param account The account to unregister | |
308 * @param password The password to use. | |
309 * @param cb Optional callback to be called when unregistration is complete | |
310 * @param user_data user data to pass to the callback | |
311 * | |
312 * @deprecated As this is internal, we should make it private in 3.0.0. | |
313 */ | |
314 void purple_connection_new_unregister(PurpleAccount *account, const char *password, PurpleAccountUnregistrationCb cb, void *user_data); | |
315 #endif | |
316 | |
317 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_CONNECTION_C_) | |
318 /** | |
319 * Disconnects and destroys a PurpleConnection. | |
320 * | |
321 * This function should only be called by purple_account_disconnect() | |
322 * in account.c. If you're trying to sign off an account, use that | |
323 * function instead. | |
324 * | |
325 * @param gc The purple connection to destroy. | |
326 * | |
327 * @deprecated As this is internal, we should make it private in 3.0.0. | |
328 */ | |
329 void purple_connection_destroy(PurpleConnection *gc); | |
330 #endif | |
331 | |
332 /** | 270 /** |
333 * Sets the connection state. PRPLs should call this and pass in | 271 * Sets the connection state. PRPLs should call this and pass in |
334 * the state #PURPLE_CONNECTED when the account is completely | 272 * the state #PURPLE_CONNECTED when the account is completely |
335 * signed on. What does it mean to be completely signed on? If | 273 * signed on. What does it mean to be completely signed on? If |
336 * the core can call prpl->set_status, and it successfully changes | 274 * the core can call prpl->set_status, and it successfully changes |
340 * @param state The connection state. | 278 * @param state The connection state. |
341 */ | 279 */ |
342 void purple_connection_set_state(PurpleConnection *gc, PurpleConnectionState state); | 280 void purple_connection_set_state(PurpleConnection *gc, PurpleConnectionState state); |
343 | 281 |
344 /** | 282 /** |
283 * Sets the connection flags. | |
284 * | |
285 * @param gc The connection. | |
286 * @param flags The flags. | |
287 */ | |
288 void purple_connection_set_flags(PurpleConnection *gc, PurpleConnectionFlags flags); | |
289 | |
290 /** | |
345 * Sets the connection's account. | 291 * Sets the connection's account. |
346 * | 292 * |
347 * @param gc The connection. | 293 * @param gc The connection. |
348 * @param account The account. | 294 * @param account The account. |
349 */ | 295 */ |
360 /** | 306 /** |
361 * Sets the protocol data for a connection. | 307 * Sets the protocol data for a connection. |
362 * | 308 * |
363 * @param connection The PurpleConnection. | 309 * @param connection The PurpleConnection. |
364 * @param proto_data The protocol data to set for the connection. | 310 * @param proto_data The protocol data to set for the connection. |
365 * | |
366 * @since 2.6.0 | |
367 */ | 311 */ |
368 void purple_connection_set_protocol_data(PurpleConnection *connection, void *proto_data); | 312 void purple_connection_set_protocol_data(PurpleConnection *connection, void *proto_data); |
369 | 313 |
370 /** | 314 /** |
371 * Returns the connection state. | 315 * Returns the connection state. |
373 * @param gc The connection. | 317 * @param gc The connection. |
374 * | 318 * |
375 * @return The connection state. | 319 * @return The connection state. |
376 */ | 320 */ |
377 PurpleConnectionState purple_connection_get_state(const PurpleConnection *gc); | 321 PurpleConnectionState purple_connection_get_state(const PurpleConnection *gc); |
322 | |
323 /** | |
324 * Returns the connection flags. | |
325 * | |
326 * @param gc The connection. | |
327 * | |
328 * @return The connection flags. | |
329 */ | |
330 PurpleConnectionFlags purple_connection_get_flags(const PurpleConnection *gc); | |
378 | 331 |
379 /** | 332 /** |
380 * Returns TRUE if the account is connected, otherwise returns FALSE. | 333 * Returns TRUE if the account is connected, otherwise returns FALSE. |
381 * | 334 * |
382 * @return TRUE if the account is connected, otherwise returns FALSE. | 335 * @return TRUE if the account is connected, otherwise returns FALSE. |
397 * Returns the protocol plugin managing a connection. | 350 * Returns the protocol plugin managing a connection. |
398 * | 351 * |
399 * @param gc The connection. | 352 * @param gc The connection. |
400 * | 353 * |
401 * @return The protocol plugin. | 354 * @return The protocol plugin. |
402 * | |
403 * @since 2.4.0 | |
404 */ | 355 */ |
405 PurplePlugin * purple_connection_get_prpl(const PurpleConnection *gc); | 356 PurplePlugin * purple_connection_get_prpl(const PurpleConnection *gc); |
406 | 357 |
407 /** | 358 /** |
408 * Returns the connection's password. | 359 * Returns the connection's password. |
426 * Gets the protocol data from a connection. | 377 * Gets the protocol data from a connection. |
427 * | 378 * |
428 * @param connection The PurpleConnection. | 379 * @param connection The PurpleConnection. |
429 * | 380 * |
430 * @return The protocol data for the connection. | 381 * @return The protocol data for the connection. |
431 * | |
432 * @since 2.6.0 | |
433 */ | 382 */ |
434 void *purple_connection_get_protocol_data(const PurpleConnection *connection); | 383 void *purple_connection_get_protocol_data(const PurpleConnection *connection); |
435 | 384 |
436 /** | 385 /** |
437 * Updates the connection progress. | 386 * Updates the connection progress. |
459 * backwards-compatibility. | 408 * backwards-compatibility. |
460 * | 409 * |
461 * @param gc the connection which is closing. | 410 * @param gc the connection which is closing. |
462 * @param reason why the connection is closing. | 411 * @param reason why the connection is closing. |
463 * @param description a non-@c NULL localized description of the error. | 412 * @param description a non-@c NULL localized description of the error. |
464 * | |
465 * @since 2.3.0 | |
466 */ | 413 */ |
467 void | 414 void |
468 purple_connection_error(PurpleConnection *gc, | 415 purple_connection_error(PurpleConnection *gc, |
469 PurpleConnectionError reason, | 416 PurpleConnectionError reason, |
470 const char *description); | 417 const char *description); |
471 | 418 |
472 /** | 419 /** |
473 * Closes a connection due to an SSL error; this is basically a shortcut to | 420 * Closes a connection due to an SSL error; this is basically a shortcut to |
474 * turning the #PurpleSslErrorType into a #PurpleConnectionError and a | 421 * turning the #PurpleSslErrorType into a #PurpleConnectionError and a |
475 * human-readable string and then calling purple_connection_error(). | 422 * human-readable string and then calling purple_connection_error(). |
476 * | |
477 * @since 2.3.0 | |
478 */ | 423 */ |
479 void | 424 void |
480 purple_connection_ssl_error (PurpleConnection *gc, | 425 purple_connection_ssl_error (PurpleConnection *gc, |
481 PurpleSslErrorType ssl_error); | 426 PurpleSslErrorType ssl_error); |
482 | 427 |
495 * | 440 * |
496 * (This function is meant to replace checking PurpleConnection.wants_to_die.) | 441 * (This function is meant to replace checking PurpleConnection.wants_to_die.) |
497 * | 442 * |
498 * @return @c TRUE if the account should not be automatically reconnected, and | 443 * @return @c TRUE if the account should not be automatically reconnected, and |
499 * @c FALSE otherwise. | 444 * @c FALSE otherwise. |
500 * | |
501 * @since 2.3.0 | |
502 */ | 445 */ |
503 gboolean | 446 gboolean |
504 purple_connection_error_is_fatal (PurpleConnectionError reason); | 447 purple_connection_error_is_fatal (PurpleConnectionError reason); |
448 | |
449 /** | |
450 * Indicate that a packet was received on the connection. | |
451 * Set by the prpl to avoid sending unneeded keepalives. | |
452 * | |
453 * @param gc The connection. | |
454 */ | |
455 void purple_connection_update_last_received(PurpleConnection *gc); | |
505 | 456 |
506 /*@}*/ | 457 /*@}*/ |
507 | 458 |
508 /**************************************************************************/ | 459 /**************************************************************************/ |
509 /** @name Connections API */ | 460 /** @name Connections API */ |