pidgin: e4d1db22: Register URL handlers for everything tha...
datallah at pidgin.im
datallah at pidgin.im
Tue Oct 13 23:23:07 EDT 2009
-----------------------------------------------------------------
Revision: e4d1db2206f399caa7a86f211435f43b77a9d936
Ancestor: 667654b3309008b53bf4d9df02bd401d1ede8db5
Author: datallah at pidgin.im
Date: 2009-10-14T03:11:27
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/e4d1db2206f399caa7a86f211435f43b77a9d936
Modified files:
pidgin/gtkutils.c
ChangeLog:
Register URL handlers for everything that Windows has knows about like we do
for GNOME.
We still pass everything to the "http" "open" handler for security reasons.
Fixes #10462
-------------- next part --------------
============================================================
--- pidgin/gtkutils.c 6cb3b55879175c36c950e62e16b132d7f036b120
+++ pidgin/gtkutils.c 31bc01f9ea416b044554581cc4176409c1968d20
@@ -3901,6 +3901,40 @@ register_gnome_url_handlers(void)
return (gnome_url_handlers != NULL);
}
+#ifdef _WIN32
+static void
+winpidgin_register_win32_url_handlers(void)
+{
+ int idx = 0;
+ LONG ret = ERROR_SUCCESS;
+
+ do {
+ DWORD nameSize = 256;
+ char protocol[256];
+ /* I don't think we need to worry about non-ASCII protocol names */
+ ret = RegEnumKeyExA(HKEY_CLASSES_ROOT, idx++, protocol, &nameSize,
+ NULL, NULL, NULL, NULL);
+ if (ret == ERROR_SUCCESS) {
+ HKEY reg_key = NULL;
+ ret = RegOpenKeyExA(HKEY_CLASSES_ROOT, protocol, 0, KEY_READ, ®_key);
+ if (ret == ERROR_SUCCESS) {
+ ret = RegQueryValueExA(reg_key, "URL Protocol", NULL, NULL, NULL, NULL);
+ if (ret == ERROR_SUCCESS) {
+ /* We still pass everything to the "http" "open" handler for security reasons */
+ gtk_imhtml_class_register_protocol(protocol, url_clicked_cb, link_context_menu);
+ }
+ RegCloseKey(reg_key);
+ }
+ ret = ERROR_SUCCESS;
+ }
+ } while (ret == ERROR_SUCCESS);
+
+ if (ret != ERROR_NO_MORE_ITEMS)
+ purple_debug_error("winpidgin", "Error iterating HKEY_CLASSES_ROOT subkeys: %ld\n",
+ ret);
+}
+#endif
+
void pidgin_utils_init(void)
{
gtk_imhtml_class_register_protocol("http://", url_clicked_cb, link_context_menu);
@@ -3918,6 +3952,11 @@ void pidgin_utils_init(void)
/* If we're under GNOME, try registering the system URL handlers. */
if (purple_running_gnome())
register_gnome_url_handlers();
+
+#ifdef _WIN32
+ winpidgin_register_win32_url_handlers();
+#endif
+
}
void pidgin_utils_uninit(void)
More information about the Commits
mailing list