changeset 2979:8e924e4aa256

[gaim-migrate @ 2992] I'll never tell... committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Sat, 23 Feb 2002 22:50:44 +0000
parents 1c7d627df5d5
children f47ed6bc470d
files src/away.c src/buddy.c src/conversation.c src/protocols/oscar/admin.c src/protocols/oscar/aim.h src/protocols/oscar/info.c src/protocols/oscar/oscar.c src/protocols/yahoo/yahoo.c src/server.c
diffstat 9 files changed, 77 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/src/away.c	Sat Feb 23 04:29:48 2002 +0000
+++ b/src/away.c	Sat Feb 23 22:50:44 2002 +0000
@@ -73,7 +73,6 @@
 			cnv = new_conversation(qm->name);
 		if (g_slist_index(connections, qm->gc) >= 0)
 			set_convo_gc(cnv, qm->gc);
-
 		write_to_conv(cnv, qm->message, qm->flags, NULL, qm->tm, qm->len);
 
 		message_queue = g_slist_remove(message_queue, qm);
--- a/src/buddy.c	Sat Feb 23 04:29:48 2002 +0000
+++ b/src/buddy.c	Sat Feb 23 22:50:44 2002 +0000
@@ -2133,6 +2133,7 @@
 					write_to_conv(c, tmp, WFLAG_SYSTEM, NULL, time(NULL), -1);
 				} else if (clistqueue && find_queue_total_by_name(b->name)) {
 					struct queued_message *qm = g_new0(struct queued_message, 1);
+					g_snprintf(qm->name, sizeof(qm->name), "%s", b->name);
 					qm->message = g_strdup_printf(_("%s logged in."), b->name);
 					qm->gc = gc;
 					qm->tm = time(NULL);
@@ -2196,6 +2197,7 @@
 				write_to_conv(c, tmp, WFLAG_SYSTEM, NULL, time(NULL), -1);
 			} else if (clistqueue && find_queue_total_by_name(b->name)) {
 				struct queued_message *qm = g_new0(struct queued_message, 1);
+				g_snprintf(qm->name, sizeof(qm->name), "%s", b->name);
 				qm->message = g_strdup_printf(_("%s logged out."), b->name);
 				qm->gc = gc;
 				qm->tm = time(NULL);
--- a/src/conversation.c	Sat Feb 23 04:29:48 2002 +0000
+++ b/src/conversation.c	Sat Feb 23 22:50:44 2002 +0000
@@ -2867,15 +2867,19 @@
 						MAX(gdk_pixbuf_get_height(buf) * SCALE(c->anim) /
 						    gdk_pixbuf_animation_get_height(c->anim), 1),
 						GDK_INTERP_NEAREST);
-		gdk_pixbuf_render_pixmap_and_mask(scale, &src, NULL, 0);
+		gdk_pixbuf_render_pixmap_and_mask(scale, &src, &bm, 100);
 		gdk_pixbuf_unref(scale);
-		gtk_pixmap_get(GTK_PIXMAP(c->icon), &pm, &bm);
+		gtk_pixmap_get(GTK_PIXMAP(c->icon), &pm, NULL);
 		gc = gdk_gc_new(pm);
-		gdk_draw_pixmap(pm, gc, src, 0, 0,
-				MAX(gdk_pixbuf_frame_get_x_offset(frame) * SCALE(c->anim) /
-				    gdk_pixbuf_animation_get_width(c->anim), 1),
-				MAX(gdk_pixbuf_frame_get_y_offset(frame) * SCALE(c->anim) /
-				    gdk_pixbuf_animation_get_height(c->anim), 1), -1, -1);
+		gdk_gc_set_clip_mask(gc, bm);
+
+		gdk_gc_set_clip_origin(gc, gdk_pixbuf_frame_get_x_offset(frame) *
+				       SCALE(c->anim)/gdk_pixbuf_get_width(scale),  
+				       gdk_pixbuf_frame_get_y_offset(frame));   
+		gdk_draw_pixmap(pm, gc, src, 0, 0, gdk_pixbuf_frame_get_x_offset(frame)*
+				SCALE(c->anim)/gdk_pixbuf_get_width(scale),
+				gdk_pixbuf_frame_get_y_offset(frame),-1,-1);
+		
 		gdk_pixmap_unref(src);
 		gtk_widget_queue_draw(c->icon);
 		gdk_gc_unref(gc);
@@ -2888,7 +2892,7 @@
 						MAX(gdk_pixbuf_get_height(buf) * SCALE(c->anim) /
 						    gdk_pixbuf_animation_get_height(c->anim), 1),
 						GDK_INTERP_NEAREST);
-		gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 0);
+		gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100);
 		gdk_pixbuf_unref(scale);
 		gtk_pixmap_set(GTK_PIXMAP(c->icon), pm, bm);
 		gdk_pixmap_unref(pm);
@@ -2904,7 +2908,7 @@
 						MAX(gdk_pixbuf_get_height(buf) * SCALE(c->anim) /
 						    gdk_pixbuf_animation_get_height(c->anim), 1),
 						GDK_INTERP_NEAREST);
-		gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 0);
+		gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100);
 		gdk_pixbuf_unref(scale);
 		gtk_pixmap_set(GTK_PIXMAP(c->icon), pm, bm);
 		gdk_pixmap_unref(pm);
--- a/src/protocols/oscar/admin.c	Sat Feb 23 04:29:48 2002 +0000
+++ b/src/protocols/oscar/admin.c	Sat Feb 23 22:50:44 2002 +0000
@@ -173,3 +173,25 @@
 	return 0;
 }
 
+faim_export int aim_admin_setnick(aim_session_t *sess, aim_conn_t *conn, const char *newnick)
+{
+	aim_frame_t *tx;
+	aim_snacid_t snacid;
+	aim_tlvlist_t *tl = NULL;
+
+	if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+2+strlen(newnick))))
+		return -ENOMEM;
+
+	snacid = aim_cachesnac(sess, 0x0007, 0x0004, 0x0000, NULL, 0);
+	aim_putsnac(&tx->data, 0x0007, 0x0004, 0x0000, snacid);
+
+	aim_addtlvtochain_raw(&tl, 0x0001, strlen(newnick), newnick);
+	
+	aim_writetlvchain(&tx->data, &tl);
+	aim_freetlvchain(&tl);
+	
+	aim_tx_enqueue(sess, tx);
+
+
+	return 0;
+}
--- a/src/protocols/oscar/aim.h	Sat Feb 23 04:29:48 2002 +0000
+++ b/src/protocols/oscar/aim.h	Sat Feb 23 22:50:44 2002 +0000
@@ -841,7 +841,7 @@
 #define AIM_CAPS_SENDBUDDYLIST  0x00000100
 #define AIM_CAPS_GAMES2         0x00000200
 #define AIM_CAPS_ICQ            0x00000400
-#define AIM_CAPS_ABINTERNAL     0x00000800
+#define AIM_CAPS_APINFO         0x00000800
 #define AIM_CAPS_ICQRTF		0x00001000
 #define AIM_CAPS_EMPTY		0x00002000
 #define AIM_CAPS_ICQSERVERRELAY 0x00004000
@@ -938,6 +938,7 @@
 faim_export int aim_admin_reqconfirm(aim_session_t *sess, aim_conn_t *conn);
 faim_export int aim_admin_getinfo(aim_session_t *sess, aim_conn_t *conn, fu16_t info);
 faim_export int aim_admin_setemail(aim_session_t *sess, aim_conn_t *conn, const char *newemail);
+faim_export int aim_admin_setnick(aim_session_t *sess, aim_conn_t *conn, const char *newnick);
 
 /* aim_buddylist.c */
 faim_export int aim_add_buddy(aim_session_t *, aim_conn_t *, const char *);
--- a/src/protocols/oscar/info.c	Sat Feb 23 04:29:48 2002 +0000
+++ b/src/protocols/oscar/info.c	Sat Feb 23 22:50:44 2002 +0000
@@ -190,10 +190,6 @@
 	 {0x09, 0x46, 0x13, 0x4b, 0x4c, 0x7f, 0x11, 0xd1,
 	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
 
-	{AIM_CAPS_ABINTERNAL,
-	 {0x09, 0x46, 0x13, 0x4f, 0x4c, 0x7f, 0x11, 0xd1,
-	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
-
 	{AIM_CAPS_ICQRTF,
 	 {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34, 
 	  0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x92}},
@@ -210,6 +206,13 @@
 	 {0xf2, 0xe7, 0xc7, 0xf4, 0xfe, 0xad, 0x4d, 0xfb,
 	  0xb2, 0x35, 0x36, 0x79, 0x8b, 0xdf, 0x00, 0x00}},
 
+	{AIM_CAPS_APINFO, 
+         {0xAA, 0x4A, 0x32, 0xB5,
+	         0xF8, 0x84,
+                0x48, 0xc6,
+	         0xA3, 0xD7,
+	         0x8C, 0x50, 0x97, 0x19, 0xFD, 0x5B}},
+
 	{AIM_CAPS_LAST}
 };
 
--- a/src/protocols/oscar/oscar.c	Sat Feb 23 04:29:48 2002 +0000
+++ b/src/protocols/oscar/oscar.c	Sat Feb 23 22:50:44 2002 +0000
@@ -88,6 +88,8 @@
 	gboolean reqemail;
 	gboolean setemail;
 	char *email;
+	gboolean setnick;
+	char *newsn;
 	gboolean chpass;
 	char *oldp;
 	char *newp;
@@ -2073,6 +2075,13 @@
 		od->newp = NULL;
 		od->chpass = FALSE;
 	}
+	if (od->setnick) {
+		debug_printf("formatting screenname\n");
+		aim_admin_setnick(sess, fr->conn, od->newsn);
+		g_free(od->newsn);
+		od->newsn = NULL;
+		od->setnick = FALSE;
+	}
 	if (od->conf) {
 		debug_printf("confirming account\n");
 		aim_admin_reqconfirm(sess, fr->conn);
@@ -2986,6 +2995,21 @@
 	}
 }
 
+static void oscar_format_screenname(struct gaim_connection *gc, char *nick) {
+	struct oscar_data *od = gc->proto_data;
+	if (!strcmp(normalize(nick), gc->username)) {
+		if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) {
+			od->setnick = TRUE;
+			od->newsn = g_strdup(nick);
+			aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH);
+		} else {
+			aim_admin_setnick(od->sess, aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH), nick);
+		}
+	} else {
+		do_error_dialog("The new formatting is invalid.", "Gaim");
+	}
+}
+
 static void oscar_do_action(struct gaim_connection *gc, char *act)
 {
 	struct oscar_data *od = gc->proto_data;
@@ -2995,6 +3019,9 @@
 		show_set_info(gc);
 	} else if (!strcmp(act, "Change Password")) {
 		show_change_passwd(gc);
+	} else if (!strcmp(act, "Format Screenname")) {
+		do_prompt_dialog("New screenname formatting:", 
+				 gc->displayname, gc, oscar_format_screenname, NULL);
 	} else if (!strcmp(act, "Confirm Account")) {
 		if (!conn) {
 			od->conf = TRUE;
@@ -3021,6 +3048,7 @@
 	m = g_list_append(m, "Set User Info");
 	m = g_list_append(m, NULL);
 	m = g_list_append(m, "Change Password");
+	m = g_list_append(m, "Format Screenname");
 	m = g_list_append(m, "Confirm Account");
 	m = g_list_append(m, "Display Current Registered Address");
 	m = g_list_append(m, "Change Current Registered Address");
--- a/src/protocols/yahoo/yahoo.c	Sat Feb 23 04:29:48 2002 +0000
+++ b/src/protocols/yahoo/yahoo.c	Sat Feb 23 22:50:44 2002 +0000
@@ -405,11 +405,8 @@
 			break;
 		case 60: /* no clue */
 			 break;
-		case 16: /* Maybe this does more.  Maybe it doesn't. */
-			do_error_dialog("This version of the Yahoo! Messenger plugin is no longer"
-					"being supported.  The latest version of Gaim is available"
-					"at " WEBSITE ".\n\nYou may be disconnected shortly.",
-					"Gaim -- Yahoo! Error");
+		case 16: /* Custom error message */
+			do_error_dialog(pair->value, "Gaim -- Yahoo! Error");
 			break;
 		default:
 			debug_printf("unknown status key %d\n", pair->key);
--- a/src/server.c	Sat Feb 23 04:29:48 2002 +0000
+++ b/src/server.c	Sat Feb 23 22:50:44 2002 +0000
@@ -621,6 +621,7 @@
 			qm->gc = gc;
 			qm->tm = mtime;
 			qm->flags = WFLAG_SEND | WFLAG_AUTO;
+			qm->len = -1;
 			message_queue = g_slist_append(message_queue, qm);
 		} else if (cnv != NULL)
 			write_to_conv(cnv, away_subs(tmpmsg, alias), WFLAG_SEND | WFLAG_AUTO, NULL,