4 * Copyright (C) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
27 #include <sys/timeb.h>
33 #include "libc_internal.h"
34 #include <glib/gstdio.h>
36 /** This is redefined here because we can't include internal.h */
40 # define _(String) ((const char *)dgettext(PACKAGE, String))
42 # define N_(String) gettext_noop (String)
44 # define N_(String) (String)
48 # define N_(String) (String)
50 # define _(String) ((const char *)String)
52 # define ngettext(Singular, Plural, Number) ((Number == 1) ? ((const char *)Singular) : ((const char *)Plural))
53 # define dngettext(Domain, Singular, Plural, Number) ((Number == 1) ? ((const char *)Singular) : ((const char *)Plural))
57 # define S_ISDIR(m) (((m)&S_IFDIR)==S_IFDIR)
60 static char errbuf
[1024];
63 static int wpurple_is_socket( int fd
) {
65 int optlen
= sizeof(int);
67 if( (getsockopt(fd
, SOL_SOCKET
, SO_TYPE
, (void*)&optval
, &optlen
)) == SOCKET_ERROR
) {
68 int error
= WSAGetLastError();
69 if( error
== WSAENOTSOCK
)
72 purple_debug(PURPLE_DEBUG_WARNING
, "wpurple", "wpurple_is_socket: getsockopt returned error: %d\n", error
);
80 int wpurple_socket (int namespace, int style
, int protocol
) {
83 ret
= socket( namespace, style
, protocol
);
85 if( ret
== INVALID_SOCKET
) {
86 errno
= WSAGetLastError();
92 int wpurple_connect(int socket
, struct sockaddr
*addr
, u_long length
) {
95 ret
= connect( socket
, addr
, length
);
97 if( ret
== SOCKET_ERROR
) {
98 errno
= WSAGetLastError();
99 if( errno
== WSAEWOULDBLOCK
)
100 errno
= WSAEINPROGRESS
;
106 int wpurple_getsockopt(int socket
, int level
, int optname
, void *optval
, socklen_t
*optlenptr
) {
107 if(getsockopt(socket
, level
, optname
, optval
, optlenptr
) == SOCKET_ERROR
) {
108 errno
= WSAGetLastError();
114 int wpurple_setsockopt(int socket
, int level
, int optname
, const void *optval
, socklen_t optlen
) {
115 if(setsockopt(socket
, level
, optname
, optval
, optlen
) == SOCKET_ERROR
) {
116 errno
= WSAGetLastError();
122 int wpurple_getsockname(int socket
, struct sockaddr
*addr
, socklen_t
*lenptr
) {
123 if(getsockname(socket
, addr
, lenptr
) == SOCKET_ERROR
) {
124 errno
= WSAGetLastError();
130 int wpurple_bind(int socket
, struct sockaddr
*addr
, socklen_t length
) {
131 if(bind(socket
, addr
, length
) == SOCKET_ERROR
) {
132 errno
= WSAGetLastError();
138 int wpurple_listen(int socket
, unsigned int n
) {
139 if(listen(socket
, n
) == SOCKET_ERROR
) {
140 errno
= WSAGetLastError();
146 int wpurple_sendto(int socket
, const void *buf
, size_t len
, int flags
, const struct sockaddr
*to
, socklen_t tolen
) {
148 if ((ret
= sendto(socket
, buf
, len
, flags
, to
, tolen
)
150 errno
= WSAGetLastError();
151 if(errno
== WSAEWOULDBLOCK
|| errno
== WSAEINPROGRESS
)
159 /* This is not a full implementation of fcntl. Update as needed.. */
160 int wpurple_fcntl(int socket
, int command
, ...) {
172 va_start(args
, command
);
173 val
= va_arg(args
, int);
180 ret
= ioctlsocket(socket
, FIONBIO
, &imode
);
186 ret
= ioctlsocket(socket
, FIONBIO
, &imode
);
193 if( ret
== SOCKET_ERROR
) {
194 errno
= WSAGetLastError();
200 purple_debug(PURPLE_DEBUG_WARNING
, "wpurple", "wpurple_fcntl: Unsupported command\n");
206 int wpurple_ioctl(int fd
, int command
, void* val
) {
210 if (ioctlsocket(fd
, FIONBIO
, (unsigned long *)val
) == SOCKET_ERROR
) {
211 errno
= WSAGetLastError();
218 INTERFACE_INFO InterfaceList
[20];
219 unsigned long nBytesReturned
;
220 if (WSAIoctl(fd
, SIO_GET_INTERFACE_LIST
,
221 0, 0, &InterfaceList
,
222 sizeof(InterfaceList
), &nBytesReturned
,
223 0, 0) == SOCKET_ERROR
) {
224 errno
= WSAGetLastError();
228 struct ifconf
*ifc
= val
;
229 char *tmp
= ifc
->ifc_buf
;
231 nBytesReturned
/ sizeof(INTERFACE_INFO
);
232 for (i
= 0; i
< nNumInterfaces
; i
++) {
233 INTERFACE_INFO ii
= InterfaceList
[i
];
234 struct ifreq
*ifr
= (struct ifreq
*) tmp
;
235 struct sockaddr_in
*sa
= (struct sockaddr_in
*) &ifr
->ifr_addr
;
237 sa
->sin_family
= ii
.iiAddress
.AddressIn
.sin_family
;
238 sa
->sin_port
= ii
.iiAddress
.AddressIn
.sin_port
;
239 sa
->sin_addr
.s_addr
= ii
.iiAddress
.AddressIn
.sin_addr
.s_addr
;
240 tmp
+= sizeof(struct ifreq
);
242 /* Make sure that we can fit in the original buffer */
243 if (tmp
>= (ifc
->ifc_buf
+ ifc
->ifc_len
+ sizeof(struct ifreq
))) {
247 /* Replace the length with the actually used length */
248 ifc
->ifc_len
= ifc
->ifc_len
- (ifc
->ifc_buf
- tmp
);
259 int wpurple_inet_aton(const char *name
, struct in_addr
*addr
) {
260 if((addr
->s_addr
= inet_addr(name
)) == INADDR_NONE
)
266 /* Thanks to GNU wget for this inet_ntop() implementation */
268 wpurple_inet_ntop (int af
, const void *src
, char *dst
, socklen_t cnt
)
270 /* struct sockaddr can't accomodate struct sockaddr_in6. */
272 struct sockaddr_in6 sin6
;
273 struct sockaddr_in sin
;
278 ZeroMemory(&sa
, sizeof(sa
));
282 sa
.sin
.sin_family
= AF_INET
;
283 sa
.sin
.sin_addr
= *(struct in_addr
*) src
;
284 srcsize
= sizeof (sa
.sin
);
287 sa
.sin6
.sin6_family
= AF_INET6
;
288 sa
.sin6
.sin6_addr
= *(struct in6_addr
*) src
;
289 srcsize
= sizeof (sa
.sin6
);
295 if (WSAAddressToString ((struct sockaddr
*) &sa
, srcsize
, NULL
, dst
, &dstlen
) != 0)
297 errno
= WSAGetLastError();
300 return (const char *) dst
;
304 wpurple_inet_pton(int af
, const char *src
, void *dst
)
306 /* struct sockaddr can't accomodate struct sockaddr_in6. */
308 struct sockaddr_in6 sin6
;
309 struct sockaddr_in sin
;
316 sa
.sin
.sin_family
= AF_INET
;
317 srcsize
= sizeof (sa
.sin
);
320 sa
.sin6
.sin6_family
= AF_INET6
;
321 srcsize
= sizeof (sa
.sin6
);
324 errno
= WSAEPFNOSUPPORT
;
328 if (WSAStringToAddress(src
, af
, NULL
, (struct sockaddr
*) &sa
, &srcsize
) != 0)
330 errno
= WSAGetLastError();
337 memcpy(dst
, &sa
.sin
.sin_addr
, sizeof(sa
.sin
.sin_addr
));
340 memcpy(dst
, &sa
.sin6
.sin6_addr
, sizeof(sa
.sin6
.sin6_addr
));
349 struct hostent
* wpurple_gethostbyname(const char *name
) {
352 if((hp
= gethostbyname(name
)) == NULL
) {
353 errno
= WSAGetLastError();
360 char* wpurple_strerror(int errornum
) {
361 if (errornum
> WSABASEERR
) {
363 case WSAECONNABORTED
: /* 10053 */
364 g_snprintf(errbuf
, sizeof(errbuf
), "%s", _("Connection interrupted by other software on your computer."));
366 case WSAECONNRESET
: /* 10054 */
367 g_snprintf(errbuf
, sizeof(errbuf
), "%s", _("Remote host closed connection."));
369 case WSAETIMEDOUT
: /* 10060 */
370 g_snprintf(errbuf
, sizeof(errbuf
), "%s", _("Connection timed out."));
372 case WSAECONNREFUSED
: /* 10061 */
373 g_snprintf(errbuf
, sizeof(errbuf
), "%s", _("Connection refused."));
375 case WSAEADDRINUSE
: /* 10048 */
376 g_snprintf(errbuf
, sizeof(errbuf
), "%s", _("Address already in use."));
379 g_snprintf(errbuf
, sizeof(errbuf
), "Windows socket error #%d", errornum
);
382 const char *tmp
= g_strerror(errornum
);
383 g_snprintf(errbuf
, sizeof(errbuf
), "%s", tmp
);
391 * We need to figure out whether fd is a file or socket handle.
393 int wpurple_read(int fd
, void *buf
, unsigned int size
) {
398 g_return_val_if_reached(-1);
401 if(wpurple_is_socket(fd
)) {
402 if((ret
= recv(fd
, buf
, size
, 0)) == SOCKET_ERROR
) {
403 errno
= WSAGetLastError();
404 if(errno
== WSAEWOULDBLOCK
|| errno
== WSAEINPROGRESS
)
409 else if( ret
== 0 ) {
410 /* connection has been gracefully closed */
416 /* success reading socket */
420 /* fd is not a socket handle.. pass it off to read */
421 return _read(fd
, buf
, size
);
425 int wpurple_send(int fd
, const void *buf
, unsigned int size
, int flags
) {
428 ret
= send(fd
, buf
, size
, flags
);
430 if (ret
== SOCKET_ERROR
) {
431 errno
= WSAGetLastError();
432 if(errno
== WSAEWOULDBLOCK
|| errno
== WSAEINPROGRESS
)
439 int wpurple_write(int fd
, const void *buf
, unsigned int size
) {
443 g_return_val_if_reached(-1);
446 if(wpurple_is_socket(fd
))
447 return wpurple_send(fd
, buf
, size
, 0);
449 return _write(fd
, buf
, size
);
452 int wpurple_recv(int fd
, void *buf
, size_t len
, int flags
) {
455 if((ret
= recv(fd
, buf
, len
, flags
)) == SOCKET_ERROR
) {
456 errno
= WSAGetLastError();
457 if(errno
== WSAEWOULDBLOCK
|| errno
== WSAEINPROGRESS
)
465 int wpurple_close(int fd
) {
470 g_return_val_if_reached(-1);
473 if( wpurple_is_socket(fd
) ) {
474 if( (ret
= closesocket(fd
)) == SOCKET_ERROR
) {
475 errno
= WSAGetLastError();
485 int wpurple_gethostname(char *name
, size_t size
) {
486 if(gethostname(name
, size
) == SOCKET_ERROR
) {
487 errno
= WSAGetLastError();
495 int wpurple_gettimeofday(struct timeval
*p
, struct timezone
*z
) {
497 struct _timeb timebuffer
;
501 z
->tz_minuteswest
= _timezone
/60;
502 z
->tz_dsttime
= _daylight
;
507 p
->tv_sec
= timebuffer
.time
; /* seconds since 1-1-1970 */
508 p
->tv_usec
= timebuffer
.millitm
*1000; /* microseconds */
516 int wpurple_rename (const char *oldname
, const char *newname
) {
517 return g_rename(oldname
, newname
);
522 struct tm
* wpurple_localtime_r (const time_t *time
, struct tm
*resultp
) {
527 tmptm
= localtime(time
);
529 return memcpy(resultp
, tmptm
, sizeof(struct tm
));
535 * Used by purple_utf8_strftime() by way of purple_internal_strftime()
538 * Code derived from PostgreSQL src/timezone/pgtz.c:
539 * http://developer.postgresql.org/cvsweb.cgi/pgsql/src/timezone/pgtz.c
543 PostgreSQL Database Management System
544 (formerly known as Postgres, then as Postgres95)
546 Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
548 Portions Copyright (c) 1994, The Regents of the University of California
550 Permission to use, copy, modify, and distribute this software and its
551 documentation for any purpose, without fee, and without a written agreement
552 is hereby granted, provided that the above copyright notice and this
553 paragraph and the following two paragraphs appear in all copies.
555 IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
556 DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
557 LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
558 DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE
559 POSSIBILITY OF SUCH DAMAGE.
561 THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
562 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
563 AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
564 ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO
565 PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
570 char *wstd
; /* Windows name of standard timezone */
571 char *wdst
; /* Windows name of daylight timezone */
572 char *ustd
; /* Unix name of standard timezone */
573 char *udst
; /* Unix name of daylight timezone */
581 * This list was built from the contents of the registry at
582 * "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones"
583 * on Windows XP Professional SP1
586 "Afghanistan Standard Time", "Afghanistan Daylight Time",
590 "Alaskan Standard Time", "Alaskan Daylight Time",
594 "Arab Standard Time", "Arab Daylight Time",
598 "Arabian Standard Time", "Arabian Daylight Time",
602 "Arabic Standard Time", "Arabic Daylight Time",
606 "Atlantic Standard Time", "Atlantic Daylight Time",
610 "AUS Central Standard Time", "AUS Central Daylight Time",
614 "AUS Eastern Standard Time", "AUS Eastern Daylight Time",
618 "Azores Standard Time", "Azores Daylight Time",
622 "Canada Central Standard Time", "Canada Central Daylight Time",
626 "Cape Verde Standard Time", "Cape Verde Daylight Time",
630 "Caucasus Standard Time", "Caucasus Daylight Time",
634 "Cen. Australia Standard Time", "Cen. Australia Daylight Time",
638 "Central America Standard Time", "Central America Daylight Time",
642 "Central Asia Standard Time", "Central Asia Daylight Time",
646 "Central Europe Standard Time", "Central Europe Daylight Time",
650 "Central European Standard Time", "Central European Daylight Time",
654 "Central Pacific Standard Time", "Central Pacific Daylight Time",
658 "Central Standard Time", "Central Daylight Time",
662 "China Standard Time", "China Daylight Time",
666 "Dateline Standard Time", "Dateline Daylight Time",
670 "E. Africa Standard Time", "E. Africa Daylight Time",
674 "E. Australia Standard Time", "E. Australia Daylight Time",
678 "E. Europe Standard Time", "E. Europe Daylight Time",
682 "E. South America Standard Time", "E. South America Daylight Time",
686 "Eastern Standard Time", "Eastern Daylight Time",
690 "Egypt Standard Time", "Egypt Daylight Time",
694 "Ekaterinburg Standard Time", "Ekaterinburg Daylight Time",
698 "Fiji Standard Time", "Fiji Daylight Time",
702 "FLE Standard Time", "FLE Daylight Time",
706 "GMT Standard Time", "GMT Daylight Time",
710 "Greenland Standard Time", "Greenland Daylight Time",
714 "Greenwich Standard Time", "Greenwich Daylight Time",
718 "GTB Standard Time", "GTB Daylight Time",
722 "Hawaiian Standard Time", "Hawaiian Daylight Time",
726 "India Standard Time", "India Daylight Time",
730 "Iran Standard Time", "Iran Daylight Time",
734 "Jerusalem Standard Time", "Jerusalem Daylight Time",
738 "Korea Standard Time", "Korea Daylight Time",
742 "Mexico Standard Time", "Mexico Daylight Time",
746 "Mexico Standard Time", "Mexico Daylight Time",
750 "Mid-Atlantic Standard Time", "Mid-Atlantic Daylight Time",
754 "Mountain Standard Time", "Mountain Daylight Time",
758 "Myanmar Standard Time", "Myanmar Daylight Time",
762 "N. Central Asia Standard Time", "N. Central Asia Daylight Time",
766 "Nepal Standard Time", "Nepal Daylight Time",
770 "New Zealand Standard Time", "New Zealand Daylight Time",
774 "Newfoundland Standard Time", "Newfoundland Daylight Time",
778 "North Asia East Standard Time", "North Asia East Daylight Time",
782 "North Asia Standard Time", "North Asia Daylight Time",
786 "Pacific SA Standard Time", "Pacific SA Daylight Time",
790 "Pacific Standard Time", "Pacific Daylight Time",
794 "Romance Standard Time", "Romance Daylight Time",
798 "Russian Standard Time", "Russian Daylight Time",
802 "SA Eastern Standard Time", "SA Eastern Daylight Time",
806 "SA Pacific Standard Time", "SA Pacific Daylight Time",
810 "SA Western Standard Time", "SA Western Daylight Time",
814 "Samoa Standard Time", "Samoa Daylight Time",
818 "SE Asia Standard Time", "SE Asia Daylight Time",
822 "Malay Peninsula Standard Time", "Malay Peninsula Daylight Time",
826 "South Africa Standard Time", "South Africa Daylight Time",
830 "Sri Lanka Standard Time", "Sri Lanka Daylight Time",
834 "Taipei Standard Time", "Taipei Daylight Time",
838 "Tasmania Standard Time", "Tasmania Daylight Time",
842 "Tokyo Standard Time", "Tokyo Daylight Time",
846 "Tonga Standard Time", "Tonga Daylight Time",
850 "US Eastern Standard Time", "US Eastern Daylight Time",
854 "US Mountain Standard Time", "US Mountain Daylight Time",
858 "Vladivostok Standard Time", "Vladivostok Daylight Time",
862 "W. Australia Standard Time", "W. Australia Daylight Time",
866 /* Not mapped in PostgreSQL.
868 * I mapped this based on the following information... -- rlaager
869 * $ cd /usr/share/zoneinfo/Africa
870 * $ for i in * ; do echo `TZ=Africa/$i date +"%z %Z"` $i ; done | grep +0100
873 * +0100 WAT Brazzaville
878 * +0100 WAT Libreville
883 * +0100 WAT Porto-Novo
887 "W. Central Africa Standard Time", "W. Central Africa Daylight Time",
892 "W. Europe Standard Time", "W. Europe Daylight Time",
896 "West Asia Standard Time", "West Asia Daylight Time",
900 "West Pacific Standard Time", "West Pacific Daylight Time",
904 "Yakutsk Standard Time", "Yakutsk Daylight Time",
914 wpurple_get_timezone_abbreviation(const struct tm
*tm
)
918 char localtzname
[256];
924 purple_debug_warning("wpurple", "could not determine current date/time: localtime failed\n");
928 if (strftime(tzname
, sizeof(tzname
) - 1, "%Z", tm
) == 0)
930 purple_debug_error("wpurple", "timezone name is too long for the buffer\n");
934 for (i
= 0; win32_tzmap
[i
].wstd
!= NULL
; i
++)
936 if (strcmp(tzname
, win32_tzmap
[i
].wstd
) == 0)
939 purple_debug_info("wpurple", "TZ \"%s\" matches Windows timezone \"%s\"\n",
940 win32_tzmap
[i
].ustd
, tzname
);
942 /* Cache the Result */
944 if (win32_tzmap
[0].wstd
[0] != '\0')
945 g_free(win32_tzmap
[0].wstd
);
946 win32_tzmap
[0].wstd
= g_strdup(tzname
);
947 win32_tzmap
[0].ustd
= win32_tzmap
[i
].ustd
;
950 return win32_tzmap
[i
].ustd
;
952 if (strcmp(tzname
, win32_tzmap
[i
].wdst
) == 0)
955 purple_debug_info("wpurple", "TZ \"%s\" matches Windows timezone \"%s\"\n",
956 win32_tzmap
[i
].udst
, tzname
);
958 /* Cache the Result */
960 if (win32_tzmap
[0].wdst
[0] != '\0')
961 g_free(win32_tzmap
[0].wdst
);
962 win32_tzmap
[0].wdst
= g_strdup(tzname
);
963 win32_tzmap
[0].udst
= win32_tzmap
[i
].udst
;
966 return win32_tzmap
[i
].udst
;
971 * Localized Windows versions return localized names for the timezone.
972 * Scan the registry to find the English name, and then try matching
973 * against our table again.
975 memset(localtzname
, 0, sizeof(localtzname
));
976 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
977 "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones",
980 &rootKey
) != ERROR_SUCCESS
)
982 purple_debug_warning("wpurple", "could not open registry key to identify Windows timezone: %i\n", (int) GetLastError());
986 for (idx
= 0;; idx
++)
995 memset(keyname
, 0, sizeof(keyname
));
996 namesize
= sizeof(keyname
);
997 if ((r
= RegEnumKeyEx(rootKey
,
1004 &lastwrite
)) != ERROR_SUCCESS
)
1006 if (r
== ERROR_NO_MORE_ITEMS
)
1008 purple_debug_warning("wpurple", "could not enumerate registry subkeys to identify Windows timezone: %i\n", (int) r
);
1012 if ((r
= RegOpenKeyEx(rootKey
, keyname
, 0, KEY_READ
, &key
)) != ERROR_SUCCESS
)
1014 purple_debug_warning("wpurple", "could not open registry subkey to identify Windows timezone: %i\n", (int) r
);
1018 memset(zonename
, 0, sizeof(zonename
));
1019 namesize
= sizeof(zonename
);
1020 if ((r
= RegQueryValueEx(key
, "Std", NULL
, NULL
, (LPBYTE
)zonename
, &namesize
)) != ERROR_SUCCESS
)
1022 purple_debug_warning("wpurple", "could not query value for 'std' to identify Windows timezone: %i\n", (int) r
);
1026 if (strcmp(tzname
, zonename
) == 0)
1029 g_strlcpy(localtzname
, keyname
, sizeof(localtzname
));
1033 memset(zonename
, 0, sizeof(zonename
));
1034 namesize
= sizeof(zonename
);
1035 if ((r
= RegQueryValueEx(key
, "Dlt", NULL
, NULL
, (LPBYTE
)zonename
, &namesize
)) != ERROR_SUCCESS
)
1037 purple_debug_warning("wpurple", "could not query value for 'dlt' to identify Windows timezone: %i\n", (int) r
);
1041 if (strcmp(tzname
, zonename
) == 0)
1043 /* Matched DST zone */
1044 g_strlcpy(localtzname
, keyname
, sizeof(localtzname
));
1052 RegCloseKey(rootKey
);
1056 /* Found a localized name, so scan for that one too */
1057 for (i
= 0; win32_tzmap
[i
].wstd
!= NULL
; i
++)
1059 if (strcmp(localtzname
, win32_tzmap
[i
].wstd
) == 0)
1062 purple_debug_info("wpurple", "TZ \"%s\" matches localized Windows timezone \"%s\" (\"%s\")\n",
1063 win32_tzmap
[i
].ustd
, tzname
, localtzname
);
1065 /* Cache the Result */
1066 if (win32_tzmap
[0].wstd
[0] != '\0')
1067 g_free(win32_tzmap
[0].wstd
);
1068 win32_tzmap
[0].wstd
= g_strdup(tzname
);
1069 win32_tzmap
[0].ustd
= win32_tzmap
[i
].ustd
;
1071 return win32_tzmap
[i
].ustd
;
1073 if (strcmp(localtzname
, win32_tzmap
[i
].wdst
) == 0)
1076 purple_debug_info("wpurple", "TZ \"%s\" matches localized Windows timezone \"%s\" (\"%s\")\n",
1077 win32_tzmap
[i
].udst
, tzname
, localtzname
);
1079 /* Cache the Result */
1080 if (win32_tzmap
[0].wdst
[0] != '\0')
1081 g_free(win32_tzmap
[0].wdst
);
1083 win32_tzmap
[0].wdst
= g_strdup(tzname
);
1084 win32_tzmap
[0].udst
= win32_tzmap
[i
].udst
;
1086 return win32_tzmap
[i
].udst
;
1091 purple_debug_warning("wpurple", "could not find a match for Windows timezone \"%s\"\n", tzname
);
1095 int wpurple_g_access (const gchar
*filename
, int mode
);
1097 * @deprecated - remove for 3.0.0
1100 wpurple_g_access (const gchar
*filename
, int mode
)
1102 return g_access(filename
, mode
);