X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fsmtpqueue.c;h=f41e38fa88c32b0fa2fe9fffc78a1799474b7993;hb=79d7fb817e842cf507c77a2252da56019a2b0a13;hp=bebc601f8704ce9860320a0968b1bf37095ca8d0;hpb=e786ecbb883f833ecb17cf0a80dfe00da10cb3de;p=citadel.git
diff --git a/webcit/smtpqueue.c b/webcit/smtpqueue.c
index bebc601f8..f41e38fa8 100644
--- a/webcit/smtpqueue.c
+++ b/webcit/smtpqueue.c
@@ -14,6 +14,20 @@
void display_queue_msg(long msgnum)
{
char buf[1024];
+ char keyword[32];
+ int in_body = 0;
+ int is_delivery_list = 0;
+ time_t submitted = 0;
+ time_t attempted = 0;
+ time_t last_attempt = 0;
+ int number_of_attempts = 0;
+ char sender[256];
+ char recipients[65536];
+ char thisrecp[256];
+ char thisdsn[256];
+
+ strcpy(sender, "");
+ strcpy(recipients, "");
serv_printf("MSG2 %ld", msgnum);
serv_getln(buf, sizeof buf);
@@ -21,19 +35,96 @@ void display_queue_msg(long msgnum)
while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
- wprintf("
");
- wprintf(_("Message ID"));
- wprintf(" | ");
- wprintf(_("Date/time submitted"));
- wprintf(" | ");
- wprintf(_("Last attempt"));
- wprintf(" | ");
- wprintf(_("Sender"));
- wprintf(" | ");
- wprintf(_("Recipients"));
- wprintf(" |
\n");
+ if (strlen(buf) > 0) {
+ if (buf[strlen(buf)-1] == 13) {
+ buf[strlen(buf)-1] = 0;
+ }
+ }
+
+ if ( (strlen(buf) == 0) && (in_body == 0) ) {
+ in_body = 1;
+ }
+
+ if ( (!in_body)
+ && (!strncasecmp(buf, "Content-type: application/x-citadel-delivery-list", 49))
+ ) {
+ is_delivery_list = 1;
+ }
+
+ if ( (in_body) && (!is_delivery_list) ) {
+ while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
+ /* Not a delivery list; flush and return quietly. */
+ }
+ return;
+ }
+
+ if ( (in_body) && (is_delivery_list) ) {
+ extract_token(keyword, buf, 0, '|', sizeof keyword);
+
+ if (!strcasecmp(keyword, "submitted")) {
+ submitted = extract_long(buf, 1);
+ }
+
+ if (!strcasecmp(keyword, "attempted")) {
+ attempted = extract_long(buf, 1);
+ ++number_of_attempts;
+ if (attempted > last_attempt) {
+ last_attempt = attempted;
+ }
+ }
+ if (!strcasecmp(keyword, "bounceto")) {
+ extract_token(sender, buf, 1, '|', sizeof sender);
+ }
+
+ if (!strcasecmp(keyword, "remote")) {
+ extract_token(thisrecp, buf, 1, '|', sizeof thisrecp);
+ extract_token(thisdsn, buf, 3, '|', sizeof thisdsn);
+
+ if (strlen(recipients) + strlen(thisrecp) + strlen(thisdsn) + 100
+ < sizeof recipients) {
+ if (strlen(recipients) > 0) {
+ strcat(recipients, "
");
+ }
+ stresc(&recipients[strlen(recipients)], thisrecp, 1, 1);
+ strcat(recipients, "
");
+ stresc(&recipients[strlen(recipients)], thisdsn, 1, 1);
+ strcat(recipients, "");
+ }
+
+ }
+
+ }
+
+ }
+
+ wprintf("");
+ wprintf("%ld", msgnum);
+
+ wprintf(" | ");
+ if (submitted > 0) {
+ fmt_date(buf, submitted, 1);
+ wprintf("%s", buf);
+ }
+ else {
+ wprintf(" ");
+ }
+
+ wprintf(" | ");
+ if (last_attempt > 0) {
+ fmt_date(buf, last_attempt, 1);
+ wprintf("%s", buf);
}
+ else {
+ wprintf(" ");
+ }
+
+ wprintf(" | ");
+ escputs(sender);
+
+ wprintf(" | ");
+ wprintf("%s", recipients);
+ wprintf(" |
\n");
}
@@ -68,19 +159,21 @@ void display_smtpqueue(void)
num_msgs = load_msg_ptrs("MSGS ALL", 0);
if (num_msgs > 0) {
+ wprintf(""
+ );
- wprintf("\n");
- wprintf("");
+ wprintf(" |
");
wprintf(_("Message ID"));
- wprintf(" | ");
+ wprintf(" | ");
wprintf(_("Date/time submitted"));
- wprintf(" | ");
+ wprintf(" | ");
wprintf(_("Last attempt"));
- wprintf(" | ");
+ wprintf(" | ");
wprintf(_("Sender"));
- wprintf(" | ");
+ wprintf(" | ");
wprintf(_("Recipients"));
- wprintf(" |
\n");
+ wprintf("\n");
for (i=0; imsgarr[i]);