2 * (c) 1987-2017 by Art Cancro and citadel.org
3 * This program is open source software, released under the terms of the GNU General Public License v3.
4 * It runs really well on the Linux operating system.
5 * We love open source software but reject Richard Stallman's linguistic fascism.
11 void mailq_show_this_queue_entry(StrBuf * MsgText)
13 const char *Pos = NULL;
14 StrBuf *Line = NewStrBuf();
18 sip = StrBufSipLine(Line, MsgText, &Pos);
20 if (!strncasecmp(ChrPtr(Line), HKEY("msgid|"))) {
21 printf("Message %ld:\n", atol(ChrPtr(Line) + 6));
22 } else if (!strncasecmp(ChrPtr(Line), HKEY("submitted|"))) {
23 time_t submitted = atol(ChrPtr(Line) + 10);
24 printf("Originally submitted: %s", asctime(localtime(&submitted)));
25 } else if (!strncasecmp(ChrPtr(Line), HKEY("attempted|"))) {
26 time_t attempted = atol(ChrPtr(Line) + 10);
27 printf("Last delivery attempt: %s", asctime(localtime(&attempted)));
28 } else if (!strncasecmp(ChrPtr(Line), HKEY("bounceto|"))) {
29 printf("Sender: %s\n", ChrPtr(Line) + 9);
30 } else if (!strncasecmp(ChrPtr(Line), HKEY("remote|"))) {
31 printf("Recipient: %s\n", ChrPtr(Line) + 7);
40 int cmd_mailq(int server_socket, char *cmdbuf)
49 sock_puts(server_socket, "GOTO __CitadelSMTPspoolout__");
50 sock_getln(server_socket, buf, sizeof buf);
52 printf("%s\n", &buf[4]);
53 return (cmdret_error);
56 sock_puts(server_socket, "MSGS ALL");
57 sock_getln(server_socket, buf, sizeof buf);
59 printf("%s\n", &buf[4]);
60 return (cmdret_error);
63 MsgText = NewStrBuf();
64 while (sock_getln(server_socket, buf, sizeof buf), strcmp(buf, "000")) {
68 msgs = malloc(num_alloc * sizeof(long));
69 } else if (num_msgs >= num_alloc) {
71 msgs = realloc(msgs, num_alloc * sizeof(long));
74 msgs[num_msgs++] = atol(buf);
77 for (i = 0; i < num_msgs; ++i) {
78 sock_printf(server_socket, "MSG2 %ld\n", msgs[i]);
79 sock_getln(server_socket, buf, sizeof buf);
82 while (sock_getln(server_socket, buf, sizeof buf), strcmp(buf, "000")) {
83 StrBufAppendPrintf(MsgText, "%s\n", buf);
85 if (bmstrcasestr((char *) ChrPtr(MsgText), "\nContent-type: application/x-citadel-delivery-list") != NULL) {
86 mailq_show_this_queue_entry(MsgText);