style cleanup
[citadel.git] / citadel / modules / imap / imap_fetch.c
index 75a4cdbea5a395b5a23ff182befe3acfde6587ba..2939f43d5cbfa73f2fdad6cf7e61c8dfb40c3593 100644 (file)
@@ -2,21 +2,17 @@
  * Implements the FETCH command in IMAP.
  * This is a good example of the protocol's gratuitous complexity.
  *
- * Copyright (c) 2001-2011 by the citadel.org team
+ * Copyright (c) 2001-2017 by the citadel.org team
  *
- *  This program is open source software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
+ * This program is open source software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  */
 
 
@@ -190,7 +186,7 @@ void imap_fetch_rfc822(long msgnum, const char *whichfmt) {
                CCC->redirect_buffer = NewStrBufPlain(NULL, SIZ);
                CtdlOutputMsg(msgnum, MT_RFC822,
                        (need_body ? HEADERS_ALL : HEADERS_FAST),
-                       0, 1, NULL, SUPPRESS_ENV_TO, NULL, NULL
+                       0, 1, NULL, SUPPRESS_ENV_TO, NULL, NULL, NULL
                );
                if (!need_body) IAPuts("\r\n"); /* extra trailing newline */
                Imap->cached_rfc822 = CCC->redirect_buffer;
@@ -238,7 +234,7 @@ void imap_fetch_rfc822(long msgnum, const char *whichfmt) {
                text_size = 0;
        }
 
-       IMAP_syslog(LOG_DEBUG, 
+       syslog(LOG_DEBUG, 
                    "RFC822: headers=" SIZE_T_FMT 
                    ", text=" SIZE_T_FMT
                    ", total=" SIZE_T_FMT,
@@ -282,12 +278,11 @@ void imap_load_part(char *name, char *filename, char *partnum, char *disp,
                    void *content, char *cbtype, char *cbcharset, size_t length, char *encoding,
                    char *cbid, void *cbuserdata)
 {
-       struct CitContext *CCC = CC;
        char mimebuf2[SIZ];
        StrBuf *desired_section;
 
        desired_section = (StrBuf *)cbuserdata;
-       IMAP_syslog(LOG_DEBUG, "imap_load_part() looking for %s, found %s",
+       syslog(LOG_DEBUG, "imap_load_part() looking for %s, found %s",
                    ChrPtr(desired_section),
                    partnum
                );
@@ -363,8 +358,8 @@ void imap_output_envelope_from(struct CtdlMessage *msg) {
                process_rfc822_addr(msg->cm_fields[erFc822Addr], user, node, name);
                IPutStr(user, strlen(user));            /* mailbox name (user id) */
                IAPuts(" ");
-               if (!strcasecmp(node, config.c_nodename)) {
-                       IPutStr(CFG_KEY(c_fqdn));
+               if (!strcasecmp(node, CtdlGetConfigStr("c_nodename"))) {
+                       IPutStr(CtdlGetConfigStr("c_fqdn"), strlen(CtdlGetConfigStr("c_fqdn")));
                }
                else {
                        IPutStr(node, strlen(node));            /* host name */
@@ -670,9 +665,7 @@ void imap_fetch_body(long msgnum, ConstStr item, int is_peek) {
        if (strchr(ChrPtr(section), '[') != NULL) {
                StrBufStripAllBut(section, '[', ']');
        }
-       IMAP_syslog(LOG_DEBUG, "Section is: [%s]", 
-                   (StrLength(section) == 0) ? "(empty)" : ChrPtr(section)
-       );
+       syslog(LOG_DEBUG, "Section is: [%s]", (StrLength(section) == 0) ? "(empty)" : ChrPtr(section));
 
        /* Burn the cache if we don't have the same section of the 
         * same message again.
@@ -704,13 +697,13 @@ void imap_fetch_body(long msgnum, ConstStr item, int is_peek) {
                is_partial = 1;
        }
        if ( (is_partial == 1) && (StrLength(partial) > 0) ) {
-               IMAP_syslog(LOG_DEBUG, "Partial is <%s>", ChrPtr(partial));
+               syslog(LOG_DEBUG, "Partial is <%s>", ChrPtr(partial));
        }
 
        if (Imap->cached_body == NULL) {
                CCC->redirect_buffer = NewStrBufPlain(NULL, SIZ);
                loading_body_now = 1;
-               msg = CtdlFetchMessage(msgnum, (need_body ? 1 : 0));
+               msg = CtdlFetchMessage(msgnum, (need_body ? 1 : 0), 1);
        }
 
        /* Now figure out what the client wants, and get it */
@@ -1085,7 +1078,7 @@ void imap_do_fetch_msg(int seq, citimap_command *Cmd) {
                                msg = NULL;
                        }
                        if (msg == NULL) {
-                               msg = CtdlFetchMessage(Imap->msgids[seq-1], 1);
+                               msg = CtdlFetchMessage(Imap->msgids[seq-1], 1, 1);
                                body_loaded = 1;
                        }
                        imap_fetch_bodystructure(Imap->msgids[seq-1],
@@ -1093,14 +1086,14 @@ void imap_do_fetch_msg(int seq, citimap_command *Cmd) {
                }
                else if (!strcasecmp(Cmd->Params[i].Key, "ENVELOPE")) {
                        if (msg == NULL) {
-                               msg = CtdlFetchMessage(Imap->msgids[seq-1], 0);
+                               msg = CtdlFetchMessage(Imap->msgids[seq-1], 0, 1);
                                body_loaded = 0;
                        }
                        imap_fetch_envelope(msg);
                }
                else if (!strcasecmp(Cmd->Params[i].Key, "INTERNALDATE")) {
                        if (msg == NULL) {
-                               msg = CtdlFetchMessage(Imap->msgids[seq-1], 0);
+                               msg = CtdlFetchMessage(Imap->msgids[seq-1], 0, 1);
                                body_loaded = 0;
                        }
                        imap_fetch_internaldate(msg);
@@ -1129,16 +1122,16 @@ void imap_do_fetch(citimap_command *Cmd) {
 /* debug output the parsed vector */
        {
                int i;
-               IMAP_syslog(LOG_DEBUG, "----- %ld params", Cmd->num_parms);
+               syslog(LOG_DEBUG, "----- %ld params", Cmd->num_parms);
 
        for (i=0; i < Cmd->num_parms; i++) {
                if (Cmd->Params[i].len != strlen(Cmd->Params[i].Key))
-                       IMAP_syslog(LOG_DEBUG, "*********** %ld != %ld : %s",
+                       syslog(LOG_DEBUG, "*********** %ld != %ld : %s",
                                    Cmd->Params[i].len, 
                                    strlen(Cmd->Params[i].Key),
                                    Cmd->Params[i].Key);
                else
-                       IMAP_syslog(LOG_DEBUG, "%ld : %s",
+                       syslog(LOG_DEBUG, "%ld : %s",
                                    Cmd->Params[i].len, 
                                    Cmd->Params[i].Key);
        }}
@@ -1461,7 +1454,7 @@ void imap_uidfetch(int num_parms, ConstStr *Params) {
 
        MakeStringOf(Cmd.CmdBuf, 4);
 #if 0
-       IMAP_syslog(LOG_DEBUG, "-------%s--------", ChrPtr(Cmd.CmdBuf));
+       syslog(LOG_DEBUG, "-------%s--------", ChrPtr(Cmd.CmdBuf));
 #endif
        num_items = imap_extract_data_items(&Cmd);
        if (num_items < 1) {