5 * \defgroup SMTPqueue Display the outbound SMTP queue
6 * \ingroup CitadelConfig
12 * \brief display one message in the queue
14 void display_queue_msg(long msgnum)
19 int is_delivery_list = 0;
22 time_t last_attempt = 0;
23 int number_of_attempts = 0;
25 char recipients[65536];
30 strcpy(recipients, "");
32 serv_printf("MSG2 %ld", msgnum);
33 serv_getln(buf, sizeof buf);
34 if (buf[0] != '1') return;
36 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
38 if (strlen(buf) > 0) {
39 if (buf[strlen(buf)-1] == 13) {
40 buf[strlen(buf)-1] = 0;
44 if ( (strlen(buf) == 0) && (in_body == 0) ) {
49 && (!strncasecmp(buf, "Content-type: application/x-citadel-delivery-list", 49))
54 if ( (in_body) && (!is_delivery_list) ) {
55 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
56 /* Not a delivery list; flush and return quietly. */
61 if ( (in_body) && (is_delivery_list) ) {
62 extract_token(keyword, buf, 0, '|', sizeof keyword);
64 if (!strcasecmp(keyword, "submitted")) {
65 submitted = extract_long(buf, 1);
68 if (!strcasecmp(keyword, "attempted")) {
69 attempted = extract_long(buf, 1);
71 if (attempted > last_attempt) {
72 last_attempt = attempted;
76 if (!strcasecmp(keyword, "bounceto")) {
77 extract_token(sender, buf, 1, '|', sizeof sender);
80 if (!strcasecmp(keyword, "remote")) {
81 extract_token(thisrecp, buf, 1, '|', sizeof thisrecp);
82 extract_token(thisdsn, buf, 3, '|', sizeof thisdsn);
84 if (strlen(recipients) + strlen(thisrecp) + strlen(thisdsn) + 100
85 < sizeof recipients) {
86 if (strlen(recipients) > 0) {
87 strcat(recipients, "<br />");
89 stresc(&recipients[strlen(recipients)], thisrecp, 1, 1);
90 strcat(recipients, "<br /> <i>");
91 stresc(&recipients[strlen(recipients)], thisdsn, 1, 1);
92 strcat(recipients, "</i>");
102 wprintf("%ld", msgnum);
104 wprintf("</td><td>");
106 fmt_date(buf, submitted, 1);
113 wprintf("</td><td>");
114 if (last_attempt > 0) {
115 fmt_date(buf, last_attempt, 1);
122 wprintf("</td><td>");
125 wprintf("</td><td>");
126 wprintf("%s", recipients);
127 wprintf("</td></tr>\n");
133 * \brief display the outbound SMTP queue
135 void display_smtpqueue(void)
140 output_headers(1, 1, 2, 0, 0, 0);
141 wprintf("<div id=\"banner\">\n");
142 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>");
143 wprintf("<SPAN CLASS=\"titlebar\">");
144 wprintf(_("View the outbound SMTP queue"));
145 wprintf("</SPAN>\n");
146 wprintf("</TD></TR></TABLE>\n");
147 wprintf("</div>\n<div id=\"content\">\n");
149 wprintf("<div class=\"fix_scrollbar_bug\">"
150 "<table border=0 width=100%% bgcolor=\"#FFFFFF\">"
151 "<tr><td valign=top>\n");
154 /* Check to see if we can go to the __CitadelSMTPspoolout__ room.
155 * If not, we don't have access to the queue.
157 gotoroom("__CitadelSMTPspoolout__");
158 if (!strcasecmp(WC->wc_roomname, "__CitadelSMTPspoolout__")) {
160 num_msgs = load_msg_ptrs("MSGS ALL", 0);
162 wprintf("<table class=\"mailbox_summary\" rules=rows "
163 "cellpadding=2 style=\"width:100%%;-moz-user-select:none;\">"
166 wprintf("<tr><td><b><i>");
167 wprintf(_("Message ID"));
168 wprintf("</i></b></td><td><b><i>");
169 wprintf(_("Date/time submitted"));
170 wprintf("</i></b></td><td><b><i>");
171 wprintf(_("Last attempt"));
172 wprintf("</i></b></td><td><b><i>");
173 wprintf(_("Sender"));
174 wprintf("</i></b></td><td><b><i>");
175 wprintf(_("Recipients"));
176 wprintf("</i></b></td></tr>\n");
178 for (i=0; i<num_msgs; ++i) {
179 display_queue_msg(WC->msgarr[i]);
186 wprintf("<br /><br /><div align=\"center\">");
187 wprintf(_("The queue is empty."));
188 wprintf("</div><br /><br />");
192 wprintf("<br /><br /><div align=\"center\">");
193 wprintf(_("You do not have permission to view this resource."));
194 wprintf("</div><br /><br />");
197 wprintf("</td></tr></table></div>\n");