pidgin: 5ae02f93: Gadu-Gadu: Fix sending inline images to ...

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Fri Mar 25 00:42:07 EDT 2011


----------------------------------------------------------------------
Revision: 5ae02f9359383aa843dd30fc25c0e264c120d422
Parent:   ffba8ea49b1824cc24c70177597ba47a8bc78d65
Author:   rekkanoryo at pidgin.im
Date:     03/25/11 00:32:46
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/5ae02f9359383aa843dd30fc25c0e264c120d422

Changelog: 

Gadu-Gadu: Fix sending inline images to remote users.  Also fix sending images
larger than 256 KB.  Fixes #13580.

Changes against parent ffba8ea49b1824cc24c70177597ba47a8bc78d65

  patched  COPYRIGHT
  patched  ChangeLog
  patched  libpurple/protocols/gg/gg.c

-------------- next part --------------
============================================================
--- ChangeLog	42fb976f1fb42c05e3b0c47659d0c25215c81833
+++ ChangeLog	cee00db7c3d462e82ff26756c0370b7b7bc6e354
@@ -28,6 +28,8 @@ version 2.8.0 (??/??/????):
 	  Klinikowski) (#13525)
 	* Suppress blank messages that happen when sending inline images. (Tomasz
 	  Wasilczyk) (#13554)
+	* Fix sending inline images, including images larger than 256 KB, to remote
+	  users. (Tomasz Wasilczyk) (#13580)
 
 	ICQ:
 	* Fix unsetting your mood when "None" is selected. (#7431)
============================================================
--- libpurple/protocols/gg/gg.c	95a68cb4aa97b3b2cd555046593941e161275277
+++ libpurple/protocols/gg/gg.c	b05c81008b4ae32f5a6d77b49f436a29c69353d6
@@ -1582,9 +1582,9 @@ static void ggp_send_image_handler(Purpl
 {
 	GGPInfo *info = gc->proto_data;
 	PurpleStoredImage *image;
-	gint imgid = GPOINTER_TO_INT(g_hash_table_lookup(info->pending_images, &ev->event.image_request.crc32));
+	gint imgid = GPOINTER_TO_INT(g_hash_table_lookup(info->pending_images, GINT_TO_POINTER(ev->event.image_request.crc32)));
 
-	purple_debug_info("gg", "ggp_send_image_handler: image request received, crc32: %u\n", ev->event.image_request.crc32);
+	purple_debug_info("gg", "ggp_send_image_handler: image request received, crc32: %u, imgid: %d\n", ev->event.image_request.crc32, imgid);
 
 	if(imgid)
 	{
@@ -1599,7 +1599,7 @@ static void ggp_send_image_handler(Purpl
 		} else {
 			purple_debug_error("gg", "ggp_send_image_handler: image imgid: %i, crc: %u in hash but not found in imgstore!\n", imgid, ev->event.image_request.crc32);
 		}
-		g_hash_table_remove(info->pending_images, &ev->event.image_request.crc32);
+		g_hash_table_remove(info->pending_images, GINT_TO_POINTER(ev->event.image_request.crc32));
 	}
 }
 
@@ -2008,7 +2008,7 @@ static void ggp_login(PurpleAccount *acc
 	info->token = NULL;
 	info->searches = ggp_search_new();
 	info->pending_richtext_messages = NULL;
-	info->pending_images = g_hash_table_new(g_int_hash, g_int_equal);
+	info->pending_images = g_hash_table_new(g_direct_hash, g_direct_equal);
 	info->status_broadcasting = purple_account_get_bool(account, "status_broadcasting", TRUE);
 	
 	gc->proto_data = info;
@@ -2149,9 +2149,9 @@ static int ggp_send_im(PurpleConnection 
 				const char *image_filename = purple_imgstore_get_filename(image);
 				uint32_t crc32 = gg_crc32(0, image_bin, image_size);
 
-				g_hash_table_insert(info->pending_images, &crc32, GINT_TO_POINTER(atoi(id)));
+				g_hash_table_insert(info->pending_images, GINT_TO_POINTER(crc32), GINT_TO_POINTER(atoi(id)));
 				purple_imgstore_ref(image);
-				purple_debug_info("gg", "ggp_send_im_richtext: got crc: %i for imgid: %i\n", crc32, atoi(id));
+				purple_debug_info("gg", "ggp_send_im_richtext: got crc: %u for imgid: %i\n", crc32, atoi(id));
 
 				actformat.font = GG_FONT_IMAGE;
 				actformat.position = pos;
@@ -2162,15 +2162,14 @@ static int ggp_send_im(PurpleConnection 
 
 				if (actimage.size > 255000) {
 					purple_debug_warning("gg", "ggp_send_im_richtext: image over 255kb!\n");
-					continue;
-				}
+				} else {
+					purple_debug_info("gg", "ggp_send_im_richtext: adding images to richtext, size: %i, crc32: %u, name: %s\n", actimage.size, actimage.crc32, image_filename);
 
-				purple_debug_info("gg", "ggp_send_im_richtext: adding images to richtext, size: %i, crc32: %u, name: %s\n", actimage.size, actimage.crc32, image_filename);
-
-				memcpy(format + format_length, &actformat, sizeof(actformat));
-				format_length += sizeof(actformat);
-				memcpy(format + format_length, &actimage, sizeof(actimage));
-				format_length += sizeof(actimage);
+					memcpy(format + format_length, &actformat, sizeof(actformat));
+					format_length += sizeof(actformat);
+					memcpy(format + format_length, &actimage, sizeof(actimage));
+					format_length += sizeof(actimage);
+				}
 			} else {
 				purple_debug_error("gg", "ggp_send_im_richtext: image not found in the image store!");
 			}
============================================================
--- COPYRIGHT	7ea145d0a783126623af5638f3052aa2b30af77d
+++ COPYRIGHT	c0841efd8ba0861cf32c71a3e1ea921432c81366
@@ -563,6 +563,7 @@ Denis Washington
 Eric Warmenhoven
 Adam J. Warrington
 Denis Washington
+Tomasz Wasilczyk
 Zsombor Welker
 Andrew Wellington
 Adam Wendt


More information about the Commits mailing list