From: Art Cancro Date: Sun, 25 Jun 2000 22:54:48 +0000 (+0000) Subject: * imap X-Git-Tag: v7.86~7177 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=b4ae16dc2b9a09cfdf2839494daf126c6e9e46c0;p=citadel.git * imap --- diff --git a/citadel/msgbase.c b/citadel/msgbase.c index 8b3fac01d..5be0bcf3b 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -104,13 +104,16 @@ int alias(char *name) int a, b; char aaa[300], bbb[300]; + TRACE; remove_any_whitespace_to_the_left_or_right_of_at_symbol(name); + TRACE; fp = fopen("network/mail.aliases", "r"); if (fp == NULL) fp = fopen("/dev/null", "r"); if (fp == NULL) return (MES_ERROR); + TRACE; strcpy(aaa, ""); strcpy(bbb, ""); while (fgets(aaa, sizeof aaa, fp) != NULL) { @@ -127,6 +130,7 @@ int alias(char *name) if (!strcasecmp(name, aaa)) strcpy(name, bbb); } + TRACE; fclose(fp); lprintf(7, "Mail is being forwarded to %s\n", name); @@ -141,15 +145,18 @@ int alias(char *name) } /* determine local or remote type, see citadel.h */ + TRACE; for (a = 0; a < strlen(name); ++a) if (name[a] == '!') return (MES_INTERNET); + TRACE; for (a = 0; a < strlen(name); ++a) if (name[a] == '@') for (b = a; b < strlen(name); ++b) if (name[b] == '.') return (MES_INTERNET); b = 0; + TRACE; for (a = 0; a < strlen(name); ++a) if (name[a] == '@') ++b; @@ -169,6 +176,7 @@ int alias(char *name) GETSN: do { a = getstring(fp, aaa); } while ((a >= 0) && (strcasecmp(aaa, bbb))); + TRACE; a = getstring(fp, aaa); if (!strncmp(aaa, "use ", 4)) { strcpy(bbb, &aaa[4]); @@ -176,6 +184,7 @@ GETSN: do { goto GETSN; } fclose(fp); + TRACE; if (!strncmp(aaa, "uum", 3)) { strcpy(bbb, name); for (a = 0; a < strlen(bbb); ++a) { @@ -209,6 +218,7 @@ GETSN: do { } return (MES_ERROR); } + TRACE; lprintf(9, "returning MES_LOCAL\n"); return (MES_LOCAL); } diff --git a/citadel/room_ops.c b/citadel/room_ops.c index 9219639c6..7cfb9b461 100644 --- a/citadel/room_ops.c +++ b/citadel/room_ops.c @@ -603,7 +603,7 @@ void cmd_lzrm(char *argbuf) -void usergoto(char *where, int display_result) +void usergoto(char *where, int display_result, int *retmsgs, int *retnew) { int a; int new_messages = 0; @@ -675,6 +675,9 @@ void usergoto(char *where, int display_result) strcpy(truncated_roomname, &truncated_roomname[11]); } + if (retmsgs != NULL) *retmsgs = total_messages; + if (retnew != NULL) *retnew = new_messages; + if (display_result) cprintf("%d%c%s|%d|%d|%d|%d|%ld|%ld|%d|%d|%d|%d\n", OK, CtdlCheckExpress(), @@ -735,7 +738,7 @@ void cmd_goto(char *gargs) /* let internal programs go directly to any room */ if (CC->internal_pgm) { - usergoto(towhere, 1); + usergoto(towhere, 1, NULL, NULL); return; } @@ -760,7 +763,7 @@ void cmd_goto(char *gargs) ((ra & UA_KNOWN) == 0)) { goto NOPE; } else { - usergoto(towhere, 1); + usergoto(towhere, 1, NULL, NULL); return; } } @@ -1148,7 +1151,7 @@ void cmd_kill(char *argbuf) if (kill_ok) { strcpy(deleted_room_name, CC->quickroom.QRname); delete_room(&CC->quickroom); /* Do the dirty work */ - usergoto(BASEROOM, 0); /* Return to the Lobby */ + usergoto(BASEROOM, 0, NULL, NULL); /* Return to the Lobby */ /* tell the world what we did */ sprintf(aaa, "%s> killed by %s\n", diff --git a/citadel/room_ops.h b/citadel/room_ops.h index ec2e9d146..aee21030f 100644 --- a/citadel/room_ops.h +++ b/citadel/room_ops.h @@ -21,7 +21,7 @@ void cmd_lkra (char *argbuf); void cmd_lkrn (char *argbuf); void cmd_lkro (char *argbuf); void cmd_lzrm (char *argbuf); -void usergoto (char *where, int display_result); +void usergoto (char *where, int display_result, int *msgs, int *new); void cmd_goto (char *gargs); void cmd_whok (void); void cmd_rdir (void); diff --git a/citadel/serv_imap.c b/citadel/serv_imap.c index 87bf09e53..42c8f890d 100644 --- a/citadel/serv_imap.c +++ b/citadel/serv_imap.c @@ -118,6 +118,7 @@ void imap_select(char *tag, char *cmd, char *parms) { int ok = 0; int ra = 0; struct quickroom QRscratch; + int msgs, new; extract_token(towhere, parms, 0, ' '); @@ -155,7 +156,15 @@ void imap_select(char *tag, char *cmd, char *parms) { return; } - /* FIXME */ + /* + * usergoto() formally takes us to the desired room, happily returning + * the number of messages and number of new messages. + */ + usergoto(augmented_roomname, 0, &msgs, &new); + + cprintf("* %d EXISTS\r\n", msgs); + cprintf("* %d RECENT\r\n", new); + cprintf("* OK [UIDVALIDITY 0] UIDs valid\r\n"); cprintf("%s OK [FIXME] SELECT completed\r\n", tag); } @@ -237,7 +246,7 @@ void imap_command_loop(void) { char *Dynamic_Module_Init(void) { SYM_IMAP = CtdlGetDynamicSymbol(); - CtdlRegisterServiceHook(1143, /* FIXME put in config setup */ + CtdlRegisterServiceHook(2243, /* FIXME put in config setup */ NULL, imap_greeting, imap_command_loop); diff --git a/citadel/user_ops.c b/citadel/user_ops.c index 5b2e47767..44e11dbe5 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -354,7 +354,7 @@ void session_startup(void) { /* Run any cleanup routines registered by loadable modules */ PerformSessionHooks(EVT_LOGIN); - usergoto(BASEROOM,0); /* Enter the lobby */ + usergoto(BASEROOM, 0, NULL, NULL); /* Enter the lobby */ rec_log(CL_LOGIN,CC->curr_user); } @@ -896,7 +896,7 @@ void cmd_forg(void) { CtdlSetRelationship(&vbuf, &CC->usersupp, &CC->quickroom); lputuser(&CC->usersupp); cprintf("%d Ok\n",OK); - usergoto(BASEROOM, 0); + usergoto(BASEROOM, 0, NULL, NULL); } /*