--- lmtp2nntp.c 2001/08/13 06:41:41 1.14
+++ lmtp2nntp.c 2001/08/13 15:16:32 1.15
@@ -640,6 +640,7 @@
char errorstring[STDSTRLEN];
char *rcpt;
int i;
+ int bSuccess;
if (argz_count(ctx->msg->azRcpt, ctx->msg->asRcpt) == 0) {
res.statuscode = "503";
@@ -738,18 +739,27 @@
}
}
- for (i=0; i < ctx->nsc; i++) {
+ bSuccess = FALSE;
+ for (i = 0; i < ctx->nsc; i++) {
fprintf(stderr, "DEBUG: trying service %s\n", ctx->ns[i].h);
- (void)nntp_post(ctx->ns[i].nntp, ctx->msg);
+ if (nntp_post(ctx->ns[i].nntp, ctx->msg) == NNTP_OK)
+ bSuccess = TRUE;
}
rcpt = NULL;
while ((rcpt = argz_next(ctx->msg->azRcpt, ctx->msg->asRcpt, rcpt)) != NULL) {
- res.statuscode = "250";
- res.dsncode = "2.0.0";
- str_format(errorstring, sizeof(errorstring), "Message accepted for delivery to %s", rcpt);
- res.statusmsg = errorstring;
- lmtp_response(lmtp, &res);
+ if (bSuccess == TRUE) {
+ res.statuscode = "250";
+ res.dsncode = "2.0.0";
+ str_format(errorstring, sizeof(errorstring), "Message accepted for delivery to %s", rcpt);
+ res.statusmsg = errorstring;
+ lmtp_response(lmtp, &res);
+ } else {
+ res.statuscode = "500";
+ res.dsncode = "5.0.0";
+ res.statusmsg = "Error posting message."; //FIXME call nntp_error()?
+ lmtp_response(lmtp, &res);
+ }
}
msg_destroy(ctx->msg);
|