1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#include "config.h"
/*
*/
#include <string.h>
#include <time.h>
#include "sqwebmail.h"
#include <courier-unicode.h>
extern const char *sqwebmail_system_charset;
extern const char *sqwebmail_content_charset;
#if HAVE_LOCALE_H
#if HAVE_SETLOCALE
#if USE_LIBCHARSET || HAVE_LANGINFO_CODESET
size_t strftime_unicode(char *s, size_t max, const char *fmt,
const struct tm *tm)
{
char sbuf[128] = "\0";
char *buf;
if (sqwebmail_system_charset && *sqwebmail_system_charset
&& sqwebmail_content_charset && *sqwebmail_content_charset
&& strcasecmp(sqwebmail_system_charset, "ASCII"))
{
int err;
char *sfmt=unicode_convert_tobuf(fmt,
sqwebmail_content_charset,
sqwebmail_system_charset,
&err);
if (sfmt && err)
{
free(sfmt);
sfmt=0;
}
if (sfmt)
{
strftime(sbuf, sizeof(sbuf), sfmt, tm);
sbuf[sizeof(sbuf)-1] = 0;
free(sfmt);
buf=unicode_convert_tobuf(sbuf,
sqwebmail_system_charset,
sqwebmail_content_charset,
&err);
if (buf && err)
{
free(buf);
buf=0;
}
if (buf)
{
strncpy(s, buf, max);
free(buf);
}
else
{
strncpy(s, sbuf, max);
}
return strlen(s);
}
}
return strftime(s, max, fmt, tm);
}
#endif
#endif
#endif
|