From: <dat...@us...> - 2006-05-18 15:34:20
|
Revision: 16191 Author: datallah Date: 2006-05-18 08:34:03 -0700 (Thu, 18 May 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16191&view=rev Log Message: ----------- SuperMMX submitted this patch to fix opening non-ASCII urls in win32. There are some other little changes that I've had laying around for a while here too. Modified Paths: -------------- trunk/src/win32/win32dep.c Modified: trunk/src/win32/win32dep.c =================================================================== --- trunk/src/win32/win32dep.c 2006-05-18 13:48:11 UTC (rev 16190) +++ trunk/src/win32/win32dep.c 2006-05-18 15:34:03 UTC (rev 16191) @@ -169,9 +169,8 @@ /* Get paths to special Windows folders. */ char *wgaim_get_special_folder(int folder_type) { static LPFNSHGETFOLDERPATHA MySHGetFolderPathA = NULL; + static LPFNSHGETFOLDERPATHW MySHGetFolderPathW = NULL; char *retval = NULL; -#if GLIB_CHECK_VERSION(2,6,0) - static LPFNSHGETFOLDERPATHW MySHGetFolderPathW = NULL; if (!MySHGetFolderPathW) { MySHGetFolderPathW = (LPFNSHGETFOLDERPATHW) @@ -186,7 +185,6 @@ retval = g_utf16_to_utf8(utf_16_dir, -1, NULL, NULL, NULL); } } -#endif if (!retval) { if (!MySHGetFolderPathA) { @@ -198,11 +196,7 @@ if (SUCCEEDED(MySHGetFolderPathA(NULL, folder_type, NULL, SHGFP_TYPE_CURRENT, locale_dir))) { -#if GLIB_CHECK_VERSION(2,6,0) retval = g_locale_to_utf8(locale_dir, -1, NULL, NULL, NULL); -#else - retval = g_strdup(locale_dir); -#endif } } } @@ -359,22 +353,51 @@ } void wgaim_notify_uri(const char *uri) { - SHELLEXECUTEINFO sinfo; - memset(&sinfo, 0, sizeof(sinfo)); - sinfo.cbSize = sizeof(sinfo); - sinfo.fMask = SEE_MASK_CLASSNAME; - sinfo.lpVerb = "open"; - sinfo.lpFile = uri; - sinfo.nShow = SW_SHOWNORMAL; - sinfo.lpClass = "http"; + /* We'll allow whatever URI schemes are supported by the + * default http browser. + */ - /* We'll allow whatever URI schemes are supported by the - default http browser. - */ - if(!ShellExecuteEx(&sinfo)) - gaim_debug_error("wgaim", "Error opening URI: %s error: %d\n", - uri, (int) sinfo.hInstApp); + if (G_WIN32_HAVE_WIDECHAR_API()) { + SHELLEXECUTEINFOW wsinfo; + wchar_t *w_uri; + + w_uri = g_utf8_to_utf16(uri, -1, NULL, NULL, NULL); + + memset(&wsinfo, 0, sizeof(wsinfo)); + wsinfo.cbSize = sizeof(wsinfo); + wsinfo.fMask = SEE_MASK_CLASSNAME; + wsinfo.lpVerb = L"open"; + wsinfo.lpFile = w_uri; + wsinfo.nShow = SW_SHOWNORMAL; + wsinfo.lpClass = L"http"; + + gaim_debug(GAIM_DEBUG_INFO, "wgaim_notify_uri", "The wide uri is %s\n", uri); + if(!ShellExecuteExW(&wsinfo)) + gaim_debug_error("wgaim", "Error opening URI: %s error: %d\n", + uri, (int) wsinfo.hInstApp); + + g_free(w_uri); + } else { + SHELLEXECUTEINFOA sinfo; + gchar *locale_uri; + + locale_uri = g_locale_from_utf8(uri, -1, NULL, NULL, NULL); + + memset(&sinfo, 0, sizeof(sinfo)); + sinfo.cbSize = sizeof(sinfo); + sinfo.fMask = SEE_MASK_CLASSNAME; + sinfo.lpVerb = "open"; + sinfo.lpFile = locale_uri; + sinfo.nShow = SW_SHOWNORMAL; + sinfo.lpClass = "http"; + + if(!ShellExecuteExA(&sinfo)) + gaim_debug_error("wgaim", "Error opening URI: %s error: %d\n", + uri, (int) sinfo.hInstApp); + + g_free(locale_uri); + } } void wgaim_init(HINSTANCE hint) { @@ -407,11 +430,10 @@ /* Set Environmental Variables */ /* Tell perl where to find Gaim's perl modules */ perlenv = g_getenv("PERL5LIB"); - newenv = g_strdup_printf("PERL5LIB=%s%s%s%s", + newenv = g_strdup_printf("PERL5LIB=%s%s%s" G_DIR_SEPARATOR_S "perlmod;", perlenv ? perlenv : "", perlenv ? ";" : "", - wgaim_install_dir(), - "\\perlmod;"); + wgaim_install_dir()); if (putenv(newenv) < 0) gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "putenv failed\n"); g_free(newenv); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |