pidgin: e8f9d9be: Fix the win32 URIs to only linkify if th...

datallah at pidgin.im datallah at pidgin.im
Mon Oct 19 18:41:18 EDT 2009


-----------------------------------------------------------------
Revision: e8f9d9be93f38aa597367b8f9bbb6322995e5ff3
Ancestor: 0fbf8ac649fc5ddcc2cdea5244045af35140a6b7
Author: datallah at pidgin.im
Date: 2009-10-19T22:34:24
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/e8f9d9be93f38aa597367b8f9bbb6322995e5ff3

Modified files:
        pidgin/gtkutils.c

ChangeLog: 

Fix the win32 URIs to only linkify if the protocol is followed by a colon.

-------------- next part --------------
============================================================
--- pidgin/gtkutils.c	31bc01f9ea416b044554581cc4176409c1968d20
+++ pidgin/gtkutils.c	e54a0f662f3ae32f2dd295d9569deb478d4d1fde
@@ -75,7 +75,7 @@ static guint accels_save_timer = 0;
 } AopMenu;
 
 static guint accels_save_timer = 0;
-static GList *gnome_url_handlers = NULL;
+static GSList *registered_url_handlers = NULL;
 
 static gboolean
 url_clicked_idle_cb(gpointer data)
@@ -3890,7 +3890,7 @@ register_gnome_url_handlers(void)
 				start += sizeof("/desktop/gnome/url-handlers/") - 1;
 
 				protocol = g_strdup_printf("%s:", start);
-				gnome_url_handlers = g_list_prepend(gnome_url_handlers, protocol);
+				registered_url_handlers = g_slist_prepend(registered_url_handlers, protocol);
 				gtk_imhtml_class_register_protocol(protocol, url_clicked_cb, link_context_menu);
 			}
 			start = c + 1;
@@ -3898,7 +3898,7 @@ register_gnome_url_handlers(void)
 	}
 	g_free(tmp);
 
-	return (gnome_url_handlers != NULL);
+	return (registered_url_handlers != NULL);
 }
 
 #ifdef _WIN32
@@ -3910,16 +3910,18 @@ winpidgin_register_win32_url_handlers(vo
 
 	do {
 		DWORD nameSize = 256;
-		char protocol[256];
+		char start[256];
 		/* I don't think we need to worry about non-ASCII protocol names */
-		ret = RegEnumKeyExA(HKEY_CLASSES_ROOT, idx++, protocol, &nameSize,
+		ret = RegEnumKeyExA(HKEY_CLASSES_ROOT, idx++, start, &nameSize,
 							NULL, NULL, NULL, NULL);
 		if (ret == ERROR_SUCCESS) {
 			HKEY reg_key = NULL;
-			ret = RegOpenKeyExA(HKEY_CLASSES_ROOT, protocol, 0, KEY_READ, &reg_key);
+			ret = RegOpenKeyExA(HKEY_CLASSES_ROOT, start, 0, KEY_READ, &reg_key);
 			if (ret == ERROR_SUCCESS) {
 				ret = RegQueryValueExA(reg_key, "URL Protocol", NULL, NULL, NULL, NULL);
 				if (ret == ERROR_SUCCESS) {
+					gchar *protocol = g_strdup_printf("%s:", start);
+					registered_url_handlers = g_slist_prepend(registered_url_handlers, protocol);
 					/* We still pass everything to the "http" "open" handler for security reasons */
 					gtk_imhtml_class_register_protocol(protocol, url_clicked_cb, link_context_menu);
 				}
@@ -3964,16 +3966,16 @@ void pidgin_utils_uninit(void)
 	gtk_imhtml_class_register_protocol("open://", NULL, NULL);
 
 	/* If we have GNOME handlers registered, unregister them. */
-	if (gnome_url_handlers)
+	if (registered_url_handlers)
 	{
-		GList *l;
-		for (l = gnome_url_handlers ; l ; l = l->next)
+		GSList *l;
+		for (l = registered_url_handlers; l; l = l->next)
 		{
 			gtk_imhtml_class_register_protocol((char *)l->data, NULL, NULL);
 			g_free(l->data);
 		}
-		g_list_free(gnome_url_handlers);
-		gnome_url_handlers = NULL;
+		g_slist_free(registered_url_handlers);
+		registered_url_handlers = NULL;
 		return;
 	}
 


More information about the Commits mailing list