pidgin: 8740eeac: Transform id-less <img> tags to links us...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sun Jun 21 18:20:35 EDT 2009


-----------------------------------------------------------------
Revision: 8740eeac007708126ac1672fb005bea399aa7f33
Ancestor: 99d11681eb284c0315d672c4282f39f175ca5d9e
Author: dmitry.petroff at gmail.com
Date: 2009-06-21T22:17:14
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/8740eeac007708126ac1672fb005bea399aa7f33

Modified files:
        COPYRIGHT ChangeLog pidgin/gtkimhtml.c

ChangeLog: 

Transform id-less <img> tags to links using src and alt attributes.

Closes #8628.

-------------- next part --------------
============================================================
--- COPYRIGHT	2146d78ee4672debf86a9962d484981925486a4d
+++ COPYRIGHT	390dbe5c16fe27da40a648e52117fa812c7d94fd
@@ -332,6 +332,7 @@ Nathan Peterson
 Luke Petre
 Diego Petten
 Nathan Peterson
+Dmitry Petroff
 Sebasti?n E. Peyrott
 Andrea Piccinelli
 Celso Pinto
============================================================
--- ChangeLog	7dd8bc0fa8b916c517a4de953f7790e0f85041a2
+++ ChangeLog	7a9af52839aed5eaff3b3116c78e4c059abcc1b4
@@ -94,6 +94,8 @@ version 2.6.0 (??/??/2009):
 	* Support saving animated custom smileys as animated images or animated
 	  custom smileys. (Andrea Piccinelli)
 	* Support for keyboard navigation on the status icon. (Li Yuan)
+	* IMG tags without 'id' attributes are turned into links to the image URL.
+	  (Dmitry Petroff)
 
 	Finch:
 	* The hardware cursor is updated correctly. This will be useful
============================================================
--- pidgin/gtkimhtml.c	dbac774b62d76fbe1371ea71c3ef06ad47d947f2
+++ pidgin/gtkimhtml.c	f357efb8979db5d0fe1608958681ea31c8ccfc1a
@@ -2996,10 +2996,21 @@ void gtk_imhtml_insert_html_at_iter(GtkI
 							break;
 
 						id = gtk_imhtml_get_html_opt(tag, "ID=");
-						if (!id)
-							break;
-						gtk_imhtml_insert_image_at_iter(imhtml, atoi(id), iter);
-						g_free(id);
+						if (id) {
+							gtk_imhtml_insert_image_at_iter(imhtml, atoi(id), iter);
+							g_free(id);
+						} else {
+							char *src, *alt;
+							src = gtk_imhtml_get_html_opt(tag, "SRC=");
+							alt = gtk_imhtml_get_html_opt(tag, "ALT=");
+							if (src) {
+								gtk_imhtml_toggle_link(imhtml, src);
+								gtk_text_buffer_insert(imhtml->text_buffer, iter, alt ? alt : src, -1);
+								gtk_imhtml_toggle_link(imhtml, NULL);
+							}
+							g_free (src);
+							g_free (alt);
+						}
 						break;
 					}
 				case 47:	/* P (opt) */


More information about the Commits mailing list