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) {
12 const char *Pos = NULL;
13 StrBuf *Line = NewStrBuf();
17 sip = StrBufSipLine(Line, MsgText, &Pos);
19 if (!strncasecmp(ChrPtr(Line), HKEY("msgid|"))) {
20 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)));
26 else if (!strncasecmp(ChrPtr(Line), HKEY("attempted|"))) {
27 time_t attempted = atol(ChrPtr(Line)+10);
28 printf("Last delivery attempt: %s", asctime(localtime(&attempted)));
30 else if (!strncasecmp(ChrPtr(Line), HKEY("bounceto|"))) {
31 printf("Sender: %s\n", ChrPtr(Line)+9);
33 else if (!strncasecmp(ChrPtr(Line), HKEY("remote|"))) {
34 printf("Recipient: %s\n", ChrPtr(Line)+7);
43 int cmd_mailq(int server_socket, char *cmdbuf) {
51 sock_puts(server_socket, "GOTO __CitadelSMTPspoolout__");
52 sock_getln(server_socket, buf, sizeof buf);
54 printf("%s\n", &buf[4]);
58 sock_puts(server_socket, "MSGS ALL");
59 sock_getln(server_socket, buf, sizeof buf);
61 printf("%s\n", &buf[4]);
65 MsgText = NewStrBuf();
66 while (sock_getln(server_socket, buf, sizeof buf), strcmp(buf, "000")) {
70 msgs = malloc(num_alloc * sizeof(long));
72 else if (num_msgs >= num_alloc) {
74 msgs = realloc(msgs, num_alloc * sizeof(long));
77 msgs[num_msgs++] = atol(buf);
80 for (i=0; i<num_msgs; ++i) {
81 sock_printf(server_socket, "MSG2 %ld\n", msgs[i]);
82 sock_getln(server_socket, buf, sizeof buf);
85 while (sock_getln(server_socket, buf, sizeof buf), strcmp(buf, "000")) {
86 StrBufAppendPrintf(MsgText, "%s\n", buf);
88 if (bmstrcasestr((char *)ChrPtr(MsgText), "\nContent-type: application/x-citadel-delivery-list") != NULL) {
89 mailq_show_this_queue_entry(MsgText);