* "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;
/*
* 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
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) &&
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);
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])) {
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);
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));
}
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));
}
}
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));
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;
* 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");
* 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;
* 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)
*/
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;
}
* 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;
* 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;
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)