]> code.citadel.org Git - citadel.git/blobdiff - webcit/smtpqueue.c
* smtp queue display, use correct variable
[citadel.git] / webcit / smtpqueue.c
index 3a1b29f2dac1a3537b9e686120defb4f412d83a2..9014cd6c9cfb5c0563110b8c34f00110fa94a5e0 100644 (file)
@@ -83,14 +83,14 @@ void display_queue_msg(long msgnum)
                        }
 
                        if (!strcasecmp(keyword, "bounceto")) {
+                               char *atsign;
                                extract_token(sender, buf, 1, '|', sizeof sender);
 
                                /* Strip off local hostname if it's our own */
-                               char *atsign;
                                atsign = strchr(sender, '@');
                                if (atsign != NULL) {
                                        ++atsign;
-                                       if (!strcasecmp(atsign, serv_info.serv_nodename)) {
+                                       if (!strcasecmp(atsign, ChrPtr(WC->serv_info->serv_nodename))) {
                                                --atsign;
                                                *atsign = 0;
                                        }
@@ -137,7 +137,7 @@ void display_queue_msg(long msgnum)
 
        wprintf("</td><td>");
        if (submitted > 0) {
-               webcit_fmt_date(buf, submitted, 1);
+               webcit_fmt_date(buf, 1024, submitted, 1);
                wprintf("%s", buf);
        }
        else {
@@ -146,7 +146,7 @@ void display_queue_msg(long msgnum)
 
        wprintf("</td><td>");
        if (last_attempt > 0) {
-               webcit_fmt_date(buf, last_attempt, 1);
+               webcit_fmt_date(buf, 1024, last_attempt, 1);
                wprintf("%s", buf);
        }
        else {
@@ -164,16 +164,23 @@ void display_queue_msg(long msgnum)
 
 
 void display_smtpqueue_inner_div(void) {
+       message_summary *Msg = NULL;
+       wcsession *WCC = WC;
        int i;
        int num_msgs;
+       StrBuf *Buf;
+       SharedMessageStatus Stat;
 
+       memset(&Stat, 0, sizeof(SharedMessageStatus));
        /* Check to see if we can go to the __CitadelSMTPspoolout__ room.
         * If not, we don't have access to the queue.
         */
-       gotoroom("__CitadelSMTPspoolout__");
-       if (!strcasecmp(WC->wc_roomname, "__CitadelSMTPspoolout__")) {
+       Buf = NewStrBufPlain(HKEY("__CitadelSMTPspoolout__"));
+       gotoroom(Buf);
+       FreeStrBuf(&Buf);
+       if (!strcasecmp(ChrPtr(WCC->wc_roomname), "__CitadelSMTPspoolout__")) {
 
-               num_msgs = load_msg_ptrs("MSGS ALL", 0);
+               num_msgs = load_msg_ptrs("MSGS ALL", &Stat);
                if (num_msgs > 0) {
                         wprintf("<table class=\"mailbox_summary\" rules=rows "
                                "cellpadding=2 style=\"width:100%%;\">"
@@ -192,7 +199,14 @@ void display_smtpqueue_inner_div(void) {
                        wprintf("</i></b></td></tr>\n");
 
                        for (i=0; i<num_msgs; ++i) {
-                               display_queue_msg(WC->msgarr[i]);
+                               Msg = GetMessagePtrAt(i, WCC->summ);
+                               if (Msg) {
+                                       lprintf(9, "%d of %d: %ld\n", i, num_msgs, Msg->msgnum);
+                                       display_queue_msg(Msg->msgnum);
+                               }
+                               else {
+                                       lprintf(9, "%d of %d: is NULL!\n", i, num_msgs);
+                               }
                        }
 
                        wprintf("</table>");
@@ -209,11 +223,12 @@ void display_smtpqueue_inner_div(void) {
                wprintf(_("You do not have permission to view this resource."));
                wprintf("</div><br /><br />");
        }
-
+       output_headers(0, 0, 0, 0, 0, 0);
+       end_burst();
 }
 
-/**
- * \brief display the outbound SMTP queue
+/*
+ * display the outbound SMTP queue
  */
 void display_smtpqueue(void)
 {
@@ -265,7 +280,10 @@ void display_smtpqueue(void)
 
 }
 
-
-
-
-/*@}*/
+void 
+InitModule_SMTP_QUEUE
+(void)
+{
+       WebcitAddUrlHandler(HKEY("display_smtpqueue"), display_smtpqueue, 0);
+       WebcitAddUrlHandler(HKEY("display_smtpqueue_inner_div"), display_smtpqueue_inner_div, 0);
+}