X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fimap_fetch.c;h=a85eba79ffd28f3254379413d0a51bb46dcb4505;hb=cb16d095ee1f3f2a5e8022b7a4a7c4289eadd77c;hp=5b3c457ac58d8120aadb0ce2d9b0722767ac5396;hpb=f68b0f9d9eaca8300005eea0d6d13b241f35a36a;p=citadel.git diff --git a/citadel/imap_fetch.c b/citadel/imap_fetch.c index 5b3c457ac..a85eba79f 100644 --- a/citadel/imap_fetch.c +++ b/citadel/imap_fetch.c @@ -39,6 +39,7 @@ #include "serv_imap.h" #include "imap_tools.h" #include "imap_fetch.h" +#include "genstamp.h" @@ -52,6 +53,21 @@ void imap_fetch_uid(int seq) { cprintf("UID %ld", IMAP->msgids[seq-1]); } +void imap_fetch_internaldate(struct CtdlMessage *msg) { + char buf[256]; + time_t msgdate; + + if (msg->cm_fields['T'] != NULL) { + msgdate = atol(msg->cm_fields['T']); + } + else { + msgdate = time(NULL); + } + + datestring(buf, msgdate, DATESTRING_IMAP); + cprintf("INTERNALDATE \"%s\"", buf); +} + /* * imap_do_fetch() calls imap_do_fetch_msg() to output the deta of an @@ -81,7 +97,7 @@ void imap_do_fetch_msg(int seq, struct CtdlMessage *msg, /* FIXME do something here */ } else if (!strcasecmp(itemlist[i], "INTERNALDATE")) { - /* FIXME do something here */ + imap_fetch_internaldate(msg); } else if (!strcasecmp(itemlist[i], "RFC822")) { /* FIXME do something here */