Mercurial > pidgin.yaz
annotate src/win32/win32dep.c @ 11671:4ebd27e664c4
[gaim-migrate @ 13957]
1327538 was not the problem, a stale/old gaimosd was.
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Sat, 15 Oct 2005 19:25:18 +0000 |
parents | 9f6df41df587 |
children | cae2fb7e8594 |
rev | line source |
---|---|
3630 | 1 /* |
5913
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
2 * gaim |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
3 * |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
4 * File: win32dep.c |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
5 * Date: June, 2002 |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
6 * Description: Windows dependant code for Gaim |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
7 * |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
8 * Copyright (C) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com> |
3630 | 9 * |
5913
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
10 * This program is free software; you can redistribute it and/or modify |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
12 * the Free Software Foundation; either version 2 of the License, or |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
13 * (at your option) any later version. |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
14 * |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
18 * GNU General Public License for more details. |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
19 * |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
21 * along with this program; if not, write to the Free Software |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
23 * |
3630 | 24 */ |
25 #include <windows.h> | |
6425
26b739bc9f1a
[gaim-migrate @ 6933]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6423
diff
changeset
|
26 #include <io.h> |
3630 | 27 #include <stdlib.h> |
28 #include <stdio.h> | |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
29 #include <winuser.h> |
5913
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
30 |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
31 #include <gtk/gtk.h> |
3630 | 32 #include <glib.h> |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
33 #include <glib/gstdio.h> |
3973
d9287e87ba56
[gaim-migrate @ 4157]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3950
diff
changeset
|
34 #include <gdk/gdkwin32.h> |
4097
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
35 |
3630 | 36 #include "gaim.h" |
5913
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
37 #include "debug.h" |
6929
906567be99b2
[gaim-migrate @ 7476]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
38 #include "notify.h" |
5913
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
39 |
3630 | 40 #include "stdafx.h" |
41 #include "resource.h" | |
3950
c25cf0495533
[gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3907
diff
changeset
|
42 #include "MinimizeToTray.h" |
4535
de9f45c815df
[gaim-migrate @ 4814]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4411
diff
changeset
|
43 #include "idletrack.h" |
5008
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
44 #include "zlib.h" |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
45 #include "untar.h" |
3630 | 46 |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
47 #include <libintl.h> |
5913
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
48 |
10673
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
49 #include "win32dep.h" |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
50 |
3630 | 51 /* |
52 * DEFINES & MACROS | |
53 */ | |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
54 #define _(x) gettext(x) |
3950
c25cf0495533
[gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3907
diff
changeset
|
55 |
3630 | 56 /* |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
57 * DATA STRUCTS |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
58 */ |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
59 |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
60 /* For shfolder.dll */ |
10589
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
61 typedef HRESULT (CALLBACK* LPFNSHGETFOLDERPATHA)(HWND, int, HANDLE, DWORD, LPSTR); |
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
62 typedef HRESULT (CALLBACK* LPFNSHGETFOLDERPATHW)(HWND, int, HANDLE, DWORD, LPWSTR); |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
63 |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
64 typedef enum { |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
65 SHGFP_TYPE_CURRENT = 0, // current value for user, verify it exists |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
66 SHGFP_TYPE_DEFAULT = 1, // default value, may not exist |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
67 } SHGFP_TYPE; |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
68 |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
69 /* |
3630 | 70 * LOCALS |
71 */ | |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
72 static char *app_data_dir, *install_dir, *lib_dir, *locale_dir; |
3950
c25cf0495533
[gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3907
diff
changeset
|
73 |
3630 | 74 /* |
75 * GLOBALS | |
76 */ | |
3856
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
77 HINSTANCE gaimexe_hInstance = 0; |
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
78 HINSTANCE gaimdll_hInstance = 0; |
3630 | 79 |
80 /* | |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
81 * PROTOS |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
82 */ |
6848
060aa79a733e
[gaim-migrate @ 7393]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
83 |
4097
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
84 FARPROC wgaim_find_and_loadproc(char*, char*); |
5008
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
85 extern void wgaim_gtkspell_init(); |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
86 char* wgaim_data_dir(void); |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
87 |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
88 /* |
3630 | 89 * STATIC CODE |
90 */ | |
91 | |
7526
77727178a1df
[gaim-migrate @ 8139]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7523
diff
changeset
|
92 static void wgaim_debug_print(GaimDebugLevel level, const char *category, const char *format, va_list args) { |
10589
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
93 char *str = NULL; |
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
94 if (args != NULL) { |
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
95 str = g_strdup_vprintf(format, args); |
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
96 } else { |
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
97 str = g_strdup(format); |
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
98 } |
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
99 printf("%s%s%s", category?category:"", category?": ":"",str); |
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
100 g_free(str); |
7526
77727178a1df
[gaim-migrate @ 8139]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7523
diff
changeset
|
101 } |
77727178a1df
[gaim-migrate @ 8139]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7523
diff
changeset
|
102 |
7803
ec291c2cad6a
[gaim-migrate @ 8449]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7606
diff
changeset
|
103 static GaimDebugUiOps ops = { |
7526
77727178a1df
[gaim-migrate @ 8139]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7523
diff
changeset
|
104 wgaim_debug_print |
77727178a1df
[gaim-migrate @ 8139]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7523
diff
changeset
|
105 }; |
77727178a1df
[gaim-migrate @ 8139]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7523
diff
changeset
|
106 |
4097
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
107 /* |
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
108 * PUBLIC CODE |
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
109 */ |
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
110 |
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
111 HINSTANCE wgaim_hinstance(void) { |
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
112 return gaimexe_hInstance; |
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
113 } |
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
114 |
4406
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
115 /* Escape windows dir separators. This is needed when paths are saved, |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
116 and on being read back have their '\' chars used as an escape char. |
4555
75f75ef235e4
[gaim-migrate @ 4835]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4535
diff
changeset
|
117 Returns an allocated string which needs to be freed. |
4406
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
118 */ |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
119 char* wgaim_escape_dirsep( char* filename ) { |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
120 int sepcount=0; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
121 char* ret=NULL; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
122 int cnt=0; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
123 |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
124 ret = filename; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
125 while(*ret) { |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
126 if(*ret == '\\') |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
127 sepcount++; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
128 ret++; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
129 } |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
130 ret = g_malloc0(strlen(filename) + sepcount + 1); |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
131 while(*filename) { |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
132 ret[cnt] = *filename; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
133 if(*filename == '\\') |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
134 ret[++cnt] = '\\'; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
135 filename++; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
136 cnt++; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
137 } |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
138 ret[cnt] = '\0'; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
139 return ret; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
140 } |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
141 |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
142 /* Determine whether the specified dll contains the specified procedure. |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
143 If so, load it (if not already loaded). */ |
4097
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
144 FARPROC wgaim_find_and_loadproc( char* dllname, char* procedure ) { |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
145 HMODULE hmod; |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
146 int did_load=0; |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
147 FARPROC proc = 0; |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
148 |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
149 if(!(hmod=GetModuleHandle(dllname))) { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
150 gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "%s not found. Loading it..\n", dllname); |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
151 if(!(hmod = LoadLibrary(dllname))) { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
152 gaim_debug(GAIM_DEBUG_ERROR, "wgaim", "Could not load: %s\n", dllname); |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
153 return NULL; |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
154 } |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
155 else |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
156 did_load = 1; |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
157 } |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
158 |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
159 if((proc=GetProcAddress(hmod, procedure))) { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
160 gaim_debug(GAIM_DEBUG_INFO, "wgaim", "This version of %s contains %s\n", |
4555
75f75ef235e4
[gaim-migrate @ 4835]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4535
diff
changeset
|
161 dllname, procedure); |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
162 return proc; |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
163 } |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
164 else { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
165 gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "Function %s not found in dll %s\n", |
4555
75f75ef235e4
[gaim-migrate @ 4835]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4535
diff
changeset
|
166 procedure, dllname); |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
167 if(did_load) { |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
168 /* unload dll */ |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
169 FreeLibrary(hmod); |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
170 } |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
171 return NULL; |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
172 } |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
173 } |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
174 |
3856
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
175 /* Determine Gaim Paths during Runtime */ |
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
176 |
10673
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
177 /* Get paths to special Windows folders. */ |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
178 char *wgaim_get_special_folder(int folder_type) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
179 static LPFNSHGETFOLDERPATHA MySHGetFolderPathA = NULL; |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
180 char *retval = NULL; |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
181 #if GLIB_CHECK_VERSION(2,6,0) |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
182 static LPFNSHGETFOLDERPATHW MySHGetFolderPathW = NULL; |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
183 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
184 if (!MySHGetFolderPathW) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
185 MySHGetFolderPathW = (LPFNSHGETFOLDERPATHW) |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
186 wgaim_find_and_loadproc("shfolder.dll", "SHGetFolderPathW"); |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
187 } |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
188 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
189 if (MySHGetFolderPathW) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
190 wchar_t utf_16_dir[MAX_PATH + 1]; |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
191 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
192 if (SUCCEEDED(MySHGetFolderPathW(NULL, folder_type, NULL, |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
193 SHGFP_TYPE_CURRENT, utf_16_dir))) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
194 retval = g_utf16_to_utf8(utf_16_dir, -1, NULL, NULL, NULL); |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
195 } |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
196 } |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
197 #endif |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
198 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
199 if (!retval) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
200 if (!MySHGetFolderPathA) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
201 MySHGetFolderPathA = (LPFNSHGETFOLDERPATHA) |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
202 wgaim_find_and_loadproc("shfolder.dll", "SHGetFolderPathA"); |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
203 } |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
204 if (MySHGetFolderPathA) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
205 char locale_dir[MAX_PATH + 1]; |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
206 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
207 if (SUCCEEDED(MySHGetFolderPathA(NULL, folder_type, NULL, |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
208 SHGFP_TYPE_CURRENT, locale_dir))) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
209 #if GLIB_CHECK_VERSION(2,6,0) |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
210 retval = g_locale_to_utf8(locale_dir, -1, NULL, NULL, NULL); |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
211 #else |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
212 retval = g_strdup(locale_dir); |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
213 #endif |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
214 } |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
215 } |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
216 } |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
217 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
218 return retval; |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
219 } |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
220 |
3630 | 221 char* wgaim_install_dir(void) { |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
222 static gboolean initialized = FALSE; |
3630 | 223 |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
224 if (!initialized) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
225 char *tmp = NULL; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
226 if (G_WIN32_HAVE_WIDECHAR_API()) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
227 wchar_t winstall_dir[MAXPATHLEN]; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
228 if (GetModuleFileNameW(NULL, winstall_dir, |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
229 MAXPATHLEN) > 0) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
230 tmp = g_utf16_to_utf8(winstall_dir, -1, |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
231 NULL, NULL, NULL); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
232 } |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
233 } else { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
234 gchar cpinstall_dir[MAXPATHLEN]; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
235 if (GetModuleFileNameA(NULL, cpinstall_dir, |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
236 MAXPATHLEN) > 0) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
237 tmp = g_locale_to_utf8(cpinstall_dir, |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
238 -1, NULL, NULL, NULL); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
239 } |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
240 } |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
241 |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
242 if (tmp == NULL) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
243 tmp = g_win32_error_message(GetLastError()); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
244 gaim_debug(GAIM_DEBUG_ERROR, "wgaim", |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
245 "GetModuleFileName error: %s\n", tmp); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
246 g_free(tmp); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
247 return NULL; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
248 } else { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
249 install_dir = g_path_get_dirname(tmp); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
250 g_free(tmp); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
251 initialized = TRUE; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
252 } |
3630 | 253 } |
254 | |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
255 return install_dir; |
3630 | 256 } |
257 | |
258 char* wgaim_lib_dir(void) { | |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
259 static gboolean initialized = FALSE; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
260 |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
261 if (!initialized) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
262 char *inst_dir = wgaim_install_dir(); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
263 if (inst_dir != NULL) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
264 lib_dir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "plugins", inst_dir); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
265 initialized = TRUE; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
266 } else { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
267 return NULL; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
268 } |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
269 } |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
270 |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
271 return lib_dir; |
3630 | 272 } |
273 | |
274 char* wgaim_locale_dir(void) { | |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
275 static gboolean initialized = FALSE; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
276 |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
277 if (!initialized) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
278 char *inst_dir = wgaim_install_dir(); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
279 if (inst_dir != NULL) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
280 locale_dir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "locale", inst_dir); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
281 initialized = TRUE; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
282 } else { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
283 return NULL; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
284 } |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
285 } |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
286 |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
287 return locale_dir; |
3630 | 288 } |
289 | |
6848
060aa79a733e
[gaim-migrate @ 7393]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
290 char* wgaim_data_dir(void) { |
10673
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
291 return app_data_dir; |
6848
060aa79a733e
[gaim-migrate @ 7393]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
292 } |
060aa79a733e
[gaim-migrate @ 7393]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
293 |
3973
d9287e87ba56
[gaim-migrate @ 4157]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3950
diff
changeset
|
294 /* Miscellaneous */ |
d9287e87ba56
[gaim-migrate @ 4157]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3950
diff
changeset
|
295 |
6437
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
296 gboolean wgaim_read_reg_string(HKEY key, char* sub_key, char* val_name, LPBYTE data, LPDWORD data_len) { |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
297 HKEY hkey; |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
298 gboolean ret = FALSE; |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
299 |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
300 if(ERROR_SUCCESS == RegOpenKeyEx(key, |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
301 sub_key, |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
302 0, KEY_QUERY_VALUE, &hkey)) { |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
303 if(ERROR_SUCCESS == RegQueryValueEx(hkey, val_name, 0, NULL, data, data_len)) |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
304 ret = TRUE; |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
305 RegCloseKey(key); |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
306 } |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
307 return ret; |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
308 } |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
309 |
5008
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
310 int wgaim_gz_decompress(const char* in, const char* out) { |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
311 gzFile fin; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
312 FILE *fout; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
313 char buf[1024]; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
314 int ret; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
315 |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
316 if((fin = gzopen(in, "rb"))) { |
10589
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
317 if(!(fout = g_fopen(out, "wb"))) { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
318 gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_decompress", "Error opening file: %s\n", out); |
5008
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
319 gzclose(fin); |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
320 return 0; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
321 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
322 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
323 else { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
324 gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_decompress", "gzopen failed to open: %s\n", in); |
5008
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
325 return 0; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
326 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
327 |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
328 while((ret=gzread(fin, buf, 1024))) { |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
329 if(fwrite(buf, 1, ret, fout) < ret) { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
330 gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_decompress", "Error writing %d bytes to file\n", ret); |
5008
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
331 gzclose(fin); |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
332 fclose(fout); |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
333 return 0; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
334 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
335 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
336 fclose(fout); |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
337 gzclose(fin); |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
338 |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
339 if(ret < 0) { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
340 gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_decompress", "gzread failed while reading: %s\n", in); |
5008
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
341 return 0; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
342 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
343 |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
344 return 1; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
345 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
346 |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
347 int wgaim_gz_untar(const char* filename, const char* destdir) { |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
348 char tmpfile[_MAX_PATH]; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
349 char template[]="wgaimXXXXXX"; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
350 |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
351 sprintf(tmpfile, "%s%s%s", g_get_tmp_dir(), G_DIR_SEPARATOR_S, _mktemp(template)); |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
352 if(wgaim_gz_decompress(filename, tmpfile)) { |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
353 int ret; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
354 if(untar(tmpfile, destdir, UNTAR_FORCE | UNTAR_QUIET)) |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
355 ret=1; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
356 else { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
357 gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_untar", "Failure untaring %s\n", tmpfile); |
5008
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
358 ret=0; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
359 } |
10589
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
360 g_unlink(tmpfile); |
5008
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
361 return ret; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
362 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
363 else { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
364 gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_untar", "Failed to gz decompress %s\n", filename); |
5008
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
365 return 0; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
366 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
367 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
368 |
6083
65fad4831077
[gaim-migrate @ 6542]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5913
diff
changeset
|
369 /* Moved over from old systray.c */ |
65fad4831077
[gaim-migrate @ 6542]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5913
diff
changeset
|
370 void wgaim_systray_minimize( GtkWidget *window ) { |
65fad4831077
[gaim-migrate @ 6542]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5913
diff
changeset
|
371 MinimizeWndToTray(GDK_WINDOW_HWND(window->window)); |
65fad4831077
[gaim-migrate @ 6542]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5913
diff
changeset
|
372 } |
65fad4831077
[gaim-migrate @ 6542]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5913
diff
changeset
|
373 |
65fad4831077
[gaim-migrate @ 6542]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5913
diff
changeset
|
374 void wgaim_systray_maximize( GtkWidget *window ) { |
65fad4831077
[gaim-migrate @ 6542]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5913
diff
changeset
|
375 RestoreWndFromTray(GDK_WINDOW_HWND(window->window)); |
65fad4831077
[gaim-migrate @ 6542]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5913
diff
changeset
|
376 } |
65fad4831077
[gaim-migrate @ 6542]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5913
diff
changeset
|
377 |
10240
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
378 void wgaim_notify_uri(const char *uri) { |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
379 SHELLEXECUTEINFO sinfo; |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
380 |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
381 memset(&sinfo, 0, sizeof(sinfo)); |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
382 sinfo.cbSize = sizeof(sinfo); |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
383 sinfo.fMask = SEE_MASK_CLASSNAME; |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
384 sinfo.lpVerb = "open"; |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
385 sinfo.lpFile = uri; |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
386 sinfo.nShow = SW_SHOWNORMAL; |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
387 sinfo.lpClass = "http"; |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
388 |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
389 /* We'll allow whatever URI schemes are supported by the |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
390 default http browser. |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
391 */ |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
392 if(!ShellExecuteEx(&sinfo)) |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
393 gaim_debug_error("wgaim", "Error opening URI: %s error: %d\n", uri, (int)sinfo.hInstApp); |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
394 } |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
395 |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
396 void wgaim_init(HINSTANCE hint) { |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
397 WORD wVersionRequested; |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
398 WSADATA wsaData; |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
399 char *perlenv; |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
400 char *newenv; |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
401 |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
402 gaim_debug_set_ui_ops(&ops); |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
403 gaim_debug(GAIM_DEBUG_INFO, "wgaim", "wgaim_init start\n"); |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
404 |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
405 gaimexe_hInstance = hint; |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
406 |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
407 /* Winsock init */ |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
408 wVersionRequested = MAKEWORD( 2, 2 ); |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
409 WSAStartup( wVersionRequested, &wsaData ); |
6848
060aa79a733e
[gaim-migrate @ 7393]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
410 |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
411 /* Confirm that the winsock DLL supports 2.2 */ |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
412 /* Note that if the DLL supports versions greater than |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
413 2.2 in addition to 2.2, it will still return 2.2 in |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
414 wVersion since that is the version we requested. */ |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
415 if ( LOBYTE( wsaData.wVersion ) != 2 || |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
416 HIBYTE( wsaData.wVersion ) != 2 ) { |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
417 gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "Could not find a usable WinSock DLL. Oh well.\n"); |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
418 WSACleanup(); |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
419 } |
3856
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
420 |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
421 /* Set Environmental Variables */ |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
422 /* Tell perl where to find Gaim's perl modules */ |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
423 perlenv = (char*) g_getenv("PERL5LIB"); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
424 newenv = g_strdup_printf("PERL5LIB=%s%s%s%s", |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
425 perlenv ? perlenv : "", |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
426 perlenv ? ";" : "", |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
427 wgaim_install_dir(), |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
428 "\\perlmod;"); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
429 if (putenv(newenv) < 0) |
6816
5aeba37b303c
[gaim-migrate @ 7356]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6437
diff
changeset
|
430 gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "putenv failed\n"); |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
431 g_free(newenv); |
6848
060aa79a733e
[gaim-migrate @ 7393]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
432 |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
433 /* Set app data dir, used by gaim_home_dir */ |
10673
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
434 newenv = (char*) g_getenv("GAIMHOME"); |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
435 if (newenv) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
436 app_data_dir = g_strdup(newenv); |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
437 } else { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
438 app_data_dir = wgaim_get_special_folder(CSIDL_APPDATA); |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
439 if (!app_data_dir) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
440 app_data_dir = g_strdup("C:"); |
10589
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
441 } |
6848
060aa79a733e
[gaim-migrate @ 7393]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
442 } |
10673
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
443 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
444 gaim_debug(GAIM_DEBUG_INFO, "wgaim", "Gaim settings dir: %s\n", app_data_dir); |
3907
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
445 |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
446 /* IdleTracker Initialization */ |
4535
de9f45c815df
[gaim-migrate @ 4814]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4411
diff
changeset
|
447 if(!wgaim_set_idlehooks()) |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
448 gaim_debug(GAIM_DEBUG_ERROR, "wgaim", "Failed to initialize idle tracker\n"); |
4861
6cb8b0686e46
[gaim-migrate @ 5188]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4728
diff
changeset
|
449 |
6cb8b0686e46
[gaim-migrate @ 5188]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4728
diff
changeset
|
450 wgaim_gtkspell_init(); |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
451 gaim_debug(GAIM_DEBUG_INFO, "wgaim", "wgaim_init end\n"); |
3630 | 452 } |
3856
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
453 |
3907
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
454 /* Windows Cleanup */ |
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
455 |
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
456 void wgaim_cleanup(void) { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
457 gaim_debug(GAIM_DEBUG_INFO, "wgaim", "wgaim_cleanup\n"); |
3907
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
458 |
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
459 /* winsock cleanup */ |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
460 WSACleanup(); |
3907
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
461 |
4535
de9f45c815df
[gaim-migrate @ 4814]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4411
diff
changeset
|
462 /* Idle tracker cleanup */ |
de9f45c815df
[gaim-migrate @ 4814]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4411
diff
changeset
|
463 wgaim_remove_idlehooks(); |
10673
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
464 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
465 g_free(app_data_dir); |
3907
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
466 } |
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
467 |
3950
c25cf0495533
[gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3907
diff
changeset
|
468 /* DLL initializer */ |
3856
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
469 BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) { |
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
470 gaimdll_hInstance = hinstDLL; |
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
471 return TRUE; |
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
472 } |