Modified the behavior of ForEachUser() to do the two phase load/perform cycle
[citadel.git] / citadel / user_ops.h
index 9054665d100ae25a829c7090bc19876dbb97af4d..f58ec1bb6489cfbdfa5c1dfefc2598d58742ee1e 100644 (file)
@@ -1,44 +1,75 @@
+/* 
+ * Header file for server functions which perform operations on user objects.
+ *
+ * Copyright (c) 1987-2019 by the citadel.org team
+ *
+ * This program is open source software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __USER_OPS_H__
+#define __USER_OPS_H__
+
+#include <ctype.h>
+#include <syslog.h>
+
 int hash (char *str);
-int getuser (struct usersupp *usbuf, char *name);
-int lgetuser (struct usersupp *usbuf, char *name);
-void putuser (struct usersupp *usbuf, char *name);
-void lputuser (struct usersupp *usbuf, char *name);
 int is_aide (void);
 int is_room_aide (void);
-int getuserbynumber (struct usersupp *usbuf, long int number);
-void cmd_user (char *cmdbuf);
+int CtdlCheckInternetMailPermission(struct ctdluser *who);
+void rebuild_usersbynumber(void);
 void session_startup (void);
-void logout (struct CitContext *who);
-void cmd_pass (char *buf);
+void logged_in_response(void);
 int purge_user (char *pname);
-int create_user (char *newusername);
-void cmd_newu (char *cmdbuf);
-void cmd_setp (char *new_pw);
-void cmd_getu (void);
-void cmd_setu (char *new_parms);
-void cmd_slrp (char *new_ptr);
-void cmd_invt_kick (char *iuser, int op);
-void cmd_forg (void);
-void cmd_gnur (void);
-void cmd_greg (char *who);
-void cmd_vali (char *v_args);
-void ForEachUser(void (*CallBack)(struct usersupp *EachUser));
-void ListThisUser(struct usersupp *usbuf);
-void cmd_list (void);
-void cmd_regi (void);
-void cmd_chek (void);
-void cmd_qusr (char *who);
-void cmd_ebio (void);
-void cmd_rbio (char *cmdbuf);
-void cmd_lbio (void);
-void cmd_agup (char *cmdbuf);
-void cmd_asup (char *cmdbuf);
+int getuserbyuid(struct ctdluser *usbuf, uid_t number);
+
+int create_user(char *newusername, int become_user, uid_t uid);
+enum {
+       CREATE_USER_DO_NOT_BECOME_USER,
+       CREATE_USER_BECOME_USER
+};
+#define NATIVE_AUTH_UID (-1)
+
+void do_login(void);
+int CtdlInvtKick(char *iuser, int op);
+void ForEachUser(void (*CallBack) (char *, void *out_data), void *in_data);
 int NewMailCount(void);
-void CtdlGetRelationship(struct visit *vbuf,
-                        struct usersupp *rel_user,
-                        struct quickroom *rel_room);
-void CtdlSetRelationship(struct visit *newvisit,
-                        struct usersupp *rel_user,
-                        struct quickroom *rel_room);
-void MailboxName(char *buf, struct usersupp *who, char *prefix);
-void PurgeStaleRelationships(void);
+int InitialMailCheck(void);
+void put_visit(visit *newvisit);
+/* MailboxName is deprecated us CtdlMailboxName instead */
+void MailboxName(char *buf, size_t n, const struct ctdluser *who,
+                const char *prefix) __attribute__ ((deprecated));
+int GenerateRelationshipIndex(  char *IndexBuf,
+                                long RoomID,
+                                long RoomGen,
+                                long UserID);
+int CtdlAssociateSystemUser(char *screenname, char *loginname);
+
+
+
+
+void CtdlSetPassword(char *new_pw);
+
+int CtdlForgetThisRoom(void);
+
+void cmd_newu (char *cmdbuf);
+void start_chkpwd_daemon(void);
+
+
+#define RENAMEUSER_OK                  0       /* Operation succeeded */
+#define RENAMEUSER_LOGGED_IN           1       /* Cannot rename a user who is currently logged in */
+#define RENAMEUSER_NOT_FOUND           2       /* The old user name does not exist */
+#define RENAMEUSER_ALREADY_EXISTS      3       /* An account with the desired new name already exists */
+
+int rename_user(char *oldname, char *newname);
+
+long cutusername(char *username);
+void makeuserkey(char *key, const char *username, long len);
+int internal_create_user(char *username, struct ctdluser *usbuf, uid_t uid);
+
+#endif