changeset 11808:4b7645e1c02d

[gaim-migrate @ 14099] Correctly restore oscar available messages at signon. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 25 Oct 2005 05:13:55 +0000
parents 1f70f265cf27
children 53da46e79de1
files src/protocols/oscar/oscar.c src/protocols/oscar/service.c
diffstat 2 files changed, 18 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/oscar.c	Tue Oct 25 04:24:26 2005 +0000
+++ b/src/protocols/oscar/oscar.c	Tue Oct 25 05:13:55 2005 +0000
@@ -5798,12 +5798,18 @@
 }
 
 static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...) {
-	GaimConnection *gc = sess->aux_data;
-	OscarData *od = (OscarData *)gc->proto_data;
-	GaimAccount *account = gaim_connection_get_account(gc);
+	GaimConnection *gc;
+	OscarData *od;
+	GaimAccount *account;
+	GaimStatus *status;
+	const char *message;
 	va_list ap;
 	fu16_t maxpermits, maxdenies;
 
+	gc = sess->aux_data;
+	od = (OscarData *)gc->proto_data;
+	account = gaim_account_get_account(gc);
+
 	va_start(ap, fr);
 	maxpermits = (fu16_t) va_arg(ap, unsigned int);
 	maxdenies = (fu16_t) va_arg(ap, unsigned int);
@@ -5820,7 +5826,13 @@
 	gaim_debug_info("oscar", "buddy list loaded\n");
 
 	aim_clientready(sess, fr->conn);
-	aim_srv_setavailmsg(sess, NULL);
+
+	/* Set our available message based on the current status */
+	status = gaim_account_get_active_status(account);
+	if (gaim_status_is_available(status))
+		message = gaim_status_get_attr_string(status, "message");
+	aim_srv_setavailmsg(sess, message);
+
 	aim_srv_setidle(sess, 0);
 
 	if (od->icq) {
@@ -6450,7 +6462,6 @@
 {
 	GaimAccount *account = gaim_connection_get_account(gc);
 	OscarData *od = (OscarData *)gc->proto_data;
-	GaimPresence *presence;
 	GaimStatus *status;
 	GaimStatusType *status_type;
 	GaimStatusPrimitive primitive;
@@ -6465,8 +6476,7 @@
 	char *away = NULL;
 	gsize awaylen = 0;
 
-	presence = gaim_account_get_presence(account);
-	status = gaim_presence_get_active_status(presence);
+	status = gaim_account_get_active_status(account);
 	status_type = gaim_status_get_type(status);
 	primitive = gaim_status_type_get_primitive(status_type);
 
--- a/src/protocols/oscar/service.c	Tue Oct 25 04:24:26 2005 +0000
+++ b/src/protocols/oscar/service.c	Tue Oct 25 05:13:55 2005 +0000
@@ -847,7 +847,7 @@
 	if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004)))
 		return -EINVAL;
 
-	if (msg != NULL) {
+	if ((msg != NULL) && *msg != '\0') {
 		if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + strlen(msg) + 8)))
 			return -ENOMEM;