sync with 0.8.11cvs33
authorPaul Mangan <paul@claws-mail.org>
Wed, 23 Apr 2003 07:55:01 +0000 (07:55 +0000)
committerPaul Mangan <paul@claws-mail.org>
Wed, 23 Apr 2003 07:55:01 +0000 (07:55 +0000)
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.ac
src/common/session.c
src/common/utils.c
src/procheader.c

index 17d82ee..fd9ac9a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2003-04-23
+
+       * src/procheader.c: procheader_date_parse(): removed debug print.
+       * src/session.c: changed every g_print to debug_print.
+         session_child_input(): removed unrequired session_close() (it'll
+         be closed anyway after returning FALSE).
+
+2003-04-23
+
+       * src/procheader.c: procheader_procheader_date_parse(): don't add
+         local timezone offset if timezone is unknown.
+         Made the Y2K workaround code to follow RFC 2822.
+         procheader_scan_date_string(): workaround for date strings which
+         don't have timezone specification.
+       * src/utils.c: remote_tzoffset_sec(): return -1 if timezone is
+         unknown.
+
 2003-04-22
 
        * src/action.[ch]: refactored. Also fixed a bug on MIME mode, and
index 1ebfb88..5fb8f2c 100644 (file)
@@ -1,3 +1,8 @@
+2003-04-23 [paul]      0.8.11claws108
+
+       * sync with 0.8.11cvs33
+               see ChangeLog 2003-04-23
+
 2003-04-22 [paul]      0.8.11claws107
 
        * src/Makefile.am
index 1f55bfa..81242ea 100644 (file)
@@ -1,3 +1,21 @@
+2003-04-23
+
+       * src/procheader.c: procheader_date_parse(): ¥Ç¥Ð¥Ã¥°ÍÑ print ¤òºï½ü¡£
+       * src/session.c: ³Æ g_print ¤ò debug_print ¤ËÊѹ¹¡£
+         session_child_input(): ÉÔÍפʠsession_close() ¤òºï½ü(FALSE ¤ò
+         ÊÖ¤·¤¿¸å·ë¶É close ¤µ¤ì¤ë)¡£
+
+2003-04-23
+
+       * src/procheader.c: procheader_procheader_date_parse(): ¥¿¥¤¥à¥¾¡¼¥ó
+         ¤¬ÉÔÌÀ¤Î¾ì¹ç¤Ï¥í¡¼¥«¥ë¥¿¥¤¥à¥¾¡¼¥ó¤Î¥ª¥Õ¥»¥Ã¥È¤òÄɲ䷤ʤ¤¤è¤¦¤Ë
+         ¤·¤¿¡£
+         Y2K Âбþ¥³¡¼¥É¤ò RFC 2822 ¤Ë½¾¤¦¤è¤¦¤Ë¤·¤¿¡£
+         procheader_scan_date_string(): ¥¿¥¤¥à¥¾¡¼¥ó»ØÄ꤬¤Ê¤¤ÆüÉÕʸ»úÎó
+         ¤Ø¤ÎÂн衣
+       * src/utils.c: remote_tzoffset_sec(): ¥¿¥¤¥à¥¾¡¼¥ó¤¬ÉÔÌÀ¤Î¾ì¹ç¤Ï
+         -1 ¤òÊÖ¤¹¤è¤¦¤Ë¤·¤¿¡£
+
 2003-04-22
 
        * src/action.[ch]: ¥ê¥Õ¥¡¥¯¥¿¥ê¥ó¥°¡£ ¤Þ¤¿ MIME ¥â¡¼¥É¤Ë¤ª¤±¤ë¥Ð¥°
index a046dcf..71147bb 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=11
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws107
+EXTRA_VERSION=claws108
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index daf677d..a640f4e 100644 (file)
@@ -139,7 +139,7 @@ gint session_connect(Session *session, const gchar *server, gushort port)
        close(pipe_fds1[1]);
        close(pipe_fds2[0]);
 
-       g_print("child: connecting to %s:%d ...\n", server, port);
+       debug_print("session: child: connecting to %s:%d ...\n", server, port);
 
        if ((sock = sock_connect(server, port)) == NULL) {
                session_send_msg(session, SESSION_MSG_ERROR,
@@ -157,7 +157,7 @@ gint session_connect(Session *session, const gchar *server, gushort port)
        }
 #endif
 
-       g_print("child: connected\n");
+       debug_print("session: child: connected\n");
 
        session->sock = sock;
        session->state = SESSION_RECV;
@@ -177,7 +177,7 @@ gint session_connect(Session *session, const gchar *server, gushort port)
 
        session_close(session);
 
-       g_print("child: disconnected\n");
+       debug_print("session: child: disconnected\n");
 
        _exit(0);
 }
@@ -191,7 +191,8 @@ gint session_connect(Session *session, const gchar *server, gushort port)
  */
 gint session_disconnect(Session *session)
 {
-       g_print("%s: session_disconnect()\n", session->child_pid == 0 ? "child" : "parent");
+       debug_print("session: %s: session_disconnect()\n",
+                   session->child_pid == 0 ? "child" : "parent");
        session_send_msg(session, SESSION_MSG_CONTROL, "DISCONNECT");
        return 0;
 }
@@ -206,7 +207,7 @@ void session_destroy(Session *session)
        g_return_if_fail(session != NULL);
        g_return_if_fail(session->destroy != NULL);
 
-       g_print("session_destroy()\n");
+       debug_print("session: session_destroy()\n");
        session_close(session);
        g_print("$$$ session_destroy() session->destroy called\n");
        session->destroy(session);
@@ -267,7 +268,8 @@ static gint session_close(Session *session)
 {
        g_return_val_if_fail(session != NULL, -1);
 
-       g_print("%s: session_close()\n", session->child_pid == 0 ? "child" : "parent");
+       debug_print("session: %s: session_close()\n",
+                   session->child_pid == 0 ? "child" : "parent");
 
        if (session->read_tag > 0) {
                g_source_remove(session->read_tag);
@@ -339,7 +341,6 @@ gint session_send_msg(Session *session, SessionMsgType type, const gchar *msg)
        }
 
        str = g_strdup_printf("%s %s\n", prefix, msg);
-       /* g_print("%s: sending message: %s", session->child_pid == 0 ? "child" : "parent", str); */
        size = strlen(str);
 
        while (size > 0) {
@@ -393,7 +394,9 @@ static gchar *session_recv_msg(Session *session)
                if (str[size - 2] == '\n') {
                        str[size - 2] = '\0';
 
-                       g_print("%s: received message: %s\n", session->child_pid == 0 ? "child" : "parent", str);
+                       debug_print("session: %s: received message: %s\n",
+                                   session->child_pid == 0 ?
+                                   "child" : "parent", str);
 
                        break;
                }
@@ -450,7 +453,9 @@ gint session_send_data(Session *session, const guchar *data, guint size)
                        return -1;
                }
                size -= bytes_written;
-               g_print("%s: sent %d bytes of data\n", session->child_pid == 0 ? "child" : "parent", bytes_written);
+               debug_print("session: %s: sent %d bytes of data\n",
+                           session->child_pid == 0 ? "child" : "parent",
+                           bytes_written);
        }
 
        return 0;
@@ -497,7 +502,9 @@ static guchar *session_read_data(Session *session, guint size)
                }
                size -= bytes_read;
                cur += bytes_read;
-               g_print("%s: received %d bytes of data\n", session->child_pid == 0 ? "child" : "parent", bytes_read);
+               debug_print("session: %s: received %d bytes of data\n",
+                           session->child_pid == 0 ? "child" : "parent",
+                           bytes_read);
        }
 
        return data;
@@ -584,7 +591,9 @@ static guchar *session_recv_data_from_sock(Session *session, guint size)
                        g_free(data);
                        return NULL;
                }
-               g_print("child: received %d bytes of data from sock\n", bytes_read);
+               debug_print("session: child: "
+                           "received %d bytes of data from sock\n",
+                           bytes_read);
                left -= bytes_read;
                cur += bytes_read;
                total_read_len += bytes_read;
@@ -834,7 +843,6 @@ gboolean session_child_input(Session *session)
        if ((msg = session_recv_msg(session)) == NULL) {
                session_send_msg(session, SESSION_MSG_ERROR,
                                 "receiving message failed.");
-               session_close(session);
                session->state = SESSION_ERROR;
                return FALSE;
        }
@@ -849,7 +857,6 @@ gboolean session_child_input(Session *session)
                if (!str) {
                        session_send_msg(session, SESSION_MSG_ERROR,
                                         "receiving message failed.");
-                       session_close(session);
                        session->state = SESSION_ERROR;
                        g_free(msg);
                        return FALSE;
@@ -866,7 +873,6 @@ gboolean session_child_input(Session *session)
                if (!send_data) {
                        session_send_msg(session, SESSION_MSG_ERROR,
                                         "sending data failed.");
-                       session_close(session);
                        session->state = SESSION_ERROR;
                        g_free(msg);
                        return FALSE;
@@ -875,7 +881,6 @@ gboolean session_child_input(Session *session)
                if (session_send_data_to_sock(session, send_data, size) < 0) {
                        session_send_msg(session, SESSION_MSG_ERROR,
                                         "sending data failed.");
-                       session_close(session);
                        session->state = SESSION_ERROR;
                        g_free(send_data);
                        g_free(msg);
@@ -898,13 +903,11 @@ gboolean session_child_input(Session *session)
                if (!recv_data) {
                        session_send_msg(session, SESSION_MSG_ERROR,
                                         "receiving data failed.");
-                       session_close(session);
                        session->state = SESSION_ERROR;
                        g_free(msg);
                        return FALSE;
                }
                if (session_send_data(session, recv_data, size) < 0) {
-                       session_close(session);
                        session->state = SESSION_ERROR;
                        g_free(recv_data);
                        g_free(msg);
@@ -920,7 +923,6 @@ gboolean session_child_input(Session *session)
                        if (!str) {
                                session_send_msg(session, SESSION_MSG_ERROR,
                                                 "receiving message failed.");
-                               session_close(session);
                                session->state = SESSION_ERROR;
                                g_free(msg);
                                return FALSE;
@@ -935,7 +937,6 @@ gboolean session_child_input(Session *session)
                                                         SSL_METHOD_TLSv1)) {
                                session_send_msg(session, SESSION_MSG_ERROR,
                                                 "can't start TLS session.");
-                               session_close(session);
                                session->state = SESSION_ERROR;
                                g_free(msg);
                                return FALSE;
@@ -955,7 +956,6 @@ gboolean session_child_input(Session *session)
                } else {
                        session_send_msg(session, SESSION_MSG_ERROR,
                                         "wrong control message.");
-                       session_close(session);
                        session->state = SESSION_ERROR;
                        g_free(msg);
                        return FALSE;
@@ -965,7 +965,6 @@ gboolean session_child_input(Session *session)
        default:
                session_send_msg(session, SESSION_MSG_ERROR,
                                 "error received from parent.");
-               session_close(session);
                session->state = SESSION_ERROR;
                g_free(msg);
                return FALSE;
index 8c851ba..284397c 100644 (file)
@@ -3105,11 +3105,16 @@ time_t remote_tzoffset_sec(const gchar *zone)
        } else if (!strncmp(zone, "UT" , 2) ||
                   !strncmp(zone, "GMT", 2)) {
                remoteoffset = 0;
-       } else if (strlen(zone3) == 3 &&
-                  (p = strstr(ustzstr, zone3)) != NULL &&
-                  (p - ustzstr) % 3 == 0) {
-               iustz = ((gint)(p - ustzstr) / 3 + 1) / 2 - 8;
-               remoteoffset = iustz * 3600;
+       } else if (strlen(zone3) == 3) {
+               for (p = ustzstr; *p != '\0'; p += 3) {
+                       if (!strncasecmp(p, zone3, 3)) {
+                               iustz = ((gint)(p - ustzstr) / 3 + 1) / 2 - 8;
+                               remoteoffset = iustz * 3600;
+                               break;
+                       }
+               }
+               if (*p == '\0')
+                       return -1;
        } else if (strlen(zone3) == 1) {
                switch (zone[0]) {
                case 'Z': remoteoffset =   0; break;
@@ -3140,7 +3145,8 @@ time_t remote_tzoffset_sec(const gchar *zone)
                default:  remoteoffset =   0; break;
                }
                remoteoffset = remoteoffset * 3600;
-       }
+       } else
+               return -1;
 
        return remoteoffset;
 }
index 39f9caf..d2a05cc 100644 (file)
@@ -758,6 +758,11 @@ static gint procheader_scan_date_string(const gchar *str,
                        day, month, year, hh, mm, ss, zone);
        if (result == 7) return 0;
 
+       *zone = '\0';
+       result = sscanf(str, "%10s %d %9s %d %2d:%2d:%2d",
+                       weekday, day, month, year, hh, mm, ss);
+       if (result == 7) return 0;
+
        *ss = 0;
        result = sscanf(str, "%10s %d %9s %d %2d:%2d %5s",
                        weekday, day, month, year, hh, mm, zone);
@@ -840,6 +845,7 @@ time_t procheader_date_parse(gchar *dest, const gchar *src, gint len)
        struct tm t;
        gchar *p;
        time_t timer;
+       time_t tz_offset;
 
        if (procheader_scan_date_string(src, weekday, &day, month, &year,
                                        &hh, &mm, &ss, zone) < 0) {
@@ -850,8 +856,8 @@ time_t procheader_date_parse(gchar *dest, const gchar *src, gint len)
        }
 
        /* Y2K compliant :) */
-       if (year < 100) {
-               if (year < 70)
+       if (year < 1000) {
+               if (year < 50)
                        year += 2000;
                else
                        year += 1900;
@@ -878,7 +884,9 @@ time_t procheader_date_parse(gchar *dest, const gchar *src, gint len)
        t.tm_isdst = -1;
 
        timer = mktime(&t);
-       timer += tzoffset_sec(&timer) - remote_tzoffset_sec(zone);
+       tz_offset = remote_tzoffset_sec(zone);
+       if (tz_offset != -1)
+               timer += tzoffset_sec(&timer) - tz_offset;
 
        if (dest)
                procheader_date_get_localtime(dest, len, timer);