Mercurial > pidgin
annotate src/win_gaim.c @ 12115:e9790eb93216
[gaim-migrate @ 14415]
quoth charkins:
" This patch has a few small fixes for the visibility
stuff in gtkblist.c.
First, tracking of the ICONIFIED state of the blist was
removed. This was intended to allow the blist to
"remember" if it was minimized between restarts.
Unfortunately, this is not possible because the
ICONIFIED state gets set when the blist is on a
different desktop with many window managers.
Second, while talking about the ICONIFIED issue on
#gtk@GIMPNet, muntyan_ asked about a bug where the
blist would get shown on an account re-connect with
1.5.0. Luke mentioned something about this with cvs as
well. This patch introduces a check in
gaim_gtk_blist_show() to prevent the window from being
shown if it already exists and is visible.
Third, sadrul pointed me to a one-line fix for the
missing blist on startup. I added a second line to make
sure the blist restores its proper size as well.
Finally, when the last visibility manager is removed,
gaim will now minimize the blist if it was previously
hidden, rather than showing it. This could prevent a
race condition with out-of-process applets, preventing
gaim from maintaining the visibility state properly
between restarts.
This was 'cvs diff'ed against the last available anon
cvs from Friday. Hopefully it'll apply cleanly."
it did.
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 16 Nov 2005 17:55:26 +0000 |
parents | 8d5ebd7d4ec3 |
children | bde1c75190b2 |
rev | line source |
---|---|
4490 | 1 /* |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
2 * win_gaim.c |
4490 | 3 * |
4 * Date: June, 2002 | |
5 * Description: Entry point for win32 gaim, and various win32 dependant | |
6 * routines. | |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
7 * |
8046 | 8 * Gaim is the legal property of its developers, whose names are too numerous |
9 * to list here. Please refer to the COPYRIGHT file distributed with this | |
10 * source distribution. | |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
11 * |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
12 * This program is free software; you can redistribute it and/or modify |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
13 * it under the terms of the GNU General Public License as published by |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
14 * the Free Software Foundation; either version 2 of the License, or |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
15 * (at your option) any later version. |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
16 * |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
17 * This program is distributed in the hope that it will be useful, |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
20 * GNU General Public License for more details. |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
21 * |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
22 * You should have received a copy of the GNU General Public License |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
23 * along with this program; if not, write to the Free Software |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
25 * |
4490 | 26 */ |
11060
52d6b10025ca
[gaim-migrate @ 13014]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10898
diff
changeset
|
27 |
11570
f1e07c3332d9
[gaim-migrate @ 13838]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11561
diff
changeset
|
28 /* This is for ATTACH_PARENT_PROCESS */ |
f1e07c3332d9
[gaim-migrate @ 13838]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11561
diff
changeset
|
29 #ifndef _WIN32_WINNT |
f1e07c3332d9
[gaim-migrate @ 13838]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11561
diff
changeset
|
30 #define _WIN32_WINNT 0x501 |
f1e07c3332d9
[gaim-migrate @ 13838]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11561
diff
changeset
|
31 #endif |
4490 | 32 #include <windows.h> |
7477
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
33 #include <fcntl.h> |
4490 | 34 #include <stdlib.h> |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
35 #include <string.h> |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
36 #include <stdio.h> |
4490 | 37 |
11193
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
38 #define WIN32_PROXY_REGKEY "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings" |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
39 |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
40 typedef int (CALLBACK* LPFNGAIMMAIN)(HINSTANCE, int, char**); |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
41 typedef void (CALLBACK* LPFNSETDLLDIRECTORY)(LPCTSTR); |
11060
52d6b10025ca
[gaim-migrate @ 13014]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10898
diff
changeset
|
42 typedef BOOL (CALLBACK* LPFNATTACHCONSOLE)(DWORD); |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
43 |
4490 | 44 /* |
45 * PROTOTYPES | |
46 */ | |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
47 static LPFNGAIMMAIN gaim_main = NULL; |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
48 static LPFNSETDLLDIRECTORY MySetDllDirectory = NULL; |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
49 |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
50 |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
51 static BOOL read_reg_string(HKEY key, char* sub_key, char* val_name, LPBYTE data, LPDWORD data_len) { |
10688
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
52 HKEY hkey; |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
53 BOOL ret = FALSE; |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
54 LONG retv; |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
55 |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
56 if (ERROR_SUCCESS == (retv = RegOpenKeyEx(key, sub_key, 0, |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
57 KEY_QUERY_VALUE, &hkey))) { |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
58 if (ERROR_SUCCESS == (retv = RegQueryValueEx(hkey, val_name, |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
59 NULL, NULL, data, data_len))) |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
60 ret = TRUE; |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
61 else { |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
62 TCHAR szBuf[80]; |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
63 |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
64 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
65 NULL, retv, 0, |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
66 (LPTSTR) &szBuf, sizeof(szBuf), NULL); |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
67 |
10688
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
68 printf("Could not read reg key '%s' subkey '%s' value: '%s'\nError: (%ld) %s\n", |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
69 ((key == HKEY_LOCAL_MACHINE) ? "HKLM" : |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
70 (key == HKEY_CURRENT_USER) ? "HKCU" : |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
71 "???"), |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
72 sub_key, val_name, retv, szBuf); |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
73 } |
11193
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
74 RegCloseKey(hkey); |
10688
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
75 } |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
76 else { |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
77 TCHAR szBuf[80]; |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
78 |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
79 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, retv, 0, |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
80 (LPTSTR) &szBuf, sizeof(szBuf), NULL); |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
81 printf("Could not open reg subkey: %s\nError: (%ld) %s\n", |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
82 sub_key, retv, szBuf); |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
83 } |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
84 |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
85 return ret; |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
86 } |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
87 |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
88 static void dll_prep() { |
11561
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
89 char path[MAX_PATH + 1]; |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
90 HMODULE hmod; |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
91 HKEY hkey; |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
92 #ifdef PORTABLE |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
93 /* We assume that GTK+ is installed under \\path\to\Gaim\..\GTK |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
94 * First we find \\path\to |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
95 */ |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
96 if (GetModuleFileName(NULL, path, MAX_PATH) != 0) { |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
97 char *tmp = path; |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
98 char *prev = NULL; |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
99 char *prev2 = NULL; |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
100 |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
101 while ((tmp = strchr(tmp, '\\'))) { |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
102 prev2 = prev; |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
103 prev = tmp; |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
104 tmp++; |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
105 } |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
106 |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
107 if (prev2) { |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
108 prev2[0] = '\0'; |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
109 } |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
110 } else { |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
111 printf("Unable to determine current executable path. \n" |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
112 "This will prevent the settings dir from being set.\n" |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
113 "Assuming GTK+ is in the PATH.\n"); |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
114 } |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
115 |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
116 if (path) { |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
117 /* Set up the settings dir base to be \\path\to |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
118 * The actual settings dir will be \\path\to\.gaim */ |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
119 char settingsdir[strlen(path) + strlen("GAIMHOME=") + 1]; |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
120 char aspelldir[strlen(path) + strlen("GAIM_ASPELL_DIR=\\Aspell\\bin") + 1]; |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
121 |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
122 snprintf(settingsdir, sizeof(settingsdir), "GAIMHOME=%s", path); |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
123 printf("Setting settings dir: %s\n", settingsdir); |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
124 putenv(settingsdir); |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
125 |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
126 snprintf(aspelldir, sizeof(aspelldir), "GAIM_ASPELL_DIR=%s\\Aspell\\bin", path); |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
127 printf(aspelldir); |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
128 |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
129 /* set the GTK+ path to be \\path\to\GTK\bin */ |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
130 strcat(path, "\\GTK\\bin"); |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
131 } else |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
132 return; |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
133 #else /* PORTABLE */ |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
134 char gtkpath[MAX_PATH + 1]; |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
135 DWORD plen; |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
136 |
10688
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
137 plen = sizeof(gtkpath); |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
138 hkey = HKEY_CURRENT_USER; |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
139 if (!read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "Path", |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
140 (LPBYTE) >kpath, &plen)) { |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
141 hkey = HKEY_LOCAL_MACHINE; |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
142 if (!read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "Path", |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
143 (LPBYTE) >kpath, &plen)) { |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
144 printf("GTK+ Path Registry Key not found. " |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
145 "Assuming GTK+ is in the PATH.\n"); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
146 return; |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
147 } |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
148 } |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
149 |
10688
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
150 /* this value is replaced during a successful RegQueryValueEx() */ |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
151 plen = sizeof(path); |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
152 /* Determine GTK+ dll path .. */ |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
153 if (!read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "DllPath", |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
154 (LPBYTE) &path, &plen)) { |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
155 strcpy(path, gtkpath); |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
156 strcat(path, "\\bin"); |
7818a5e9e3a2
[gaim-migrate @ 12237]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10521
diff
changeset
|
157 } |
11561
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
158 #endif |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
159 printf("GTK+ path found: %s\n", path); |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
160 |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
161 if ((hmod = GetModuleHandle("kernel32.dll"))) { |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
162 MySetDllDirectory = (LPFNSETDLLDIRECTORY) GetProcAddress( |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
163 hmod, "SetDllDirectoryA"); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
164 if (!MySetDllDirectory) |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
165 printf("SetDllDirectory not supported\n"); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
166 } else |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
167 printf("Error getting kernel32.dll module handle\n"); |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
168 |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
169 /* For Windows XP SP1+ / Server 2003 we use SetDllDirectory to avoid dll hell */ |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
170 if (MySetDllDirectory) { |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
171 printf("Using SetDllDirectory\n"); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
172 MySetDllDirectory(path); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
173 } |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
174 |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
175 /* For the rest, we set the current directory and make sure |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
176 * SafeDllSearch is set to 0 where needed. */ |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
177 else { |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
178 OSVERSIONINFO osinfo; |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
179 |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
180 printf("Setting current directory to GTK+ dll directory\n"); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
181 SetCurrentDirectory(path); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
182 /* For Windows 2000 (SP3+) / WinXP (No SP): |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
183 * If SafeDllSearchMode is set to 1, Windows system directories are |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
184 * searched for dlls before the current directory. Therefore we set it |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
185 * to 0. |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
186 */ |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
187 osinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
188 GetVersionEx(&osinfo); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
189 if ((osinfo.dwMajorVersion == 5 && |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
190 osinfo.dwMinorVersion == 0 && |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
191 strcmp(osinfo.szCSDVersion, "Service Pack 3") >= 0) || |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
192 (osinfo.dwMajorVersion == 5 && |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
193 osinfo.dwMinorVersion == 1 && |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
194 strcmp(osinfo.szCSDVersion, "") >= 0) |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
195 ) { |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
196 DWORD regval = 1; |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
197 DWORD reglen = sizeof(DWORD); |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
198 |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
199 printf("Using Win2k (SP3+) / WinXP (No SP).. Checking SafeDllSearch\n"); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
200 read_reg_string(HKEY_LOCAL_MACHINE, |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
201 "System\\CurrentControlSet\\Control\\Session Manager", |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
202 "SafeDllSearchMode", |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
203 (LPBYTE) ®val, |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
204 ®len); |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
205 |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
206 if (regval != 0) { |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
207 printf("Trying to set SafeDllSearchMode to 0\n"); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
208 regval = 0; |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
209 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
210 "System\\CurrentControlSet\\Control\\Session Manager", |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
211 0, KEY_SET_VALUE, &hkey |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
212 ) == ERROR_SUCCESS) { |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
213 if (RegSetValueEx(hkey, |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
214 "SafeDllSearchMode", 0, |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
215 REG_DWORD, (LPBYTE) ®val, |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
216 sizeof(DWORD) |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
217 ) != ERROR_SUCCESS) |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
218 printf("Error writing SafeDllSearchMode. Error: %u\n", |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
219 (UINT) GetLastError()); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
220 RegCloseKey(hkey); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
221 } else |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
222 printf("Error opening Session Manager key for writing. Error: %u\n", |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
223 (UINT) GetLastError()); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
224 } else |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
225 printf("SafeDllSearchMode is set to 0\n"); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
226 }/*end else*/ |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
227 } |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
228 } |
4490 | 229 |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
230 static char* wgaim_lcid_to_posix(LCID lcid) { |
12004
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
231 char *posix = NULL; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
232 int lang_id = PRIMARYLANGID(lcid); |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
233 int sub_id = SUBLANGID(lcid); |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
234 |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
235 switch (lang_id) { |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
236 case LANG_ARABIC: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
237 case LANG_BULGARIAN: posix = "bg"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
238 case LANG_CATALAN: posix = "ca"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
239 case LANG_CHINESE: |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
240 switch (sub_id) { |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
241 case SUBLANG_CHINESE_SIMPLIFIED: |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
242 posix = "zh_CN"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
243 case SUBLANG_CHINESE_TRADITIONAL: |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
244 posix = "zh_TW"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
245 default: |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
246 posix = "zh"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
247 } |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
248 break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
249 case LANG_CZECH: posix = "cs"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
250 case LANG_DANISH: posix = "da"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
251 case LANG_GERMAN: posix = "de"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
252 case LANG_GREEK: posix = "el"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
253 case LANG_ENGLISH: |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
254 switch (sub_id) { |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
255 case SUBLANG_ENGLISH_UK: |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
256 posix = "en_GB"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
257 case SUBLANG_ENGLISH_AUS: |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
258 posix = "en_AU"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
259 case SUBLANG_ENGLISH_CAN: |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
260 posix = "en_CA"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
261 default: |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
262 posix = "en"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
263 } |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
264 break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
265 case LANG_SPANISH: posix = "es"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
266 case LANG_FINNISH: posix = "fi"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
267 case LANG_FRENCH: posix = "fr"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
268 case LANG_HEBREW: posix = "he"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
269 case LANG_HUNGARIAN: posix = "hu"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
270 case LANG_ICELANDIC: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
271 case LANG_ITALIAN: posix = "it"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
272 case LANG_JAPANESE: posix = "ja"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
273 case LANG_KOREAN: posix = "ko"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
274 case LANG_DUTCH: posix = "nl"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
275 case LANG_NORWEGIAN: |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
276 switch (sub_id) { |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
277 case SUBLANG_NORWEGIAN_BOKMAL: |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
278 posix = "nb"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
279 case SUBLANG_NORWEGIAN_NYNORSK: |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
280 posix = "nn"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
281 } |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
282 break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
283 case LANG_POLISH: posix = "pl"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
284 case LANG_PORTUGUESE: |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
285 switch (sub_id) { |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
286 case SUBLANG_PORTUGUESE_BRAZILIAN: |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
287 posix = "pt_BR"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
288 default: |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
289 posix = "pt"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
290 } |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
291 break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
292 case LANG_ROMANIAN: posix = "ro"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
293 case LANG_RUSSIAN: posix = "ru"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
294 /* LANG_CROATIAN == LANG_SERBIAN for some reason |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
295 * We'll need to do something here if we ever get a croatian translation */ |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
296 /* case LANG_CROATIAN: posix = "hr"; break;*/ |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
297 case LANG_SERBIAN: |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
298 switch (sub_id) { |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
299 case SUBLANG_SERBIAN_LATIN: |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
300 posix = "sr@Latn"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
301 case SUBLANG_SERBIAN_CYRILLIC: |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
302 posix = "sr"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
303 } |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
304 break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
305 case LANG_SLOVAK: posix = "sk"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
306 case LANG_ALBANIAN: posix = "sq"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
307 case LANG_SWEDISH: posix = "sv"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
308 case LANG_THAI: posix = "th"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
309 case LANG_TURKISH: posix = "tr"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
310 case LANG_URDU: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
311 case LANG_INDONESIAN: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
312 case LANG_UKRAINIAN: posix = "uk"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
313 case LANG_BELARUSIAN: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
314 case LANG_SLOVENIAN: posix = "sl"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
315 case LANG_ESTONIAN: posix = "et"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
316 case LANG_LATVIAN: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
317 case LANG_LITHUANIAN: posix = "lt"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
318 case LANG_FARSI: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
319 case LANG_VIETNAMESE: posix = "vi"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
320 case LANG_ARMENIAN: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
321 case LANG_AZERI: posix = "az"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
322 case LANG_BASQUE: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
323 case LANG_MACEDONIAN: posix = "mk"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
324 case LANG_AFRIKAANS: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
325 case LANG_GEORGIAN: posix = "ka"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
326 case LANG_FAEROESE: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
327 case LANG_HINDI: posix = "hi"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
328 case LANG_MALAY: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
329 case LANG_KAZAK: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
330 case LANG_KYRGYZ: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
331 case LANG_SWAHILI: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
332 case LANG_UZBEK: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
333 case LANG_TATAR: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
334 case LANG_BENGALI: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
335 case LANG_PUNJABI: posix = "pa"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
336 case LANG_GUJARATI: posix = "gu"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
337 case LANG_ORIYA: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
338 case LANG_TAMIL: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
339 case LANG_TELUGU: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
340 case LANG_KANNADA: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
341 case LANG_MALAYALAM: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
342 case LANG_ASSAMESE: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
343 case LANG_MARATHI: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
344 case LANG_SANSKRIT: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
345 case LANG_MONGOLIAN: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
346 case LANG_GALICIAN: posix = "gl"; break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
347 case LANG_KONKANI: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
348 case LANG_MANIPURI: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
349 case LANG_SINDHI: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
350 case LANG_SYRIAC: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
351 case LANG_KASHMIRI: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
352 case LANG_NEPALI: break; |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
353 case LANG_DIVEHI: break; |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
354 } |
12004
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
355 |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
356 /* Deal with exceptions */ |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
357 if (posix == NULL) { |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
358 switch (lcid) { |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
359 case 2125: posix = "my_MM"; break; /* Myanmar (Burmese) */ |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
360 case 1076: posix = "xh"; break; /* Xhosa */ |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
361 } |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
362 } |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
363 |
8d5ebd7d4ec3
[gaim-migrate @ 14297]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11571
diff
changeset
|
364 return posix; |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
365 } |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
366 |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
367 /* Determine and set Gaim locale as follows (in order of priority): |
10210
4d3c2749deec
[gaim-migrate @ 11332]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10095
diff
changeset
|
368 - Check GAIMLANG env var |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
369 - Check NSIS Installer Language reg value |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
370 - Use default user locale |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
371 */ |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
372 static const char *wgaim_get_locale() { |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
373 const char *locale = NULL; |
11561
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
374 LCID lcid; |
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
375 #ifndef PORTABLE |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
376 char data[10]; |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
377 DWORD datalen = 10; |
11561
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
378 #endif |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
379 |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
380 /* Check if user set GAIMLANG env var */ |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
381 if ((locale = getenv("GAIMLANG"))) |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
382 return locale; |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
383 |
11561
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
384 #ifndef PORTABLE |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
385 if (read_reg_string(HKEY_CURRENT_USER, "SOFTWARE\\gaim", |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
386 "Installer Language", (LPBYTE) &data, &datalen)) { |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
387 if ((locale = wgaim_lcid_to_posix(atoi(data)))) |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
388 return locale; |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
389 } |
11561
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
390 #endif |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
391 |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
392 lcid = GetUserDefaultLCID(); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
393 if ((locale = wgaim_lcid_to_posix(lcid))) |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
394 return locale; |
10330 | 395 |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
396 return "en"; |
10330 | 397 } |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
398 |
10330 | 399 static void wgaim_set_locale() { |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
400 const char *locale = NULL; |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
401 char envstr[25]; |
10330 | 402 |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
403 locale = wgaim_get_locale(); |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
404 |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
405 snprintf(envstr, 25, "LANG=%s", locale); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
406 printf("Setting locale: %s\n", envstr); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
407 putenv(envstr); |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
408 } |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
409 |
10212
08251403c871
[gaim-migrate @ 11336]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10210
diff
changeset
|
410 static BOOL wgaim_set_running() { |
08251403c871
[gaim-migrate @ 11336]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10210
diff
changeset
|
411 HANDLE h; |
08251403c871
[gaim-migrate @ 11336]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10210
diff
changeset
|
412 |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
413 if ((h = CreateMutex(NULL, FALSE, "gaim_is_running"))) { |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
414 if (GetLastError() == ERROR_ALREADY_EXISTS) { |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
415 MessageBox(NULL, |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
416 "An instance of Gaim is already running", |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
417 NULL, MB_OK | MB_TOPMOST); |
10212
08251403c871
[gaim-migrate @ 11336]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10210
diff
changeset
|
418 return FALSE; |
08251403c871
[gaim-migrate @ 11336]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10210
diff
changeset
|
419 } |
08251403c871
[gaim-migrate @ 11336]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10210
diff
changeset
|
420 } |
08251403c871
[gaim-migrate @ 11336]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10210
diff
changeset
|
421 return TRUE; |
08251403c871
[gaim-migrate @ 11336]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10210
diff
changeset
|
422 } |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
423 |
11193
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
424 static void wgaim_set_proxy() { |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
425 DWORD regval = 1; |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
426 DWORD reglen = sizeof(DWORD); |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
427 |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
428 /* If the proxy server environment variables are already set, |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
429 * we shouldn't override them */ |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
430 if (getenv("HTTP_PROXY") || getenv("http_proxy") || getenv("HTTPPROXY")) |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
431 return; |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
432 |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
433 if (read_reg_string(HKEY_CURRENT_USER, WIN32_PROXY_REGKEY, |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
434 "ProxyEnable", |
11193
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
435 (LPBYTE) ®val, ®len) && (regval & 1)) { |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
436 char proxy_server[2048]; |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
437 char *c = NULL; |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
438 reglen = sizeof(proxy_server); |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
439 |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
440 if (!read_reg_string(HKEY_CURRENT_USER, WIN32_PROXY_REGKEY, |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
441 "ProxyServer", (LPBYTE) &proxy_server, ®len)) |
11193
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
442 return; |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
443 |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
444 if ((reglen > strlen("http=")) |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
445 && (c = strstr(proxy_server, "http="))) { |
11193
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
446 char *d; |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
447 c += strlen("http="); |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
448 d = strchr(c, ';'); |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
449 if (d) { |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
450 *d = '\0'; |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
451 } |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
452 /* c now points the proxy server (and port) */ |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
453 } |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
454 |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
455 if (c) { |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
456 const char envstr_prefix[] = "HTTP_PROXY=http://"; |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
457 char envstr[sizeof(envstr_prefix) + strlen(c) + 1]; |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
458 snprintf(envstr, sizeof(envstr), "%s%s", |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
459 envstr_prefix, c); |
11193
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
460 printf("Setting HTTP Proxy: %s\n", envstr); |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
461 putenv(envstr); |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
462 } |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
463 } |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
464 |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
465 } |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
466 |
4490 | 467 #ifdef __GNUC__ |
468 # ifndef _stdcall | |
469 # define _stdcall __attribute__((stdcall)) | |
470 # endif | |
471 #endif | |
472 | |
473 int _stdcall | |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
474 WinMain (struct HINSTANCE__ *hInstance, struct HINSTANCE__ *hPrevInstance, |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
475 char *lpszCmdLine, int nCmdShow) { |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
476 char errbuf[512]; |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
477 char gaimdir[MAX_PATH]; |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
478 HMODULE hmod; |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
479 |
11469
d83e1fe99d69
[gaim-migrate @ 13709]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11441
diff
changeset
|
480 /* If debug or help or version flag used, create console for output */ |
d83e1fe99d69
[gaim-migrate @ 13709]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11441
diff
changeset
|
481 if (strstr(lpszCmdLine, "-d") || strstr(lpszCmdLine, "-h") || strstr(lpszCmdLine, "-v")) { |
11060
52d6b10025ca
[gaim-migrate @ 13014]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10898
diff
changeset
|
482 LPFNATTACHCONSOLE MyAttachConsole = NULL; |
52d6b10025ca
[gaim-migrate @ 13014]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10898
diff
changeset
|
483 if ((hmod = GetModuleHandle("kernel32.dll"))) { |
52d6b10025ca
[gaim-migrate @ 13014]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10898
diff
changeset
|
484 MyAttachConsole = |
52d6b10025ca
[gaim-migrate @ 13014]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10898
diff
changeset
|
485 (LPFNATTACHCONSOLE) |
52d6b10025ca
[gaim-migrate @ 13014]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10898
diff
changeset
|
486 GetProcAddress(hmod, "AttachConsole"); |
52d6b10025ca
[gaim-migrate @ 13014]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10898
diff
changeset
|
487 } |
52d6b10025ca
[gaim-migrate @ 13014]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10898
diff
changeset
|
488 if ((MyAttachConsole && MyAttachConsole(ATTACH_PARENT_PROCESS)) |
52d6b10025ca
[gaim-migrate @ 13014]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10898
diff
changeset
|
489 || AllocConsole()) |
52d6b10025ca
[gaim-migrate @ 13014]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10898
diff
changeset
|
490 freopen("CONOUT$", "w", stdout); |
52d6b10025ca
[gaim-migrate @ 13014]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10898
diff
changeset
|
491 } |
7802
f1d2907db5be
[gaim-migrate @ 8448]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7522
diff
changeset
|
492 |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
493 /* Load exception handler if we have it */ |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
494 if (GetModuleFileName(NULL, gaimdir, MAX_PATH) != 0) { |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
495 char *tmp = gaimdir; |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
496 char *prev = NULL; |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
497 |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
498 while ((tmp = strchr(tmp, '\\'))) { |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
499 prev = tmp; |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
500 tmp++; |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
501 } |
7477
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
502 |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
503 if (prev) { |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
504 prev[0] = '\0'; |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
505 strcat(gaimdir, "\\exchndl.dll"); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
506 if (LoadLibrary(gaimdir)) |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
507 printf("Loaded exchndl.dll\n"); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
508 } |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
509 } else { |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
510 snprintf(errbuf, 512, |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
511 "Error getting module filename. Error: %u", |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
512 (UINT) GetLastError()); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
513 MessageBox(NULL, errbuf, NULL, MB_OK | MB_TOPMOST); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
514 } |
7477
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
515 |
11561
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
516 #ifndef PORTABLE |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
517 if (!getenv("GAIM_NO_DLL_CHECK")) |
11561
71945305a87e
[gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11555
diff
changeset
|
518 #endif |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
519 dll_prep(); |
6816
5aeba37b303c
[gaim-migrate @ 7356]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4490
diff
changeset
|
520 |
11193
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
521 wgaim_set_locale(); |
11469
d83e1fe99d69
[gaim-migrate @ 13709]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11441
diff
changeset
|
522 /* If help or version flag used, do not check Mutex */ |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
523 if (!strstr(lpszCmdLine, "-h") && !strstr(lpszCmdLine, "-v")) |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
524 if (!getenv("GAIM_MULTI_INST") && !wgaim_set_running()) |
11469
d83e1fe99d69
[gaim-migrate @ 13709]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11441
diff
changeset
|
525 return 0; |
11193
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
526 |
e865bdbbf91d
[gaim-migrate @ 13316]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11060
diff
changeset
|
527 wgaim_set_proxy(); |
7477
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
528 |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
529 /* Now we are ready for Gaim .. */ |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
530 if ((hmod = LoadLibrary("gaim.dll"))) { |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
531 gaim_main = (LPFNGAIMMAIN) GetProcAddress(hmod, "gaim_main"); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
532 } |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
533 |
11555
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
534 if (!gaim_main) { |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
535 snprintf(errbuf, 512, "Error loading gaim.dll. Error: %u", |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
536 (UINT) GetLastError()); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
537 MessageBox(NULL, errbuf, NULL, MB_OK | MB_TOPMOST); |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
538 return 0; |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
539 } |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
540 |
4da9e0d4e8d2
[gaim-migrate @ 13815]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11469
diff
changeset
|
541 return gaim_main (hInstance, __argc, __argv); |
4490 | 542 } |