annotate src/win32/libc_interface.c @ 13549:cef825f41d56

[gaim-migrate @ 15926] Kevin suggested this on gaim-devel: 'I would suggest changing "_Only when someone says your nick" in the message notification plugin to a more standard terminology for your own name or screen name or nickname. "Nick" is an IRC abbreviation which may be less clear. Kevin' committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Wed, 22 Mar 2006 06:56:41 +0000
parents cf292e05a6cc
children cb2060acb34f
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
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
288 int wgaim_write(int fd, const void *buf, unsigned int size) {
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
13200
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12749
diff changeset
291 if(wgaim_is_socket(fd)) {
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12749
diff changeset
292 if((ret = send(fd, buf, size, 0)) == SOCKET_ERROR) {
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
293 errno = WSAGetLastError();
13200
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12749
diff changeset
294 if(errno == WSAEWOULDBLOCK)
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12749
diff changeset
295 errno = EAGAIN;
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
296 return -1;
13200
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12749
diff changeset
297 } else {
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
298 /* success */
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
299 return ret;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
300 }
13200
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12749
diff changeset
301 } else
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
302 return write(fd, buf, size);
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
303 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
304
12749
13276711babc [gaim-migrate @ 15096]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12488
diff changeset
305 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
306 int ret;
13276711babc [gaim-migrate @ 15096]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12488
diff changeset
307
13200
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12749
diff changeset
308 if((ret = recv(fd, buf, len, flags)) == SOCKET_ERROR) {
12749
13276711babc [gaim-migrate @ 15096]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12488
diff changeset
309 errno = WSAGetLastError();
13200
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12749
diff changeset
310 if(errno == WSAEWOULDBLOCK)
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12749
diff changeset
311 errno = EAGAIN;
12749
13276711babc [gaim-migrate @ 15096]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12488
diff changeset
312 return -1;
13276711babc [gaim-migrate @ 15096]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12488
diff changeset
313 } else {
13276711babc [gaim-migrate @ 15096]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12488
diff changeset
314 return ret;
13276711babc [gaim-migrate @ 15096]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12488
diff changeset
315 }
13276711babc [gaim-migrate @ 15096]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12488
diff changeset
316 }
13276711babc [gaim-migrate @ 15096]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12488
diff changeset
317
3712
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
318 int wgaim_close(int fd) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
319 int ret;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
320
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
321 if( wgaim_is_socket(fd) ) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
322 if( (ret = closesocket(fd)) == SOCKET_ERROR ) {
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
323 errno = WSAGetLastError();
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
324 return -1;
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 else
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
327 return 0;
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
328 }
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
329 else
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
330 return close(fd);
ac6ca3890c53 [gaim-migrate @ 3845]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
331 }
3777
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
332
8244
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
333 int wgaim_gethostname(char *name, size_t size) {
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
334 if(gethostname(name, size) == SOCKET_ERROR) {
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
335 errno = WSAGetLastError();
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
336 return -1;
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
337 }
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
338 return 0;
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
339 }
5e7ffea3f76a [gaim-migrate @ 8967]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6425
diff changeset
340
3777
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
341 /* sys/time.h */
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
342
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
343 int wgaim_gettimeofday(struct timeval *p, struct timezone *z) {
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
344 int res = 0;
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
345 struct _timeb timebuffer;
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
346
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
347 if (z != 0) {
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
348 _tzset();
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
349 z->tz_minuteswest = _timezone/60;
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
350 z->tz_dsttime = _daylight;
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
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
353 if (p != 0) {
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
354 _ftime(&timebuffer);
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
355 p->tv_sec = timebuffer.time; /* seconds since 1-1-1970 */
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
356 p->tv_usec = timebuffer.millitm*1000; /* microseconds */
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
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
359 return res;
10ffafd1c91f [gaim-migrate @ 3917]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3712
diff changeset
360 }
4905
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
361
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
362 /* stdio.h */
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
363
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
364 int wgaim_rename (const char *oldname, const char *newname) {
10601
e46b51de549a [gaim-migrate @ 12028]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10589
diff changeset
365 struct stat oldstat, newstat;
4905
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
366
10601
e46b51de549a [gaim-migrate @ 12028]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10589
diff changeset
367 if(g_stat(oldname, &oldstat) == 0) {
4905
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
368 /* newname exists */
10601
e46b51de549a [gaim-migrate @ 12028]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10589
diff changeset
369 if(g_stat(newname, &newstat) == 0) {
4905
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
370 /* oldname is a dir */
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
371 if(_S_ISDIR(oldstat.st_mode)) {
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
372 if(!_S_ISDIR(newstat.st_mode)) {
10601
e46b51de549a [gaim-migrate @ 12028]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10589
diff changeset
373 return g_rename(oldname, newname);
4905
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
374 }
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
375 /* newname is a dir */
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
376 else {
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
377 /* This is not quite right.. If newname is empty and
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
378 is not a sub dir of oldname, newname should be
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
379 deleted and oldname should be renamed.
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
380 */
6425
26b739bc9f1a [gaim-migrate @ 6933]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5913
diff changeset
381 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
382 return g_rename(oldname, newname);
4905
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
383 }
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
384 }
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
385 /* oldname is not a dir */
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
386 else {
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
387 /* newname is a dir */
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
388 if(_S_ISDIR(newstat.st_mode)) {
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
389 errno = EISDIR;
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
390 return -1;
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
391 }
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
392 /* newname is not a dir */
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
393 else {
10589
0f7452b1f777 [gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 9611
diff changeset
394 g_remove(newname);
10601
e46b51de549a [gaim-migrate @ 12028]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10589
diff changeset
395 return g_rename(oldname, newname);
4905
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 }
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
398 }
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
399 /* newname doesn't exist */
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
400 else
10601
e46b51de549a [gaim-migrate @ 12028]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10589
diff changeset
401 return g_rename(oldname, newname);
4905
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 else {
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
404 /* oldname doesn't exist */
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
405 errno = ENOENT;
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
406 return -1;
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
86037d6bf80f [gaim-migrate @ 5239]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4193
diff changeset
409 }
5113
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
410
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
411 /* time.h */
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
412
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
413 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
414 struct tm* tmptm;
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
415
5474
0b355ec51083 [gaim-migrate @ 5868]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5113
diff changeset
416 if(!time)
5913
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5474
diff changeset
417 return NULL;
5113
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
418 tmptm = localtime(time);
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
419 if(resultp && tmptm)
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
420 return memcpy(resultp, tmptm, sizeof(struct tm));
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
421 else
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
422 return NULL;
bac62d8d386f [gaim-migrate @ 5476]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
423 }
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
424
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
425 /*
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
426 * Used by gaim_utf8_strftime() by way of gaim_internal_strftime()
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
427 * in src/util.c
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
428 *
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
429 * Code derived from PostgreSQL src/timezone/pgtz.c:
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
430 * http://developer.postgresql.org/cvsweb.cgi/pgsql/src/timezone/pgtz.c
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
431 */
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
432
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 PostgreSQL Database Management System
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
435 (formerly known as Postgres, then as Postgres95)
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 Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
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 Portions Copyright (c) 1994, The Regents of the University of California
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
440
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
441 Permission to use, copy, modify, and distribute this software and its
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
442 documentation for any purpose, without fee, and without a written agreement
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
443 is hereby granted, provided that the above copyright notice and this
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
444 paragraph and the following two paragraphs appear in all copies.
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 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
447 DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
448 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
449 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
450 POSSIBILITY OF SUCH DAMAGE.
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
451
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
452 THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
453 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
454 AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
455 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
456 PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
457
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
458 */
13340
c6ab9c1cf28d [gaim-migrate @ 15710]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13338
diff changeset
459 static struct
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
460 {
13340
c6ab9c1cf28d [gaim-migrate @ 15710]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13338
diff changeset
461 char *wstd; /* Windows name of standard timezone */
c6ab9c1cf28d [gaim-migrate @ 15710]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13338
diff changeset
462 char *wdst; /* Windows name of daylight timezone */
c6ab9c1cf28d [gaim-migrate @ 15710]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13338
diff changeset
463 char *ustd; /* Unix name of standard timezone */
c6ab9c1cf28d [gaim-migrate @ 15710]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13338
diff changeset
464 char *udst; /* Unix name of daylight timezone */
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
465 } win32_tzmap[] =
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
466 {
13338
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
467 {
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
468 "", "",
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
469 "", "",
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
470 },
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
471 /*
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
472 * This list was built from the contents of the registry at
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
473 * "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
474 * on Windows XP Professional SP1
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
475 */
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 "Afghanistan Standard Time", "Afghanistan Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
478 "AFT", "AFT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
479 },
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 "Alaskan Standard Time", "Alaskan Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
482 "AKST", "AKDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
483 },
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 "Arab Standard Time", "Arab Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
486 "AST", "AST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
487 },
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 "Arabian Standard Time", "Arabian Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
490 "GST", "GST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
491 },
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 "Arabic Standard Time", "Arabic Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
494 "AST", "ADT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
495 },
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 "Atlantic Standard Time", "Atlantic Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
498 "AST", "ADT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
499 },
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 "AUS Central Standard Time", "AUS Central Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
502 "CST", "CST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
503 },
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 "AUS Eastern Standard Time", "AUS Eastern Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
506 "EST", "EST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
507 },
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 "Azores Standard Time", "Azores Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
510 "AZOT", "AZOST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
511 },
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 "Canada Central Standard Time", "Canada Central Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
514 "CST", "MDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
515 },
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 "Cape Verde Standard Time", "Cape Verde Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
518 "CVT", "CVST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
519 },
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 "Caucasus Standard Time", "Caucasus Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
522 "AZT", "AZST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
523 },
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 "Cen. Australia Standard Time", "Cen. Australia Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
526 "CST", "CST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
527 },
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 "Central America Standard Time", "Central America Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
530 "CST", "CDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
531 },
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 "Central Asia Standard Time", "Central Asia Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
534 "BDT", "BDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
535 },
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 "Central Europe Standard Time", "Central Europe Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
538 "CET", "CEST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
539 },
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 "Central European Standard Time", "Central European Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
542 "CET", "CEST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
543 },
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 "Central Pacific Standard Time", "Central Pacific Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
546 "NCT", "NCST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
547 },
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 "Central Standard Time", "Central Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
550 "CST", "CDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
551 },
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 "China Standard Time", "China Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
554 "HKT", "HKST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
555 },
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 "Dateline Standard Time", "Dateline Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
558 "GMT+12", "GMT+12"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
559 },
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 "E. Africa Standard Time", "E. Africa Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
562 "EAT", "EAT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
563 },
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 "E. Australia Standard Time", "E. Australia Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
566 "EST", "EST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
567 },
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 "E. Europe Standard Time", "E. Europe Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
570 "EET", "EEST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
571 },
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 "E. South America Standard Time", "E. South America Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
574 "BRT", "BRST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
575 },
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 "Eastern Standard Time", "Eastern Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
578 "EST", "EDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
579 },
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 "Egypt Standard Time", "Egypt Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
582 "EET", "EEST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
583 },
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 "Ekaterinburg Standard Time", "Ekaterinburg Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
586 "YEKT", "YEKST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
587 },
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 "Fiji Standard Time", "Fiji Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
590 "FJT", "FJST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
591 },
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 "FLE Standard Time", "FLE Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
594 "EET", "EEST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
595 },
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 "GMT Standard Time", "GMT Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
598 "GMT", "IST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
599 },
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 "Greenland Standard Time", "Greenland Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
602 "WGT", "WGST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
603 },
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 "Greenwich Standard Time", "Greenwich Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
606 "WET", "WEST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
607 },
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 "GTB Standard Time", "GTB Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
610 "EET", "EEST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
611 },
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 "Hawaiian Standard Time", "Hawaiian Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
614 "HST", "HPT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
615 },
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 "India Standard Time", "India Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
618 "IST", "IST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
619 },
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 "Iran Standard Time", "Iran Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
622 "IRST", "IRDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
623 },
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 "Jerusalem Standard Time", "Jerusalem Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
626 "IST", "IDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
627 },
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 "Korea Standard Time", "Korea Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
630 "KST", "KDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
631 },
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 "Mexico Standard Time", "Mexico Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
634 "CST", "CDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
635 },
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 "Mexico Standard Time", "Mexico Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
638 "BOT", "BOST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
639 },
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 "Mid-Atlantic Standard Time", "Mid-Atlantic Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
642 "GST", "GST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
643 },
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 "Mountain Standard Time", "Mountain Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
646 "MST", "MDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
647 },
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 "Myanmar Standard Time", "Myanmar Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
650 "MMT", "MMT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
651 },
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 "N. Central Asia Standard Time", "N. Central Asia Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
654 "ALMT", "ALMST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
655 },
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 "Nepal Standard Time", "Nepal Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
658 "NPT", "NPT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
659 },
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 "New Zealand Standard Time", "New Zealand Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
662 "NZST", "NZDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
663 },
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 "Newfoundland Standard Time", "Newfoundland Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
666 "NST", "NDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
667 },
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 "North Asia East Standard Time", "North Asia East Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
670 "IRKT", "IRKST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
671 },
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 "North Asia Standard Time", "North Asia Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
674 "KRAT", "KRAST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
675 },
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 "Pacific SA Standard Time", "Pacific SA Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
678 "CLT", "CLST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
679 },
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 "Pacific Standard Time", "Pacific Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
682 "PST", "PDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
683 },
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 "Romance Standard Time", "Romance Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
686 "CET", "CEST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
687 },
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 "Russian Standard Time", "Russian Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
690 "MSK", "MSD"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
691 },
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 "SA Eastern Standard Time", "SA Eastern Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
694 "ART", "ARST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
695 },
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 "SA Pacific Standard Time", "SA Pacific Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
698 "COT", "COST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
699 },
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 "SA Western Standard Time", "SA Western Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
702 "VET", "VET"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
703 },
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 "Samoa Standard Time", "Samoa Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
706 "SST", "NDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
707 },
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 "SE Asia Standard Time", "SE Asia Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
710 "ICT", "ICT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
711 },
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 "Malay Peninsula Standard Time", "Malay Peninsula Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
714 "MYT", "MALST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
715 },
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 "South Africa Standard Time", "South Africa Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
718 "CAT", "CAT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
719 },
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 "Sri Lanka Standard Time", "Sri Lanka Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
722 "LKT", "IST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
723 },
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 "Taipei Standard Time", "Taipei Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
726 "CST", "CDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
727 },
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 "Tasmania Standard Time", "Tasmania Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
730 "EST", "EST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
731 },
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 "Tokyo Standard Time", "Tokyo Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
734 "JST", "JDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
735 },
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 "Tonga Standard Time", "Tonga Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
738 "TOT", "TOST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
739 },
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 "US Eastern Standard Time", "US Eastern Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
742 "EST", "EDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
743 },
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 "US Mountain Standard Time", "US Mountain Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
746 "MST", "MDT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
747 },
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 "Vladivostok Standard Time", "Vladivostok Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
750 "VLAT", "VLAST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
751 },
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 "W. Australia Standard Time", "W. Australia Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
754 "WST", "WST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
755 },
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 /* Not mapped in PostgreSQL.
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
758 *
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
759 * I mapped this based on the following information... -- rlaager
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
760 * $ cd /usr/share/zoneinfo/Africa
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
761 * $ 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
762 * +0100 CET Algiers
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
763 * +0100 WAT Bangui
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
764 * +0100 WAT Brazzaville
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
765 * +0100 CET Ceuta
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
766 * +0100 WAT Douala
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
767 * +0100 WAT Kinshasa
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
768 * +0100 WAT Lagos
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
769 * +0100 WAT Libreville
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
770 * +0100 WAT Luanda
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
771 * +0100 WAT Malabo
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
772 * +0100 WAT Ndjamena
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
773 * +0100 WAT Niamey
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
774 * +0100 WAT Porto-Novo
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
775 * +0100 CET Tunis
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
776 **/
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
777 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
778 "W. Central Africa Standard Time", "W. Central Africa Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
779 "WAT", "WAT"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
780 },
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. Europe Standard Time", "W. Europe Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
784 "CET", "CEST"
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 "West Asia Standard Time", "West Asia Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
788 "PKT", "PKST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
789 },
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 "West Pacific Standard Time", "West Pacific Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
792 "ChST", "ChST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
793 },
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 "Yakutsk Standard Time", "Yakutsk Daylight Time",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
796 "YAKT", "YAKST"
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
797 },
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 NULL, NULL,
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
800 NULL, NULL
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
801 }
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 const char *
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
805 wgaim_get_timezone_abbreviation(const struct tm *tm)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
806 {
13370
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
807 int i;
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
808 char tzname[128];
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
809 char localtzname[256];
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
810 HKEY rootKey;
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
811 int idx;
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
812
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
813 if (!tm)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
814 {
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
815 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
816 return "";
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
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
819 if (strftime(tzname, sizeof(tzname) - 1, "%Z", tm) == 0)
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
820 {
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
821 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
822 return "";
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
823 }
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
824
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
825 for (i = 0; win32_tzmap[i].wstd != NULL; i++)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
826 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
827 if (strcmp(tzname, win32_tzmap[i].wstd) == 0)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
828 {
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
829 #if 0
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
830 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
831 win32_tzmap[i].ustd, tzname);
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
832 #endif
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
833 /* Cache the Result */
13370
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
834 if (i > 0) {
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
835 if (win32_tzmap[0].wstd[0] != '\0')
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
836 g_free(win32_tzmap[0].wstd);
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
837 win32_tzmap[0].wstd = g_strdup(tzname);
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
838 win32_tzmap[0].ustd = win32_tzmap[i].ustd;
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
839 }
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
840
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
841 return win32_tzmap[i].ustd;
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
842 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
843 if (strcmp(tzname, win32_tzmap[i].wdst) == 0)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
844 {
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
845 #if 0
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
846 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
847 win32_tzmap[i].udst, tzname);
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
848 #endif
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
849 /* Cache the Result */
13370
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
850 if (i > 0) {
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
851 if (win32_tzmap[0].wdst[0] != '\0')
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
852 g_free(win32_tzmap[0].wdst);
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
853 win32_tzmap[0].wdst = g_strdup(tzname);
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
854 win32_tzmap[0].udst = win32_tzmap[i].udst;
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
855 }
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
856
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
857 return win32_tzmap[i].udst;
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
858 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
859 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
860
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
861 /*
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
862 * Localized Windows versions return localized names for the timezone.
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
863 * 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
864 * against our table again.
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 memset(localtzname, 0, sizeof(localtzname));
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
867 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
868 "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones",
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
869 0,
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
870 KEY_READ,
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
871 &rootKey) != ERROR_SUCCESS)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
872 {
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
873 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
874 return "";
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
875 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
876
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
877 for (idx = 0;; idx++)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
878 {
13370
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
879 char keyname[256];
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
880 char zonename[256];
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
881 DWORD namesize;
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
882 FILETIME lastwrite;
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
883 HKEY key;
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
884 LONG r;
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
885
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
886 memset(keyname, 0, sizeof(keyname));
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
887 namesize = sizeof(keyname);
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
888 if ((r = RegEnumKeyEx(rootKey,
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
889 idx,
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
890 keyname,
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
891 &namesize,
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
892 NULL,
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
893 NULL,
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
894 NULL,
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
895 &lastwrite)) != ERROR_SUCCESS)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
896 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
897 if (r == ERROR_NO_MORE_ITEMS)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
898 break;
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
899 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
900 break;
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
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
903 if ((r = RegOpenKeyEx(rootKey, keyname, 0, KEY_READ, &key)) != ERROR_SUCCESS)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
904 {
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
905 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
906 break;
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
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
909 memset(zonename, 0, sizeof(zonename));
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
910 namesize = sizeof(zonename);
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
911 if ((r = RegQueryValueEx(key, "Std", NULL, NULL, zonename, &namesize)) != ERROR_SUCCESS)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
912 {
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
913 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
914 RegCloseKey(key);
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
915 break;
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
916 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
917 if (strcmp(tzname, zonename) == 0)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
918 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
919 /* Matched zone */
13370
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
920 strcpy(localtzname, keyname);
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
921 RegCloseKey(key);
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
922 break;
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 memset(zonename, 0, sizeof(zonename));
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
925 namesize = sizeof(zonename);
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
926 if ((r = RegQueryValueEx(key, "Dlt", NULL, NULL, zonename, &namesize)) != ERROR_SUCCESS)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
927 {
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
928 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
929 RegCloseKey(key);
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
930 break;
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
931 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
932 if (strcmp(tzname, zonename) == 0)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
933 {
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
934 /* Matched DST zone */
13370
cf292e05a6cc [gaim-migrate @ 15743]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13362
diff changeset
935 strcpy(localtzname, keyname);
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
936 RegCloseKey(key);
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
937 break;
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
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
940 RegCloseKey(key);
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
941 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
942
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
943 RegCloseKey(rootKey);
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 if (localtzname[0])
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 /* Found a localized name, so scan for that one too */
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
948 for (i = 0; win32_tzmap[i].wstd != NULL; i++)
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 (strcmp(localtzname, win32_tzmap[i].wstd) == 0)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
951 {
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
952 #if 0
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
953 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
954 win32_tzmap[i].ustd, tzname, localtzname);
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
955 #endif
13338
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
956 /* Cache the Result */
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
957 if (win32_tzmap[0].wstd[0] != '\0')
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
958 g_free(win32_tzmap[0].wstd);
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
959 win32_tzmap[0].wstd = g_strdup(tzname);
13340
c6ab9c1cf28d [gaim-migrate @ 15710]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13338
diff changeset
960 win32_tzmap[0].ustd = win32_tzmap[i].ustd;
13338
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
961
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
962 return win32_tzmap[i].ustd;
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
963 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
964 if (strcmp(localtzname, win32_tzmap[i].wdst) == 0)
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
965 {
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
966 #if 0
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
967 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
968 win32_tzmap[i].udst, tzname, localtzname);
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
969 #endif
13338
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
970 /* Cache the Result */
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
971 if (win32_tzmap[0].wdst[0] != '\0')
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
972 g_free(win32_tzmap[0].wdst);
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
973
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
974 win32_tzmap[0].wdst = g_strdup(tzname);
13340
c6ab9c1cf28d [gaim-migrate @ 15710]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13338
diff changeset
975 win32_tzmap[0].udst = win32_tzmap[i].udst;
13338
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
976
13333
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
977 return win32_tzmap[i].udst;
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
978 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
979 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
980 }
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
981
13362
f33077f19b60 [gaim-migrate @ 15735]
Richard Laager <rlaager@wiktel.com>
parents: 13340
diff changeset
982 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
983 return "";
b04212d6b115 [gaim-migrate @ 15703]
Richard Laager <rlaager@wiktel.com>
parents: 13200
diff changeset
984 }
13338
0f708ed02902 [gaim-migrate @ 15708]
Richard Laager <rlaager@wiktel.com>
parents: 13333
diff changeset
985