]> code.citadel.org Git - citadel.git/blobdiff - citadel/user_ops.c
* Every user gets a Trash folder. Clients can also use _TRASH_
[citadel.git] / citadel / user_ops.c
index a9757e2dbdc4cb586c22c1bce6f38d9d1141cbac..1fb0936e629a818857b1cfc6cfdd58a5e9a0c7eb 100644 (file)
@@ -489,6 +489,7 @@ void session_startup(void)
         */
        create_room(MAILROOM, 4, "", 0, 1, 0, VIEW_MAILBOX);
        create_room(SENTITEMS, 4, "", 0, 1, 0, VIEW_MAILBOX);
+       create_room(USERTRASHROOM, 4, "", 0, 1, 0, VIEW_MAILBOX);
 
        /* Run any startup routines registered by loadable modules */
        PerformSessionHooks(EVT_LOGIN);
@@ -589,8 +590,8 @@ static int validpw(uid_t uid, const char *pass)
                }
                close(pipev[0]);
 
-               execl(BBSDIR "/chkpwd", BBSDIR "/chkpwd", NULL);
-               perror(BBSDIR "/chkpwd");
+               execl(CTDLDIR "/chkpwd", CTDLDIR "/chkpwd", NULL);
+               perror(CTDLDIR "/chkpwd");
                exit(1);
        }
 
@@ -646,10 +647,10 @@ int CtdlTryPassword(char *password)
 
 
 #ifdef ENABLE_AUTOLOGIN
-       /* A uid of BBSUID or -1 indicates that this user exists only in
+       /* A uid of CTDLUID or -1 indicates that this user exists only in
         * Citadel, not in the underlying operating system.
         */
-       if ( (CC->user.uid == BBSUID) || (CC->user.uid == (-1)) ) {
+       if ( (CC->user.uid == CTDLUID) || (CC->user.uid == (-1)) ) {
                strproc(password);
                strproc(CC->user.password);
                code = strcasecmp(CC->user.password, password);
@@ -756,11 +757,23 @@ int purge_user(char pname[])
        cdb_delete(CDB_USERS, usernamekey, strlen(usernamekey));
 
        /* remove the user's bio file */
-       snprintf(filename, sizeof filename, "./bio/%ld", usbuf.usernum);
+       snprintf(filename, sizeof filename, 
+#ifndef HAVE_DATA_DIR
+                        "."
+#else
+                        DATA_DIR
+#endif
+                        "/bio/%ld", usbuf.usernum);
        unlink(filename);
 
        /* remove the user's picture */
-       snprintf(filename, sizeof filename, "./userpics/%ld.gif", usbuf.usernum);
+       snprintf(filename, sizeof filename, 
+#ifndef HAVE_DATA_DIR
+                        "."
+#else
+                        DATA_DIR
+#endif
+                        "/userpics/%ld.gif", usbuf.usernum);
        unlink(filename);
 
        return (0);
@@ -938,7 +951,7 @@ void cmd_setp(char *new_pw)
        if (CtdlAccessCheck(ac_logged_in)) {
                return;
        }
-       if ( (CC->user.uid != BBSUID) && (CC->user.uid != (-1)) ) {
+       if ( (CC->user.uid != CTDLUID) && (CC->user.uid != (-1)) ) {
                cprintf("%d Not allowed.  Use the 'passwd' command.\n", ERROR + NOT_HERE);
                return;
        }
@@ -1099,7 +1112,8 @@ void cmd_seen(char *argbuf) {
        target_msgnum = extract_long(argbuf, 0);
        target_setting = extract_int(argbuf, 1);
 
-       CtdlSetSeen(target_msgnum, target_setting, ctdlsetseen_seen);
+       CtdlSetSeen(&target_msgnum, 1, target_setting,
+                       ctdlsetseen_seen, NULL, NULL);
        cprintf("%d OK\n", CIT_OK);
 }
 
@@ -1355,6 +1369,13 @@ void ForEachUser(void (*CallBack) (struct ctdluser * EachUser, void *out_data),
  */
 void ListThisUser(struct ctdluser *usbuf, void *data)
 {
+       char *searchstring;
+
+       searchstring = (char *)data;
+       if (bmstrcasestr(usbuf->fullname, searchstring) == NULL) {
+               return;
+       }
+
        if (usbuf->axlevel > 0) {
                if ((CC->user.axlevel >= 6)
                    || ((usbuf->flags & US_UNLISTED) == 0)
@@ -1374,12 +1395,15 @@ void ListThisUser(struct ctdluser *usbuf, void *data)
 }
 
 /* 
- *  List users
+ *  List users (searchstring may be empty to list all users)
  */
-void cmd_list(void)
+void cmd_list(char *cmdbuf)
 {
+       char searchstring[256];
+       extract_token(searchstring, cmdbuf, 0, '|', sizeof searchstring);
+       striplt(searchstring);
        cprintf("%d \n", LISTING_FOLLOWS);
-       ForEachUser(ListThisUser, NULL);
+       ForEachUser(ListThisUser, (void *)searchstring );
        cprintf("000\n");
 }