changeset 10863:f289e9f76053

[gaim-migrate @ 12546] Better status for Gadu-Gadu. I know this fixes the bug where enabled gg accounts would not sign-on when you start Gaim. It probably fixes other, related problems. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 24 Apr 2005 20:49:55 +0000
parents 885377f484b7
children 55e29b8e9689
files src/protocols/gg/gg.c
diffstat 1 files changed, 20 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/gg/gg.c	Sun Apr 24 20:38:36 2005 +0000
+++ b/src/protocols/gg/gg.c	Sun Apr 24 20:49:55 2005 +0000
@@ -1,6 +1,6 @@
 /*
  * gaim - Gadu-Gadu Protocol Plugin
- * $Id: gg.c 12471 2005-04-11 15:26:51Z lschiere $
+ * $Id: gg.c 12546 2005-04-24 20:49:55Z thekingant $
  *
  * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
  *
@@ -180,15 +180,32 @@
 {
 	GaimConnection *gc;
 	struct agg_data *gd;
+	gboolean connected;
+	GaimStatusType *type;
+	int primitive;
 	int status_num;
 	const char *status_id;
 	char *msg = NULL;
 
-	gc = gaim_account_get_connection(account);
+	connected = gaim_account_is_connected(account);
+	type = gaim_status_get_type(status);
+	primitive = gaim_status_type_get_primitive(type);
 
-	if (gc == NULL)
+	if (!gaim_status_is_active(status))
 		return;
 
+	if (!connected) {
+		if (primitive != GAIM_STATUS_OFFLINE)
+			gaim_account_connect(account);
+		return;
+	}
+
+	if (primitive == GAIM_STATUS_OFFLINE) {
+		gaim_account_disconnect(account);
+		return;
+	}
+
+	gc = gaim_account_get_connection(account);
 	gd = (struct agg_data *)gc->proto_data;
 	status_num = gd->own_status;
 	status_id = gaim_status_get_id(status);