--- lmtp2nntp_msg.c 2002/02/26 15:56:08 1.3
+++ lmtp2nntp_msg.c 2002/03/13 14:41:13 1.4
@@ -29,6 +29,7 @@
#include "lmtp2nntp_msg.h"
#include "lmtp2nntp_argz.h"
+#include "fixme.h" //FIMXE logbook only
#include "str.h"
@@ -136,14 +137,14 @@
* header information.
*/
- log0(msg, DEBUG, "split message into header and body");
+ logbook(msg->l2, L2_LEVEL_DEBUG, "split message into header and body");
if (str_parse(msg->cpMsg, "m/((?:.*?)\\n)\\n(.*)$/s", &cpHeaders, &msg->cpBody) <= 0)
return MSG_ERR_SPLITHEADBODY;
free(msg->cpMsg);
msg->cpMsg = NULL;
- log0(msg, DEBUG, "replace envelope From w/o colon by X-F: pseudotag");
+ logbook(msg->l2, L2_LEVEL_DEBUG, "replace envelope From w/o colon by X-F: pseudotag");
/* This eliminates the special case of having one header, which is really
* an embedded envelope, not ending with a colon while all others do.
* After splitting headers into name and value pairs this envelope ist
@@ -152,14 +153,14 @@
if (strncasecmp(cpHeaders, "From", 4) == 0)
memcpy(cpHeaders, "X-F:", 4);
- log0(msg, DEBUG, "unwrap header lines");
+ logbook(msg->l2, L2_LEVEL_DEBUG, "unwrap header lines");
/* poor man's s///g simulator as current str library doesn't support global substitution */
while (str_parse(cpHeaders, "s/(.*?)\\n[ \\t]+(.*)/$1 $2/s", &cpRem) > 0) {
free(cpHeaders);
cpHeaders = cpRem;
}
- log0(msg, DEBUG, "split header lines into names and values");
+ logbook(msg->l2, L2_LEVEL_DEBUG, "split header lines into names and values");
while (str_parse(cpHeaders, "m/^[> \\t]*([\\x21-\\x7e]+?:)[ \\t]*([^\\n]*?)[ \\t]*\\n(.*)/s", &cpName, &cpValue, &cpRem) > 0) {
free(cpHeaders);
cpHeaders = cpRem;
@@ -169,13 +170,13 @@
free(cpValue);
}
- log0(msg, DEBUG, "check for headers we care about and do whatever neccessary");
+ logbook(msg->l2, L2_LEVEL_DEBUG, "check for headers we care about and do whatever neccessary");
msg->cpMsgid = NULL;
msg->azNewsgroups = NULL;
msg->asNewsgroups = 0;
cp = msg->azHeaders;
while (cp != NULL) {
- log1(msg, DEBUG, "processing header \"%s\"", cp);
+ logbook(msg->l2, L2_LEVEL_DEBUG, "processing header \"%s\"", cp);
if (strcasecmp("X-F:", cp) == 0) {
argz_delete(&msg->azHeaders, &msg->asHeaders, cp); /* del name */
argz_delete(&msg->azHeaders, &msg->asHeaders, cp); /* del value */
@@ -190,7 +191,7 @@
argz_delete(&msg->azHeaders, &msg->asHeaders, cp); /* del name */
if ((msg->cpFid == NULL) &&
(str_parse(cp, "m/\\sid\\s+<?([\\w\\d]{1,30})/i", &msg->cpFid) > 0))
- log1(msg, DEBUG, "found foreign-ID \"%s\" for logging", msg->cpFid);
+ logbook(msg->l2, L2_LEVEL_DEBUG, "found foreign-ID \"%s\" for logging", msg->cpFid);
argz_delete(&msg->azHeaders, &msg->asHeaders, cp); /* del value */
continue;
}
@@ -228,22 +229,22 @@
break;
}
- log0(msg, DEBUG, "checking Message-ID");
+ logbook(msg->l2, L2_LEVEL_DEBUG, "checking Message-ID");
if (msg->cpMsgid == NULL)
return MSG_ERR_SPLITIDNONE;
- log0(msg, DEBUG, "checking Newsgroups");
+ logbook(msg->l2, L2_LEVEL_DEBUG, "checking Newsgroups");
if (msg->azNewsgroups != NULL) {
argz_stringify(msg->azNewsgroups, msg->asNewsgroups, ',');
if (argz_create_sep(msg->azNewsgroups, ',', &msg->azNewsgroups, &msg->asNewsgroups) != 0)
return MSG_ERR_MEM;
}
- log0(msg, DEBUG, "adding mandatory Path: header");
+ logbook(msg->l2, L2_LEVEL_DEBUG, "adding mandatory Path: header");
argz_add(&msg->azHeaders, &msg->asHeaders, "Path:");
argz_add(&msg->azHeaders, &msg->asHeaders, "lmtp2nntp!not-for-mail");
- log0(msg, DEBUG, "split complete");
+ logbook(msg->l2, L2_LEVEL_DEBUG, "split complete");
return MSG_OK;
}
@@ -263,7 +264,7 @@
char *azNewheaders;
size_t asNewheaders;
- log0(msg, DEBUG, "verify Newsgroups");
+ logbook(msg->l2, L2_LEVEL_DEBUG, "verify Newsgroups");
if (msg->azNewsgroups == NULL)
return MSG_ERR_JOINGROUPNONE;
argz_stringify(msg->azNewsgroups, msg->asNewsgroups, ',');
@@ -272,7 +273,7 @@
argz_add(&msg->azHeaders, &msg->asHeaders, "Newsgroups:");
argz_add(&msg->azHeaders, &msg->asHeaders, msg->azNewsgroups);
- log0(msg, DEBUG, "verify Message-ID");
+ logbook(msg->l2, L2_LEVEL_DEBUG, "verify Message-ID");
if (msg->cpMsgid == NULL)
return MSG_ERR_JOINIDNONE;
if (strlen(msg->cpMsgid) == 0)
@@ -280,7 +281,7 @@
argz_add(&msg->azHeaders, &msg->asHeaders, "Message-ID:");
argz_add(&msg->azHeaders, &msg->asHeaders, msg->cpMsgid);
- log0(msg, DEBUG, "merge name/value pairs into single string");
+ logbook(msg->l2, L2_LEVEL_DEBUG, "merge name/value pairs into single string");
argz_add(&msg->azHeaders, &msg->asHeaders, ""); /* append empty string */
if ((aHeaders = (char **)malloc((argz_count(msg->azHeaders, msg->asHeaders) + 1) * sizeof(char *))) == NULL)
return MSG_ERR_MEM;
@@ -298,7 +299,7 @@
}
free(aHeaders);
- log0(msg, DEBUG, "fold headers");
+ logbook(msg->l2, L2_LEVEL_DEBUG, "fold headers");
/* A logical line is split into one or more physical '\n'-terminated
* lines. The physical line is never longer than WRAPAT characters. This
* includes the folded data and the header name + colon + space for the
@@ -348,19 +349,19 @@
strcat(cpWrap, cpRem);
}
argz_add(&azNewheaders, &asNewheaders, cpWrap);
- log2(msg, DEBUG, "a folded header \"%{text}D\"", cpWrap, strlen(cpWrap));
+ logbook(msg->l2, L2_LEVEL_DEBUG, "a folded header \"%{text}D\"", cpWrap, strlen(cpWrap));
free(cpWrap);
}
else {
argz_add(&azNewheaders, &asNewheaders, cp);
- log2(msg, DEBUG, "verbatim header \"%{text}D\"", cp, strlen(cp));
+ logbook(msg->l2, L2_LEVEL_DEBUG, "verbatim header \"%{text}D\"", cp, strlen(cp));
}
}
free(msg->azHeaders);
msg->azHeaders = azNewheaders;
msg->asHeaders = asNewheaders;
- log0(msg, DEBUG, "strigify headers");
+ logbook(msg->l2, L2_LEVEL_DEBUG, "strigify headers");
argz_stringify(msg->azHeaders, msg->asHeaders, '\n');
cpHeaders = msg->azHeaders;
@@ -368,7 +369,7 @@
* header + CRLF + body + '.' + CRLF + NUL, replacing NL with CRLF *
********************************************************************/
- log0(msg, DEBUG, "assemble header and body");
+ logbook(msg->l2, L2_LEVEL_DEBUG, "assemble header and body");
n = 0;
/* count size of headers, reserve space for NL to CRLF conversion */
for (i = 0; ((c = cpHeaders[i]) != NUL); i++) {
@@ -436,7 +437,7 @@
msg->cpMsg[n++] = '\n';
msg->cpMsg[n] = NUL;
- log0(msg, DEBUG, "join complete");
+ logbook(msg->l2, L2_LEVEL_DEBUG, "join complete");
return MSG_OK;
}
|