* imap
authorArt Cancro <ajc@citadel.org>
Sun, 25 Jun 2000 22:54:48 +0000 (22:54 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 25 Jun 2000 22:54:48 +0000 (22:54 +0000)
citadel/msgbase.c
citadel/room_ops.c
citadel/room_ops.h
citadel/serv_imap.c
citadel/user_ops.c

index 8b3fac01db3de576cb7a2d8964caacddd3f78c09..5be0bcf3bbacc67bd94724f678b00adc1e13e568 100644 (file)
@@ -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);
 }
index 9219639c6f37f7bac2107b3091b9efa613473275..7cfb9b461ee9ec154460fab0fdbec639e1442fcc 100644 (file)
@@ -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",
index ec2e9d1467e72289bdb0826124b1db3f54565f02..aee21030f174d141563de9e41ace279c3f798294 100644 (file)
@@ -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);
index 87bf09e5389aae7a09d4a7aa3452d7d85e803f65..42c8f890dc0ffca9f5ea8134695cfd37fff585d1 100644 (file)
@@ -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);
index 5b2e4776725142dc9ba1f5ba3bf448caa54ee17b..44e11dbe52ccdc7e322f58f5c9361e4f9524854a 100644 (file)
@@ -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);
        }
 
 /*