serv_smtpclient.c: style cleanup
authorArt Cancro <ajc@citadel.org>
Mon, 18 Dec 2023 04:39:00 +0000 (23:39 -0500)
committerArt Cancro <ajc@citadel.org>
Mon, 18 Dec 2023 04:39:00 +0000 (23:39 -0500)
Mostly just made stuff look nice in 132 columns

citadel/server/modules/smtp/serv_smtpclient.c

index 9d5867d564c533e65812cd248905a3293ddf86b3..6c1b9cc8427824bf7fa7c45d0defc3bd6318b487 100644 (file)
@@ -269,7 +269,7 @@ int smtp_attempt_delivery(long msgid, char *recp, char *envelope_from, char *sou
                        // Construct an SMTP URL in the form of:
                        //      smtp[s]://target_host/source_host
                        // This looks weird but libcurl uses that last part to set our name for EHLO or HELO.
-                       // We check for "smtp://" and "smtps://" because the admin may have put those prefixes in a smart-host entry.
+                       // We check for "smtp://" and "smtps://" because an admin may have put those prefixes in a smart-host entry
                        // If there is no prefix we add "smtp://"
                        extract_token(try_this_mx, mxes, i, '|', (sizeof try_this_mx - 7));
                        snprintf(smtp_url, sizeof smtp_url,
@@ -353,18 +353,12 @@ void smtp_process_one_msg(long qmsgnum) {
        char cfgline[SIZ];
        for (i = 0; i < num_tokens(instr, '\n'); ++i) {
                extract_token(cfgline, instr, i, '\n', sizeof cfgline);
-               if (!strncasecmp(cfgline, HKEY("msgid|")))
-                       msgid = atol(&cfgline[6]);
-               if (!strncasecmp(cfgline, HKEY("submitted|")))
-                       submitted = atol(&cfgline[10]);
-               if (!strncasecmp(cfgline, HKEY("attempted|")))
-                       attempted = atol(&cfgline[10]);
-               if (!strncasecmp(cfgline, HKEY("bounceto|")))
-                       bounceto = strdup(&cfgline[9]);
-               if (!strncasecmp(cfgline, HKEY("envelope_from|")))
-                       envelope_from = strdup(&cfgline[14]);
-               if (!strncasecmp(cfgline, HKEY("source_room|")))
-                       source_room = strdup(&cfgline[12]);
+               if (!strncasecmp(cfgline, HKEY("msgid|")))              msgid = atol(&cfgline[6]);
+               if (!strncasecmp(cfgline, HKEY("submitted|")))          submitted = atol(&cfgline[10]);
+               if (!strncasecmp(cfgline, HKEY("attempted|")))          attempted = atol(&cfgline[10]);
+               if (!strncasecmp(cfgline, HKEY("bounceto|")))           bounceto = strdup(&cfgline[9]);
+               if (!strncasecmp(cfgline, HKEY("envelope_from|")))      envelope_from = strdup(&cfgline[14]);
+               if (!strncasecmp(cfgline, HKEY("source_room|")))        source_room = strdup(&cfgline[12]);
        }
 
        int should_try_now = 0;
@@ -533,8 +527,8 @@ void smtp_do_queue(int type_of_queue_run) {
 
        // Put the queue in memory so we can close the db cursor
        CtdlForEachMessage(
-               (type_of_queue_run == QUICK_QUEUE_RUN ? MSGS_GT : MSGS_ALL),                    // quick = new jobs; full = all jobs
-               (type_of_queue_run == QUICK_QUEUE_RUN ? last_queue_job_processed : 0),          // quick = new jobs; full = all jobs
+               (type_of_queue_run == QUICK_QUEUE_RUN ? MSGS_GT : MSGS_ALL),            // quick = new jobs; full = all jobs
+               (type_of_queue_run == QUICK_QUEUE_RUN ? last_queue_job_processed : 0),  // quick = new jobs; full = all jobs
                NULL,
                SPOOLMIME,              // Searching for Content-type of SPOOLIME will give us only queue instruction messages
                NULL,
@@ -560,11 +554,15 @@ void smtp_do_queue(int type_of_queue_run) {
 }
 
 
+// The "full" queue run goes through the entire queue, attempting delivery for newly submitted messages,
+// retrying failed deliveries periodically, and handling undeliverable messages.
 void smtp_do_queue_full(void) {
        smtp_do_queue(FULL_QUEUE_RUN);
 }
 
 
+// The "quick" queue run only handles newly submitted messages, allowing them to be delivered immediately
+// instead of waiting for the next "full" queue run.
 void smtp_do_queue_quick(void) {
        if (last_queue_job_submitted > last_queue_job_processed) {
                smtp_do_queue(QUICK_QUEUE_RUN);