X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=ctdlsh%2Fmailq.c;h=921e96e2aed72ffc8018c55bb4481944a8c07d96;hb=HEAD;hp=d6ed794aaed771b614afa180c11e73dc36e47c2b;hpb=6a82444d499be104e019899b9bdc8a14ad0cbd0f;p=citadel.git diff --git a/ctdlsh/mailq.c b/ctdlsh/mailq.c index d6ed794aa..921e96e2a 100644 --- a/ctdlsh/mailq.c +++ b/ctdlsh/mailq.c @@ -8,39 +8,37 @@ #include "ctdlsh.h" -void mailq_show_this_queue_entry(StrBuf *MsgText) { - const char *Pos = NULL; +void mailq_show_this_queue_entry(StrBuf * MsgText) +{ + const char *Pos = NULL; StrBuf *Line = NewStrBuf(); int sip = 0; - do { + do { sip = StrBufSipLine(Line, MsgText, &Pos); if (!strncasecmp(ChrPtr(Line), HKEY("msgid|"))) { - printf("Message %ld:\n", atol(ChrPtr(Line)+6)); - } - else if (!strncasecmp(ChrPtr(Line), HKEY("submitted|"))) { - time_t submitted = atol(ChrPtr(Line)+10); + printf("Message %ld:\n", atol(ChrPtr(Line) + 6)); + } else if (!strncasecmp(ChrPtr(Line), HKEY("submitted|"))) { + time_t submitted = atol(ChrPtr(Line) + 10); printf("Originally submitted: %s", asctime(localtime(&submitted))); - } - else if (!strncasecmp(ChrPtr(Line), HKEY("attempted|"))) { - time_t attempted = atol(ChrPtr(Line)+10); + } else if (!strncasecmp(ChrPtr(Line), HKEY("attempted|"))) { + time_t attempted = atol(ChrPtr(Line) + 10); printf("Last delivery attempt: %s", asctime(localtime(&attempted))); + } else if (!strncasecmp(ChrPtr(Line), HKEY("bounceto|"))) { + printf("Sender: %s\n", ChrPtr(Line) + 9); + } else if (!strncasecmp(ChrPtr(Line), HKEY("remote|"))) { + printf("Recipient: %s\n", ChrPtr(Line) + 7); } - else if (!strncasecmp(ChrPtr(Line), HKEY("bounceto|"))) { - printf("Sender: %s\n", ChrPtr(Line)+9); - } - else if (!strncasecmp(ChrPtr(Line), HKEY("remote|"))) { - printf("Recipient: %s\n", ChrPtr(Line)+7); - } - } while(sip); + } while (sip); FreeStrBuf(&Line); printf("\n"); } -int cmd_mailq(int server_socket, char *cmdbuf) { +int cmd_mailq(int server_socket, char *cmdbuf) +{ char buf[1024]; long *msgs = NULL; int num_msgs = 0; @@ -48,28 +46,27 @@ int cmd_mailq(int server_socket, char *cmdbuf) { int i; StrBuf *MsgText; - sock_puts(server_socket, "GOTO __CitadelSMTPspoolout__"); - sock_getln(server_socket, buf, sizeof buf); + sock_puts(server_socket, "GOTO __CitadelSMTPspoolout__"); + sock_getln(server_socket, buf, sizeof buf); if (buf[0] != '2') { printf("%s\n", &buf[4]); - return(cmdret_error); + return (cmdret_error); } - sock_puts(server_socket, "MSGS ALL"); - sock_getln(server_socket, buf, sizeof buf); + sock_puts(server_socket, "MSGS ALL"); + sock_getln(server_socket, buf, sizeof buf); if (buf[0] != '1') { printf("%s\n", &buf[4]); - return(cmdret_error); + return (cmdret_error); } MsgText = NewStrBuf(); - while (sock_getln(server_socket, buf, sizeof buf), strcmp(buf, "000")) { + while (sock_getln(server_socket, buf, sizeof buf), strcmp(buf, "000")) { if (num_alloc == 0) { num_alloc = 100; msgs = malloc(num_alloc * sizeof(long)); - } - else if (num_msgs >= num_alloc) { + } else if (num_msgs >= num_alloc) { num_alloc *= 2; msgs = realloc(msgs, num_alloc * sizeof(long)); } @@ -77,15 +74,15 @@ int cmd_mailq(int server_socket, char *cmdbuf) { msgs[num_msgs++] = atol(buf); } - for (i=0; i