changeset 10782:93fd90cbf45c

[gaim-migrate @ 12410] Mark is right, I should have committed grim's dnd fix here also committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Mon, 04 Apr 2005 12:41:08 +0000
parents f6d630211935
children 48779a02fe99
files src/gtkimhtml.c
diffstat 1 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkimhtml.c	Mon Apr 04 04:35:57 2005 +0000
+++ b/src/gtkimhtml.c	Mon Apr 04 12:41:08 2005 +0000
@@ -1536,6 +1536,7 @@
 	char *text = sd->data;
 	GtkTextMark *mark = gtk_text_buffer_get_insert(imhtml->text_buffer);
 	GtkTextIter iter;
+	gint i = 0;
 
 	gtk_text_buffer_get_iter_at_mark(imhtml->text_buffer, &iter, mark);
 
@@ -1545,21 +1546,32 @@
 			gaim_str_strip_cr(sd->data);
 
 			links = g_strsplit(sd->data, "\n", 0);
-			while((link = *links++) != NULL){
+			while((link = links[i]) != NULL){
 				if(gaim_str_has_prefix(link, "http://") ||
 				   gaim_str_has_prefix(link, "https://") ||
-				   gaim_str_has_prefix(link, "ftp://")){
-					gtk_imhtml_insert_link(imhtml, mark, link, link);
+                   gaim_str_has_prefix(link, "ftp://"))
+				{
+					gchar *label;
+
+					if(links[i + 1])
+						i++;
+
+					label = links[i];
+
+					gtk_imhtml_insert_link(imhtml, mark, link, label);
 				} else if (link=='\0') {
 					/* Ignore blank lines */
 				} else {
 					/* Special reasons, aka images being put in via other tag, etc. */
 					/* ... don't pretend we handled it if we didn't */
 					gtk_drag_finish(dc, FALSE, FALSE, t);
+					g_strfreev(links);
 					return;
 				}
+
+				i++;
 			}
-			g_strfreev(links);
+            g_strfreev(links);
 			break;
 		case GTK_IMHTML_DRAG_HTML:
 			{