+
+
+/*
+ * Rename a user
+ */
+void cmd_renu(char *cmdbuf)
+{
+ int retcode;
+ char oldname[USERNAME_SIZE];
+ char newname[USERNAME_SIZE];
+
+ if (CtdlAccessCheck(ac_aide)) {
+ return;
+ }
+
+ extract_token(oldname, cmdbuf, 0, '|', sizeof oldname);
+ extract_token(newname, cmdbuf, 1, '|', sizeof newname);
+
+ retcode = rename_user(oldname, newname);
+ switch(retcode) {
+ case RENAMEUSER_OK:
+ cprintf("%d '%s' has been renamed to '%s'.\n", CIT_OK, oldname, newname);
+ return;
+ case RENAMEUSER_LOGGED_IN:
+ cprintf("%d '%s' is currently logged in and cannot be renamed.\n",
+ ERROR + ALREADY_LOGGED_IN , oldname);
+ return;
+ case RENAMEUSER_NOT_FOUND:
+ cprintf("%d '%s' does not exist.\n", ERROR + NO_SUCH_USER, oldname);
+ return;
+ case RENAMEUSER_ALREADY_EXISTS:
+ cprintf("%d A user named '%s' already exists.\n", ERROR + ALREADY_EXISTS, newname);
+ return;
+ }
+
+ cprintf("%d An unknown error occurred.\n", ERROR);
+}
+
+
+
+/*****************************************************************************/
+/* MODULE INITIALIZATION STUFF */
+/*****************************************************************************/
+
+
+CTDL_MODULE_INIT(user_ops)
+{
+ if (!threading) {
+ CtdlRegisterProtoHook(cmd_user, "USER", "Submit username for login");
+ CtdlRegisterProtoHook(cmd_pass, "PASS", "Complete login by submitting a password");
+ CtdlRegisterProtoHook(cmd_creu, "CREU", "Create User");
+ CtdlRegisterProtoHook(cmd_setp, "SETP", "Set the password for an account");
+ CtdlRegisterProtoHook(cmd_getu, "GETU", "Get User parameters");
+ CtdlRegisterProtoHook(cmd_setu, "SETU", "Set User parameters");
+ CtdlRegisterProtoHook(cmd_slrp, "SLRP", "Set Last Read Pointer");
+ CtdlRegisterProtoHook(cmd_invt, "INVT", "Invite a user to a room");
+ CtdlRegisterProtoHook(cmd_kick, "KICK", "Kick a user out of a room");
+ CtdlRegisterProtoHook(cmd_forg, "FORG", "Forget a room");
+ CtdlRegisterProtoHook(cmd_gnur, "GNUR", "Get Next Unregistered User");
+ CtdlRegisterProtoHook(cmd_vali, "VALI", "Validate new users");
+ CtdlRegisterProtoHook(cmd_list, "LIST", "List users");
+ CtdlRegisterProtoHook(cmd_chek, "CHEK", "assorted info we need to check at login");
+ CtdlRegisterProtoHook(cmd_qusr, "QUSR", "check to see if a user exists");
+ CtdlRegisterProtoHook(cmd_agup, "AGUP", "Administratively Get User Parameters");
+ CtdlRegisterProtoHook(cmd_asup, "ASUP", "Administratively Set User Parameters");
+ CtdlRegisterProtoHook(cmd_seen, "SEEN", "Manipulate seen/unread message flags");
+ CtdlRegisterProtoHook(cmd_gtsn, "GTSN", "Fetch seen/unread message flags");
+ CtdlRegisterProtoHook(cmd_view, "VIEW", "Set preferred view for user/room combination");
+ CtdlRegisterProtoHook(cmd_renu, "RENU", "Rename a user");
+ CtdlRegisterProtoHook(cmd_newu, "NEWU", "Log in as a new user");
+ }
+ /* return our Subversion id for the Log */
+ return "user_ops";
+}