changeset 4642:c0abcd675ca6

[gaim-migrate @ 4952] Gonna dress you up in mylar All over, your body Gonna dress you up in mylar I tried to add a warning for when your buddy list is temporarily unavailbabable, but I don't really have a way to test it. SO, if you get a cool little dialog that says "You're buddy list is unavailble," let me know, so I can get some football players to dump gatorade on my head. I want to make gaim fallback to old-school buddy lists, but they're not working so well right now, for some reason. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 03 Mar 2003 08:31:55 +0000
parents 94635db7c6af
children 2b37c498b4bd
files src/protocols/oscar/aim.h src/protocols/oscar/bstream.c src/protocols/oscar/oscar.c src/protocols/oscar/ssi.c
diffstat 4 files changed, 40 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/aim.h	Mon Mar 03 07:43:55 2003 +0000
+++ b/src/protocols/oscar/aim.h	Mon Mar 03 08:31:55 2003 +0000
@@ -1184,7 +1184,7 @@
 /* These build the actual SNACs and queue them to be sent */
 /* 0x0002 */ faim_export int aim_ssi_reqrights(aim_session_t *sess, aim_conn_t *conn);
 /* 0x0005 */ faim_export int aim_ssi_reqdata(aim_session_t *sess, aim_conn_t *conn, time_t localstamp, fu16_t localrev);
-/* 0x0007 */ faim_export int aim_ssi_enable(aim_session_t *sess, aim_conn_t *conn);
+/* 0x0007 */ faim_export int aim_ssi_enable(aim_session_t *sess);
 /* 0x0008 */ faim_export int aim_ssi_addmoddel(aim_session_t *sess, aim_conn_t *conn);
 /* 0x0011 */ faim_export int aim_ssi_modbegin(aim_session_t *sess, aim_conn_t *conn);
 /* 0x0012 */ faim_export int aim_ssi_modend(aim_session_t *sess, aim_conn_t *conn);
--- a/src/protocols/oscar/bstream.c	Mon Mar 03 07:43:55 2003 +0000
+++ b/src/protocols/oscar/bstream.c	Mon Mar 03 08:31:55 2003 +0000
@@ -233,7 +233,8 @@
 
 	ob[len] = '\0';
 
-	return ob;}
+	return ob;
+}
 
 faim_internal int aimbs_putraw(aim_bstream_t *bs, const fu8_t *v, int len)
 {
--- a/src/protocols/oscar/oscar.c	Mon Mar 03 07:43:55 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Mon Mar 03 08:31:55 2003 +0000
@@ -596,6 +596,7 @@
 static int gaim_icqinfo          (aim_session_t *, aim_frame_t *, ...);
 static int gaim_popup            (aim_session_t *, aim_frame_t *, ...);
 #ifndef NOSSI
+static int gaim_ssi_parseerr     (aim_session_t *, aim_frame_t *, ...);
 static int gaim_ssi_parserights  (aim_session_t *, aim_frame_t *, ...);
 static int gaim_ssi_parselist    (aim_session_t *, aim_frame_t *, ...);
 static int gaim_ssi_parseack     (aim_session_t *, aim_frame_t *, ...);
@@ -1103,6 +1104,7 @@
 	aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_POP, 0x0002, gaim_popup, 0);
 	aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_INFO, gaim_icqinfo, 0);
 #ifndef NOSSI
+	aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_ERROR, gaim_ssi_parseerr, 0);
 	aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RIGHTSINFO, gaim_ssi_parserights, 0);
 	aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_LIST, gaim_ssi_parselist, 0);
 	aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_NOLIST, gaim_ssi_parselist, 0);
@@ -4220,6 +4222,31 @@
 	}
 }
 
+static int gaim_ssi_parseerr(aim_session_t *sess, aim_frame_t *fr, ...) {
+	struct gaim_connection *gc = sess->aux_data;
+	struct oscar_data *od = gc->proto_data;
+	va_list ap;
+	fu16_t reason;
+
+	va_start(ap, fr);
+	reason = (fu16_t)va_arg(ap, unsigned int);
+	va_end(ap);
+
+	debug_printf("ssi: SNAC error %hu\n", reason);
+
+	if (reason == 0x0005) {
+		do_error_dialog(_("Unable To Retrive Buddy List"), _("Gaim was temporarily unable to retrive your buddy list from the AIM servers.  Your buddy list is not lost, and will probably become available in a few hours."), GAIM_ERROR);
+	}
+
+	/* Activate SSI */
+	/* Sending the enable causes other people to be able to see you, and you to see them */
+	/* Make sure your privacy setting/invisibility is set how you want it before this! */
+	debug_printf("ssi: activating server-stored buddy list\n");
+	aim_ssi_enable(od->sess);
+
+	return 1;
+}
+
 static int gaim_ssi_parserights(aim_session_t *sess, aim_frame_t *fr, ...) {
 	struct gaim_connection *gc = sess->aux_data;
 	struct oscar_data *od = (struct oscar_data *)gc->proto_data;
@@ -4414,7 +4441,7 @@
 			char *dialog_msg = g_strdup_printf(_("The maximum number of buddies allowed in your buddy list is %d, and you have %d."
 							     "  Until you are below the limit, some buddies will not show up as online."), 
 							   od->rights.maxbuddies, tmp);
-			do_error_dialog("Maximum buddy list length exceeded.", dialog_msg, GAIM_WARNING);
+			do_error_dialog(_("Maximum buddy list length exceeded."), dialog_msg, GAIM_WARNING);
 			g_free(dialog_msg);
 		}
 		
@@ -4424,7 +4451,7 @@
 	/* Sending the enable causes other people to be able to see you, and you to see them */
 	/* Make sure your privacy setting/invisibility is set how you want it before this! */
 	debug_printf("ssi: activating server-stored buddy list\n");
-	aim_ssi_enable(sess, fr->conn);
+	aim_ssi_enable(sess);
 
 	return 1;
 }
@@ -4993,7 +5020,7 @@
 		aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gc->username);
 		break;
 	case 3:
-		list = gc->permit;
+		list = gc->account->permit;
 		at = 0;
 		while (list) {
 			at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data);
@@ -5002,7 +5029,7 @@
 		aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf);
 		break;
 	case 4:
-		list = gc->deny;
+		list = gc->account->deny;
 		at = 0;
 		while (list) {
 			at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data);
--- a/src/protocols/oscar/ssi.c	Mon Mar 03 07:43:55 2003 +0000
+++ b/src/protocols/oscar/ssi.c	Mon Mar 03 08:31:55 2003 +0000
@@ -1196,8 +1196,13 @@
  * settings into effect.
  * 
  */
-faim_export int aim_ssi_enable(aim_session_t *sess, aim_conn_t *conn)
+faim_export int aim_ssi_enable(aim_session_t *sess)
 {
+	aim_conn_t *conn;
+
+	if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_SSI)))
+		return -EINVAL;
+
 	return aim_genericreq_n(sess, conn, AIM_CB_FAM_SSI, 0x0007);
 }