RSS parser can now handle datestamps in RFC822 format
authorArt Cancro <ajc@citadel.org>
Thu, 13 Dec 2007 03:52:19 +0000 (03:52 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 13 Dec 2007 03:52:19 +0000 (03:52 +0000)
citadel/modules/rssclient/serv_rssclient.c

index e27f888d41a53153b5707bc6ac581a4cfe6eeff2..b3ff2b7a4fcde65f5db7800a3c4ad498b25afa25 100644 (file)
@@ -35,6 +35,7 @@
 #include "ctdl_module.h"
 #include "clientsocket.h"
 #include "msgbase.h"
+#include "parsedate.h"
 #include "database.h"
 #include "citadel_dirs.h"
 #include "md5.h"
@@ -179,6 +180,7 @@ void rss_save_item(struct rss_item *ri) {
 time_t rdf_parsedate(char *p)
 {
        struct tm tm;
+       time_t t = 0;
 
        if (!p) return 0L;
        if (strlen(p) < 10) return 0L;
@@ -195,13 +197,16 @@ time_t rdf_parsedate(char *p)
                        tm.tm_hour = atoi(&p[11]);
                        tm.tm_min = atoi(&p[14]);
                }
+               return mktime(&tm);
        }
 
-       else {
-               /* FIXME try an imap timestamp conversion */
-       }
+       /* hmm... try RFC822 date stamp format */
+
+       t = parsedate(p);
+       if (t > 0) return(t);
 
-       return mktime(&tm);
+       /* yeesh.  ok, just return the current date and time. */
+       return(time(NULL));
 }