annotate src/win32/libc_interface.c @ 13823:4a1debda969d

[gaim-migrate @ 16263] Fix SF Bug #1504509 "in file trunk/plugins/tcl/Makefile.mingw is forgotten to add the new file tcl_ref.c to the source list." committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Mon, 12 Jun 2006 13:24:10 +0000
parents cb2060acb34f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
1 /*
5913
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5474
diff changeset
2 * gaim
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5474
diff changeset
3 *
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5474
diff changeset
4 * Copyright (C) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com>
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5474
diff changeset
5 *
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5474
diff changeset
6 * This program is free software; you can redistribute it and/or modify
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5474
diff changeset
7 * it under the terms of the GNU General Public License as published by
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5474
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5474
diff changeset
9 * (at your option) any later version.
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5474
diff changeset
10 *
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5474
diff changeset
11 * This program is distributed in the hope that it will be useful,
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5474
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5474
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5474
diff changeset
14 * GNU General Public License for more details.
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5474
diff changeset
15 *
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5474
diff changeset
16 * You should have received a copy of the GNU General Public License
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5474
diff changeset
17 * along with this program; if not, write to the Free Software
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5474
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5474
diff changeset
19 *
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
20 */
8244
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
21 #include <winsock2.h>
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
22 #include <ws2tcpip.h>
3777
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
23 #include <io.h>
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
24 #include <stdlib.h>
3777
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
25 #include <stdio.h>
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
26 #include <errno.h>
3777
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
27 #include <sys/timeb.h>
4905
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
28 #include <sys/stat.h>
3777
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
29 #include <time.h>
10589
0f7452b1f777 [gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 9611
diff changeset
30 #include <glib.h>
6425
26b739bc9f1a [gaim-migrate @ 6933]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5913
diff changeset
31 #include "debug.h"
3777
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
32 #include "libc_internal.h"
10601
e46b51de549a [gaim-migrate @ 12028]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10589
diff changeset
33 #if GLIB_CHECK_VERSION(2,6,0)
e46b51de549a [gaim-migrate @ 12028]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10589
diff changeset
34 # include <glib/gstdio.h>
e46b51de549a [gaim-migrate @ 12028]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10589
diff changeset
35 #else
e46b51de549a [gaim-migrate @ 12028]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10589
diff changeset
36 #define g_remove remove
e46b51de549a [gaim-migrate @ 12028]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10589
diff changeset
37 #define g_rename rename
e46b51de549a [gaim-migrate @ 12028]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10589
diff changeset
38 #define g_stat stat
10589
0f7452b1f777 [gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 9611
diff changeset
39 #endif
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
40
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
41 static char errbuf[1024];
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
42
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
43 /* helpers */
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
44 static int wgaim_is_socket( int fd ) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
45 int optval;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
46 unsigned int optlen = sizeof(int);
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
47
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
48 if( (getsockopt(fd, SOL_SOCKET, SO_TYPE, (void*)&optval, &optlen)) == SOCKET_ERROR ) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
49 int error = WSAGetLastError();
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
50 if( error == WSAENOTSOCK )
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
51 return FALSE;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
52 else {
6425
26b739bc9f1a [gaim-migrate @ 6933]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5913
diff changeset
53 gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "wgaim_is_socket: getsockopt returned error: %d\n", error);
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
54 return FALSE;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
55 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
56 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
57 return TRUE;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
58 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
59
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
60 /* socket.h */
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
61 int wgaim_socket (int namespace, int style, int protocol) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
62 int ret;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
63
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
64 ret = socket( namespace, style, protocol );
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
65
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
66 if( ret == INVALID_SOCKET ) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
67 errno = WSAGetLastError();
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
68 return -1;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
69 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
70 return ret;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
71 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
72
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
73 int wgaim_connect(int socket, struct sockaddr *addr, u_long length) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
74 int ret;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
75
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
76 ret = connect( socket, addr, length );
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
77
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
78 if( ret == SOCKET_ERROR ) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
79 errno = WSAGetLastError();
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
80 if( errno == WSAEWOULDBLOCK )
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
81 errno = WSAEINPROGRESS;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
82 return -1;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
83 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
84 return 0;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
85 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
86
8244
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
87 int wgaim_getsockopt(int socket, int level, int optname, void *optval, socklen_t *optlenptr) {
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
88 if(getsockopt(socket, level, optname, optval, optlenptr) == SOCKET_ERROR ) {
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
89 errno = WSAGetLastError();
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
90 return -1;
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
91 }
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
92 return 0;
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
93 }
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
94
9611
5e78d07f6b36 [gaim-migrate @ 10454]
Tim Ringenbach <marv@pidgin.im>
parents: 8244
diff changeset
95 int wgaim_setsockopt(int socket, int level, int optname, const void *optval, socklen_t optlen) {
8244
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
96 if(setsockopt(socket, level, optname, optval, optlen) == SOCKET_ERROR ) {
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
97 errno = WSAGetLastError();
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
98 return -1;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
99 }
8244
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
100 return 0;
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
101 }
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
102
8244
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
103 int wgaim_getsockname(int socket, struct sockaddr *addr, socklen_t *lenptr) {
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
104 if(getsockname(socket, addr, lenptr) == SOCKET_ERROR) {
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
105 errno = WSAGetLastError();
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
106 return -1;
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
107 }
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
108 return 0;
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
109 }
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
110
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
111 int wgaim_bind(int socket, struct sockaddr *addr, socklen_t length) {
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
112 if(bind(socket, addr, length) == SOCKET_ERROR) {
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
113 errno = WSAGetLastError();
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
114 return -1;
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
115 }
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
116 return 0;
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
117 }
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
118
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
119 int wgaim_listen(int socket, unsigned int n) {
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
120 if(listen(socket, n) == SOCKET_ERROR) {
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
121 errno = WSAGetLastError();
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
122 return -1;
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
123 }
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
124 return 0;
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
125 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
126
11431
d2e44c8085e0 [gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11364
diff changeset
127 int wgaim_sendto(int socket, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen) {
d2e44c8085e0 [gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11364
diff changeset
128 int ret;
d2e44c8085e0 [gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11364
diff changeset
129 if ((ret = sendto(socket, buf, len, flags, to, tolen)
d2e44c8085e0 [gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11364
diff changeset
130 ) == SOCKET_ERROR) {
d2e44c8085e0 [gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11364
diff changeset
131 errno = WSAGetLastError();
d2e44c8085e0 [gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11364
diff changeset
132 return -1;
d2e44c8085e0 [gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11364
diff changeset
133 }
d2e44c8085e0 [gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11364
diff changeset
134 return ret;
d2e44c8085e0 [gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11364
diff changeset
135 }
d2e44c8085e0 [gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11364
diff changeset
136
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
137 /* fcntl.h */
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
138 /* This is not a full implementation of fcntl. Update as needed.. */
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
139 int wgaim_fcntl(int socket, int command, int val) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
140 switch( command ) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
141 case F_SETFL:
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
142 {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
143 int ret=0;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
144
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
145 switch( val ) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
146 case O_NONBLOCK:
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
147 {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
148 u_long imode=1;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
149 ret = ioctlsocket(socket, FIONBIO, &imode);
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
150 break;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
151 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
152 case 0:
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
153 {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
154 u_long imode=0;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
155 ret = ioctlsocket(socket, FIONBIO, &imode);
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
156 break;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
157 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
158 default:
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
159 errno = EINVAL;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
160 return -1;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
161 }/*end switch*/
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
162 if( ret == SOCKET_ERROR ) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
163 errno = WSAGetLastError();
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
164 return -1;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
165 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
166 return 0;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
167 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
168 default:
6425
26b739bc9f1a [gaim-migrate @ 6933]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5913
diff changeset
169 gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "wgaim_fcntl: Unsupported command\n");
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
170 return -1;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
171 }/*end switch*/
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
172 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
173
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
174 /* sys/ioctl.h */
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
175 int wgaim_ioctl(int fd, int command, void* val) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
176 switch( command ) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
177 case FIONBIO:
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
178 {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
179 if (ioctlsocket(fd, FIONBIO, (unsigned long *)val) == SOCKET_ERROR) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
180 errno = WSAGetLastError();
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
181 return -1;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
182 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
183 return 0;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
184 }
11364
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
185 case SIOCGIFCONF:
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
186 {
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
187 INTERFACE_INFO InterfaceList[20];
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
188 unsigned long nBytesReturned;
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
189 if (WSAIoctl(fd, SIO_GET_INTERFACE_LIST,
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
190 0, 0, &InterfaceList,
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
191 sizeof(InterfaceList), &nBytesReturned,
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
192 0, 0) == SOCKET_ERROR) {
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
193 errno = WSAGetLastError();
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
194 return -1;
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
195 } else {
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
196 int i;
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
197 struct ifconf *ifc = val;
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
198 char *tmp = ifc->ifc_buf;
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
199 int nNumInterfaces =
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
200 nBytesReturned / sizeof(INTERFACE_INFO);
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
201 for (i = 0; i < nNumInterfaces; i++) {
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
202 INTERFACE_INFO ii = InterfaceList[i];
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
203 struct ifreq *ifr = (struct ifreq *) tmp;
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
204 struct sockaddr_in *sa = (struct sockaddr_in *) &ifr->ifr_addr;
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
205
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
206 sa->sin_family = ii.iiAddress.AddressIn.sin_family;
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
207 sa->sin_port = ii.iiAddress.AddressIn.sin_port;
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
208 sa->sin_addr.s_addr = ii.iiAddress.AddressIn.sin_addr.s_addr;
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
209 tmp += sizeof(struct ifreq);
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
210
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
211 /* Make sure that we can fit in the original buffer */
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
212 if (tmp >= (ifc->ifc_buf + ifc->ifc_len + sizeof(struct ifreq))) {
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
213 break;
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
214 }
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
215 }
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
216 /* Replace the length with the actually used length */
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
217 ifc->ifc_len = ifc->ifc_len - (ifc->ifc_buf - tmp);
12488
40fada5b3d59 [gaim-migrate @ 14800]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11543
diff changeset
218 return 0;
11364
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
219 }
e1840eb860e7 [gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10601
diff changeset
220 }
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
221 default:
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
222 errno = EINVAL;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
223 return -1;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
224 }/*end switch*/
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
225 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
226
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
227 /* arpa/inet.h */
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
228 int wgaim_inet_aton(const char *name, struct in_addr *addr) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
229 if((addr->s_addr = inet_addr(name)) == INADDR_NONE)
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
230 return 0;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
231 else
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
232 return 1;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
233 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
234
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
235 /* netdb.h */
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
236 struct hostent* wgaim_gethostbyname(const char *name) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
237 struct hostent *hp;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
238
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
239 if((hp = gethostbyname(name)) == NULL) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
240 errno = WSAGetLastError();
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
241 return NULL;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
242 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
243 return hp;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
244 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
245
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
246 /* string.h */
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
247 char* wgaim_strerror( int errornum ) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
248 if( errornum > WSABASEERR ) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
249 sprintf( errbuf, "Windows socket error #%d", errornum );
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
250 return errbuf;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
251 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
252 else
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
253 return strerror( errornum );
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
254 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
255
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
256 /* unistd.h */
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
257
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
258 /*
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
259 * We need to figure out whether fd is a file or socket handle.
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
260 */
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
261 int wgaim_read(int fd, void *buf, unsigned int size) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
262 int ret;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
263
13200
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12749
diff changeset
264 if(wgaim_is_socket(fd)) {
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12749
diff changeset
265 if((ret = recv(fd, buf, size, 0)) == SOCKET_ERROR) {
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
266 errno = WSAGetLastError();
13200
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12749
diff changeset
267 if(errno == WSAEWOULDBLOCK)
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12749
diff changeset
268 errno = EAGAIN;
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
269 return -1;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
270 }
11543
8be7f4c472cf [gaim-migrate @ 13798]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11431
diff changeset
271 #if 0
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
272 else if( ret == 0 ) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
273 /* connection has been gracefully closed */
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
274 errno = WSAENOTCONN;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
275 return -1;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
276 }
11543
8be7f4c472cf [gaim-migrate @ 13798]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11431
diff changeset
277 #endif
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
278 else {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
279 /* success reading socket */
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
280 return ret;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
281 }
13200
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12749
diff changeset
282 } else {
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
283 /* fd is not a socket handle.. pass it off to read */
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
284 return read(fd, buf, size);
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
285 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
286 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
287
13778
cb2060acb34f [gaim-migrate @ 16190]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13370
diff changeset
288 int wgaim_send(int fd, const void *buf, unsigned int size, int flags) {
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
289 int ret;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
290
13778
cb2060acb34f [gaim-migrate @ 16190]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13370
diff changeset
291 ret = send(fd, buf, size, flags);
cb2060acb34f [gaim-migrate @ 16190]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13370
diff changeset
292
cb2060acb34f [gaim-migrate @ 16190]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13370
diff changeset
293 if (ret == SOCKET_ERROR) {
cb2060acb34f [gaim-migrate @ 16190]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13370
diff changeset
294 errno = WSAGetLastError();
cb2060acb34f [gaim-migrate @ 16190]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13370
diff changeset
295 if(errno == WSAEWOULDBLOCK)
cb2060acb34f [gaim-migrate @ 16190]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13370
diff changeset
296 errno = EAGAIN;
cb2060acb34f [gaim-migrate @ 16190]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13370
diff changeset
297 return -1;
cb2060acb34f [gaim-migrate @ 16190]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13370
diff changeset
298 }
cb2060acb34f [gaim-migrate @ 16190]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13370
diff changeset
299 return ret;
cb2060acb34f [gaim-migrate @ 16190]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13370
diff changeset
300 }
cb2060acb34f [gaim-migrate @ 16190]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13370
diff changeset
301
cb2060acb34f [gaim-migrate @ 16190]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13370
diff changeset
302 int wgaim_write(int fd, const void *buf, unsigned int size) {
cb2060acb34f [gaim-migrate @ 16190]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13370
diff changeset
303
cb2060acb34f [gaim-migrate @ 16190]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13370
diff changeset
304 if(wgaim_is_socket(fd))
cb2060acb34f [gaim-migrate @ 16190]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13370
diff changeset
305 return wgaim_send(fd, buf, size, 0);
cb2060acb34f [gaim-migrate @ 16190]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13370
diff changeset
306 else
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
307 return write(fd, buf, size);
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
308 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
309
12749
13276711babc [gaim-migrate @ 15096]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12488
diff changeset
310 int wgaim_recv(int fd, void *buf, size_t len, int flags) {
13276711babc [gaim-migrate @ 15096]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12488
diff changeset
311 int ret;
13276711babc [gaim-migrate @ 15096]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12488
diff changeset
312
13200
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12749
diff changeset
313 if((ret = recv(fd, buf, len, flags)) == SOCKET_ERROR) {
12749
13276711babc [gaim-migrate @ 15096]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12488
diff changeset
314 errno = WSAGetLastError();
13200
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12749
diff changeset
315 if(errno == WSAEWOULDBLOCK)
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12749
diff changeset
316 errno = EAGAIN;
12749
13276711babc [gaim-migrate @ 15096]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12488
diff changeset
317 return -1;
13276711babc [gaim-migrate @ 15096]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12488
diff changeset
318 } else {
13276711babc [gaim-migrate @ 15096]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12488
diff changeset
319 return ret;
13276711babc [gaim-migrate @ 15096]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12488
diff changeset
320 }
13276711babc [gaim-migrate @ 15096]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12488
diff changeset
321 }
13276711babc [gaim-migrate @ 15096]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12488
diff changeset
322
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
323 int wgaim_close(int fd) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
324 int ret;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
325
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
326 if( wgaim_is_socket(fd) ) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
327 if( (ret = closesocket(fd)) == SOCKET_ERROR ) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
328 errno = WSAGetLastError();
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
329 return -1;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
330 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
331 else
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
332 return 0;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
333 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
334 else
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
335 return close(fd);
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
336 }
3777
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
337
8244
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
338 int wgaim_gethostname(char *name, size_t size) {
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
339 if(gethostname(name, size) == SOCKET_ERROR) {
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
340 errno = WSAGetLastError();
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
341 return -1;
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
342 }
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
343 return 0;
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
344 }
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
345
3777
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
346 /* sys/time.h */
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
347
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
348 int wgaim_gettimeofday(struct timeval *p, struct timezone *z) {
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
349 int res = 0;
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
350 struct _timeb timebuffer;
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
351
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
352 if (z != 0) {
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
353 _tzset();
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
354 z->tz_minuteswest = _timezone/60;
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
355 z->tz_dsttime = _daylight;
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
356 }
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
357
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
358 if (p != 0) {
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
359 _ftime(&timebuffer);
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
360 p->tv_sec = timebuffer.time; /* seconds since 1-1-1970 */
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
361 p->tv_usec = timebuffer.millitm*1000; /* microseconds */
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
362 }
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
363
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
364 return res;
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
365 }
4905
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
366
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
367 /* stdio.h */
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
368
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
369 int wgaim_rename (const char *oldname, const char *newname) {
10601
e46b51de549a [gaim-migrate @ 12028]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10589
diff changeset
370 struct stat oldstat, newstat;
4905
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
371
10601
e46b51de549a [gaim-migrate @ 12028]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10589
diff changeset
372 if(g_stat(oldname, &oldstat) == 0) {
4905
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
373 /* newname exists */
10601
e46b51de549a [gaim-migrate @ 12028]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10589
diff changeset
374 if(g_stat(newname, &newstat) == 0) {
4905
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
375 /* oldname is a dir */
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
376 if(_S_ISDIR(oldstat.st_mode)) {
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
377 if(!_S_ISDIR(newstat.st_mode)) {
10601
e46b51de549a [gaim-migrate @ 12028]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10589
diff changeset
378 return g_rename(oldname, newname);
4905
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
379 }
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
380 /* newname is a dir */
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
381 else {
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
382 /* This is not quite right.. If newname is empty and
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
383 is not a sub dir of oldname, newname should be
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
384 deleted and oldname should be renamed.
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
385 */
6425
26b739bc9f1a [gaim-migrate @ 6933]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5913
diff changeset
386 gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "wgaim_rename does not behave here as it should\n");
10601
e46b51de549a [gaim-migrate @ 12028]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10589
diff changeset
387 return g_rename(oldname, newname);
4905
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
388 }
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
389 }
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
390 /* oldname is not a dir */
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
391 else {
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
392 /* newname is a dir */
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
393 if(_S_ISDIR(newstat.st_mode)) {
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
394 errno = EISDIR;
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
395 return -1;
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
396 }
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
397 /* newname is not a dir */
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
398 else {
10589
0f7452b1f777 [gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 9611
diff changeset
399 g_remove(newname);
10601
e46b51de549a [gaim-migrate @ 12028]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10589
diff changeset
400 return g_rename(oldname, newname);
4905
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
401 }
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
402 }
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
403 }
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
404 /* newname doesn't exist */
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
405 else
10601
e46b51de549a [gaim-migrate @ 12028]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10589
diff changeset
406 return g_rename(oldname, newname);
4905
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
407 }
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
408 else {
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
409 /* oldname doesn't exist */
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
410 errno = ENOENT;
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
411 return -1;
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
412 }
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
413
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
414 }
5113
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
415
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
416 /* time.h */
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
417
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
418 struct tm * wgaim_localtime_r (const time_t *time, struct tm *resultp) {
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
419 struct tm* tmptm;
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
420
5474
0b355ec51083 [gaim-migrate @ 5868]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5113
diff changeset
421 if(!time)
5913
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5474
diff changeset
422 return NULL;
5113
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
423 tmptm = localtime(time);
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
424 if(resultp && tmptm)
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
425 return memcpy(resultp, tmptm, sizeof(struct tm));
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
426 else
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
427 return NULL;
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
428 }
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
429
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
430 /*
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
431 * Used by gaim_utf8_strftime() by way of gaim_internal_strftime()
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
432 * in src/util.c
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
433 *
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
434 * Code derived from PostgreSQL src/timezone/pgtz.c:
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
435 * http://developer.postgresql.org/cvsweb.cgi/pgsql/src/timezone/pgtz.c
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
436 */
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
437
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
438 /*
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
439 PostgreSQL Database Management System
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
440 (formerly known as Postgres, then as Postgres95)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
441
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
442 Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
443
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
444 Portions Copyright (c) 1994, The Regents of the University of California
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
445
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
446 Permission to use, copy, modify, and distribute this software and its
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
447 documentation for any purpose, without fee, and without a written agreement
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
448 is hereby granted, provided that the above copyright notice and this
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
449 paragraph and the following two paragraphs appear in all copies.
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
450
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
451 IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
452 DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
453 LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
454 DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
455 POSSIBILITY OF SUCH DAMAGE.
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
456
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
457 THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
458 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
459 AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
460 ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
461 PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
462
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
463 */
13340
c6ab9c1cf28d [gaim-migrate @ 15710]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13338
diff changeset
464 static struct
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
465 {
13340
c6ab9c1cf28d [gaim-migrate @ 15710]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13338
diff changeset
466 char *wstd; /* Windows name of standard timezone */
c6ab9c1cf28d [gaim-migrate @ 15710]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13338
diff changeset
467 char *wdst; /* Windows name of daylight timezone */
c6ab9c1cf28d [gaim-migrate @ 15710]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13338
diff changeset
468 char *ustd; /* Unix name of standard timezone */
c6ab9c1cf28d [gaim-migrate @ 15710]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13338
diff changeset
469 char *udst; /* Unix name of daylight timezone */
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
470 } win32_tzmap[] =
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
471 {
13338
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
472 {
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
473 "", "",
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
474 "", "",
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
475 },
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
476 /*
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
477 * This list was built from the contents of the registry at
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
478 * "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
479 * on Windows XP Professional SP1
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
480 */
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
481 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
482 "Afghanistan Standard Time", "Afghanistan Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
483 "AFT", "AFT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
484 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
485 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
486 "Alaskan Standard Time", "Alaskan Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
487 "AKST", "AKDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
488 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
489 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
490 "Arab Standard Time", "Arab Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
491 "AST", "AST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
492 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
493 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
494 "Arabian Standard Time", "Arabian Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
495 "GST", "GST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
496 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
497 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
498 "Arabic Standard Time", "Arabic Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
499 "AST", "ADT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
500 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
501 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
502 "Atlantic Standard Time", "Atlantic Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
503 "AST", "ADT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
504 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
505 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
506 "AUS Central Standard Time", "AUS Central Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
507 "CST", "CST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
508 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
509 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
510 "AUS Eastern Standard Time", "AUS Eastern Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
511 "EST", "EST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
512 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
513 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
514 "Azores Standard Time", "Azores Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
515 "AZOT", "AZOST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
516 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
517 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
518 "Canada Central Standard Time", "Canada Central Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
519 "CST", "MDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
520 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
521 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
522 "Cape Verde Standard Time", "Cape Verde Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
523 "CVT", "CVST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
524 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
525 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
526 "Caucasus Standard Time", "Caucasus Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
527 "AZT", "AZST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
528 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
529 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
530 "Cen. Australia Standard Time", "Cen. Australia Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
531 "CST", "CST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
532 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
533 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
534 "Central America Standard Time", "Central America Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
535 "CST", "CDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
536 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
537 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
538 "Central Asia Standard Time", "Central Asia Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
539 "BDT", "BDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
540 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
541 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
542 "Central Europe Standard Time", "Central Europe Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
543 "CET", "CEST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
544 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
545 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
546 "Central European Standard Time", "Central European Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
547 "CET", "CEST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
548 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
549 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
550 "Central Pacific Standard Time", "Central Pacific Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
551 "NCT", "NCST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
552 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
553 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
554 "Central Standard Time", "Central Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
555 "CST", "CDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
556 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
557 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
558 "China Standard Time", "China Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
559 "HKT", "HKST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
560 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
561 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
562 "Dateline Standard Time", "Dateline Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
563 "GMT+12", "GMT+12"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
564 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
565 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
566 "E. Africa Standard Time", "E. Africa Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
567 "EAT", "EAT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
568 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
569 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
570 "E. Australia Standard Time", "E. Australia Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
571 "EST", "EST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
572 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
573 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
574 "E. Europe Standard Time", "E. Europe Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
575 "EET", "EEST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
576 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
577 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
578 "E. South America Standard Time", "E. South America Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
579 "BRT", "BRST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
580 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
581 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
582 "Eastern Standard Time", "Eastern Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
583 "EST", "EDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
584 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
585 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
586 "Egypt Standard Time", "Egypt Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
587 "EET", "EEST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
588 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
589 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
590 "Ekaterinburg Standard Time", "Ekaterinburg Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
591 "YEKT", "YEKST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
592 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
593 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
594 "Fiji Standard Time", "Fiji Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
595 "FJT", "FJST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
596 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
597 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
598 "FLE Standard Time", "FLE Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
599 "EET", "EEST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
600 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
601 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
602 "GMT Standard Time", "GMT Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
603 "GMT", "IST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
604 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
605 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
606 "Greenland Standard Time", "Greenland Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
607 "WGT", "WGST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
608 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
609 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
610 "Greenwich Standard Time", "Greenwich Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
611 "WET", "WEST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
612 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
613 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
614 "GTB Standard Time", "GTB Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
615 "EET", "EEST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
616 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
617 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
618 "Hawaiian Standard Time", "Hawaiian Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
619 "HST", "HPT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
620 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
621 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
622 "India Standard Time", "India Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
623 "IST", "IST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
624 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
625 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
626 "Iran Standard Time", "Iran Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
627 "IRST", "IRDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
628 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
629 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
630 "Jerusalem Standard Time", "Jerusalem Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
631 "IST", "IDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
632 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
633 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
634 "Korea Standard Time", "Korea Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
635 "KST", "KDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
636 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
637 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
638 "Mexico Standard Time", "Mexico Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
639 "CST", "CDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
640 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
641 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
642 "Mexico Standard Time", "Mexico Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
643 "BOT", "BOST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
644 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
645 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
646 "Mid-Atlantic Standard Time", "Mid-Atlantic Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
647 "GST", "GST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
648 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
649 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
650 "Mountain Standard Time", "Mountain Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
651 "MST", "MDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
652 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
653 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
654 "Myanmar Standard Time", "Myanmar Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
655 "MMT", "MMT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
656 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
657 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
658 "N. Central Asia Standard Time", "N. Central Asia Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
659 "ALMT", "ALMST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
660 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
661 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
662 "Nepal Standard Time", "Nepal Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
663 "NPT", "NPT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
664 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
665 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
666 "New Zealand Standard Time", "New Zealand Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
667 "NZST", "NZDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
668 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
669 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
670 "Newfoundland Standard Time", "Newfoundland Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
671 "NST", "NDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
672 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
673 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
674 "North Asia East Standard Time", "North Asia East Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
675 "IRKT", "IRKST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
676 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
677 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
678 "North Asia Standard Time", "North Asia Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
679 "KRAT", "KRAST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
680 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
681 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
682 "Pacific SA Standard Time", "Pacific SA Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
683 "CLT", "CLST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
684 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
685 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
686 "Pacific Standard Time", "Pacific Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
687 "PST", "PDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
688 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
689 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
690 "Romance Standard Time", "Romance Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
691 "CET", "CEST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
692 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
693 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
694 "Russian Standard Time", "Russian Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
695 "MSK", "MSD"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
696 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
697 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
698 "SA Eastern Standard Time", "SA Eastern Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
699 "ART", "ARST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
700 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
701 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
702 "SA Pacific Standard Time", "SA Pacific Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
703 "COT", "COST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
704 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
705 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
706 "SA Western Standard Time", "SA Western Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
707 "VET", "VET"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
708 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
709 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
710 "Samoa Standard Time", "Samoa Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
711 "SST", "NDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
712 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
713 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
714 "SE Asia Standard Time", "SE Asia Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
715 "ICT", "ICT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
716 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
717 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
718 "Malay Peninsula Standard Time", "Malay Peninsula Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
719 "MYT", "MALST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
720 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
721 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
722 "South Africa Standard Time", "South Africa Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
723 "CAT", "CAT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
724 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
725 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
726 "Sri Lanka Standard Time", "Sri Lanka Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
727 "LKT", "IST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
728 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
729 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
730 "Taipei Standard Time", "Taipei Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
731 "CST", "CDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
732 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
733 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
734 "Tasmania Standard Time", "Tasmania Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
735 "EST", "EST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
736 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
737 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
738 "Tokyo Standard Time", "Tokyo Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
739 "JST", "JDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
740 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
741 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
742 "Tonga Standard Time", "Tonga Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
743 "TOT", "TOST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
744 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
745 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
746 "US Eastern Standard Time", "US Eastern Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
747 "EST", "EDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
748 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
749 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
750 "US Mountain Standard Time", "US Mountain Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
751 "MST", "MDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
752 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
753 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
754 "Vladivostok Standard Time", "Vladivostok Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
755 "VLAT", "VLAST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
756 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
757 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
758 "W. Australia Standard Time", "W. Australia Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
759 "WST", "WST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
760 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
761
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
762 /* Not mapped in PostgreSQL.
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
763 *
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
764 * I mapped this based on the following information... -- rlaager
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
765 * $ cd /usr/share/zoneinfo/Africa
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
766 * $ for i in * ; do echo `TZ=Africa/$i date +"%z %Z"` $i ; done | grep +0100
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
767 * +0100 CET Algiers
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
768 * +0100 WAT Bangui
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
769 * +0100 WAT Brazzaville
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
770 * +0100 CET Ceuta
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
771 * +0100 WAT Douala
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
772 * +0100 WAT Kinshasa
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
773 * +0100 WAT Lagos
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
774 * +0100 WAT Libreville
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
775 * +0100 WAT Luanda
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
776 * +0100 WAT Malabo
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
777 * +0100 WAT Ndjamena
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
778 * +0100 WAT Niamey
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
779 * +0100 WAT Porto-Novo
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
780 * +0100 CET Tunis
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
781 **/
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
782 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
783 "W. Central Africa Standard Time", "W. Central Africa Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
784 "WAT", "WAT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
785 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
786
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
787 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
788 "W. Europe Standard Time", "W. Europe Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
789 "CET", "CEST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
790 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
791 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
792 "West Asia Standard Time", "West Asia Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
793 "PKT", "PKST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
794 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
795 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
796 "West Pacific Standard Time", "West Pacific Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
797 "ChST", "ChST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
798 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
799 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
800 "Yakutsk Standard Time", "Yakutsk Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
801 "YAKT", "YAKST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
802 },
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
803 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
804 NULL, NULL,
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
805 NULL, NULL
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
806 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
807 };
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
808
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
809 const char *
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
810 wgaim_get_timezone_abbreviation(const struct tm *tm)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
811 {
13370
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
812 int i;
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
813 char tzname[128];
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
814 char localtzname[256];
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
815 HKEY rootKey;
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
816 int idx;
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
817
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
818 if (!tm)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
819 {
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
820 gaim_debug_warning("wgaim", "could not determine current date/time: localtime failed\n");
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
821 return "";
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
822 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
823
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
824 if (strftime(tzname, sizeof(tzname) - 1, "%Z", tm) == 0)
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
825 {
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
826 gaim_debug_error("wgaim", "timezone name is too long for the buffer\n");
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
827 return "";
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
828 }
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
829
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
830 for (i = 0; win32_tzmap[i].wstd != NULL; i++)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
831 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
832 if (strcmp(tzname, win32_tzmap[i].wstd) == 0)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
833 {
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
834 #if 0
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
835 gaim_debug_info("wgaim", "TZ \"%s\" matches Windows timezone \"%s\"\n",
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
836 win32_tzmap[i].ustd, tzname);
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
837 #endif
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
838 /* Cache the Result */
13370
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
839 if (i > 0) {
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
840 if (win32_tzmap[0].wstd[0] != '\0')
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
841 g_free(win32_tzmap[0].wstd);
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
842 win32_tzmap[0].wstd = g_strdup(tzname);
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
843 win32_tzmap[0].ustd = win32_tzmap[i].ustd;
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
844 }
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
845
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
846 return win32_tzmap[i].ustd;
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
847 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
848 if (strcmp(tzname, win32_tzmap[i].wdst) == 0)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
849 {
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
850 #if 0
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
851 gaim_debug_info("wgaim", "TZ \"%s\" matches Windows timezone \"%s\"\n",
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
852 win32_tzmap[i].udst, tzname);
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
853 #endif
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
854 /* Cache the Result */
13370
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
855 if (i > 0) {
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
856 if (win32_tzmap[0].wdst[0] != '\0')
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
857 g_free(win32_tzmap[0].wdst);
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
858 win32_tzmap[0].wdst = g_strdup(tzname);
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
859 win32_tzmap[0].udst = win32_tzmap[i].udst;
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
860 }
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
861
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
862 return win32_tzmap[i].udst;
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
863 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
864 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
865
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
866 /*
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
867 * Localized Windows versions return localized names for the timezone.
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
868 * Scan the registry to find the English name, and then try matching
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
869 * against our table again.
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
870 */
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
871 memset(localtzname, 0, sizeof(localtzname));
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
872 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
873 "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
874 0,
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
875 KEY_READ,
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
876 &rootKey) != ERROR_SUCCESS)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
877 {
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
878 gaim_debug_warning("wgaim", "could not open registry key to identify Windows timezone: %i\n", (int) GetLastError());
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
879 return "";
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
880 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
881
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
882 for (idx = 0;; idx++)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
883 {
13370
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
884 char keyname[256];
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
885 char zonename[256];
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
886 DWORD namesize;
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
887 FILETIME lastwrite;
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
888 HKEY key;
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
889 LONG r;
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
890
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
891 memset(keyname, 0, sizeof(keyname));
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
892 namesize = sizeof(keyname);
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
893 if ((r = RegEnumKeyEx(rootKey,
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
894 idx,
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
895 keyname,
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
896 &namesize,
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
897 NULL,
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
898 NULL,
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
899 NULL,
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
900 &lastwrite)) != ERROR_SUCCESS)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
901 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
902 if (r == ERROR_NO_MORE_ITEMS)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
903 break;
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
904 gaim_debug_warning("wgaim", "could not enumerate registry subkeys to identify Windows timezone: %i\n", (int) r);
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
905 break;
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
906 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
907
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
908 if ((r = RegOpenKeyEx(rootKey, keyname, 0, KEY_READ, &key)) != ERROR_SUCCESS)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
909 {
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
910 gaim_debug_warning("wgaim", "could not open registry subkey to identify Windows timezone: %i\n", (int) r);
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
911 break;
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
912 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
913
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
914 memset(zonename, 0, sizeof(zonename));
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
915 namesize = sizeof(zonename);
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
916 if ((r = RegQueryValueEx(key, "Std", NULL, NULL, zonename, &namesize)) != ERROR_SUCCESS)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
917 {
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
918 gaim_debug_warning("wgaim", "could not query value for 'std' to identify Windows timezone: %i\n", (int) r);
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
919 RegCloseKey(key);
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
920 break;
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
921 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
922 if (strcmp(tzname, zonename) == 0)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
923 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
924 /* Matched zone */
13370
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
925 strcpy(localtzname, keyname);
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
926 RegCloseKey(key);
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
927 break;
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
928 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
929 memset(zonename, 0, sizeof(zonename));
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
930 namesize = sizeof(zonename);
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
931 if ((r = RegQueryValueEx(key, "Dlt", NULL, NULL, zonename, &namesize)) != ERROR_SUCCESS)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
932 {
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
933 gaim_debug_warning("wgaim", "could not query value for 'dlt' to identify Windows timezone: %i\n", (int) r);
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
934 RegCloseKey(key);
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
935 break;
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
936 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
937 if (strcmp(tzname, zonename) == 0)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
938 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
939 /* Matched DST zone */
13370
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
940 strcpy(localtzname, keyname);
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
941 RegCloseKey(key);
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
942 break;
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
943 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
944
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
945 RegCloseKey(key);
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
946 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
947
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
948 RegCloseKey(rootKey);
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
949
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
950 if (localtzname[0])
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
951 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
952 /* Found a localized name, so scan for that one too */
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
953 for (i = 0; win32_tzmap[i].wstd != NULL; i++)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
954 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
955 if (strcmp(localtzname, win32_tzmap[i].wstd) == 0)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
956 {
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
957 #if 0
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
958 gaim_debug_info("wgaim", "TZ \"%s\" matches localized Windows timezone \"%s\" (\"%s\")\n",
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
959 win32_tzmap[i].ustd, tzname, localtzname);
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
960 #endif
13338
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
961 /* Cache the Result */
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
962 if (win32_tzmap[0].wstd[0] != '\0')
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
963 g_free(win32_tzmap[0].wstd);
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
964 win32_tzmap[0].wstd = g_strdup(tzname);
13340
c6ab9c1cf28d [gaim-migrate @ 15710]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13338
diff changeset
965 win32_tzmap[0].ustd = win32_tzmap[i].ustd;
13338
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
966
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
967 return win32_tzmap[i].ustd;
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
968 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
969 if (strcmp(localtzname, win32_tzmap[i].wdst) == 0)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
970 {
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
971 #if 0
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
972 gaim_debug_info("wgaim", "TZ \"%s\" matches localized Windows timezone \"%s\" (\"%s\")\n",
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
973 win32_tzmap[i].udst, tzname, localtzname);
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
974 #endif
13338
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
975 /* Cache the Result */
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
976 if (win32_tzmap[0].wdst[0] != '\0')
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
977 g_free(win32_tzmap[0].wdst);
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
978
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
979 win32_tzmap[0].wdst = g_strdup(tzname);
13340
c6ab9c1cf28d [gaim-migrate @ 15710]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13338
diff changeset
980 win32_tzmap[0].udst = win32_tzmap[i].udst;
13338
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
981
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
982 return win32_tzmap[i].udst;
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
983 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
984 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
985 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
986
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
987 gaim_debug_warning("wgaim", "could not find a match for Windows timezone \"%s\"\n", tzname);
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
988 return "";
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
989 }
13338
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
990