serv_imap: removed all the CCC and CCCIMAP shorthand
authorArt Cancro <ajc@citadel.org>
Sat, 19 Aug 2023 20:28:56 +0000 (11:28 -0900)
committerArt Cancro <ajc@citadel.org>
Sat, 19 Aug 2023 20:28:56 +0000 (11:28 -0900)
citadel/server/modules/imap/imap_fetch.c
citadel/server/modules/imap/imap_list.c
citadel/server/modules/imap/serv_imap.c
citadel/server/modules/imap/serv_imap.h

index 0434879193d0b3aab44c8ae7b18038d1206a74ef..7d2fe746f4e9a39f95b7f66e03ff549ae82a83c3 100644 (file)
@@ -117,8 +117,7 @@ void imap_fetch_internaldate(struct CtdlMessage *msg) {
  *     "RFC822.TEXT"   body only (without leading blank line)
  */
 void imap_fetch_rfc822(long msgnum, const char *whichfmt) {
-       CitContext *CCC = CC;
-       citimap *Imap = CCCIMAP;
+       citimap *Imap = IMAP;
        const char *ptr = NULL;
        size_t headers_size, text_size, total_size;
        size_t bytes_to_send = 0;
@@ -171,7 +170,7 @@ void imap_fetch_rfc822(long msgnum, const char *whichfmt) {
                /*
                 * Load the message into memory for translation & measurement
                 */
-               CCC->redirect_buffer = NewStrBufPlain(NULL, SIZ);
+               CC->redirect_buffer = NewStrBufPlain(NULL, SIZ);
                CtdlOutputMsg(msgnum, MT_RFC822,
                        (need_body ? HEADERS_ALL : HEADERS_FAST),
                        0, 1, NULL, SUPPRESS_ENV_TO, NULL, NULL, NULL
@@ -179,8 +178,8 @@ void imap_fetch_rfc822(long msgnum, const char *whichfmt) {
                if (!need_body) {
                        client_write(HKEY("\r\n"));             // extra trailing newline -- to the redirect_buffer, *not* to the client
                }
-               Imap->cached_rfc822 = CCC->redirect_buffer;
-               CCC->redirect_buffer = NULL;
+               Imap->cached_rfc822 = CC->redirect_buffer;
+               CC->redirect_buffer = NULL;
                Imap->cached_rfc822_msgnum = msgnum;
                Imap->cached_rfc822_withbody = need_body;
                if ( (need_to_rewrite_metadata) && 
@@ -536,9 +535,8 @@ void imap_strip_headers(StrBuf *section) {
        int ok = 0;
        int done_headers = 0;
        const char *Ptr = NULL;
-       CitContext *CCC = CC;
 
-       if (CCC->redirect_buffer == NULL) return;
+       if (CC->redirect_buffer == NULL) return;
 
        which_fields = NewStrBufDup(section);
 
@@ -562,12 +560,12 @@ void imap_strip_headers(StrBuf *section) {
        Cmd.CmdBuf = which_fields;
        num_parms = imap_parameterize(&Cmd);
 
-       boiled_headers = NewStrBufPlain(NULL, StrLength(CCC->redirect_buffer));
+       boiled_headers = NewStrBufPlain(NULL, StrLength(CC->redirect_buffer));
        Line = NewStrBufPlain(NULL, SIZ);
        Ptr = NULL;
        ok = 0;
        do {
-               StrBufSipLine(Line, CCC->redirect_buffer, &Ptr);
+               StrBufSipLine(Line, CC->redirect_buffer, &Ptr);
 
                if (!isspace(ChrPtr(Line)[0])) {
 
@@ -608,8 +606,8 @@ void imap_strip_headers(StrBuf *section) {
        StrBufAppendBufPlain(boiled_headers, HKEY("\r\n"), 0);
 
        /* Now save it back (it'll always be smaller) */
-       FreeStrBuf(&CCC->redirect_buffer);
-       CCC->redirect_buffer = boiled_headers;
+       FreeStrBuf(&CC->redirect_buffer);
+       CC->redirect_buffer = boiled_headers;
 
        free(Cmd.Params);
        FreeStrBuf(&which_fields);
@@ -629,8 +627,7 @@ void imap_fetch_body(long msgnum, ConstStr item, int is_peek) {
        int loading_body_now = 0;
        int need_body = 1;
        int burn_the_cache = 0;
-       CitContext *CCC = CC;
-       citimap *Imap = CCCIMAP;
+       citimap *Imap = IMAP;
 
        /* extract section */
        section = NewStrBufPlain(CKEY(item));
@@ -674,7 +671,7 @@ void imap_fetch_body(long msgnum, ConstStr item, int is_peek) {
        }
 
        if (Imap->cached_body == NULL) {
-               CCC->redirect_buffer = NewStrBufPlain(NULL, SIZ);
+               CC->redirect_buffer = NewStrBufPlain(NULL, SIZ);
                loading_body_now = 1;
                msg = CtdlFetchMessage(msgnum, (need_body ? 1 : 0));
        }
@@ -726,8 +723,8 @@ void imap_fetch_body(long msgnum, ConstStr item, int is_peek) {
        }
 
        if (loading_body_now) {
-               Imap->cached_body_len = StrLength(CCC->redirect_buffer);
-               Imap->cached_body = SmashStrBuf(&CCC->redirect_buffer);
+               Imap->cached_body_len = StrLength(CC->redirect_buffer);
+               Imap->cached_body = SmashStrBuf(&CC->redirect_buffer);
                Imap->cached_bodymsgnum = msgnum;
                Imap->cached_body_withbody = need_body;
                strcpy(Imap->cached_bodypart, ChrPtr(section));
index 33b714912ea767506f3002ed259a1dfe32c5f267..bf54112f312f1944427d5996cf7d1854e612cfba 100644 (file)
@@ -179,8 +179,7 @@ void imap_listroom(struct ctdlroom *qrbuf, void *data)
  */
 void imap_list(int num_parms, ConstStr *Params)
 {
-       struct CitContext *CCC = CC;
-       citimap *Imap = CCCIMAP;
+       citimap *Imap = IMAP;
        int i, j, paren_nest;
        ImapRoomListFilter ImapFilter;
        int selection_left = (-1);
index b42c5022b80ac8ca929615ee7f62e719e4c97b3e..621d21396b8a03000eafecb2a1c3fa0d328b179b 100644 (file)
@@ -63,9 +63,8 @@ void registerImapCMD(const char *First, long FLen, const char *Second, long SLen
 
 
 const imap_handler_hook *imap_lookup(int num_parms, ConstStr *Params) {
-       struct CitContext *CCC = CC;
        void *v;
-       citimap *Imap = CCCIMAP;
+       citimap *Imap = IMAP;
 
        if (num_parms < 1)
                return NULL;
@@ -257,9 +256,8 @@ void imap_add_single_msgid(long msgnum, void *userdata) {
  * Set up a message ID map for the current room (folder)
  */
 void imap_load_msgids(void) {
-       struct CitContext *CCC = CC;
        struct cdbdata *cdbfr;
-       citimap *Imap = CCCIMAP;
+       citimap *Imap = IMAP;
 
        if (Imap->selected == 0) {
                syslog(LOG_ERR, "imap_load_msgids() can't run; no room selected");
@@ -292,8 +290,7 @@ void imap_load_msgids(void) {
  * Re-scan the selected room (folder) and see if it's been changed at all
  */
 void imap_rescan_msgids(void) {
-       struct CitContext *CCC = CC;
-       citimap *Imap = CCCIMAP;
+       citimap *Imap = IMAP;
        int original_num_msgs = 0;
        long original_highest = 0L;
        int i, j, jstart;
@@ -411,8 +408,7 @@ void imap_rescan_msgids(void) {
  * the IMAP server.
  */
 void imap_cleanup_function(void) {
-       struct CitContext *CCC = CC;
-       citimap *Imap = CCCIMAP;
+       citimap *Imap = IMAP;
 
        /* Don't do this stuff if this is not a Imap session! */
        if (CC->h_command_function != imap_command_loop)
@@ -511,20 +507,19 @@ void imap_id(int num_parms, ConstStr *Params) {
  */
 void imap_greeting(void) {
        citimap *Imap;
-       CitContext *CCC = CC;
 
-       strcpy(CCC->cs_clientname, "IMAP session");
-       CCC->session_specific_data = malloc(sizeof(citimap));
-       Imap = (citimap *)CCC->session_specific_data;
+       strcpy(CC->cs_clientname, "IMAP session");
+       CC->session_specific_data = malloc(sizeof(citimap));
+       Imap = (citimap *)CC->session_specific_data;
        memset(Imap, 0, sizeof(citimap));
        Imap->authstate = imap_as_normal;
        Imap->cached_rfc822_msgnum = (-1);
        Imap->cached_rfc822_withbody = 0;
        Imap->Reply = NewStrBufPlain(NULL, SIZ * 10); /* 40k */
 
-       if (CCC->nologin) {
+       if (CC->nologin) {
                IAPuts("* BYE; Server busy, try later\r\n");
-               CCC->kill_me = KILLME_NOLOGIN;
+               CC->kill_me = KILLME_NOLOGIN;
                IUnbuffer();
                return;
        }
@@ -862,8 +857,7 @@ void imap_select(int num_parms, ConstStr *Params) {
  * Does the real work for expunge.
  */
 int imap_do_expunge(void) {
-       struct CitContext *CCC = CC;
-       citimap *Imap = CCCIMAP;
+       citimap *Imap = IMAP;
        int i;
        int num_expunged = 0;
        long *delmsgs = NULL;
@@ -1408,7 +1402,6 @@ void imap_rename(int num_parms, ConstStr *Params) {
  * Main command loop for IMAP sessions.
  */
 void imap_command_loop(void) {
-       struct CitContext *CCC = CC;
        struct timeval tv1, tv2;
        suseconds_t total_time = 0;
        citimap *Imap;
@@ -1416,8 +1409,8 @@ void imap_command_loop(void) {
        const imap_handler_hook *h;
 
        gettimeofday(&tv1, NULL);
-       CCC->lastcmd = time(NULL);
-       Imap = CCCIMAP;
+       CC->lastcmd = time(NULL);
+       Imap = IMAP;
 
        flush_output();
        if (Imap->Cmd.CmdBuf == NULL)
index bd5b93390b6a3402fb673120c82c462d3709e550..fe18a24b120f0e26e2dd29415d31a29e906d3288 100644 (file)
@@ -102,7 +102,6 @@ enum {
 #define FDELIM '\\'
 
 #define IMAP ((citimap *)CC->session_specific_data)
-#define CCCIMAP ((citimap *)CCC->session_specific_data)
 
 #define IMAPDBGLOG(LEVEL) if ((LEVEL != LOG_DEBUG) || (IMAPDebugEnabled != 0))