--- lmtp2nntp_msg.c 2002/07/02 07:49:01 1.29
+++ lmtp2nntp_msg.c 2003/01/30 13:30:41 1.30
@@ -562,128 +562,6 @@
return rc;
}
-static var_rc_t canonifydate(
- val_t *prival,
- const char *cpArg, size_t nArg,
- const char *cpVal, size_t nVal,
- char **cppOut, size_t *pnOut, size_t *pnOutsize)
-{
- /* RFC0822
- 5. DATE AND TIME SPECIFICATION
- 5.1. SYNTAX
-
- date-time = [ day "," ] date time ; "dd mm yy" or "hh:mm:ss zzz"
- day = "Mon" / "Tue" / "Wed" / "Thu" / "Fri" / "Sat" / "Sun"
- date = 1*2DIGIT month 2DIGIT ; day month year e.g. 20 Jun 82
- month = "Jan" / "Feb"/ "Mar" / "Apr"/ "May" / "Jun"/ "Jul" / "Aug"/ "Sep" / "Oct"/ "Nov" / "Dec"
- time = hour zone ; ANSI and Military
- hour = 2DIGIT ":" 2DIGIT [":" 2DIGIT] ; 00:00:00 - 23:59:59
- zone = "UT" / "GMT" ; Universal Time, North American : UT
- / "EST" / "EDT" ; Eastern: - 5/ - 4
- / "CST" / "CDT" ; Central: - 6/ - 5
- / "MST" / "MDT" ; Mountain: - 7/ - 6
- / "PST" / "PDT" ; Pacific: - 8/ - 7
- / 1ALPHA ; Military: Z = UT; A:-1; (J not used); M:-12; N:+1; Y:+12
- / ( ("+" / "-") 4DIGIT ) ; Local differential hours+min. (HHMM)
- */
- tai_rc_t rv;
- int i;
- int bOk;
- char *fmt[] = {
- "%a, %d %b %Y %H:%M:%S %z", /* RFC0822 but four digit year */
- "%a, %d %b %y %H:%M:%S %z", /* RFC0822 strict */
- "%a, %d %b %Y %H:%M %z", /* RFC0822 but four digit year */
- "%a, %d %b %y %H:%M %z", /* RFC0822 strict */
- "%d %b %Y %H:%M:%S %z", /* RFC0822 but four digit year */
- "%d %b %y %H:%M:%S %z", /* RFC0822 strict */
- "%d %b %Y %H:%M %z", /* RFC0822 but four digit year */
- "%d %b %y %H:%M %z", /* RFC0822 strict */
- "%a %b %d %H:%M:%S %Y", /* strange Mon Jan 27 12:34:56 2001 */
- NULL };
- tai_t *now;
- tai_t *pastrange;
- tai_t *futurerange;
- tai_t *value;
-
- tai_create(&now); /* FIXME ex */
- (void /*FIXME*/)tai_import(now, TAI_TYPE_UNIX);
-
- /* parse argument ([past][,[future]])
- () (,) infinite range in the past, infinite range in the future => canonify only
- (7), (7,) seven days in the past, infinite range in the future
- (,3) infinite range in the past, three days in the future
- (7,0) seven days in the past, no point in future allowed
- (0,3) no point in past allowed, three days in the future => useless
- (0,0) now
- */
- pastrange = NULL; /* infinite */
- futurerange = NULL; /* infinite */
- if (cpArg != NULL) {
- char *cpP, *cpF;
- cpP = strdupex(cpArg);
- cpF = strchr(cpP, ',');
- if (cpF == NULL)
- cpF = "";
- else
- *cpF++ = NUL;
- if (strlen(cpP) != 0) {
- tai_create(&pastrange); /* FIXME ex */
- (void /*FIXME*/)tai_import(pastrange , TAI_TYPE_SECONDS, 24*60*60*atoi(cpP));
- }
- if (strlen(cpF) != 0) {
- tai_create(&futurerange); /* FIXME ex */
- (void /*FIXME*/)tai_import(futurerange, TAI_TYPE_SECONDS, 24*60*60*atoi(cpF));
- }
- free(cpP);
- }
-
- /* FIXME printf("DEBUG: cpVal=\"%41s\", cpArg=\"%s\"\n", cpVal, cpArg); */
- if ((cpVal == NULL) || (strlen(cpVal) == 0)) {
- *cppOut = (char *)mallocex(DATELENMAX);
- *pnOutsize = DATELENMAX;
- (void /*FIXME*/)tai_format(now, *cppOut, DATELENMAX, "%a, %d %b %Y %H:%M:%S %z");
- *pnOut = strlen(*cppOut);
- }
- else {
- tai_create(&value); /* FIXME ex */
- bOk = FALSE;
- for (i = 0; !bOk && (fmt[i] != NULL); i++) {
- if ((rv = tai_parse(value, cpVal, strlen(cpVal), fmt[i])) == TAI_OK)
- bOk = TRUE;
- /* FIXME printf("DEBUG: checked against \"%41s\" returned %d\n", fmt[i], rv); */
- }
- if ( bOk
-#if 0
- tai_op is not yet implemented
- && ((pastrange != NULL) && (tai_op(value, TAI_OP_GT, pastrange ) == TAI_OK))
- && ((futurerange != NULL) && (tai_op(value, TAI_OP_LT, futurerange) == TAI_OK))
-#endif
- ) {
- *cppOut = (char *)mallocex(DATELENMAX);
- *pnOutsize = DATELENMAX;
- (void /*FIXME*/)tai_format(value, *cppOut, DATELENMAX, "%a, %d %b %Y %H:%M:%S %z");
- *pnOut = strlen(*cppOut);
- }
- else {
- *cppOut = "";
- *pnOutsize = 0;
- *pnOut = 0;
- }
- }
-
- /* cleanup */
- if(now != NULL)
- tai_destroy(now);
- if(pastrange != NULL)
- tai_destroy(pastrange);
- if(futurerange != NULL)
- tai_destroy(futurerange);
- if(value != NULL)
- tai_destroy(value);
-
- return VAR_OK;
-}
-
static var_rc_t createmessageid(
val_t *prival,
const char *cpArg, size_t nArg,
@@ -759,9 +637,6 @@
if (op_len == 15 && strncmp(op_ptr, "createmessageid", 15) == 0) {
return createmessageid(prival, arg_ptr, arg_len, val_ptr, val_len, out_ptr, out_len, out_size);
}
- else if (op_len == 12 && strncmp(op_ptr, "canonifydate", 12) == 0) {
- return canonifydate (prival, arg_ptr, arg_len, val_ptr, val_len, out_ptr, out_len, out_size);
- }
else
return VAR_ERR_UNDEFINED_OPERATION;
}
|