libpurple/account.c

changeset 35512
8d6f1349b57a
parent 35499
c4c5e0a670b1
child 35972
04fa195c585c
child 37108
73c5fb6d78b3
equal deleted inserted replaced
35511:201a7fd12507 35512:8d6f1349b57a
901 purple_account_set_enabled(PurpleAccount *account, const char *ui, 901 purple_account_set_enabled(PurpleAccount *account, const char *ui,
902 gboolean value) 902 gboolean value)
903 { 903 {
904 PurpleConnection *gc; 904 PurpleConnection *gc;
905 PurpleAccountPrivate *priv; 905 PurpleAccountPrivate *priv;
906 gboolean was_enabled = FALSE, wants_to_die = FALSE; 906 gboolean was_enabled = FALSE;
907 907
908 g_return_if_fail(PURPLE_IS_ACCOUNT(account)); 908 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
909 g_return_if_fail(ui != NULL); 909 g_return_if_fail(ui != NULL);
910 910
911 was_enabled = purple_account_get_enabled(account, ui); 911 was_enabled = purple_account_get_enabled(account, ui);
919 purple_signal_emit(purple_accounts_get_handle(), "account-enabled", account); 919 purple_signal_emit(purple_accounts_get_handle(), "account-enabled", account);
920 920
921 g_object_notify_by_pspec(G_OBJECT(account), properties[PROP_ENABLED]); 921 g_object_notify_by_pspec(G_OBJECT(account), properties[PROP_ENABLED]);
922 922
923 if ((gc != NULL) && (_purple_connection_wants_to_die(gc))) 923 if ((gc != NULL) && (_purple_connection_wants_to_die(gc)))
924 wants_to_die = TRUE; 924 return;
925 925
926 priv = PURPLE_ACCOUNT_GET_PRIVATE(account); 926 priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
927 927
928 if (!wants_to_die && value && purple_presence_is_online(priv->presence)) 928 if (value && purple_presence_is_online(priv->presence))
929 purple_account_connect(account); 929 purple_account_connect(account);
930 else if (!value && !purple_account_is_disconnected(account)) 930 else if (!value && !purple_account_is_disconnected(account))
931 purple_account_disconnect(account); 931 purple_account_disconnect(account);
932 } 932 }
933 933
2978 2978
2979 /* GObject dispose function */ 2979 /* GObject dispose function */
2980 static void 2980 static void
2981 purple_account_dispose(GObject *object) 2981 purple_account_dispose(GObject *object)
2982 { 2982 {
2983 PurpleAccountPrivate *priv = PURPLE_ACCOUNT_GET_PRIVATE(object); 2983 PurpleAccount *account = PURPLE_ACCOUNT(object);
2984 PurpleAccountPrivate *priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
2985
2986 if (!purple_account_is_disconnected(account))
2987 purple_account_disconnect(account);
2984 2988
2985 if (priv->presence) { 2989 if (priv->presence) {
2986 g_object_unref(priv->presence); 2990 g_object_unref(priv->presence);
2987 priv->presence = NULL; 2991 priv->presence = NULL;
2988 } 2992 }

mercurial