Wed, 16 Nov 2005 18:17:01 +0000
[gaim-migrate @ 14416]
" This patch implements a replacement for the queuing
system from 1.x. It also obsoletes a previous patch
[#1338873] I submitted to prioritize the unseen states
in gtk conversations.
The attached envelope.png is ripped from the
msgunread.png already included in gaim. It should be
dropped in the pixmaps directory (Makefile.am is
updated accordingly in this patch).
The two separate queuing preferences from 1.x, queuing
messages while away and queuing all new messages (from
docklet), are replaced with a single 3-way preference
for conversations. The new preference is "Hide new IM
conversations". This preference can be set to never,
away and always.
When a gtk conversation is created, it may be placed in
a hidden conversation window instead of being placed
normally. This decision is based upon the preference
and possibly the away state of the account the
conversation is being created for. This *will* effect
conversations the user explicitly requests to be
created, so in these cases the caller must be sure to
present the conversation to the user, using
gaim_gtkconv_present_conversation(). This is done
already in gtkdialogs.c which handles creating
conversations requested by the user from gaim proper
(menus, double-clicking on budy in blist, etc.).
The main advantage to not queuing messages is that the
conversations exist, the message is written to the
conversation (and logged if appropriate) and the unseen
state is set on the conversation. This means no
additional features are needed to track whether there
are queued messages or not, just use the unseen state
on conversations.
Since conversations may not be visible (messages
"queued"), gaim proper needs some notification that
there are messages waiting. I opted for a menutray icon
that shows up when an im conversation has an unseen
message. Clicking this icon will focus (and show if
hidden) the first conversation with an unseen message.
This is essentially the same behavior of the docklet in
cvs right now, except that the icon is only visible
when there is a conversation with an unread message.
The api that is added is flexible enough to allow
either the docklet or the new blist menutray icon to be
visible for conversations of any/all types and for
unseen messages >= any state. Currently they are set to
only IM conversations and only unseen states >= TEXT
(system messages and no log messages will not trigger
blinking the docklet or showing the blist tray icon),
but these could be made preferences relatively easily
in the future. Other plugins could probably benefit as
well: gaim_gtk_conversations_get_first_unseen().
There is probably some limit to comment size, so I'll
stop rambling now. If anyone has more
questions/comments, catch me in #gaim, here or on
gaim-devel."
committer: Luke Schierer <lschiere@pidgin.im>
| 4490 | 1 | /* |
|
7350
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.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
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.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
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
11 | * |
|
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
12 | * This program is free software; you can redistribute it and/or modify |
|
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
13 | * it under the terms of the GNU General Public License as published by |
|
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
14 | * the Free Software Foundation; either version 2 of the License, or |
|
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
15 | * (at your option) any later version. |
|
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
16 | * |
|
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
17 | * This program is distributed in the hope that it will be useful, |
|
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
20 | * GNU General Public License for more details. |
|
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
21 | * |
|
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
22 | * You should have received a copy of the GNU General Public License |
|
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
23 | * along with this program; if not, write to the Free Software |
|
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
25 | * |
| 4490 | 26 | */ |
|
11060
21bc781a543b
[gaim-migrate @ 13014]
Daniel Atallah <datallah@pidgin.im>
parents:
10898
diff
changeset
|
27 | |
|
11570
dc34629fcaf1
[gaim-migrate @ 13838]
Daniel Atallah <datallah@pidgin.im>
parents:
11561
diff
changeset
|
28 | /* This is for ATTACH_PARENT_PROCESS */ |
|
dc34629fcaf1
[gaim-migrate @ 13838]
Daniel Atallah <datallah@pidgin.im>
parents:
11561
diff
changeset
|
29 | #ifndef _WIN32_WINNT |
|
dc34629fcaf1
[gaim-migrate @ 13838]
Daniel Atallah <datallah@pidgin.im>
parents:
11561
diff
changeset
|
30 | #define _WIN32_WINNT 0x501 |
|
dc34629fcaf1
[gaim-migrate @ 13838]
Daniel Atallah <datallah@pidgin.im>
parents:
11561
diff
changeset
|
31 | #endif |
| 4490 | 32 | #include <windows.h> |
|
7477
40ce33c4955a
[gaim-migrate @ 8090]
Herman Bloggs <herman@bluedigits.com>
parents:
7363
diff
changeset
|
33 | #include <fcntl.h> |
| 4490 | 34 | #include <stdlib.h> |
|
6890
7833463f1b73
[gaim-migrate @ 7436]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
35 | #include <string.h> |
|
7833463f1b73
[gaim-migrate @ 7436]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
36 | #include <stdio.h> |
| 4490 | 37 | |
|
11193
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
38 | #define WIN32_PROXY_REGKEY "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings" |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
39 | |
|
7522
b8230e11849d
[gaim-migrate @ 8135]
Herman Bloggs <herman@bluedigits.com>
parents:
7477
diff
changeset
|
40 | typedef int (CALLBACK* LPFNGAIMMAIN)(HINSTANCE, int, char**); |
|
b8230e11849d
[gaim-migrate @ 8135]
Herman Bloggs <herman@bluedigits.com>
parents:
7477
diff
changeset
|
41 | typedef void (CALLBACK* LPFNSETDLLDIRECTORY)(LPCTSTR); |
|
11060
21bc781a543b
[gaim-migrate @ 13014]
Daniel Atallah <datallah@pidgin.im>
parents:
10898
diff
changeset
|
42 | typedef BOOL (CALLBACK* LPFNATTACHCONSOLE)(DWORD); |
|
7522
b8230e11849d
[gaim-migrate @ 8135]
Herman Bloggs <herman@bluedigits.com>
parents:
7477
diff
changeset
|
43 | |
| 4490 | 44 | /* |
| 45 | * PROTOTYPES | |
| 46 | */ | |
|
7522
b8230e11849d
[gaim-migrate @ 8135]
Herman Bloggs <herman@bluedigits.com>
parents:
7477
diff
changeset
|
47 | static LPFNGAIMMAIN gaim_main = NULL; |
|
b8230e11849d
[gaim-migrate @ 8135]
Herman Bloggs <herman@bluedigits.com>
parents:
7477
diff
changeset
|
48 | static LPFNSETDLLDIRECTORY MySetDllDirectory = NULL; |
|
6890
7833463f1b73
[gaim-migrate @ 7436]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
49 | |
|
7833463f1b73
[gaim-migrate @ 7436]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
50 | |
|
7350
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.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
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
52 | HKEY hkey; |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
53 | BOOL ret = FALSE; |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
54 | LONG retv; |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
55 | |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
56 | if (ERROR_SUCCESS == (retv = RegOpenKeyEx(key, sub_key, 0, |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
57 | KEY_QUERY_VALUE, &hkey))) { |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
58 | if (ERROR_SUCCESS == (retv = RegQueryValueEx(hkey, val_name, |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
59 | NULL, NULL, data, data_len))) |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
60 | ret = TRUE; |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
61 | else { |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
62 | TCHAR szBuf[80]; |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
63 | |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
64 | FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
65 | NULL, retv, 0, |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
66 | (LPTSTR) &szBuf, sizeof(szBuf), NULL); |
|
6890
7833463f1b73
[gaim-migrate @ 7436]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
67 | |
|
10688
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
68 | printf("Could not read reg key '%s' subkey '%s' value: '%s'\nError: (%ld) %s\n", |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
69 | ((key == HKEY_LOCAL_MACHINE) ? "HKLM" : |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
70 | (key == HKEY_CURRENT_USER) ? "HKCU" : |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
71 | "???"), |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
72 | sub_key, val_name, retv, szBuf); |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
73 | } |
|
11193
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
74 | RegCloseKey(hkey); |
|
10688
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
75 | } |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
76 | else { |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
77 | TCHAR szBuf[80]; |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
78 | |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
79 | FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, retv, 0, |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
80 | (LPTSTR) &szBuf, sizeof(szBuf), NULL); |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
81 | printf("Could not open reg subkey: %s\nError: (%ld) %s\n", |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
82 | sub_key, retv, szBuf); |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
83 | } |
|
7522
b8230e11849d
[gaim-migrate @ 8135]
Herman Bloggs <herman@bluedigits.com>
parents:
7477
diff
changeset
|
84 | |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
85 | return ret; |
|
6890
7833463f1b73
[gaim-migrate @ 7436]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
86 | } |
|
7833463f1b73
[gaim-migrate @ 7436]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
87 | |
|
7522
b8230e11849d
[gaim-migrate @ 8135]
Herman Bloggs <herman@bluedigits.com>
parents:
7477
diff
changeset
|
88 | static void dll_prep() { |
|
11561
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
89 | char path[MAX_PATH + 1]; |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
90 | HMODULE hmod; |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
91 | HKEY hkey; |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
92 | #ifdef PORTABLE |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
93 | /* We assume that GTK+ is installed under \\path\to\Gaim\..\GTK |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
94 | * First we find \\path\to |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
95 | */ |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
96 | if (GetModuleFileName(NULL, path, MAX_PATH) != 0) { |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
97 | char *tmp = path; |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
98 | char *prev = NULL; |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
99 | char *prev2 = NULL; |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
100 | |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
101 | while ((tmp = strchr(tmp, '\\'))) { |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
102 | prev2 = prev; |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
103 | prev = tmp; |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
104 | tmp++; |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
105 | } |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
106 | |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
107 | if (prev2) { |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
108 | prev2[0] = '\0'; |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
109 | } |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
110 | } else { |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
111 | printf("Unable to determine current executable path. \n" |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
112 | "This will prevent the settings dir from being set.\n" |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
113 | "Assuming GTK+ is in the PATH.\n"); |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
114 | } |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
115 | |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
116 | if (path) { |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
117 | /* Set up the settings dir base to be \\path\to |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
118 | * The actual settings dir will be \\path\to\.gaim */ |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
119 | char settingsdir[strlen(path) + strlen("GAIMHOME=") + 1]; |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
120 | char aspelldir[strlen(path) + strlen("GAIM_ASPELL_DIR=\\Aspell\\bin") + 1]; |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
121 | |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
122 | snprintf(settingsdir, sizeof(settingsdir), "GAIMHOME=%s", path); |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
123 | printf("Setting settings dir: %s\n", settingsdir); |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
124 | putenv(settingsdir); |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
125 | |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
126 | snprintf(aspelldir, sizeof(aspelldir), "GAIM_ASPELL_DIR=%s\\Aspell\\bin", path); |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
127 | printf(aspelldir); |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
128 | |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
129 | /* set the GTK+ path to be \\path\to\GTK\bin */ |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
130 | strcat(path, "\\GTK\\bin"); |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
131 | } else |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
132 | return; |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
133 | #else /* PORTABLE */ |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
134 | char gtkpath[MAX_PATH + 1]; |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
135 | DWORD plen; |
|
6890
7833463f1b73
[gaim-migrate @ 7436]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
136 | |
|
10688
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
137 | plen = sizeof(gtkpath); |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
138 | hkey = HKEY_CURRENT_USER; |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
139 | if (!read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "Path", |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
140 | (LPBYTE) >kpath, &plen)) { |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
141 | hkey = HKEY_LOCAL_MACHINE; |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
142 | if (!read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "Path", |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
143 | (LPBYTE) >kpath, &plen)) { |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
144 | printf("GTK+ Path Registry Key not found. " |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
145 | "Assuming GTK+ is in the PATH.\n"); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
146 | return; |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
147 | } |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
148 | } |
|
7350
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
149 | |
|
10688
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
150 | /* this value is replaced during a successful RegQueryValueEx() */ |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
151 | plen = sizeof(path); |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
152 | /* Determine GTK+ dll path .. */ |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
153 | if (!read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "DllPath", |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
154 | (LPBYTE) &path, &plen)) { |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
155 | strcpy(path, gtkpath); |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
156 | strcat(path, "\\bin"); |
|
38ed5a31d016
[gaim-migrate @ 12237]
Daniel Atallah <datallah@pidgin.im>
parents:
10521
diff
changeset
|
157 | } |
|
11561
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
158 | #endif |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
159 | printf("GTK+ path found: %s\n", path); |
|
7522
b8230e11849d
[gaim-migrate @ 8135]
Herman Bloggs <herman@bluedigits.com>
parents:
7477
diff
changeset
|
160 | |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
161 | if ((hmod = GetModuleHandle("kernel32.dll"))) { |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
162 | MySetDllDirectory = (LPFNSETDLLDIRECTORY) GetProcAddress( |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
163 | hmod, "SetDllDirectoryA"); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
164 | if (!MySetDllDirectory) |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
165 | printf("SetDllDirectory not supported\n"); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
166 | } else |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
167 | printf("Error getting kernel32.dll module handle\n"); |
|
7522
b8230e11849d
[gaim-migrate @ 8135]
Herman Bloggs <herman@bluedigits.com>
parents:
7477
diff
changeset
|
168 | |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
169 | /* For Windows XP SP1+ / Server 2003 we use SetDllDirectory to avoid dll hell */ |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
170 | if (MySetDllDirectory) { |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
171 | printf("Using SetDllDirectory\n"); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
172 | MySetDllDirectory(path); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
173 | } |
|
7350
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
174 | |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
175 | /* For the rest, we set the current directory and make sure |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
176 | * SafeDllSearch is set to 0 where needed. */ |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
177 | else { |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
178 | OSVERSIONINFO osinfo; |
|
7350
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
179 | |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
180 | printf("Setting current directory to GTK+ dll directory\n"); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
181 | SetCurrentDirectory(path); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
182 | /* For Windows 2000 (SP3+) / WinXP (No SP): |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
183 | * If SafeDllSearchMode is set to 1, Windows system directories are |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
184 | * searched for dlls before the current directory. Therefore we set it |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
185 | * to 0. |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
186 | */ |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
187 | osinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
188 | GetVersionEx(&osinfo); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
189 | if ((osinfo.dwMajorVersion == 5 && |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
190 | osinfo.dwMinorVersion == 0 && |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
191 | strcmp(osinfo.szCSDVersion, "Service Pack 3") >= 0) || |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
192 | (osinfo.dwMajorVersion == 5 && |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
193 | osinfo.dwMinorVersion == 1 && |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
194 | strcmp(osinfo.szCSDVersion, "") >= 0) |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
195 | ) { |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
196 | DWORD regval = 1; |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
197 | DWORD reglen = sizeof(DWORD); |
|
7522
b8230e11849d
[gaim-migrate @ 8135]
Herman Bloggs <herman@bluedigits.com>
parents:
7477
diff
changeset
|
198 | |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
199 | printf("Using Win2k (SP3+) / WinXP (No SP).. Checking SafeDllSearch\n"); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
200 | read_reg_string(HKEY_LOCAL_MACHINE, |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
201 | "System\\CurrentControlSet\\Control\\Session Manager", |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
202 | "SafeDllSearchMode", |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
203 | (LPBYTE) ®val, |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
204 | ®len); |
|
7522
b8230e11849d
[gaim-migrate @ 8135]
Herman Bloggs <herman@bluedigits.com>
parents:
7477
diff
changeset
|
205 | |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
206 | if (regval != 0) { |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
207 | printf("Trying to set SafeDllSearchMode to 0\n"); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
208 | regval = 0; |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
209 | if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
210 | "System\\CurrentControlSet\\Control\\Session Manager", |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
211 | 0, KEY_SET_VALUE, &hkey |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
212 | ) == ERROR_SUCCESS) { |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
213 | if (RegSetValueEx(hkey, |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
214 | "SafeDllSearchMode", 0, |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
215 | REG_DWORD, (LPBYTE) ®val, |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
216 | sizeof(DWORD) |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
217 | ) != ERROR_SUCCESS) |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
218 | printf("Error writing SafeDllSearchMode. Error: %u\n", |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
219 | (UINT) GetLastError()); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
220 | RegCloseKey(hkey); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
221 | } else |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
222 | printf("Error opening Session Manager key for writing. Error: %u\n", |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
223 | (UINT) GetLastError()); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
224 | } else |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
225 | printf("SafeDllSearchMode is set to 0\n"); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
226 | }/*end else*/ |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
227 | } |
|
6890
7833463f1b73
[gaim-migrate @ 7436]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
228 | } |
| 4490 | 229 | |
|
7350
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
230 | static char* wgaim_lcid_to_posix(LCID lcid) { |
|
12004
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
231 | char *posix = NULL; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
232 | int lang_id = PRIMARYLANGID(lcid); |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
233 | int sub_id = SUBLANGID(lcid); |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
234 | |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
235 | switch (lang_id) { |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
236 | case LANG_ARABIC: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
237 | case LANG_BULGARIAN: posix = "bg"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
238 | case LANG_CATALAN: posix = "ca"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
239 | case LANG_CHINESE: |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
240 | switch (sub_id) { |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
241 | case SUBLANG_CHINESE_SIMPLIFIED: |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
242 | posix = "zh_CN"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
243 | case SUBLANG_CHINESE_TRADITIONAL: |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
244 | posix = "zh_TW"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
245 | default: |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
246 | posix = "zh"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
247 | } |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
248 | break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
249 | case LANG_CZECH: posix = "cs"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
250 | case LANG_DANISH: posix = "da"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
251 | case LANG_GERMAN: posix = "de"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
252 | case LANG_GREEK: posix = "el"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
253 | case LANG_ENGLISH: |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
254 | switch (sub_id) { |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
255 | case SUBLANG_ENGLISH_UK: |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
256 | posix = "en_GB"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
257 | case SUBLANG_ENGLISH_AUS: |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
258 | posix = "en_AU"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
259 | case SUBLANG_ENGLISH_CAN: |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
260 | posix = "en_CA"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
261 | default: |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
262 | posix = "en"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
263 | } |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
264 | break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
265 | case LANG_SPANISH: posix = "es"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
266 | case LANG_FINNISH: posix = "fi"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
267 | case LANG_FRENCH: posix = "fr"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
268 | case LANG_HEBREW: posix = "he"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
269 | case LANG_HUNGARIAN: posix = "hu"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
270 | case LANG_ICELANDIC: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
271 | case LANG_ITALIAN: posix = "it"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
272 | case LANG_JAPANESE: posix = "ja"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
273 | case LANG_KOREAN: posix = "ko"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
274 | case LANG_DUTCH: posix = "nl"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
275 | case LANG_NORWEGIAN: |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
276 | switch (sub_id) { |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
277 | case SUBLANG_NORWEGIAN_BOKMAL: |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
278 | posix = "nb"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
279 | case SUBLANG_NORWEGIAN_NYNORSK: |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
280 | posix = "nn"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
281 | } |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
282 | break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
283 | case LANG_POLISH: posix = "pl"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
284 | case LANG_PORTUGUESE: |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
285 | switch (sub_id) { |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
286 | case SUBLANG_PORTUGUESE_BRAZILIAN: |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
287 | posix = "pt_BR"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
288 | default: |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
289 | posix = "pt"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
290 | } |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
291 | break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
292 | case LANG_ROMANIAN: posix = "ro"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
293 | case LANG_RUSSIAN: posix = "ru"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
294 | /* LANG_CROATIAN == LANG_SERBIAN for some reason |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
295 | * We'll need to do something here if we ever get a croatian translation */ |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
296 | /* case LANG_CROATIAN: posix = "hr"; break;*/ |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
297 | case LANG_SERBIAN: |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
298 | switch (sub_id) { |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
299 | case SUBLANG_SERBIAN_LATIN: |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
300 | posix = "sr@Latn"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
301 | case SUBLANG_SERBIAN_CYRILLIC: |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
302 | posix = "sr"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
303 | } |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
304 | break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
305 | case LANG_SLOVAK: posix = "sk"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
306 | case LANG_ALBANIAN: posix = "sq"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
307 | case LANG_SWEDISH: posix = "sv"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
308 | case LANG_THAI: posix = "th"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
309 | case LANG_TURKISH: posix = "tr"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
310 | case LANG_URDU: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
311 | case LANG_INDONESIAN: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
312 | case LANG_UKRAINIAN: posix = "uk"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
313 | case LANG_BELARUSIAN: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
314 | case LANG_SLOVENIAN: posix = "sl"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
315 | case LANG_ESTONIAN: posix = "et"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
316 | case LANG_LATVIAN: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
317 | case LANG_LITHUANIAN: posix = "lt"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
318 | case LANG_FARSI: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
319 | case LANG_VIETNAMESE: posix = "vi"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
320 | case LANG_ARMENIAN: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
321 | case LANG_AZERI: posix = "az"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
322 | case LANG_BASQUE: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
323 | case LANG_MACEDONIAN: posix = "mk"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
324 | case LANG_AFRIKAANS: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
325 | case LANG_GEORGIAN: posix = "ka"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
326 | case LANG_FAEROESE: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
327 | case LANG_HINDI: posix = "hi"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
328 | case LANG_MALAY: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
329 | case LANG_KAZAK: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
330 | case LANG_KYRGYZ: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
331 | case LANG_SWAHILI: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
332 | case LANG_UZBEK: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
333 | case LANG_TATAR: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
334 | case LANG_BENGALI: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
335 | case LANG_PUNJABI: posix = "pa"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
336 | case LANG_GUJARATI: posix = "gu"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
337 | case LANG_ORIYA: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
338 | case LANG_TAMIL: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
339 | case LANG_TELUGU: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
340 | case LANG_KANNADA: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
341 | case LANG_MALAYALAM: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
342 | case LANG_ASSAMESE: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
343 | case LANG_MARATHI: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
344 | case LANG_SANSKRIT: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
345 | case LANG_MONGOLIAN: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
346 | case LANG_GALICIAN: posix = "gl"; break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
347 | case LANG_KONKANI: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
348 | case LANG_MANIPURI: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
349 | case LANG_SINDHI: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
350 | case LANG_SYRIAC: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
351 | case LANG_KASHMIRI: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
352 | case LANG_NEPALI: break; |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
353 | case LANG_DIVEHI: break; |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
354 | } |
|
12004
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
355 | |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
356 | /* Deal with exceptions */ |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
357 | if (posix == NULL) { |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
358 | switch (lcid) { |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
359 | case 2125: posix = "my_MM"; break; /* Myanmar (Burmese) */ |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
360 | case 1076: posix = "xh"; break; /* Xhosa */ |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
361 | } |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
362 | } |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
363 | |
|
0fcbe03a9e5a
[gaim-migrate @ 14297]
Daniel Atallah <datallah@pidgin.im>
parents:
11571
diff
changeset
|
364 | return posix; |
|
7350
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
365 | } |
|
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
366 | |
|
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
367 | /* Determine and set Gaim locale as follows (in order of priority): |
|
10210
6ea72edf1460
[gaim-migrate @ 11332]
Herman Bloggs <herman@bluedigits.com>
parents:
10095
diff
changeset
|
368 | - Check GAIMLANG env var |
|
7350
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
369 | - Check NSIS Installer Language reg value |
|
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
370 | - Use default user locale |
|
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
371 | */ |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
372 | static const char *wgaim_get_locale() { |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
373 | const char *locale = NULL; |
|
11561
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
374 | LCID lcid; |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
375 | #ifndef PORTABLE |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
376 | char data[10]; |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
377 | DWORD datalen = 10; |
|
11561
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
378 | #endif |
|
7350
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
379 | |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
380 | /* Check if user set GAIMLANG env var */ |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
381 | if ((locale = getenv("GAIMLANG"))) |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
382 | return locale; |
|
7350
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
383 | |
|
11561
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
384 | #ifndef PORTABLE |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
385 | if (read_reg_string(HKEY_CURRENT_USER, "SOFTWARE\\gaim", |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
386 | "Installer Language", (LPBYTE) &data, &datalen)) { |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
387 | if ((locale = wgaim_lcid_to_posix(atoi(data)))) |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
388 | return locale; |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
389 | } |
|
11561
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
390 | #endif |
|
7350
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
391 | |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
392 | lcid = GetUserDefaultLCID(); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
393 | if ((locale = wgaim_lcid_to_posix(lcid))) |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
394 | return locale; |
|
10330
6497dacdf912
[gaim-migrate @ 11537]
Mark Doliner <markdoliner@pidgin.im>
parents:
10227
diff
changeset
|
395 | |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
396 | return "en"; |
|
10330
6497dacdf912
[gaim-migrate @ 11537]
Mark Doliner <markdoliner@pidgin.im>
parents:
10227
diff
changeset
|
397 | } |
|
7350
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
398 | |
|
10330
6497dacdf912
[gaim-migrate @ 11537]
Mark Doliner <markdoliner@pidgin.im>
parents:
10227
diff
changeset
|
399 | static void wgaim_set_locale() { |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
400 | const char *locale = NULL; |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
401 | char envstr[25]; |
|
10330
6497dacdf912
[gaim-migrate @ 11537]
Mark Doliner <markdoliner@pidgin.im>
parents:
10227
diff
changeset
|
402 | |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
403 | locale = wgaim_get_locale(); |
|
7350
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
404 | |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
405 | snprintf(envstr, 25, "LANG=%s", locale); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
406 | printf("Setting locale: %s\n", envstr); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
407 | putenv(envstr); |
|
7350
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
408 | } |
|
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
409 | |
|
10212
9a9c18b72773
[gaim-migrate @ 11336]
Herman Bloggs <herman@bluedigits.com>
parents:
10210
diff
changeset
|
410 | static BOOL wgaim_set_running() { |
|
9a9c18b72773
[gaim-migrate @ 11336]
Herman Bloggs <herman@bluedigits.com>
parents:
10210
diff
changeset
|
411 | HANDLE h; |
|
9a9c18b72773
[gaim-migrate @ 11336]
Herman Bloggs <herman@bluedigits.com>
parents:
10210
diff
changeset
|
412 | |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
413 | if ((h = CreateMutex(NULL, FALSE, "gaim_is_running"))) { |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
414 | if (GetLastError() == ERROR_ALREADY_EXISTS) { |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
415 | MessageBox(NULL, |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
416 | "An instance of Gaim is already running", |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
417 | NULL, MB_OK | MB_TOPMOST); |
|
10212
9a9c18b72773
[gaim-migrate @ 11336]
Herman Bloggs <herman@bluedigits.com>
parents:
10210
diff
changeset
|
418 | return FALSE; |
|
9a9c18b72773
[gaim-migrate @ 11336]
Herman Bloggs <herman@bluedigits.com>
parents:
10210
diff
changeset
|
419 | } |
|
9a9c18b72773
[gaim-migrate @ 11336]
Herman Bloggs <herman@bluedigits.com>
parents:
10210
diff
changeset
|
420 | } |
|
9a9c18b72773
[gaim-migrate @ 11336]
Herman Bloggs <herman@bluedigits.com>
parents:
10210
diff
changeset
|
421 | return TRUE; |
|
9a9c18b72773
[gaim-migrate @ 11336]
Herman Bloggs <herman@bluedigits.com>
parents:
10210
diff
changeset
|
422 | } |
|
7350
83ad4a0d4250
[gaim-migrate @ 7941]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
423 | |
|
11193
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
424 | static void wgaim_set_proxy() { |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
425 | DWORD regval = 1; |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
426 | DWORD reglen = sizeof(DWORD); |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
427 | |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
428 | /* If the proxy server environment variables are already set, |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
429 | * we shouldn't override them */ |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
430 | if (getenv("HTTP_PROXY") || getenv("http_proxy") || getenv("HTTPPROXY")) |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
431 | return; |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
432 | |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
433 | if (read_reg_string(HKEY_CURRENT_USER, WIN32_PROXY_REGKEY, |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
434 | "ProxyEnable", |
|
11193
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
435 | (LPBYTE) ®val, ®len) && (regval & 1)) { |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
436 | char proxy_server[2048]; |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
437 | char *c = NULL; |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
438 | reglen = sizeof(proxy_server); |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
439 | |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
440 | if (!read_reg_string(HKEY_CURRENT_USER, WIN32_PROXY_REGKEY, |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
441 | "ProxyServer", (LPBYTE) &proxy_server, ®len)) |
|
11193
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
442 | return; |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
443 | |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
444 | if ((reglen > strlen("http=")) |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
445 | && (c = strstr(proxy_server, "http="))) { |
|
11193
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
446 | char *d; |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
447 | c += strlen("http="); |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
448 | d = strchr(c, ';'); |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
449 | if (d) { |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
450 | *d = '\0'; |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
451 | } |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
452 | /* c now points the proxy server (and port) */ |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
453 | } |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
454 | |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
455 | if (c) { |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
456 | const char envstr_prefix[] = "HTTP_PROXY=http://"; |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
457 | char envstr[sizeof(envstr_prefix) + strlen(c) + 1]; |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
458 | snprintf(envstr, sizeof(envstr), "%s%s", |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
459 | envstr_prefix, c); |
|
11193
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
460 | printf("Setting HTTP Proxy: %s\n", envstr); |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
461 | putenv(envstr); |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
462 | } |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
463 | } |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
464 | |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
465 | } |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
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
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
474 | WinMain (struct HINSTANCE__ *hInstance, struct HINSTANCE__ *hPrevInstance, |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
475 | char *lpszCmdLine, int nCmdShow) { |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
476 | char errbuf[512]; |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
477 | char gaimdir[MAX_PATH]; |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
478 | HMODULE hmod; |
|
6890
7833463f1b73
[gaim-migrate @ 7436]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
479 | |
|
11469
093e0797fc85
[gaim-migrate @ 13709]
Steve Láposi <ronin_hun@users.sourceforge.net>
parents:
11441
diff
changeset
|
480 | /* If debug or help or version flag used, create console for output */ |
|
093e0797fc85
[gaim-migrate @ 13709]
Steve Láposi <ronin_hun@users.sourceforge.net>
parents:
11441
diff
changeset
|
481 | if (strstr(lpszCmdLine, "-d") || strstr(lpszCmdLine, "-h") || strstr(lpszCmdLine, "-v")) { |
|
11060
21bc781a543b
[gaim-migrate @ 13014]
Daniel Atallah <datallah@pidgin.im>
parents:
10898
diff
changeset
|
482 | LPFNATTACHCONSOLE MyAttachConsole = NULL; |
|
21bc781a543b
[gaim-migrate @ 13014]
Daniel Atallah <datallah@pidgin.im>
parents:
10898
diff
changeset
|
483 | if ((hmod = GetModuleHandle("kernel32.dll"))) { |
|
21bc781a543b
[gaim-migrate @ 13014]
Daniel Atallah <datallah@pidgin.im>
parents:
10898
diff
changeset
|
484 | MyAttachConsole = |
|
21bc781a543b
[gaim-migrate @ 13014]
Daniel Atallah <datallah@pidgin.im>
parents:
10898
diff
changeset
|
485 | (LPFNATTACHCONSOLE) |
|
21bc781a543b
[gaim-migrate @ 13014]
Daniel Atallah <datallah@pidgin.im>
parents:
10898
diff
changeset
|
486 | GetProcAddress(hmod, "AttachConsole"); |
|
21bc781a543b
[gaim-migrate @ 13014]
Daniel Atallah <datallah@pidgin.im>
parents:
10898
diff
changeset
|
487 | } |
|
21bc781a543b
[gaim-migrate @ 13014]
Daniel Atallah <datallah@pidgin.im>
parents:
10898
diff
changeset
|
488 | if ((MyAttachConsole && MyAttachConsole(ATTACH_PARENT_PROCESS)) |
|
21bc781a543b
[gaim-migrate @ 13014]
Daniel Atallah <datallah@pidgin.im>
parents:
10898
diff
changeset
|
489 | || AllocConsole()) |
|
21bc781a543b
[gaim-migrate @ 13014]
Daniel Atallah <datallah@pidgin.im>
parents:
10898
diff
changeset
|
490 | freopen("CONOUT$", "w", stdout); |
|
21bc781a543b
[gaim-migrate @ 13014]
Daniel Atallah <datallah@pidgin.im>
parents:
10898
diff
changeset
|
491 | } |
|
7802
9f9bec07b86c
[gaim-migrate @ 8448]
Herman Bloggs <herman@bluedigits.com>
parents:
7522
diff
changeset
|
492 | |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
493 | /* Load exception handler if we have it */ |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
494 | if (GetModuleFileName(NULL, gaimdir, MAX_PATH) != 0) { |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
495 | char *tmp = gaimdir; |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
496 | char *prev = NULL; |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
497 | |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
498 | while ((tmp = strchr(tmp, '\\'))) { |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
499 | prev = tmp; |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
500 | tmp++; |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
501 | } |
|
7477
40ce33c4955a
[gaim-migrate @ 8090]
Herman Bloggs <herman@bluedigits.com>
parents:
7363
diff
changeset
|
502 | |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
503 | if (prev) { |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
504 | prev[0] = '\0'; |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
505 | strcat(gaimdir, "\\exchndl.dll"); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
506 | if (LoadLibrary(gaimdir)) |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
507 | printf("Loaded exchndl.dll\n"); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
508 | } |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
509 | } else { |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
510 | snprintf(errbuf, 512, |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
511 | "Error getting module filename. Error: %u", |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
512 | (UINT) GetLastError()); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
513 | MessageBox(NULL, errbuf, NULL, MB_OK | MB_TOPMOST); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
514 | } |
|
7477
40ce33c4955a
[gaim-migrate @ 8090]
Herman Bloggs <herman@bluedigits.com>
parents:
7363
diff
changeset
|
515 | |
|
11561
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
516 | #ifndef PORTABLE |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
517 | if (!getenv("GAIM_NO_DLL_CHECK")) |
|
11561
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11555
diff
changeset
|
518 | #endif |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
519 | dll_prep(); |
|
6816
b14a3043ed09
[gaim-migrate @ 7356]
Herman Bloggs <herman@bluedigits.com>
parents:
4490
diff
changeset
|
520 | |
|
11193
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
521 | wgaim_set_locale(); |
|
11469
093e0797fc85
[gaim-migrate @ 13709]
Steve Láposi <ronin_hun@users.sourceforge.net>
parents:
11441
diff
changeset
|
522 | /* If help or version flag used, do not check Mutex */ |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
523 | if (!strstr(lpszCmdLine, "-h") && !strstr(lpszCmdLine, "-v")) |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
524 | if (!getenv("GAIM_MULTI_INST") && !wgaim_set_running()) |
|
11469
093e0797fc85
[gaim-migrate @ 13709]
Steve Láposi <ronin_hun@users.sourceforge.net>
parents:
11441
diff
changeset
|
525 | return 0; |
|
11193
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
526 | |
|
0678b5ac640a
[gaim-migrate @ 13316]
Daniel Atallah <datallah@pidgin.im>
parents:
11060
diff
changeset
|
527 | wgaim_set_proxy(); |
|
7477
40ce33c4955a
[gaim-migrate @ 8090]
Herman Bloggs <herman@bluedigits.com>
parents:
7363
diff
changeset
|
528 | |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
529 | /* Now we are ready for Gaim .. */ |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
530 | if ((hmod = LoadLibrary("gaim.dll"))) { |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
531 | gaim_main = (LPFNGAIMMAIN) GetProcAddress(hmod, "gaim_main"); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
532 | } |
|
6890
7833463f1b73
[gaim-migrate @ 7436]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
533 | |
|
11555
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
534 | if (!gaim_main) { |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
535 | snprintf(errbuf, 512, "Error loading gaim.dll. Error: %u", |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
536 | (UINT) GetLastError()); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
537 | MessageBox(NULL, errbuf, NULL, MB_OK | MB_TOPMOST); |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
538 | return 0; |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
539 | } |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
540 | |
|
1bfcd508f5d4
[gaim-migrate @ 13815]
Daniel Atallah <datallah@pidgin.im>
parents:
11469
diff
changeset
|
541 | return gaim_main (hInstance, __argc, __argv); |
| 4490 | 542 | } |