Began work on a 'View outbound SMTP queue' screen
[citadel.git] / webcit / smtpqueue.c
1 /* 
2  * $Id: $
3  */
4 /**
5  * \defgroup SMTPqueue Display the outbound SMTP queue
6  * \ingroup CitadelConfig
7  */
8 /*@{*/
9 #include "webcit.h"
10
11 /**
12  * \brief display one message in the queue
13  */
14 void display_queue_msg(long msgnum)
15 {
16         char buf[1024];
17
18         serv_printf("MSG2 %ld", msgnum);
19         serv_getln(buf, sizeof buf);
20         if (buf[0] != '1') return;
21
22         while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
23
24                         wprintf("<tr><td>");
25                         wprintf(_("Message ID"));
26                         wprintf("</td><td>");
27                         wprintf(_("Date/time submitted"));
28                         wprintf("</td><td>");
29                         wprintf(_("Last attempt"));
30                         wprintf("</td><td>");
31                         wprintf(_("Sender"));
32                         wprintf("</td><td>");
33                         wprintf(_("Recipients"));
34                         wprintf("</td></tr>\n");
35
36         }
37
38 }
39
40
41 /**
42  * \brief display the outbound SMTP queue
43  */
44 void display_smtpqueue(void)
45 {
46         int i;
47         int num_msgs;
48
49         output_headers(1, 1, 2, 0, 0, 0);
50         wprintf("<div id=\"banner\">\n");
51         wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>");
52         wprintf("<SPAN CLASS=\"titlebar\">");
53         wprintf(_("View the outbound SMTP queue"));
54         wprintf("</SPAN>\n");
55         wprintf("</TD></TR></TABLE>\n");
56         wprintf("</div>\n<div id=\"content\">\n");
57
58         wprintf("<div class=\"fix_scrollbar_bug\">"
59                 "<table border=0 width=100%% bgcolor=\"#FFFFFF\">"
60                 "<tr><td valign=top>\n");
61
62
63         /* Check to see if we can go to the __CitadelSMTPspoolout__ room.
64          * If not, we don't have access to the queue.
65          */
66         gotoroom("__CitadelSMTPspoolout__");
67         if (!strcasecmp(WC->wc_roomname, "__CitadelSMTPspoolout__")) {
68
69                 num_msgs = load_msg_ptrs("MSGS ALL", 0);
70                 if (num_msgs > 0) {
71
72                         wprintf("<table border=1 width=100%%>\n");
73                         wprintf("<tr><td>");
74                         wprintf(_("Message ID"));
75                         wprintf("</td><td>");
76                         wprintf(_("Date/time submitted"));
77                         wprintf("</td><td>");
78                         wprintf(_("Last attempt"));
79                         wprintf("</td><td>");
80                         wprintf(_("Sender"));
81                         wprintf("</td><td>");
82                         wprintf(_("Recipients"));
83                         wprintf("</td></tr>\n");
84
85                         for (i=0; i<num_msgs; ++i) {
86                                 display_queue_msg(WC->msgarr[i]);
87                         }
88
89                         wprintf("</table>");
90
91                 }
92                 else {
93                         wprintf("<br /><br /><div align=\"center\">");
94                         wprintf(_("The queue is empty."));
95                         wprintf("</div><br /><br />");
96                 }
97         }
98         else {
99                 wprintf("<br /><br /><div align=\"center\">");
100                 wprintf(_("You do not have permission to view this resource."));
101                 wprintf("</div><br /><br />");
102         }
103
104         wprintf("</td></tr></table></div>\n");
105         wDumpContent(1);
106
107 }
108
109
110
111
112 /*@}*/