Mercurial > pidgin.yaz
comparison libpurple/connection.h @ 20813:66e7b104b4ea
rlaager pointed out that purple_connection_error_reason should be setting
wants_to_die appropriately to the reason, rather than leaving it up to the
prpl, so let's make it so!
author | Will Thompson <will.thompson@collabora.co.uk> |
---|---|
date | Tue, 09 Oct 2007 13:25:47 +0000 |
parents | 88aa557b997f |
children | c560286daede |
comparison
equal
deleted
inserted
replaced
20812:88aa557b997f | 20813:66e7b104b4ea |
---|---|
213 | 213 |
214 PurpleAccount *account; /**< The account being connected to. */ | 214 PurpleAccount *account; /**< The account being connected to. */ |
215 char *password; /**< The password used. */ | 215 char *password; /**< The password used. */ |
216 int inpa; /**< The input watcher. */ | 216 int inpa; /**< The input watcher. */ |
217 | 217 |
218 GSList *buddy_chats; /**< A list of active chats. */ | 218 GSList *buddy_chats; /**< A list of active chats |
219 (#PurpleConversation structs of type | |
220 #PURPLE_CONV_TYPE_CHAT). */ | |
219 void *proto_data; /**< Protocol-specific data. */ | 221 void *proto_data; /**< Protocol-specific data. */ |
220 | 222 |
221 char *display_name; /**< How you appear to other people. */ | 223 char *display_name; /**< How you appear to other people. */ |
222 guint keepalive; /**< Keep-alive. */ | 224 guint keepalive; /**< Keep-alive. */ |
223 | 225 |
224 | 226 /** Wants to Die state. This is set when the user chooses to log out, or |
225 gboolean wants_to_die; /**< Wants to Die state. This is set | 227 * when the protocol is disconnected and should not be automatically |
226 when the user chooses to log out, | 228 * reconnected (incorrect password, etc.). prpls should rely on |
227 or when the protocol is | 229 * purple_connection_error_reason() to set this for them rather than |
228 disconnected and should not be | 230 * setting it themselves. |
229 automatically reconnected | 231 * @see purple_connection_reason_is_fatal |
230 (incorrect password, etc.) */ | 232 */ |
233 gboolean wants_to_die; | |
234 | |
231 guint disconnect_timeout; /**< Timer used for nasty stack tricks */ | 235 guint disconnect_timeout; /**< Timer used for nasty stack tricks */ |
232 }; | 236 }; |
233 | 237 |
234 #ifdef __cplusplus | 238 #ifdef __cplusplus |
235 extern "C" { | 239 extern "C" { |
283 */ | 287 */ |
284 void purple_connection_destroy(PurpleConnection *gc); | 288 void purple_connection_destroy(PurpleConnection *gc); |
285 | 289 |
286 /** | 290 /** |
287 * Sets the connection state. PRPLs should call this and pass in | 291 * Sets the connection state. PRPLs should call this and pass in |
288 * the state "PURPLE_CONNECTED" when the account is completely | 292 * the state #PURPLE_CONNECTED when the account is completely |
289 * signed on. What does it mean to be completely signed on? If | 293 * signed on. What does it mean to be completely signed on? If |
290 * the core can call prpl->set_status, and it successfully changes | 294 * the core can call prpl->set_status, and it successfully changes |
291 * your status, then the account is online. | 295 * your status, then the account is online. |
292 * | 296 * |
293 * @param gc The connection. | 297 * @param gc The connection. |
379 * | 383 * |
380 * @param gc The connection. | 384 * @param gc The connection. |
381 * @param reason The error text. | 385 * @param reason The error text. |
382 * @deprecated in favour of #purple_connection_error_reason. Calling | 386 * @deprecated in favour of #purple_connection_error_reason. Calling |
383 * @c purple_connection_error(gc, text) is equivalent to calling | 387 * @c purple_connection_error(gc, text) is equivalent to calling |
384 * @c purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR, text). | 388 * @c purple_connection_error_reason(gc, reason, text) where @c reason is |
389 * #PURPLE_REASON_OTHER_ERROR if @c gc->wants_to_die is @c TRUE, and | |
390 * #PURPLE_REASON_NETWORK_ERROR if not. (This is to keep auto-reconnection | |
391 * behaviour the same when using old prpls which don't use reasons yet.) | |
385 */ | 392 */ |
386 void purple_connection_error(PurpleConnection *gc, const char *reason); | 393 void purple_connection_error(PurpleConnection *gc, const char *reason); |
387 | 394 |
388 /** | 395 /** |
389 * Closes a connection with an error and an optional description of the | 396 * Closes a connection with an error and an optional description of the |
390 * error. | 397 * error. It also sets @c gc->wants_to_die to the value of |
398 * #purple_connection_reason_is_fatal(@a reason). | |
391 * | 399 * |
392 * @param reason why the connection is closing. | 400 * @param reason why the connection is closing. |
393 * @param description a localized description of the error. | 401 * @param description a localized description of the error. |
394 */ | 402 */ |
395 void | 403 void |
407 PurpleSslErrorType ssl_error); | 415 PurpleSslErrorType ssl_error); |
408 | 416 |
409 /** | 417 /** |
410 * Reports whether a disconnection reason is fatal (in which case the account | 418 * Reports whether a disconnection reason is fatal (in which case the account |
411 * should probably not be automatically reconnected) or transient (so | 419 * should probably not be automatically reconnected) or transient (so |
412 * auto-reconnection is a good idea. | 420 * auto-reconnection is a good idea). |
413 * For instance, #PURPLE_REASON_NETWORK_ERROR is a temporary | 421 * For instance, #PURPLE_REASON_NETWORK_ERROR is a temporary |
414 * error, which might be caused by losing the network connection, so | 422 * error, which might be caused by losing the network connection, so |
415 * @a purple_connection_reason_is_fatal(PURPLE_REASON_NETWORK_ERROR) is | 423 * @a purple_connection_reason_is_fatal(PURPLE_REASON_NETWORK_ERROR) is |
416 * @a FALSE. On the other hand, #PURPLE_REASON_AUTHENTICATION_FAILED probably | 424 * @c FALSE. On the other hand, #PURPLE_REASON_AUTHENTICATION_FAILED probably |
417 * indicates a misconfiguration of the account which needs the user to go fix | 425 * indicates a misconfiguration of the account which needs the user to go fix |
418 * it up, so @a | 426 * it up, so @a |
419 * purple_connection_reason_is_fatal(PURPLE_REASON_AUTHENTICATION_FAILED) | 427 * purple_connection_reason_is_fatal(PURPLE_REASON_AUTHENTICATION_FAILED) |
420 * is @a TRUE. | 428 * is @c TRUE. |
421 * | 429 * |
422 * (This function is meant to replace checking PurpleConnection.wants_to_die.) | 430 * (This function is meant to replace checking PurpleConnection.wants_to_die.) |
423 * | 431 * |
424 * @return @a TRUE iff automatic reconnection is a bad idea. | 432 * @return @c TRUE iff automatic reconnection is a bad idea. |
425 */ | 433 */ |
426 gboolean | 434 gboolean |
427 purple_connection_reason_is_fatal (PurpleDisconnectReason reason); | 435 purple_connection_reason_is_fatal (PurpleDisconnectReason reason); |
428 | 436 |
429 /*@}*/ | 437 /*@}*/ |