Mercurial > pidgin.yaz
annotate src/win32/win32dep.c @ 11907:d2db6426c88a
[gaim-migrate @ 14198]
sf patch #1342817, from Evan Schoenberg
"As discussed in #gaim, this patch removes idle.c and replaces it
with gtkidle.c and gtkidle.h. The attached diff removes the idle
management from its various hiding places in connection.c, server.c,
and gaim.h. The plugins Changelog.API is appropriately updated.
The new gtkidle files are attached; idle.c should be removed from
CVS."
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 30 Oct 2005 23:00:47 +0000 |
parents | 386ec55b6a15 |
children | bf01b160ab0d |
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 |
3630 | 31 #include <glib.h> |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
32 #include <glib/gstdio.h> |
4097
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
33 |
3630 | 34 #include "gaim.h" |
5913
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
35 #include "debug.h" |
6929
906567be99b2
[gaim-migrate @ 7476]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
36 #include "notify.h" |
5913
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
37 |
3630 | 38 #include "resource.h" |
4535
de9f45c815df
[gaim-migrate @ 4814]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4411
diff
changeset
|
39 #include "idletrack.h" |
5008
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
40 #include "zlib.h" |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
41 #include "untar.h" |
3630 | 42 |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
43 #include <libintl.h> |
5913
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
44 |
10673
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
45 #include "win32dep.h" |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
46 |
3630 | 47 /* |
48 * DEFINES & MACROS | |
49 */ | |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
50 #define _(x) gettext(x) |
3950
c25cf0495533
[gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3907
diff
changeset
|
51 |
3630 | 52 /* |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
53 * DATA STRUCTS |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
54 */ |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
55 |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
56 /* For shfolder.dll */ |
10589
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
57 typedef HRESULT (CALLBACK* LPFNSHGETFOLDERPATHA)(HWND, int, HANDLE, DWORD, LPSTR); |
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
58 typedef HRESULT (CALLBACK* LPFNSHGETFOLDERPATHW)(HWND, int, HANDLE, DWORD, LPWSTR); |
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 typedef enum { |
11829
4669e7461968
[gaim-migrate @ 14120]
Richard Laager <rlaager@wiktel.com>
parents:
11709
diff
changeset
|
61 SHGFP_TYPE_CURRENT = 0, /* current value for user, verify it exists */ |
4669e7461968
[gaim-migrate @ 14120]
Richard Laager <rlaager@wiktel.com>
parents:
11709
diff
changeset
|
62 SHGFP_TYPE_DEFAULT = 1, /* default value, may not exist */ |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
63 } SHGFP_TYPE; |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
64 |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
65 /* |
3630 | 66 * LOCALS |
67 */ | |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
68 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
|
69 |
3630 | 70 /* |
71 * GLOBALS | |
72 */ | |
3856
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
73 HINSTANCE gaimexe_hInstance = 0; |
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
74 HINSTANCE gaimdll_hInstance = 0; |
3630 | 75 |
76 /* | |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
77 * PROTOS |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
78 */ |
6848
060aa79a733e
[gaim-migrate @ 7393]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
79 |
4097
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
80 FARPROC wgaim_find_and_loadproc(char*, char*); |
5008
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
81 extern void wgaim_gtkspell_init(); |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
82 char* wgaim_data_dir(void); |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
83 |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
84 /* |
3630 | 85 * STATIC CODE |
86 */ | |
87 | |
7526
77727178a1df
[gaim-migrate @ 8139]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7523
diff
changeset
|
88 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
|
89 char *str = NULL; |
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
90 if (args != NULL) { |
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
91 str = g_strdup_vprintf(format, args); |
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
92 } else { |
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
93 str = g_strdup(format); |
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
94 } |
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
95 printf("%s%s%s", category?category:"", category?": ":"",str); |
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
96 g_free(str); |
7526
77727178a1df
[gaim-migrate @ 8139]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7523
diff
changeset
|
97 } |
77727178a1df
[gaim-migrate @ 8139]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7523
diff
changeset
|
98 |
7803
ec291c2cad6a
[gaim-migrate @ 8449]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7606
diff
changeset
|
99 static GaimDebugUiOps ops = { |
7526
77727178a1df
[gaim-migrate @ 8139]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7523
diff
changeset
|
100 wgaim_debug_print |
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 |
4097
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
103 /* |
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
104 * PUBLIC CODE |
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
105 */ |
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
106 |
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
107 HINSTANCE wgaim_hinstance(void) { |
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
108 return gaimexe_hInstance; |
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 |
4406
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
111 /* Escape windows dir separators. This is needed when paths are saved, |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
112 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
|
113 Returns an allocated string which needs to be freed. |
4406
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
114 */ |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
115 char* wgaim_escape_dirsep( char* filename ) { |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
116 int sepcount=0; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
117 char* ret=NULL; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
118 int cnt=0; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
119 |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
120 ret = filename; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
121 while(*ret) { |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
122 if(*ret == '\\') |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
123 sepcount++; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
124 ret++; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
125 } |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
126 ret = g_malloc0(strlen(filename) + sepcount + 1); |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
127 while(*filename) { |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
128 ret[cnt] = *filename; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
129 if(*filename == '\\') |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
130 ret[++cnt] = '\\'; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
131 filename++; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
132 cnt++; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
133 } |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
134 ret[cnt] = '\0'; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
135 return ret; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
136 } |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
137 |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
138 /* Determine whether the specified dll contains the specified procedure. |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
139 If so, load it (if not already loaded). */ |
4097
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
140 FARPROC wgaim_find_and_loadproc( char* dllname, char* procedure ) { |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
141 HMODULE hmod; |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
142 int did_load=0; |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
143 FARPROC proc = 0; |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
144 |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
145 if(!(hmod=GetModuleHandle(dllname))) { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
146 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
|
147 if(!(hmod = LoadLibrary(dllname))) { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
148 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
|
149 return NULL; |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
150 } |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
151 else |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
152 did_load = 1; |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
153 } |
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 if((proc=GetProcAddress(hmod, procedure))) { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
156 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
|
157 dllname, procedure); |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
158 return proc; |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
159 } |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
160 else { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
161 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
|
162 procedure, dllname); |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
163 if(did_load) { |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
164 /* unload dll */ |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
165 FreeLibrary(hmod); |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
166 } |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
167 return NULL; |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
168 } |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
169 } |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
170 |
3856
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
171 /* Determine Gaim Paths during Runtime */ |
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
172 |
10673
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
173 /* Get paths to special Windows folders. */ |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
174 char *wgaim_get_special_folder(int folder_type) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
175 static LPFNSHGETFOLDERPATHA MySHGetFolderPathA = NULL; |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
176 char *retval = NULL; |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
177 #if GLIB_CHECK_VERSION(2,6,0) |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
178 static LPFNSHGETFOLDERPATHW MySHGetFolderPathW = NULL; |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
179 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
180 if (!MySHGetFolderPathW) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
181 MySHGetFolderPathW = (LPFNSHGETFOLDERPATHW) |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
182 wgaim_find_and_loadproc("shfolder.dll", "SHGetFolderPathW"); |
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 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
185 if (MySHGetFolderPathW) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
186 wchar_t utf_16_dir[MAX_PATH + 1]; |
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 if (SUCCEEDED(MySHGetFolderPathW(NULL, folder_type, NULL, |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
189 SHGFP_TYPE_CURRENT, utf_16_dir))) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
190 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
|
191 } |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
192 } |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
193 #endif |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
194 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
195 if (!retval) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
196 if (!MySHGetFolderPathA) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
197 MySHGetFolderPathA = (LPFNSHGETFOLDERPATHA) |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
198 wgaim_find_and_loadproc("shfolder.dll", "SHGetFolderPathA"); |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
199 } |
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 char locale_dir[MAX_PATH + 1]; |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
202 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
203 if (SUCCEEDED(MySHGetFolderPathA(NULL, folder_type, NULL, |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
204 SHGFP_TYPE_CURRENT, locale_dir))) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
205 #if GLIB_CHECK_VERSION(2,6,0) |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
206 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
|
207 #else |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
208 retval = g_strdup(locale_dir); |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
209 #endif |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
210 } |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
211 } |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
212 } |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
213 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
214 return retval; |
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 |
3630 | 217 char* wgaim_install_dir(void) { |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
218 static gboolean initialized = FALSE; |
3630 | 219 |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
220 if (!initialized) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
221 char *tmp = NULL; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
222 if (G_WIN32_HAVE_WIDECHAR_API()) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
223 wchar_t winstall_dir[MAXPATHLEN]; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
224 if (GetModuleFileNameW(NULL, winstall_dir, |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
225 MAXPATHLEN) > 0) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
226 tmp = g_utf16_to_utf8(winstall_dir, -1, |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
227 NULL, NULL, NULL); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
228 } |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
229 } else { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
230 gchar cpinstall_dir[MAXPATHLEN]; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
231 if (GetModuleFileNameA(NULL, cpinstall_dir, |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
232 MAXPATHLEN) > 0) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
233 tmp = g_locale_to_utf8(cpinstall_dir, |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
234 -1, NULL, NULL, NULL); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
235 } |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
236 } |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
237 |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
238 if (tmp == NULL) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
239 tmp = g_win32_error_message(GetLastError()); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
240 gaim_debug(GAIM_DEBUG_ERROR, "wgaim", |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
241 "GetModuleFileName error: %s\n", tmp); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
242 g_free(tmp); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
243 return NULL; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
244 } else { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
245 install_dir = g_path_get_dirname(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 initialized = TRUE; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
248 } |
3630 | 249 } |
250 | |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
251 return install_dir; |
3630 | 252 } |
253 | |
254 char* wgaim_lib_dir(void) { | |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
255 static gboolean initialized = FALSE; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
256 |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
257 if (!initialized) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
258 char *inst_dir = wgaim_install_dir(); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
259 if (inst_dir != NULL) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
260 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
|
261 initialized = TRUE; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
262 } else { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
263 return NULL; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
264 } |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
265 } |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
266 |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
267 return lib_dir; |
3630 | 268 } |
269 | |
270 char* wgaim_locale_dir(void) { | |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
271 static gboolean initialized = FALSE; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
272 |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
273 if (!initialized) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
274 char *inst_dir = wgaim_install_dir(); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
275 if (inst_dir != NULL) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
276 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
|
277 initialized = TRUE; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
278 } else { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
279 return NULL; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
280 } |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
281 } |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
282 |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
283 return locale_dir; |
3630 | 284 } |
285 | |
6848
060aa79a733e
[gaim-migrate @ 7393]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
286 char* wgaim_data_dir(void) { |
10673
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
287 return app_data_dir; |
6848
060aa79a733e
[gaim-migrate @ 7393]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
288 } |
060aa79a733e
[gaim-migrate @ 7393]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
289 |
3973
d9287e87ba56
[gaim-migrate @ 4157]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3950
diff
changeset
|
290 /* Miscellaneous */ |
d9287e87ba56
[gaim-migrate @ 4157]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3950
diff
changeset
|
291 |
6437
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
292 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
|
293 HKEY hkey; |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
294 gboolean ret = FALSE; |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
295 |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
296 if(ERROR_SUCCESS == RegOpenKeyEx(key, |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
297 sub_key, |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
298 0, KEY_QUERY_VALUE, &hkey)) { |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
299 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
|
300 ret = TRUE; |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
301 RegCloseKey(key); |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
302 } |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
303 return ret; |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
304 } |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
305 |
5008
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
306 int wgaim_gz_decompress(const char* in, const char* out) { |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
307 gzFile fin; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
308 FILE *fout; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
309 char buf[1024]; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
310 int ret; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
311 |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
312 if((fin = gzopen(in, "rb"))) { |
10589
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
313 if(!(fout = g_fopen(out, "wb"))) { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
314 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
|
315 gzclose(fin); |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
316 return 0; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
317 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
318 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
319 else { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
320 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
|
321 return 0; |
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 |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
324 while((ret=gzread(fin, buf, 1024))) { |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
325 if(fwrite(buf, 1, ret, fout) < ret) { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
326 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
|
327 gzclose(fin); |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
328 fclose(fout); |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
329 return 0; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
330 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
331 } |
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 gzclose(fin); |
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 if(ret < 0) { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
336 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
|
337 return 0; |
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 |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
340 return 1; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
341 } |
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 int wgaim_gz_untar(const char* filename, const char* destdir) { |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
344 char tmpfile[_MAX_PATH]; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
345 char template[]="wgaimXXXXXX"; |
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 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
|
348 if(wgaim_gz_decompress(filename, tmpfile)) { |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
349 int ret; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
350 if(untar(tmpfile, destdir, UNTAR_FORCE | UNTAR_QUIET)) |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
351 ret=1; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
352 else { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
353 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
|
354 ret=0; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
355 } |
10589
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
356 g_unlink(tmpfile); |
5008
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
357 return ret; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
358 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
359 else { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
360 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
|
361 return 0; |
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 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
364 |
10240
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
365 void wgaim_notify_uri(const char *uri) { |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
366 SHELLEXECUTEINFO sinfo; |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
367 |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
368 memset(&sinfo, 0, sizeof(sinfo)); |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
369 sinfo.cbSize = sizeof(sinfo); |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
370 sinfo.fMask = SEE_MASK_CLASSNAME; |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
371 sinfo.lpVerb = "open"; |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
372 sinfo.lpFile = uri; |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
373 sinfo.nShow = SW_SHOWNORMAL; |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
374 sinfo.lpClass = "http"; |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
375 |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
376 /* We'll allow whatever URI schemes are supported by the |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
377 default http browser. |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
378 */ |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
379 if(!ShellExecuteEx(&sinfo)) |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
380 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
|
381 } |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
382 |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
383 void wgaim_init(HINSTANCE hint) { |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
384 WORD wVersionRequested; |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
385 WSADATA wsaData; |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
386 char *perlenv; |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
387 char *newenv; |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
388 |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
389 gaim_debug_set_ui_ops(&ops); |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
390 gaim_debug(GAIM_DEBUG_INFO, "wgaim", "wgaim_init start\n"); |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
391 |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
392 gaimexe_hInstance = hint; |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
393 |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
394 /* Winsock init */ |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
395 wVersionRequested = MAKEWORD( 2, 2 ); |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
396 WSAStartup( wVersionRequested, &wsaData ); |
6848
060aa79a733e
[gaim-migrate @ 7393]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
397 |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
398 /* Confirm that the winsock DLL supports 2.2 */ |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
399 /* Note that if the DLL supports versions greater than |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
400 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
|
401 wVersion since that is the version we requested. */ |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
402 if ( LOBYTE( wsaData.wVersion ) != 2 || |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
403 HIBYTE( wsaData.wVersion ) != 2 ) { |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
404 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
|
405 WSACleanup(); |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
406 } |
3856
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
407 |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
408 /* Set Environmental Variables */ |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
409 /* Tell perl where to find Gaim's perl modules */ |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
410 perlenv = (char*) g_getenv("PERL5LIB"); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
411 newenv = g_strdup_printf("PERL5LIB=%s%s%s%s", |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
412 perlenv ? perlenv : "", |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
413 perlenv ? ";" : "", |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
414 wgaim_install_dir(), |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
415 "\\perlmod;"); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
416 if (putenv(newenv) < 0) |
6816
5aeba37b303c
[gaim-migrate @ 7356]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6437
diff
changeset
|
417 gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "putenv failed\n"); |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
418 g_free(newenv); |
6848
060aa79a733e
[gaim-migrate @ 7393]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
419 |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
420 /* Set app data dir, used by gaim_home_dir */ |
10673
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
421 newenv = (char*) g_getenv("GAIMHOME"); |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
422 if (newenv) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
423 app_data_dir = g_strdup(newenv); |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
424 } else { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
425 app_data_dir = wgaim_get_special_folder(CSIDL_APPDATA); |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
426 if (!app_data_dir) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
427 app_data_dir = g_strdup("C:"); |
10589
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
428 } |
6848
060aa79a733e
[gaim-migrate @ 7393]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
429 } |
10673
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
430 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
431 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
|
432 |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
433 /* IdleTracker Initialization */ |
4535
de9f45c815df
[gaim-migrate @ 4814]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4411
diff
changeset
|
434 if(!wgaim_set_idlehooks()) |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
435 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
|
436 |
6cb8b0686e46
[gaim-migrate @ 5188]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4728
diff
changeset
|
437 wgaim_gtkspell_init(); |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
438 gaim_debug(GAIM_DEBUG_INFO, "wgaim", "wgaim_init end\n"); |
3630 | 439 } |
3856
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
440 |
3907
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
441 /* Windows Cleanup */ |
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
442 |
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
443 void wgaim_cleanup(void) { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
444 gaim_debug(GAIM_DEBUG_INFO, "wgaim", "wgaim_cleanup\n"); |
3907
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
445 |
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
446 /* winsock cleanup */ |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
447 WSACleanup(); |
3907
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
448 |
4535
de9f45c815df
[gaim-migrate @ 4814]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4411
diff
changeset
|
449 /* Idle tracker cleanup */ |
de9f45c815df
[gaim-migrate @ 4814]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4411
diff
changeset
|
450 wgaim_remove_idlehooks(); |
10673
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
451 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
452 g_free(app_data_dir); |
3907
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
453 } |
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
454 |
3950
c25cf0495533
[gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3907
diff
changeset
|
455 /* DLL initializer */ |
3856
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
456 BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) { |
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
457 gaimdll_hInstance = hinstDLL; |
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
458 return TRUE; |
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
459 } |