Fri, 11 Feb 2005 05:10:40 +0000
[gaim-migrate @ 11994]
Use GLib 2.6's gstdio functions. This should fix gaim not liking non-ascii filenames in win32.
| 3630 | 1 | /* |
|
5913
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
2 | * gaim |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
3 | * |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
4 | * File: win32dep.c |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
5 | * Date: June, 2002 |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
6 | * Description: Windows dependant code for Gaim |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
7 | * |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
8 | * Copyright (C) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com> |
| 3630 | 9 | * |
|
5913
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
10 | * This program is free software; you can redistribute it and/or modify |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
11 | * it under the terms of the GNU General Public License as published by |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
12 | * the Free Software Foundation; either version 2 of the License, or |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
13 | * (at your option) any later version. |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
14 | * |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
15 | * This program is distributed in the hope that it will be useful, |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
18 | * GNU General Public License for more details. |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
19 | * |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
20 | * You should have received a copy of the GNU General Public License |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
21 | * along with this program; if not, write to the Free Software |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
23 | * |
| 3630 | 24 | */ |
| 25 | #include <windows.h> | |
|
6425
3e86c949c98a
[gaim-migrate @ 6933]
Herman Bloggs <herman@bluedigits.com>
parents:
6423
diff
changeset
|
26 | #include <io.h> |
| 3630 | 27 | #include <stdlib.h> |
| 28 | #include <stdio.h> | |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
29 | #include <winuser.h> |
|
10589
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
30 | #include <shlobj.h> |
|
5913
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
31 | |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
32 | #include <gtk/gtk.h> |
| 3630 | 33 | #include <glib.h> |
|
10589
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
34 | #if GLIB_CHECK_VERSION(2,6,0) |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
35 | # include <glib/gstdio.h> |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
36 | #else |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
37 | # define g_fopen fopen |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
38 | # define g_unlink unlink |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
39 | #endif |
|
3973
acade2595b85
[gaim-migrate @ 4157]
Herman Bloggs <herman@bluedigits.com>
parents:
3950
diff
changeset
|
40 | #include <gdk/gdkwin32.h> |
|
4097
3ad9e41eb933
[gaim-migrate @ 4312]
Herman Bloggs <herman@bluedigits.com>
parents:
4042
diff
changeset
|
41 | |
| 3630 | 42 | #include "gaim.h" |
|
5913
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
43 | #include "debug.h" |
|
6929
47829b408f9d
[gaim-migrate @ 7476]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
44 | #include "notify.h" |
|
5913
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
45 | |
| 3630 | 46 | #include "stdafx.h" |
| 47 | #include "resource.h" | |
|
3950
0cab330f1cd6
[gaim-migrate @ 4129]
Herman Bloggs <herman@bluedigits.com>
parents:
3907
diff
changeset
|
48 | #include "MinimizeToTray.h" |
|
3973
acade2595b85
[gaim-migrate @ 4157]
Herman Bloggs <herman@bluedigits.com>
parents:
3950
diff
changeset
|
49 | #include "winuser_extra.h" |
|
4535
9b3bdd5d6653
[gaim-migrate @ 4814]
Herman Bloggs <herman@bluedigits.com>
parents:
4411
diff
changeset
|
50 | #include "idletrack.h" |
|
5008
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
51 | #include "zlib.h" |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
52 | #include "untar.h" |
| 3630 | 53 | |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
54 | #include <libintl.h> |
|
5913
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
55 | |
| 3630 | 56 | /* |
| 57 | * DEFINES & MACROS | |
| 58 | */ | |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
59 | #define _(x) gettext(x) |
|
3950
0cab330f1cd6
[gaim-migrate @ 4129]
Herman Bloggs <herman@bluedigits.com>
parents:
3907
diff
changeset
|
60 | |
| 3630 | 61 | /* |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
62 | * DATA STRUCTS |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
63 | */ |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
64 | |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
65 | /* For shfolder.dll */ |
|
10589
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
66 | typedef HRESULT (CALLBACK* LPFNSHGETFOLDERPATHA)(HWND, int, HANDLE, DWORD, LPSTR); |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
67 | typedef HRESULT (CALLBACK* LPFNSHGETFOLDERPATHW)(HWND, int, HANDLE, DWORD, LPWSTR); |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
68 | |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
69 | typedef enum { |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
70 | SHGFP_TYPE_CURRENT = 0, // current value for user, verify it exists |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
71 | SHGFP_TYPE_DEFAULT = 1, // default value, may not exist |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
72 | } SHGFP_TYPE; |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
73 | |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
74 | /* flash info */ |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
75 | typedef BOOL (CALLBACK* LPFNFLASHWINDOWEX)(PFLASHWINFO); |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
76 | |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
77 | struct _WGAIM_FLASH_INFO { |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
78 | guint t_handle; |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
79 | guint sig_handler; |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
80 | }; |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
81 | typedef struct _WGAIM_FLASH_INFO WGAIM_FLASH_INFO; |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
82 | |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
83 | /* |
| 3630 | 84 | * LOCALS |
| 85 | */ | |
|
10589
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
86 | static char app_data_dir[MAX_PATH + 1] = "C:"; |
| 3630 | 87 | static char install_dir[MAXPATHLEN]; |
| 88 | static char lib_dir[MAXPATHLEN]; | |
| 89 | static char locale_dir[MAXPATHLEN]; | |
|
6437
809e9334e31f
[gaim-migrate @ 6945]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
90 | static gboolean blink_turned_on = TRUE; |
|
3950
0cab330f1cd6
[gaim-migrate @ 4129]
Herman Bloggs <herman@bluedigits.com>
parents:
3907
diff
changeset
|
91 | |
| 3630 | 92 | /* |
| 93 | * GLOBALS | |
| 94 | */ | |
|
3856
db98b5201da8
[gaim-migrate @ 4008]
Herman Bloggs <herman@bluedigits.com>
parents:
3630
diff
changeset
|
95 | HINSTANCE gaimexe_hInstance = 0; |
|
db98b5201da8
[gaim-migrate @ 4008]
Herman Bloggs <herman@bluedigits.com>
parents:
3630
diff
changeset
|
96 | HINSTANCE gaimdll_hInstance = 0; |
| 3630 | 97 | |
| 98 | /* | |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
99 | * PROTOS |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
100 | */ |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
101 | LPFNFLASHWINDOWEX MyFlashWindowEx = NULL; |
|
10589
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
102 | LPFNSHGETFOLDERPATHA MySHGetFolderPathA = NULL; |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
103 | LPFNSHGETFOLDERPATHW MySHGetFolderPathW = NULL; |
|
6848
ca91f08b60df
[gaim-migrate @ 7393]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
104 | |
|
4097
3ad9e41eb933
[gaim-migrate @ 4312]
Herman Bloggs <herman@bluedigits.com>
parents:
4042
diff
changeset
|
105 | FARPROC wgaim_find_and_loadproc(char*, char*); |
|
5008
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
106 | extern void wgaim_gtkspell_init(); |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
107 | char* wgaim_data_dir(void); |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
108 | |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
109 | /* |
| 3630 | 110 | * STATIC CODE |
| 111 | */ | |
| 112 | ||
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
113 | /* Window flasher */ |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
114 | static gboolean flash_window_cb(gpointer data) { |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
115 | FlashWindow((HWND)data, TRUE); |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
116 | return TRUE; |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
117 | } |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
118 | |
| 8147 | 119 | static int halt_flash_filter(GtkWidget *widget, GdkEventFocus *event, gpointer data) { |
|
7803
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
120 | if(MyFlashWindowEx) { |
|
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
121 | HWND hWnd = data; |
|
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
122 | FLASHWINFO info; |
|
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
123 | |
|
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
124 | if(!IsWindow(hWnd)) |
| 8147 | 125 | return 0; |
|
7803
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
126 | memset(&info, 0, sizeof(FLASHWINFO)); |
|
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
127 | info.cbSize = sizeof(FLASHWINFO); |
|
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
128 | info.hwnd = hWnd; |
|
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
129 | info.dwFlags = FLASHW_STOP; |
|
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
130 | info.dwTimeout = 0; |
|
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
131 | MyFlashWindowEx(&info); |
|
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
132 | } |
|
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
133 | else { |
|
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
134 | WGAIM_FLASH_INFO *finfo = data; |
|
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
135 | /* Stop flashing and remove filter */ |
|
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
136 | gaim_debug(GAIM_DEBUG_INFO, "wgaim", "Removing timeout\n"); |
| 8287 | 137 | gaim_timeout_remove(finfo->t_handle); |
|
7803
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
138 | gaim_debug(GAIM_DEBUG_INFO, "wgaim", "Disconnecting signal handler\n"); |
|
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
139 | g_signal_handler_disconnect(G_OBJECT(widget),finfo->sig_handler); |
|
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
140 | gaim_debug(GAIM_DEBUG_INFO, "wgaim", "done\n"); |
|
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
141 | g_free(finfo); |
|
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
142 | } |
| 8147 | 143 | return 0; |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
144 | } |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
145 | |
|
4097
3ad9e41eb933
[gaim-migrate @ 4312]
Herman Bloggs <herman@bluedigits.com>
parents:
4042
diff
changeset
|
146 | static void load_winver_specific_procs(void) { |
|
3ad9e41eb933
[gaim-migrate @ 4312]
Herman Bloggs <herman@bluedigits.com>
parents:
4042
diff
changeset
|
147 | /* Used for Win98+ and WinNT5+ */ |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
148 | MyFlashWindowEx = (LPFNFLASHWINDOWEX)wgaim_find_and_loadproc("user32.dll", "FlashWindowEx" ); |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
149 | } |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
150 | |
|
7526
bf210d91506e
[gaim-migrate @ 8139]
Herman Bloggs <herman@bluedigits.com>
parents:
7523
diff
changeset
|
151 | static void wgaim_debug_print(GaimDebugLevel level, const char *category, const char *format, va_list args) { |
|
10589
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
152 | char *str = NULL; |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
153 | if (args != NULL) { |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
154 | str = g_strdup_vprintf(format, args); |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
155 | } else { |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
156 | str = g_strdup(format); |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
157 | } |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
158 | printf("%s%s%s", category?category:"", category?": ":"",str); |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
159 | g_free(str); |
|
7526
bf210d91506e
[gaim-migrate @ 8139]
Herman Bloggs <herman@bluedigits.com>
parents:
7523
diff
changeset
|
160 | } |
|
bf210d91506e
[gaim-migrate @ 8139]
Herman Bloggs <herman@bluedigits.com>
parents:
7523
diff
changeset
|
161 | |
|
7803
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
162 | static GaimDebugUiOps ops = { |
|
7526
bf210d91506e
[gaim-migrate @ 8139]
Herman Bloggs <herman@bluedigits.com>
parents:
7523
diff
changeset
|
163 | wgaim_debug_print |
|
bf210d91506e
[gaim-migrate @ 8139]
Herman Bloggs <herman@bluedigits.com>
parents:
7523
diff
changeset
|
164 | }; |
|
bf210d91506e
[gaim-migrate @ 8139]
Herman Bloggs <herman@bluedigits.com>
parents:
7523
diff
changeset
|
165 | |
|
4097
3ad9e41eb933
[gaim-migrate @ 4312]
Herman Bloggs <herman@bluedigits.com>
parents:
4042
diff
changeset
|
166 | /* |
|
3ad9e41eb933
[gaim-migrate @ 4312]
Herman Bloggs <herman@bluedigits.com>
parents:
4042
diff
changeset
|
167 | * PUBLIC CODE |
|
3ad9e41eb933
[gaim-migrate @ 4312]
Herman Bloggs <herman@bluedigits.com>
parents:
4042
diff
changeset
|
168 | */ |
|
3ad9e41eb933
[gaim-migrate @ 4312]
Herman Bloggs <herman@bluedigits.com>
parents:
4042
diff
changeset
|
169 | |
|
3ad9e41eb933
[gaim-migrate @ 4312]
Herman Bloggs <herman@bluedigits.com>
parents:
4042
diff
changeset
|
170 | HINSTANCE wgaim_hinstance(void) { |
|
3ad9e41eb933
[gaim-migrate @ 4312]
Herman Bloggs <herman@bluedigits.com>
parents:
4042
diff
changeset
|
171 | return gaimexe_hInstance; |
|
3ad9e41eb933
[gaim-migrate @ 4312]
Herman Bloggs <herman@bluedigits.com>
parents:
4042
diff
changeset
|
172 | } |
|
3ad9e41eb933
[gaim-migrate @ 4312]
Herman Bloggs <herman@bluedigits.com>
parents:
4042
diff
changeset
|
173 | |
|
4406
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
174 | /* Escape windows dir separators. This is needed when paths are saved, |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
175 | and on being read back have their '\' chars used as an escape char. |
|
4555
3ff630a3045a
[gaim-migrate @ 4835]
Herman Bloggs <herman@bluedigits.com>
parents:
4535
diff
changeset
|
176 | Returns an allocated string which needs to be freed. |
|
4406
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
177 | */ |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
178 | char* wgaim_escape_dirsep( char* filename ) { |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
179 | int sepcount=0; |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
180 | char* ret=NULL; |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
181 | int cnt=0; |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
182 | |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
183 | ret = filename; |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
184 | while(*ret) { |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
185 | if(*ret == '\\') |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
186 | sepcount++; |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
187 | ret++; |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
188 | } |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
189 | ret = g_malloc0(strlen(filename) + sepcount + 1); |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
190 | while(*filename) { |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
191 | ret[cnt] = *filename; |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
192 | if(*filename == '\\') |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
193 | ret[++cnt] = '\\'; |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
194 | filename++; |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
195 | cnt++; |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
196 | } |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
197 | ret[cnt] = '\0'; |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
198 | return ret; |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
199 | } |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
200 | |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
201 | /* Determine whether the specified dll contains the specified procedure. |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
202 | If so, load it (if not already loaded). */ |
|
4097
3ad9e41eb933
[gaim-migrate @ 4312]
Herman Bloggs <herman@bluedigits.com>
parents:
4042
diff
changeset
|
203 | FARPROC wgaim_find_and_loadproc( char* dllname, char* procedure ) { |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
204 | HMODULE hmod; |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
205 | int did_load=0; |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
206 | FARPROC proc = 0; |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
207 | |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
208 | if(!(hmod=GetModuleHandle(dllname))) { |
| 5854 | 209 | gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "%s not found. Loading it..\n", dllname); |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
210 | if(!(hmod = LoadLibrary(dllname))) { |
| 5854 | 211 | gaim_debug(GAIM_DEBUG_ERROR, "wgaim", "Could not load: %s\n", dllname); |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
212 | return NULL; |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
213 | } |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
214 | else |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
215 | did_load = 1; |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
216 | } |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
217 | |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
218 | if((proc=GetProcAddress(hmod, procedure))) { |
| 5854 | 219 | gaim_debug(GAIM_DEBUG_INFO, "wgaim", "This version of %s contains %s\n", |
|
4555
3ff630a3045a
[gaim-migrate @ 4835]
Herman Bloggs <herman@bluedigits.com>
parents:
4535
diff
changeset
|
220 | dllname, procedure); |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
221 | return proc; |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
222 | } |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
223 | else { |
| 5854 | 224 | gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "Function %s not found in dll %s\n", |
|
4555
3ff630a3045a
[gaim-migrate @ 4835]
Herman Bloggs <herman@bluedigits.com>
parents:
4535
diff
changeset
|
225 | procedure, dllname); |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
226 | if(did_load) { |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
227 | /* unload dll */ |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
228 | FreeLibrary(hmod); |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
229 | } |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
230 | return NULL; |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
231 | } |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
232 | } |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
233 | |
|
3856
db98b5201da8
[gaim-migrate @ 4008]
Herman Bloggs <herman@bluedigits.com>
parents:
3630
diff
changeset
|
234 | /* Determine Gaim Paths during Runtime */ |
|
db98b5201da8
[gaim-migrate @ 4008]
Herman Bloggs <herman@bluedigits.com>
parents:
3630
diff
changeset
|
235 | |
| 3630 | 236 | char* wgaim_install_dir(void) { |
| 237 | HMODULE hmod; | |
| 238 | char* buf; | |
| 239 | ||
| 240 | hmod = GetModuleHandle(NULL); | |
| 241 | if( hmod == 0 ) { | |
| 242 | buf = g_win32_error_message( GetLastError() ); | |
| 5854 | 243 | gaim_debug(GAIM_DEBUG_ERROR, "wgaim", "GetModuleHandle error: %s\n", buf); |
| 7606 | 244 | g_free(buf); |
| 3630 | 245 | return NULL; |
| 246 | } | |
| 247 | if(GetModuleFileName( hmod, (char*)&install_dir, MAXPATHLEN ) == 0) { | |
| 248 | buf = g_win32_error_message( GetLastError() ); | |
| 5854 | 249 | gaim_debug(GAIM_DEBUG_ERROR, "wgaim", "GetModuleFileName error: %s\n", buf); |
| 7606 | 250 | g_free(buf); |
| 3630 | 251 | return NULL; |
| 252 | } | |
| 253 | buf = g_path_get_dirname( install_dir ); | |
| 254 | strcpy( (char*)&install_dir, buf ); | |
| 7606 | 255 | g_free( buf ); |
| 3630 | 256 | |
| 257 | return (char*)&install_dir; | |
| 258 | } | |
| 259 | ||
| 260 | char* wgaim_lib_dir(void) { | |
| 261 | strcpy(lib_dir, wgaim_install_dir()); | |
|
9916
9ccd988b02c4
[gaim-migrate @ 10808]
Daniel Atallah <datallah@pidgin.im>
parents:
9141
diff
changeset
|
262 | g_strlcat(lib_dir, G_DIR_SEPARATOR_S "plugins", sizeof(lib_dir)); |
| 3630 | 263 | return (char*)&lib_dir; |
| 264 | } | |
| 265 | ||
| 266 | char* wgaim_locale_dir(void) { | |
| 267 | strcpy(locale_dir, wgaim_install_dir()); | |
|
9916
9ccd988b02c4
[gaim-migrate @ 10808]
Daniel Atallah <datallah@pidgin.im>
parents:
9141
diff
changeset
|
268 | g_strlcat(locale_dir, G_DIR_SEPARATOR_S "locale", sizeof(locale_dir)); |
| 3630 | 269 | return (char*)&locale_dir; |
| 270 | } | |
| 271 | ||
|
6848
ca91f08b60df
[gaim-migrate @ 7393]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
272 | char* wgaim_data_dir(void) { |
|
ca91f08b60df
[gaim-migrate @ 7393]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
273 | return (char*)&app_data_dir; |
|
ca91f08b60df
[gaim-migrate @ 7393]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
274 | } |
|
ca91f08b60df
[gaim-migrate @ 7393]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
275 | |
|
3973
acade2595b85
[gaim-migrate @ 4157]
Herman Bloggs <herman@bluedigits.com>
parents:
3950
diff
changeset
|
276 | /* Miscellaneous */ |
|
acade2595b85
[gaim-migrate @ 4157]
Herman Bloggs <herman@bluedigits.com>
parents:
3950
diff
changeset
|
277 | |
|
6437
809e9334e31f
[gaim-migrate @ 6945]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
278 | gboolean wgaim_read_reg_string(HKEY key, char* sub_key, char* val_name, LPBYTE data, LPDWORD data_len) { |
|
809e9334e31f
[gaim-migrate @ 6945]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
279 | HKEY hkey; |
|
809e9334e31f
[gaim-migrate @ 6945]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
280 | gboolean ret = FALSE; |
|
809e9334e31f
[gaim-migrate @ 6945]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
281 | |
|
809e9334e31f
[gaim-migrate @ 6945]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
282 | if(ERROR_SUCCESS == RegOpenKeyEx(key, |
|
809e9334e31f
[gaim-migrate @ 6945]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
283 | sub_key, |
|
809e9334e31f
[gaim-migrate @ 6945]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
284 | 0, KEY_QUERY_VALUE, &hkey)) { |
|
809e9334e31f
[gaim-migrate @ 6945]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
285 | if(ERROR_SUCCESS == RegQueryValueEx(hkey, val_name, 0, NULL, data, data_len)) |
|
809e9334e31f
[gaim-migrate @ 6945]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
286 | ret = TRUE; |
|
809e9334e31f
[gaim-migrate @ 6945]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
287 | RegCloseKey(key); |
|
809e9334e31f
[gaim-migrate @ 6945]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
288 | } |
|
809e9334e31f
[gaim-migrate @ 6945]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
289 | return ret; |
|
809e9334e31f
[gaim-migrate @ 6945]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
290 | } |
|
809e9334e31f
[gaim-migrate @ 6945]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
291 | |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
292 | /* FlashWindowEx is only supported by Win98+ and WinNT5+. If its |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
293 | not supported we do it our own way */ |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6929
diff
changeset
|
294 | void wgaim_conv_im_blink(GtkWidget *window) { |
|
6437
809e9334e31f
[gaim-migrate @ 6945]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
295 | if(!blink_turned_on) |
|
809e9334e31f
[gaim-migrate @ 6945]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
296 | return; |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
297 | if(MyFlashWindowEx) { |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
298 | FLASHWINFO info; |
|
7803
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
299 | if(GetForegroundWindow() == GDK_WINDOW_HWND(window->window)) |
|
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
300 | return; |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
301 | memset(&info, 0, sizeof(FLASHWINFO)); |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
302 | info.cbSize = sizeof(FLASHWINFO); |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
303 | info.hwnd = GDK_WINDOW_HWND(window->window); |
|
7803
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
304 | info.dwFlags = FLASHW_ALL | FLASHW_TIMER; |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
305 | info.dwTimeout = 0; |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
306 | MyFlashWindowEx(&info); |
|
7803
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
307 | /* Stop flashing when window receives focus */ |
|
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
308 | g_signal_connect(G_OBJECT(window), |
|
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
309 | "focus-in-event", |
|
e2a0687d6b02
[gaim-migrate @ 8449]
Herman Bloggs <herman@bluedigits.com>
parents:
7606
diff
changeset
|
310 | G_CALLBACK(halt_flash_filter), info.hwnd); |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
311 | } |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
312 | else { |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
313 | WGAIM_FLASH_INFO *finfo = g_new0(WGAIM_FLASH_INFO, 1); |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
314 | |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
315 | /* Start Flashing window */ |
| 8273 | 316 | finfo->t_handle = gaim_timeout_add(1000, |
|
4555
3ff630a3045a
[gaim-migrate @ 4835]
Herman Bloggs <herman@bluedigits.com>
parents:
4535
diff
changeset
|
317 | flash_window_cb, |
|
3ff630a3045a
[gaim-migrate @ 4835]
Herman Bloggs <herman@bluedigits.com>
parents:
4535
diff
changeset
|
318 | GDK_WINDOW_HWND(window->window)); |
|
3ff630a3045a
[gaim-migrate @ 4835]
Herman Bloggs <herman@bluedigits.com>
parents:
4535
diff
changeset
|
319 | finfo->sig_handler = g_signal_connect(G_OBJECT(window), |
|
3ff630a3045a
[gaim-migrate @ 4835]
Herman Bloggs <herman@bluedigits.com>
parents:
4535
diff
changeset
|
320 | "focus-in-event", |
|
3ff630a3045a
[gaim-migrate @ 4835]
Herman Bloggs <herman@bluedigits.com>
parents:
4535
diff
changeset
|
321 | G_CALLBACK(halt_flash_filter), finfo); |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
322 | } |
|
3973
acade2595b85
[gaim-migrate @ 4157]
Herman Bloggs <herman@bluedigits.com>
parents:
3950
diff
changeset
|
323 | } |
|
acade2595b85
[gaim-migrate @ 4157]
Herman Bloggs <herman@bluedigits.com>
parents:
3950
diff
changeset
|
324 | |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6929
diff
changeset
|
325 | void wgaim_conv_im_blink_state(gboolean val) { |
|
6437
809e9334e31f
[gaim-migrate @ 6945]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
326 | blink_turned_on = val; |
|
809e9334e31f
[gaim-migrate @ 6945]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
327 | } |
|
809e9334e31f
[gaim-migrate @ 6945]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
328 | |
|
5008
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
329 | int wgaim_gz_decompress(const char* in, const char* out) { |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
330 | gzFile fin; |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
331 | FILE *fout; |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
332 | char buf[1024]; |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
333 | int ret; |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
334 | |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
335 | if((fin = gzopen(in, "rb"))) { |
|
10589
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
336 | if(!(fout = g_fopen(out, "wb"))) { |
| 5854 | 337 | gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_decompress", "Error opening file: %s\n", out); |
|
5008
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
338 | gzclose(fin); |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
339 | return 0; |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
340 | } |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
341 | } |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
342 | else { |
| 5854 | 343 | gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_decompress", "gzopen failed to open: %s\n", in); |
|
5008
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
344 | return 0; |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
345 | } |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
346 | |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
347 | while((ret=gzread(fin, buf, 1024))) { |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
348 | if(fwrite(buf, 1, ret, fout) < ret) { |
| 5854 | 349 | gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_decompress", "Error writing %d bytes to file\n", ret); |
|
5008
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
350 | gzclose(fin); |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
351 | fclose(fout); |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
352 | return 0; |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
353 | } |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
354 | } |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
355 | fclose(fout); |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
356 | gzclose(fin); |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
357 | |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
358 | if(ret < 0) { |
| 5854 | 359 | gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_decompress", "gzread failed while reading: %s\n", in); |
|
5008
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
360 | return 0; |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
361 | } |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
362 | |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
363 | return 1; |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
364 | } |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
365 | |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
366 | int wgaim_gz_untar(const char* filename, const char* destdir) { |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
367 | char tmpfile[_MAX_PATH]; |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
368 | char template[]="wgaimXXXXXX"; |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
369 | |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
370 | sprintf(tmpfile, "%s%s%s", g_get_tmp_dir(), G_DIR_SEPARATOR_S, _mktemp(template)); |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
371 | if(wgaim_gz_decompress(filename, tmpfile)) { |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
372 | int ret; |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
373 | if(untar(tmpfile, destdir, UNTAR_FORCE | UNTAR_QUIET)) |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
374 | ret=1; |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
375 | else { |
| 5854 | 376 | gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_untar", "Failure untaring %s\n", tmpfile); |
|
5008
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
377 | ret=0; |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
378 | } |
|
10589
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
379 | g_unlink(tmpfile); |
|
5008
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
380 | return ret; |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
381 | } |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
382 | else { |
| 5854 | 383 | gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_untar", "Failed to gz decompress %s\n", filename); |
|
5008
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
384 | return 0; |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
385 | } |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
386 | } |
|
f3894181fadc
[gaim-migrate @ 5343]
Herman Bloggs <herman@bluedigits.com>
parents:
4984
diff
changeset
|
387 | |
|
6083
cc86a426e8e8
[gaim-migrate @ 6542]
Herman Bloggs <herman@bluedigits.com>
parents:
5913
diff
changeset
|
388 | /* Moved over from old systray.c */ |
|
cc86a426e8e8
[gaim-migrate @ 6542]
Herman Bloggs <herman@bluedigits.com>
parents:
5913
diff
changeset
|
389 | void wgaim_systray_minimize( GtkWidget *window ) { |
|
cc86a426e8e8
[gaim-migrate @ 6542]
Herman Bloggs <herman@bluedigits.com>
parents:
5913
diff
changeset
|
390 | MinimizeWndToTray(GDK_WINDOW_HWND(window->window)); |
|
cc86a426e8e8
[gaim-migrate @ 6542]
Herman Bloggs <herman@bluedigits.com>
parents:
5913
diff
changeset
|
391 | } |
|
cc86a426e8e8
[gaim-migrate @ 6542]
Herman Bloggs <herman@bluedigits.com>
parents:
5913
diff
changeset
|
392 | |
|
cc86a426e8e8
[gaim-migrate @ 6542]
Herman Bloggs <herman@bluedigits.com>
parents:
5913
diff
changeset
|
393 | void wgaim_systray_maximize( GtkWidget *window ) { |
|
cc86a426e8e8
[gaim-migrate @ 6542]
Herman Bloggs <herman@bluedigits.com>
parents:
5913
diff
changeset
|
394 | RestoreWndFromTray(GDK_WINDOW_HWND(window->window)); |
|
cc86a426e8e8
[gaim-migrate @ 6542]
Herman Bloggs <herman@bluedigits.com>
parents:
5913
diff
changeset
|
395 | } |
|
cc86a426e8e8
[gaim-migrate @ 6542]
Herman Bloggs <herman@bluedigits.com>
parents:
5913
diff
changeset
|
396 | |
|
10240
09342bc554d9
[gaim-migrate @ 11377]
Herman Bloggs <herman@bluedigits.com>
parents:
10213
diff
changeset
|
397 | void wgaim_notify_uri(const char *uri) { |
|
09342bc554d9
[gaim-migrate @ 11377]
Herman Bloggs <herman@bluedigits.com>
parents:
10213
diff
changeset
|
398 | SHELLEXECUTEINFO sinfo; |
|
09342bc554d9
[gaim-migrate @ 11377]
Herman Bloggs <herman@bluedigits.com>
parents:
10213
diff
changeset
|
399 | |
|
09342bc554d9
[gaim-migrate @ 11377]
Herman Bloggs <herman@bluedigits.com>
parents:
10213
diff
changeset
|
400 | memset(&sinfo, 0, sizeof(sinfo)); |
|
09342bc554d9
[gaim-migrate @ 11377]
Herman Bloggs <herman@bluedigits.com>
parents:
10213
diff
changeset
|
401 | sinfo.cbSize = sizeof(sinfo); |
|
09342bc554d9
[gaim-migrate @ 11377]
Herman Bloggs <herman@bluedigits.com>
parents:
10213
diff
changeset
|
402 | sinfo.fMask = SEE_MASK_CLASSNAME; |
|
09342bc554d9
[gaim-migrate @ 11377]
Herman Bloggs <herman@bluedigits.com>
parents:
10213
diff
changeset
|
403 | sinfo.lpVerb = "open"; |
|
09342bc554d9
[gaim-migrate @ 11377]
Herman Bloggs <herman@bluedigits.com>
parents:
10213
diff
changeset
|
404 | sinfo.lpFile = uri; |
|
09342bc554d9
[gaim-migrate @ 11377]
Herman Bloggs <herman@bluedigits.com>
parents:
10213
diff
changeset
|
405 | sinfo.nShow = SW_SHOWNORMAL; |
|
09342bc554d9
[gaim-migrate @ 11377]
Herman Bloggs <herman@bluedigits.com>
parents:
10213
diff
changeset
|
406 | sinfo.lpClass = "http"; |
|
09342bc554d9
[gaim-migrate @ 11377]
Herman Bloggs <herman@bluedigits.com>
parents:
10213
diff
changeset
|
407 | |
|
09342bc554d9
[gaim-migrate @ 11377]
Herman Bloggs <herman@bluedigits.com>
parents:
10213
diff
changeset
|
408 | /* We'll allow whatever URI schemes are supported by the |
|
09342bc554d9
[gaim-migrate @ 11377]
Herman Bloggs <herman@bluedigits.com>
parents:
10213
diff
changeset
|
409 | default http browser. |
|
09342bc554d9
[gaim-migrate @ 11377]
Herman Bloggs <herman@bluedigits.com>
parents:
10213
diff
changeset
|
410 | */ |
|
09342bc554d9
[gaim-migrate @ 11377]
Herman Bloggs <herman@bluedigits.com>
parents:
10213
diff
changeset
|
411 | if(!ShellExecuteEx(&sinfo)) |
|
09342bc554d9
[gaim-migrate @ 11377]
Herman Bloggs <herman@bluedigits.com>
parents:
10213
diff
changeset
|
412 | gaim_debug_error("wgaim", "Error opening URI: %s error: %d\n", uri, (int)sinfo.hInstApp); |
|
09342bc554d9
[gaim-migrate @ 11377]
Herman Bloggs <herman@bluedigits.com>
parents:
10213
diff
changeset
|
413 | } |
|
09342bc554d9
[gaim-migrate @ 11377]
Herman Bloggs <herman@bluedigits.com>
parents:
10213
diff
changeset
|
414 | |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
415 | void wgaim_init(HINSTANCE hint) { |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
416 | WORD wVersionRequested; |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
417 | WSADATA wsaData; |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
418 | char *perlenv; |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
419 | char *newenv; |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
420 | |
|
7526
bf210d91506e
[gaim-migrate @ 8139]
Herman Bloggs <herman@bluedigits.com>
parents:
7523
diff
changeset
|
421 | gaim_debug_set_ui_ops(&ops); |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
422 | gaim_debug(GAIM_DEBUG_INFO, "wgaim", "wgaim_init start\n"); |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
423 | |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
424 | gaimexe_hInstance = hint; |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
425 | |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
426 | load_winver_specific_procs(); |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
427 | |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
428 | /* Winsock init */ |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
429 | wVersionRequested = MAKEWORD( 2, 2 ); |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
430 | WSAStartup( wVersionRequested, &wsaData ); |
|
6848
ca91f08b60df
[gaim-migrate @ 7393]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
431 | |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
432 | /* Confirm that the winsock DLL supports 2.2 */ |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
433 | /* Note that if the DLL supports versions greater than |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
434 | 2.2 in addition to 2.2, it will still return 2.2 in |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
435 | wVersion since that is the version we requested. */ |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
436 | if ( LOBYTE( wsaData.wVersion ) != 2 || |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
437 | HIBYTE( wsaData.wVersion ) != 2 ) { |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
438 | gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "Could not find a usable WinSock DLL. Oh well.\n"); |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
439 | WSACleanup(); |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
440 | } |
|
3856
db98b5201da8
[gaim-migrate @ 4008]
Herman Bloggs <herman@bluedigits.com>
parents:
3630
diff
changeset
|
441 | |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
442 | /* Set Environmental Variables */ |
|
6816
b14a3043ed09
[gaim-migrate @ 7356]
Herman Bloggs <herman@bluedigits.com>
parents:
6437
diff
changeset
|
443 | /* Tell perl where to find Gaim's perl modules */ |
|
b14a3043ed09
[gaim-migrate @ 7356]
Herman Bloggs <herman@bluedigits.com>
parents:
6437
diff
changeset
|
444 | perlenv = (char*)g_getenv("PERL5LIB"); |
|
b14a3043ed09
[gaim-migrate @ 7356]
Herman Bloggs <herman@bluedigits.com>
parents:
6437
diff
changeset
|
445 | newenv = g_strdup_printf("PERL5LIB=%s%s%s%s", |
|
b14a3043ed09
[gaim-migrate @ 7356]
Herman Bloggs <herman@bluedigits.com>
parents:
6437
diff
changeset
|
446 | perlenv ? perlenv : "", |
|
b14a3043ed09
[gaim-migrate @ 7356]
Herman Bloggs <herman@bluedigits.com>
parents:
6437
diff
changeset
|
447 | perlenv ? ";" : "", |
|
b14a3043ed09
[gaim-migrate @ 7356]
Herman Bloggs <herman@bluedigits.com>
parents:
6437
diff
changeset
|
448 | wgaim_install_dir(), |
|
b14a3043ed09
[gaim-migrate @ 7356]
Herman Bloggs <herman@bluedigits.com>
parents:
6437
diff
changeset
|
449 | "\\perlmod;"); |
|
b14a3043ed09
[gaim-migrate @ 7356]
Herman Bloggs <herman@bluedigits.com>
parents:
6437
diff
changeset
|
450 | if(putenv(newenv)<0) |
|
b14a3043ed09
[gaim-migrate @ 7356]
Herman Bloggs <herman@bluedigits.com>
parents:
6437
diff
changeset
|
451 | gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "putenv failed\n"); |
|
b14a3043ed09
[gaim-migrate @ 7356]
Herman Bloggs <herman@bluedigits.com>
parents:
6437
diff
changeset
|
452 | g_free(newenv); |
|
6848
ca91f08b60df
[gaim-migrate @ 7393]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
453 | |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
454 | /* Set app data dir, used by gaim_home_dir */ |
|
10210
6ea72edf1460
[gaim-migrate @ 11332]
Herman Bloggs <herman@bluedigits.com>
parents:
9916
diff
changeset
|
455 | newenv = (char*)g_getenv("GAIMHOME"); |
|
6848
ca91f08b60df
[gaim-migrate @ 7393]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
456 | if(!newenv) { |
|
10589
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
457 | #if GLIB_CHECK_VERSION(2,6,0) |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
458 | if ((MySHGetFolderPathW = (LPFNSHGETFOLDERPATHW) wgaim_find_and_loadproc("shfolder.dll", "SHGetFolderPathW"))) { |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
459 | wchar_t utf_16_dir[MAX_PATH +1]; |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
460 | char *temp; |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
461 | MySHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
462 | SHGFP_TYPE_CURRENT, utf_16_dir); |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
463 | temp = g_utf16_to_utf8(utf_16_dir, -1, NULL, NULL, NULL); |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
464 | g_strlcpy(app_data_dir, temp, sizeof(app_data_dir)); |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
465 | g_free(temp); |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
466 | } else if ((MySHGetFolderPathA = (LPFNSHGETFOLDERPATHA) wgaim_find_and_loadproc("shfolder.dll", "SHGetFolderPathA"))) { |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
467 | char locale_dir[MAX_PATH + 1]; |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
468 | char *temp; |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
469 | MySHGetFolderPathA(NULL, CSIDL_APPDATA, NULL, |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
470 | SHGFP_TYPE_CURRENT, locale_dir); |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
471 | temp = g_locale_to_utf8(locale_dir, -1, NULL, NULL, NULL); |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
472 | g_strlcpy(app_data_dir, temp, sizeof(app_data_dir)); |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
473 | g_free(temp); |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
474 | } |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
475 | #else |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
476 | if ((MySHGetFolderPathA = (LPFNSHGETFOLDERPATHA) wgaim_find_and_loadproc("shfolder.dll", "SHGetFolderPathA"))) { |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
477 | MySHGetFolderPathA(NULL, CSIDL_APPDATA, NULL, |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
478 | SHGFP_TYPE_CURRENT, app_data_dir); |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
479 | } |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
480 | #endif |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
481 | else { |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
482 | strcpy(app_data_dir, "C:"); |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
483 | } |
|
6848
ca91f08b60df
[gaim-migrate @ 7393]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
484 | } |
|
ca91f08b60df
[gaim-migrate @ 7393]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
485 | else { |
|
9916
9ccd988b02c4
[gaim-migrate @ 10808]
Daniel Atallah <datallah@pidgin.im>
parents:
9141
diff
changeset
|
486 | g_strlcpy(app_data_dir, newenv, sizeof(app_data_dir)); |
|
6848
ca91f08b60df
[gaim-migrate @ 7393]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
487 | } |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
488 | gaim_debug(GAIM_DEBUG_INFO, "wgaim", "Gaim settings dir: %s\n", app_data_dir); |
|
3907
7de53cfd3660
[gaim-migrate @ 4060]
Herman Bloggs <herman@bluedigits.com>
parents:
3905
diff
changeset
|
489 | |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
490 | /* IdleTracker Initialization */ |
|
4535
9b3bdd5d6653
[gaim-migrate @ 4814]
Herman Bloggs <herman@bluedigits.com>
parents:
4411
diff
changeset
|
491 | if(!wgaim_set_idlehooks()) |
| 5854 | 492 | gaim_debug(GAIM_DEBUG_ERROR, "wgaim", "Failed to initialize idle tracker\n"); |
|
4861
3b98cd332858
[gaim-migrate @ 5188]
Herman Bloggs <herman@bluedigits.com>
parents:
4728
diff
changeset
|
493 | |
|
3b98cd332858
[gaim-migrate @ 5188]
Herman Bloggs <herman@bluedigits.com>
parents:
4728
diff
changeset
|
494 | wgaim_gtkspell_init(); |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
495 | gaim_debug(GAIM_DEBUG_INFO, "wgaim", "wgaim_init end\n"); |
| 3630 | 496 | } |
|
3856
db98b5201da8
[gaim-migrate @ 4008]
Herman Bloggs <herman@bluedigits.com>
parents:
3630
diff
changeset
|
497 | |
|
3907
7de53cfd3660
[gaim-migrate @ 4060]
Herman Bloggs <herman@bluedigits.com>
parents:
3905
diff
changeset
|
498 | /* Windows Cleanup */ |
|
7de53cfd3660
[gaim-migrate @ 4060]
Herman Bloggs <herman@bluedigits.com>
parents:
3905
diff
changeset
|
499 | |
|
7de53cfd3660
[gaim-migrate @ 4060]
Herman Bloggs <herman@bluedigits.com>
parents:
3905
diff
changeset
|
500 | void wgaim_cleanup(void) { |
| 5854 | 501 | gaim_debug(GAIM_DEBUG_INFO, "wgaim", "wgaim_cleanup\n"); |
|
3907
7de53cfd3660
[gaim-migrate @ 4060]
Herman Bloggs <herman@bluedigits.com>
parents:
3905
diff
changeset
|
502 | |
|
7de53cfd3660
[gaim-migrate @ 4060]
Herman Bloggs <herman@bluedigits.com>
parents:
3905
diff
changeset
|
503 | /* winsock cleanup */ |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
504 | WSACleanup(); |
|
3907
7de53cfd3660
[gaim-migrate @ 4060]
Herman Bloggs <herman@bluedigits.com>
parents:
3905
diff
changeset
|
505 | |
|
4535
9b3bdd5d6653
[gaim-migrate @ 4814]
Herman Bloggs <herman@bluedigits.com>
parents:
4411
diff
changeset
|
506 | /* Idle tracker cleanup */ |
|
9b3bdd5d6653
[gaim-migrate @ 4814]
Herman Bloggs <herman@bluedigits.com>
parents:
4411
diff
changeset
|
507 | wgaim_remove_idlehooks(); |
|
3907
7de53cfd3660
[gaim-migrate @ 4060]
Herman Bloggs <herman@bluedigits.com>
parents:
3905
diff
changeset
|
508 | } |
|
7de53cfd3660
[gaim-migrate @ 4060]
Herman Bloggs <herman@bluedigits.com>
parents:
3905
diff
changeset
|
509 | |
|
3950
0cab330f1cd6
[gaim-migrate @ 4129]
Herman Bloggs <herman@bluedigits.com>
parents:
3907
diff
changeset
|
510 | /* DLL initializer */ |
|
3856
db98b5201da8
[gaim-migrate @ 4008]
Herman Bloggs <herman@bluedigits.com>
parents:
3630
diff
changeset
|
511 | BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) { |
|
db98b5201da8
[gaim-migrate @ 4008]
Herman Bloggs <herman@bluedigits.com>
parents:
3630
diff
changeset
|
512 | gaimdll_hInstance = hinstDLL; |
|
db98b5201da8
[gaim-migrate @ 4008]
Herman Bloggs <herman@bluedigits.com>
parents:
3630
diff
changeset
|
513 | return TRUE; |
|
db98b5201da8
[gaim-migrate @ 4008]
Herman Bloggs <herman@bluedigits.com>
parents:
3630
diff
changeset
|
514 | } |