4 * IMAP server for the Citadel/UX system
5 * Copyright (C) 2000-2001 by Art Cancro and others.
6 * This code is released under the terms of the GNU General Public License.
8 * WARNING: this is an incomplete implementation, still in progress. Parts of
9 * it work, but it's not really usable yet from a user perspective.
11 * WARNING: Mark Crispin is an idiot. IMAP is the most brain-damaged protocol
12 * you will ever have the profound lack of pleasure to encounter.
24 #include <sys/types.h>
33 #include "sysdep_decls.h"
34 #include "citserver.h"
37 #include "dynloader.h"
44 #include "internet_addressing.h"
45 #include "serv_imap.h"
46 #include "imap_tools.h"
47 #include "imap_fetch.h"
48 #include "imap_search.h"
49 #include "imap_store.h"
50 #include "imap_misc.h"
57 * If there is a message ID map in memory, free it
59 void imap_free_msgids(void) {
60 if (IMAP->msgids != NULL) {
65 if (IMAP->flags != NULL) {
73 * If there is a transmitted message in memory, free it
75 void imap_free_transmitted_message(void) {
76 if (IMAP->transmitted_message != NULL) {
77 phree(IMAP->transmitted_message);
78 IMAP->transmitted_message = NULL;
79 IMAP->transmitted_length = 0;
85 * Back end for imap_load_msgids()
87 * FIXME: this should be optimized by figuring out a way to allocate memory
88 * once rather than doing a reallok() for each message.
90 void imap_add_single_msgid(long msgnum, void *userdata) {
92 IMAP->num_msgs = IMAP->num_msgs + 1;
93 if (IMAP->msgids == NULL) {
94 IMAP->msgids = mallok(IMAP->num_msgs * sizeof(long));
97 IMAP->msgids = reallok(IMAP->msgids,
98 IMAP->num_msgs * sizeof(long));
100 if (IMAP->flags == NULL) {
101 IMAP->flags = mallok(IMAP->num_msgs * sizeof(long));
104 IMAP->flags = reallok(IMAP->flags,
105 IMAP->num_msgs * sizeof(long));
107 IMAP->msgids[IMAP->num_msgs - 1] = msgnum;
108 IMAP->flags[IMAP->num_msgs - 1] = 0;
114 * Set up a message ID map for the current room (folder)
116 void imap_load_msgids(void) {
118 if (IMAP->selected == 0) {
119 lprintf(5, "imap_load_msgids() can't run; no room selected\n");
123 imap_free_msgids(); /* If there was already a map, free it */
125 CtdlForEachMessage(MSGS_ALL, 0L, (-63), NULL, NULL,
126 imap_add_single_msgid, NULL);
128 lprintf(9, "imap_load_msgids() mapped %d messages\n", IMAP->num_msgs);
133 * Re-scan the selected room (folder) and see if it's been changed at all
135 void imap_rescan_msgids(void) {
137 int original_num_msgs = 0;
138 long original_highest = 0L;
142 if (IMAP->selected == 0) {
143 lprintf(5, "imap_load_msgids() can't run; no room selected\n");
149 * Check to see if any of the messages we know about have been expunged
151 if (IMAP->num_msgs > 0)
152 for (i=0; i<IMAP->num_msgs; ++i) {
154 count = CtdlForEachMessage(MSGS_EQ, IMAP->msgids[i],
155 (-63), NULL, NULL, NULL, NULL);
158 cprintf("* %d EXPUNGE\r\n", i+1);
160 /* Here's some nice stupid nonsense. When a message
161 * is expunged, we have to slide all the existing
162 * messages up in the message array.
165 memcpy(&IMAP->msgids[i], &IMAP->msgids[i+1],
166 (sizeof(long)*(IMAP->num_msgs-i)) );
167 memcpy(&IMAP->flags[i], &IMAP->flags[i+1],
168 (sizeof(long)*(IMAP->num_msgs-i)) );
176 * Remember how many messages were here before we re-scanned.
178 original_num_msgs = IMAP->num_msgs;
179 if (IMAP->num_msgs > 0) {
180 original_highest = IMAP->msgids[IMAP->num_msgs - 1];
183 original_highest = 0L;
187 * Now peruse the room for *new* messages only.
189 CtdlForEachMessage(MSGS_GT, original_highest, (-63), NULL, NULL,
190 imap_add_single_msgid, NULL);
193 * If new messages have arrived, tell the client about them.
195 if (IMAP->num_msgs > original_num_msgs) {
196 cprintf("* %d EXISTS\r\n", IMAP->num_msgs);
208 * This cleanup function blows away the temporary memory and files used by
211 void imap_cleanup_function(void) {
213 /* Don't do this stuff if this is not a IMAP session! */
214 if (CC->h_command_function != imap_command_loop) return;
216 lprintf(9, "Performing IMAP cleanup hook\n");
218 imap_free_transmitted_message();
219 lprintf(9, "Finished IMAP cleanup hook\n");
225 * Here's where our IMAP session begins its happy day.
227 void imap_greeting(void) {
229 strcpy(CC->cs_clientname, "IMAP session");
230 CtdlAllocUserData(SYM_IMAP, sizeof(struct citimap));
231 IMAP->authstate = imap_as_normal;
233 cprintf("* OK %s Citadel/UX IMAP4rev1 server ready\r\n",
239 * implements the LOGIN command (ordinary username/password login)
241 void imap_login(int num_parms, char *parms[]) {
242 if (CtdlLoginExistingUser(parms[2]) == login_ok) {
243 if (CtdlTryPassword(parms[3]) == pass_ok) {
244 cprintf("%s OK login successful\r\n", parms[0]);
249 cprintf("%s BAD Login incorrect\r\n", parms[0]);
254 * Implements the AUTHENTICATE command
256 void imap_authenticate(int num_parms, char *parms[]) {
259 if (num_parms != 3) {
260 cprintf("%s BAD incorrect number of parameters\r\n", parms[0]);
264 if (!strcasecmp(parms[2], "LOGIN")) {
265 encode_base64(buf, "Username:");
266 cprintf("+ %s\r\n", buf);
267 IMAP->authstate = imap_as_expecting_username;
268 strcpy(IMAP->authseq, parms[0]);
273 cprintf("%s NO AUTHENTICATE %s failed\r\n",
278 void imap_auth_login_user(char *cmd) {
281 decode_base64(buf, cmd);
282 CtdlLoginExistingUser(buf);
283 encode_base64(buf, "Password:");
284 cprintf("+ %s\r\n", buf);
285 IMAP->authstate = imap_as_expecting_password;
289 void imap_auth_login_pass(char *cmd) {
292 decode_base64(buf, cmd);
293 if (CtdlTryPassword(buf) == pass_ok) {
294 cprintf("%s OK authentication succeeded\r\n", IMAP->authseq);
297 cprintf("%s NO authentication failed\r\n", IMAP->authseq);
299 IMAP->authstate = imap_as_normal;
306 * implements the CAPABILITY command
308 void imap_capability(int num_parms, char *parms[]) {
309 cprintf("* CAPABILITY IMAP4 IMAP4REV1 AUTH=LOGIN\r\n");
310 cprintf("%s OK CAPABILITY completed\r\n", parms[0]);
318 * implements the SELECT command
320 void imap_select(int num_parms, char *parms[]) {
322 char augmented_roomname[ROOMNAMELEN];
326 struct quickroom QRscratch;
332 /* Convert the supplied folder name to a roomname */
333 i = imap_roomname(towhere, sizeof towhere, parms[2]);
335 cprintf("%s NO Invalid mailbox name.\r\n", parms[0]);
339 floornum = (i & 0x00ff);
340 roomflags = (i & 0xff00);
342 /* First try a regular match */
343 c = getroom(&QRscratch, towhere);
345 /* Then try a mailbox name match */
347 MailboxName(augmented_roomname, &CC->usersupp, towhere);
348 c = getroom(&QRscratch, augmented_roomname);
350 strcpy(towhere, augmented_roomname);
353 /* If the room exists, check security/access */
355 /* See if there is an existing user/room relationship */
356 ra = CtdlRoomAccess(&QRscratch, &CC->usersupp);
358 /* normal clients have to pass through security */
364 /* Fail here if no such room */
366 cprintf("%s NO ... no such room, or access denied\r\n",
373 * usergoto() formally takes us to the desired room, happily returning
374 * the number of messages and number of new messages.
376 usergoto(QRscratch.QRname, 0, &msgs, &new);
379 if (!strcasecmp(parms[1], "EXAMINE")) {
388 /* FIXME ... much more info needs to be supplied here */
389 cprintf("* %d EXISTS\r\n", msgs);
390 cprintf("* %d RECENT\r\n", new);
391 cprintf("* FLAGS (\\Deleted)\r\n");
392 cprintf("* OK [PERMANENTFLAGS (\\Deleted)] permanent flags\r\n");
393 cprintf("* OK [UIDVALIDITY 0] UIDs valid\r\n");
394 cprintf("%s OK [%s] %s completed\r\n",
396 (IMAP->readonly ? "READ-ONLY" : "READ-WRITE"),
403 * does the real work for expunge
405 int imap_do_expunge(void) {
407 int num_expunged = 0;
409 if (IMAP->num_msgs > 0) for (i=0; i<IMAP->num_msgs; ++i) {
410 if (IMAP->flags[i] & IMAP_DELETED) {
411 CtdlDeleteMessages(CC->quickroom.QRname,
412 IMAP->msgids[i], "");
417 if (num_expunged > 0) {
418 imap_rescan_msgids();
421 return(num_expunged);
426 * implements the EXPUNGE command syntax
428 void imap_expunge(int num_parms, char *parms[]) {
429 int num_expunged = 0;
431 cprintf("%s OK expunged %d messages.\r\n", parms[0], num_expunged);
436 * implements the CLOSE command
438 void imap_close(int num_parms, char *parms[]) {
440 /* Yes, we always expunge on close. */
446 cprintf("%s OK CLOSE completed\r\n", parms[0]);
453 * Used by LIST and LSUB to show the floors in the listing
455 void imap_list_floors(char *cmd, char *pattern) {
459 for (i=0; i<MAXFLOORS; ++i) {
461 if (fl->f_flags & F_INUSE) {
462 if (imap_mailbox_matches_pattern(pattern, fl->f_name)) {
463 cprintf("* %s (\\NoSelect) \"|\" ", cmd);
464 imap_strout(fl->f_name);
474 * Back end for imap_lsub()
476 * IMAP "subscribed folder" is equivocated to Citadel "known rooms." This
477 * may or may not be the desired behavior in the future.
479 void imap_lsub_listroom(struct quickroom *qrbuf, void *data) {
484 pattern = (char *)data;
486 /* Only list rooms to which the user has access!! */
487 ra = CtdlRoomAccess(qrbuf, &CC->usersupp);
489 imap_mailboxname(buf, sizeof buf, qrbuf);
490 if (imap_mailbox_matches_pattern(pattern, buf)) {
491 cprintf("* LSUB (\\NoInferiors) \"|\" ");
500 * Implements the LSUB command
502 * FIXME: Handle wildcards, please.
504 void imap_lsub(int num_parms, char *parms[]) {
507 cprintf("%s BAD arguments invalid\r\n", parms[0]);
510 sprintf(pattern, "%s%s", parms[2], parms[3]);
512 if (strlen(parms[3])==0) {
513 cprintf("* LIST (\\Noselect) \"|\" \"\"\r\n");
517 imap_list_floors("LSUB", pattern);
518 ForEachRoom(imap_lsub_listroom, pattern);
521 cprintf("%s OK LSUB completed\r\n", parms[0]);
527 * Back end for imap_list()
529 void imap_list_listroom(struct quickroom *qrbuf, void *data) {
534 pattern = (char *)data;
536 /* Only list rooms to which the user has access!! */
537 ra = CtdlRoomAccess(qrbuf, &CC->usersupp);
539 || ((ra & UA_GOTOALLOWED) && (ra & UA_ZAPPED))) {
540 imap_mailboxname(buf, sizeof buf, qrbuf);
541 if (imap_mailbox_matches_pattern(pattern, buf)) {
542 cprintf("* LIST (\\NoInferiors) \"|\" ");
551 * Implements the LIST command
553 * FIXME: Handle wildcards, please.
555 void imap_list(int num_parms, char *parms[]) {
558 cprintf("%s BAD arguments invalid\r\n", parms[0]);
561 sprintf(pattern, "%s%s", parms[2], parms[3]);
563 if (strlen(parms[3])==0) {
564 cprintf("* LIST (\\Noselect) \"|\" \"\"\r\n");
568 imap_list_floors("LIST", pattern);
569 ForEachRoom(imap_list_listroom, pattern);
572 cprintf("%s OK LIST completed\r\n", parms[0]);
578 * Implements the CREATE command
581 void imap_create(int num_parms, char *parms[]) {
583 char roomname[ROOMNAMELEN];
588 ret = imap_roomname(roomname, sizeof roomname, parms[2]);
590 cprintf("%s NO Invalid mailbox name or location\r\n",
594 floornum = ( ret & 0x00ff ); /* lower 8 bits = floor number */
595 flags = ( ret & 0xff00 ); /* upper 8 bits = flags */
597 if (flags & IR_MAILBOX) {
598 newroomtype = 4; /* private mailbox */
601 newroomtype = 0; /* public folder */
604 lprintf(7, "Create new room <%s> on floor <%d> with type <%d>\n",
605 roomname, floornum, newroomtype);
607 ret = create_room(roomname, newroomtype, "", floornum, 1);
609 cprintf("%s NO Mailbox already exists, or create failed\r\n",
613 cprintf("%s OK CREATE completed\r\n", parms[0]);
619 * Locate a room by its IMAP folder name, and check access to it
621 int imap_grabroom(char *returned_roomname, char *foldername) {
623 char augmented_roomname[ROOMNAMELEN];
624 char roomname[ROOMNAMELEN];
626 struct quickroom QRscratch;
630 ret = imap_roomname(roomname, sizeof roomname, foldername);
635 /* First try a regular match */
636 c = getroom(&QRscratch, roomname);
638 /* Then try a mailbox name match */
640 MailboxName(augmented_roomname, &CC->usersupp, roomname);
641 c = getroom(&QRscratch, augmented_roomname);
643 strcpy(roomname, augmented_roomname);
646 /* If the room exists, check security/access */
648 /* See if there is an existing user/room relationship */
649 ra = CtdlRoomAccess(&QRscratch, &CC->usersupp);
651 /* normal clients have to pass through security */
657 /* Fail here if no such room */
659 strcpy(returned_roomname, "");
663 strcpy(returned_roomname, QRscratch.QRname);
670 * Implements the STATUS command (sort of)
673 void imap_status(int num_parms, char *parms[]) {
675 char roomname[ROOMNAMELEN];
677 char savedroom[ROOMNAMELEN];
680 ret = imap_grabroom(roomname, parms[2]);
682 cprintf("%s NO Invalid mailbox name or location, or access denied\r\n",
688 * usergoto() formally takes us to the desired room, happily returning
689 * the number of messages and number of new messages. (If another
690 * folder is selected, save its name so we can return there!!!!!)
692 if (IMAP->selected) {
693 strcpy(savedroom, CC->quickroom.QRname);
695 usergoto(roomname, 0, &msgs, &new);
698 * Tell the client what it wants to know. In fact, tell it *more* than
699 * it wants to know. We happily IGnore the supplied status data item
700 * names and simply spew all possible data items. It's far easier to
701 * code and probably saves us some processing time too.
703 * FIXME we need to implement RECENT and UNSEEN eventually...
706 imap_mailboxname(buf, sizeof buf, &CC->quickroom);
707 cprintf("* STATUS ");
709 cprintf(" (MESSAGES %d RECENT 0 UIDNEXT %ld "
710 "UIDVALIDITY 0 UNSEEN 0)\r\n",
712 CitControl.MMhighest + 1
716 * If another folder is selected, go back to that room so we can resume
717 * our happy day without violent explosions.
719 if (IMAP->selected) {
720 usergoto(savedroom, 0, &msgs, &new);
724 * Oooh, look, we're done!
726 cprintf("%s OK STATUS completed\r\n", parms[0]);
732 * Implements the SUBSCRIBE command
735 void imap_subscribe(int num_parms, char *parms[]) {
737 char roomname[ROOMNAMELEN];
738 char savedroom[ROOMNAMELEN];
741 ret = imap_grabroom(roomname, parms[2]);
743 cprintf("%s NO Invalid mailbox name or location, or access denied\r\n",
749 * usergoto() formally takes us to the desired room, which has the side
750 * effect of marking the room as not-zapped ... exactly the effect
753 if (IMAP->selected) {
754 strcpy(savedroom, CC->quickroom.QRname);
756 usergoto(roomname, 0, &msgs, &new);
759 * If another folder is selected, go back to that room so we can resume
760 * our happy day without violent explosions.
762 if (IMAP->selected) {
763 usergoto(savedroom, 0, &msgs, &new);
766 cprintf("%s OK SUBSCRIBE completed\r\n", parms[0]);
771 * Implements the UNSUBSCRIBE command
774 void imap_unsubscribe(int num_parms, char *parms[]) {
776 char roomname[ROOMNAMELEN];
777 char savedroom[ROOMNAMELEN];
780 ret = imap_grabroom(roomname, parms[2]);
782 cprintf("%s NO Invalid mailbox name or location, or access denied\r\n",
788 * usergoto() formally takes us to the desired room.
790 if (IMAP->selected) {
791 strcpy(savedroom, CC->quickroom.QRname);
793 usergoto(roomname, 0, &msgs, &new);
796 * Now make the API call to zap the room
798 if (CtdlForgetThisRoom() == 0) {
799 cprintf("%s OK UNSUBSCRIBE completed\r\n", parms[0]);
802 cprintf("%s NO You may not unsubscribe from this folder.\r\n",
807 * If another folder is selected, go back to that room so we can resume
808 * our happy day without violent explosions.
810 if (IMAP->selected) {
811 usergoto(savedroom, 0, &msgs, &new);
818 * Implements the DELETE command
821 void imap_delete(int num_parms, char *parms[]) {
823 char roomname[ROOMNAMELEN];
824 char savedroom[ROOMNAMELEN];
827 ret = imap_grabroom(roomname, parms[2]);
829 cprintf("%s NO Invalid mailbox name, or access denied\r\n",
835 * usergoto() formally takes us to the desired room, happily returning
836 * the number of messages and number of new messages. (If another
837 * folder is selected, save its name so we can return there!!!!!)
839 if (IMAP->selected) {
840 strcpy(savedroom, CC->quickroom.QRname);
842 usergoto(roomname, 0, &msgs, &new);
845 * Now delete the room.
847 if (CtdlDoIHavePermissionToDeleteThisRoom(&CC->quickroom)) {
848 cprintf("%s OK DELETE completed\r\n", parms[0]);
849 delete_room(&CC->quickroom);
852 cprintf("%s NO Can't delete this folder.\r\n", parms[0]);
856 * If another folder is selected, go back to that room so we can resume
857 * our happy day without violent explosions.
859 if (IMAP->selected) {
860 usergoto(savedroom, 0, &msgs, &new);
867 * Implements the RENAME command
870 void imap_rename(int num_parms, char *parms[]) {
871 cprintf("%s NO The RENAME command is not yet implemented (FIXME)\r\n",
878 * Main command loop for IMAP sessions.
880 void imap_command_loop(void) {
886 memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
887 if (client_gets(cmdbuf) < 1) {
888 lprintf(3, "IMAP socket is broken. Ending session.\r\n");
893 lprintf(5, "citserver[%3d]: %s\r\n", CC->cs_pid, cmdbuf);
894 while (strlen(cmdbuf) < 5) strcat(cmdbuf, " ");
897 /* strip off l/t whitespace and CRLF */
898 if (cmdbuf[strlen(cmdbuf)-1]=='\n') cmdbuf[strlen(cmdbuf)-1]=0;
899 if (cmdbuf[strlen(cmdbuf)-1]=='\r') cmdbuf[strlen(cmdbuf)-1]=0;
902 /* If we're in the middle of a multi-line command, handle that */
903 if (IMAP->authstate == imap_as_expecting_username) {
904 imap_auth_login_user(cmdbuf);
907 if (IMAP->authstate == imap_as_expecting_password) {
908 imap_auth_login_pass(cmdbuf);
913 /* Ok, at this point we're in normal command mode. The first thing
914 * we do is print any incoming pages (yeah! we really do!)
916 imap_print_express_messages();
919 * Before processing the command that was just entered... if we happen
920 * to have a folder selected, we'd like to rescan that folder for new
921 * messages, and for deletions/changes of existing messages. This
922 * could probably be optimized somehow, but IMAP sucks...
924 if (IMAP->selected) {
925 imap_rescan_msgids();
928 /* Now for the command set. */
930 /* Grab the tag, command, and parameters. Check syntax. */
931 num_parms = imap_parameterize(parms, cmdbuf);
933 cprintf("BAD syntax error\r\n");
936 /* The commands below may be executed in any state */
938 else if ( (!strcasecmp(parms[1], "NOOP"))
939 || (!strcasecmp(parms[1], "CHECK")) ) {
940 cprintf("%s OK This command successfully did nothing.\r\n",
944 else if (!strcasecmp(parms[1], "LOGOUT")) {
945 cprintf("* BYE %s logging out\r\n", config.c_fqdn);
946 cprintf("%s OK thank you for using Citadel IMAP\r\n", parms[0]);
951 else if (!strcasecmp(parms[1], "LOGIN")) {
952 imap_login(num_parms, parms);
955 else if (!strcasecmp(parms[1], "AUTHENTICATE")) {
956 imap_authenticate(num_parms, parms);
959 else if (!strcasecmp(parms[1], "CAPABILITY")) {
960 imap_capability(num_parms, parms);
963 else if (!CC->logged_in) {
964 cprintf("%s BAD Not logged in.\r\n", parms[0]);
967 /* The commans below require a logged-in state */
969 else if (!strcasecmp(parms[1], "SELECT")) {
970 imap_select(num_parms, parms);
973 else if (!strcasecmp(parms[1], "EXAMINE")) {
974 imap_select(num_parms, parms);
977 else if (!strcasecmp(parms[1], "LSUB")) {
978 imap_lsub(num_parms, parms);
981 else if (!strcasecmp(parms[1], "LIST")) {
982 imap_list(num_parms, parms);
985 else if (!strcasecmp(parms[1], "CREATE")) {
986 imap_create(num_parms, parms);
989 else if (!strcasecmp(parms[1], "DELETE")) {
990 imap_delete(num_parms, parms);
993 else if (!strcasecmp(parms[1], "RENAME")) {
994 imap_rename(num_parms, parms);
997 else if (!strcasecmp(parms[1], "STATUS")) {
998 imap_status(num_parms, parms);
1001 else if (!strcasecmp(parms[1], "SUBSCRIBE")) {
1002 imap_subscribe(num_parms, parms);
1005 else if (!strcasecmp(parms[1], "UNSUBSCRIBE")) {
1006 imap_unsubscribe(num_parms, parms);
1009 else if (!strcasecmp(parms[1], "APPEND")) {
1010 imap_append(num_parms, parms);
1013 else if (IMAP->selected == 0) {
1014 cprintf("%s BAD no folder selected\r\n", parms[0]);
1017 /* The commands below require the SELECT state on a mailbox */
1019 else if (!strcasecmp(parms[1], "FETCH")) {
1020 imap_fetch(num_parms, parms);
1023 else if ( (!strcasecmp(parms[1], "UID"))
1024 && (!strcasecmp(parms[2], "FETCH")) ) {
1025 imap_uidfetch(num_parms, parms);
1028 else if (!strcasecmp(parms[1], "SEARCH")) {
1029 imap_search(num_parms, parms);
1032 else if ( (!strcasecmp(parms[1], "UID"))
1033 && (!strcasecmp(parms[2], "SEARCH")) ) {
1034 imap_uidsearch(num_parms, parms);
1037 else if (!strcasecmp(parms[1], "STORE")) {
1038 imap_store(num_parms, parms);
1041 else if ( (!strcasecmp(parms[1], "UID"))
1042 && (!strcasecmp(parms[2], "STORE")) ) {
1043 imap_uidstore(num_parms, parms);
1046 else if (!strcasecmp(parms[1], "COPY")) {
1047 imap_copy(num_parms, parms);
1050 else if ( (!strcasecmp(parms[1], "UID"))
1051 && (!strcasecmp(parms[2], "COPY")) ) {
1052 imap_uidcopy(num_parms, parms);
1055 else if (!strcasecmp(parms[1], "EXPUNGE")) {
1056 imap_expunge(num_parms, parms);
1059 else if (!strcasecmp(parms[1], "CLOSE")) {
1060 imap_close(num_parms, parms);
1063 /* End of commands. If we get here, the command is either invalid
1068 cprintf("%s BAD command unrecognized\r\n", parms[0]);
1071 /* If the client transmitted a message we can free it now */
1072 imap_free_transmitted_message();
1078 * This function is called by dynloader.c to register the IMAP module
1079 * with the Citadel server.
1081 char *Dynamic_Module_Init(void)
1083 SYM_IMAP = CtdlGetDynamicSymbol();
1084 CtdlRegisterServiceHook(config.c_imap_port,
1088 CtdlRegisterSessionHook(imap_cleanup_function, EVT_STOP);