$Log$
+ Revision 573.123 2001/04/03 00:47:23 ajc
+ * Began implementing IMAP APPEND
+
Revision 573.122 2001/04/01 22:05:44 cough
* *Actually* fixed a botched ChangeLog entry.
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
-
-
+/*
+ * This function is called by the main command loop.
+ */
+void imap_append(int num_parms, char *parms[]) {
+ size_t literal_length;
+ int ret;
+
+ if (num_parms < 4) {
+ cprintf("%s BAD usage error\r\n", parms[0]);
+ return;
+ }
+
+ if ( (parms[num_parms-1][0] != '{')
+ || (parms[num_parms-1][strlen(parms[num_parms-1])-1] != '}') ) {
+ cprintf("%s BAD no message literal supplied\r\n", parms[0]);
+ return;
+ }
+
+ literal_length = (size_t) atol(&parms[num_parms-1][1]);
+ if (literal_length < 1) {
+ cprintf("%s BAD Message length must be at least 1.\r\n",
+ parms[0]);
+ return;
+ }
+
+ imap_free_transmitted_message(); /* just in case. */
+ IMAP->transmitted_message = mallok(literal_length);
+ if (IMAP->transmitted_message == NULL) {
+ cprintf("%s NO Cannot allocate memory.\r\n", parms[0]);
+ return;
+ }
+ IMAP->transmitted_length = literal_length;
+
+ cprintf("+ Transmit message now.\r\n");
+ ret = client_read(IMAP->transmitted_message, literal_length);
+ if (ret != 1) {
+ cprintf("%s NO Read failed.\r\n", parms[0]);
+ return;
+ }
+
+ cprintf("%s NO not implemented yet ** FIXME ** \r\n", parms[0]);
+}
void imap_copy(int num_parms, char *parms[]);
void imap_uidcopy(int num_parms, char *parms[]);
void imap_print_express_messages(void);
+void imap_append(int num_parms, char *parms[]);
}
+/*
+ * If there is a transmitted message in memory, free it
+ */
+void imap_free_transmitted_message(void) {
+ if (IMAP->transmitted_message != NULL) {
+ phree(IMAP->transmitted_message);
+ IMAP->transmitted_message = NULL;
+ IMAP->transmitted_length = 0;
+ }
+}
+
+
/*
* Back end for imap_load_msgids()
*
lprintf(9, "Performing IMAP cleanup hook\n");
imap_free_msgids();
+ imap_free_transmitted_message();
lprintf(9, "Finished IMAP cleanup hook\n");
}
imap_unsubscribe(num_parms, parms);
}
+ else if (!strcasecmp(parms[1], "APPEND")) {
+ imap_append(num_parms, parms);
+ }
+
else if (IMAP->selected == 0) {
cprintf("%s BAD no folder selected\r\n", parms[0]);
}
cprintf("%s BAD command unrecognized\r\n", parms[0]);
}
+ /* If the client transmitted a message we can free it now */
+ imap_free_transmitted_message();
}
void imap_greeting(void);
void imap_command_loop(void);
int imap_grabroom(char *returned_roomname, char *foldername);
+void imap_free_transmitted_message(void);
int num_msgs; /* Number of messages being mapped */
long *msgids;
unsigned int *flags;
+ char *transmitted_message; /* for APPEND command... */
+ size_t transmitted_length;
};
/*