imap4r1.c   imap4r1.c 
/* ======================================================================== /* ========================================================================
* Copyright 1988-2007 University of Washington * Copyright 1988-2008 University of Washington
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* *
* ======================================================================== * ========================================================================
*/ */
/* /*
* Program: Interactive Message Access Protocol 4rev1 (IMAP4R1) routines * Program: Interactive Message Access Protocol 4rev1 (IMAP4R1) routines
* *
* Author: Mark Crispin * Author: Mark Crispin
* Networks and Distributed Computing * UW Technology
* Computing & Communications
* University of Washington * University of Washington
* Administration Building, AG-44
* Seattle, WA 98195 * Seattle, WA 98195
* Internet: MRC@CAC.Washington.EDU * Internet: MRC@CAC.Washington.EDU
* *
* Date: 15 June 1988 * Date: 15 June 1988
* Last Edited: 19 November 2007 * Last Edited: 19 February 2008
* *
* This original version of this file is * This original version of this file is
* Copyright 1988 Stanford University * Copyright 1988 Stanford University
* and was developed in the Symbolic Systems Resources Group of the Knowled ge * and was developed in the Symbolic Systems Resources Group of the Knowled ge
* Systems Laboratory at Stanford University in 1987-88, and was funded by the * Systems Laboratory at Stanford University in 1987-88, and was funded by the
* Biomedical Research Technology Program of the National Institutes of Hea lth * Biomedical Research Technology Program of the National Institutes of Hea lth
* under grant number RR-00785. * under grant number RR-00785.
*/ */
#include <ctype.h> #include <ctype.h>
skipping to change at line 2539 skipping to change at line 2537
IMAPARG *args[5],ambx,aflg,adat,amsg; IMAPARG *args[5],ambx,aflg,adat,amsg;
IMAPPARSEDREPLY *reply; IMAPPARSEDREPLY *reply;
char tmp[MAILTMPLEN]; char tmp[MAILTMPLEN];
int i; int i;
ambx.type = ASTRING; ambx.text = (void *) mailbox; ambx.type = ASTRING; ambx.text = (void *) mailbox;
args[i = 0] = &ambx; args[i = 0] = &ambx;
if (flags) { if (flags) {
aflg.type = FLAGS; aflg.text = (void *) flags; aflg.type = FLAGS; aflg.text = (void *) flags;
args[++i] = &aflg; args[++i] = &aflg;
} }
if (date) { /* ensure date in INTERNALDATE format */ if (date) { /* ensure date in INTERNALDATE format */
if (!mail_parse_date (&elt,date)) { if (!mail_parse_date (&elt,date)) {
/* flush previous reply */ /* flush previous reply */
if (LOCAL->reply.line) fs_give ((void **) &LOCAL->reply.line); if (LOCAL->reply.line) fs_give ((void **) &LOCAL->reply.line);
/* build new fake reply */ /* build new fake reply */
LOCAL->reply.tag = LOCAL->reply.line = cpystr ("*"); LOCAL->reply.tag = LOCAL->reply.line = cpystr ("*");
LOCAL->reply.key = "BAD"; LOCAL->reply.key = "BAD";
LOCAL->reply.text = "Bad date in append"; LOCAL->reply.text = "Bad date in append";
return &LOCAL->reply; return &LOCAL->reply;
} }
adat.type = ASTRING; adat.type = ASTRING;
adat.text = (void *) (date = mail_date (tmp,&elt)); adat.text = (void *) (date = mail_date (tmp,&elt));
args[++i] = &adat; args[++i] = &adat;
} }
amsg.type = LITERAL; amsg.text = (void *) message; amsg.type = LITERAL; amsg.text = (void *) message;
args[++i] = &amsg; args[++i] = &amsg;
args[++i] = NIL; args[++i] = NIL;
if (!strcmp ((reply = imap_send (stream,"APPEND",args))->key,"BAD") && /* easy if IMAP4[rev1] */
(flags || date)) { /* full form and got a BAD? */ if (LEVELIMAP4 (stream)) reply = imap_send (stream,"APPEND",args);
/* yes, retry with old IMAP2bis form */ else { /* try the IMAP2bis way */
args[1] = &amsg; args[2] = NIL; args[1] = &amsg; args[2] = NIL;
reply = imap_send (stream,"APPEND",args); reply = imap_send (stream,"APPEND",args);
} }
return reply; return reply;
} }
/* IMAP garbage collect stream /* IMAP garbage collect stream
* Accepts: Mail stream * Accepts: Mail stream
* garbage collection flags * garbage collection flags
*/ */
 End of changes. 6 change blocks. 
9 lines changed or deleted 7 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/