51ea437b7241951c9c7fb7bffe77c8178ddbe421
[citadel.git] / citadel / modules / ctdlproto / serv_user.c
1 /* 
2  * Server functions which perform operations on user objects.
3  *
4  * Copyright (c) 1987-2015 by the citadel.org team
5  *
6  * This program is open source software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License, version 3.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  */
14
15 #include "support.h"
16 #include "control.h"
17 #include "ctdl_module.h"
18 #include "citserver.h"
19 #include "config.h"
20 #include "user_ops.h"
21 #include "internet_addressing.h"
22
23
24 /*
25  * USER cmd
26  */
27 void cmd_user(char *cmdbuf)
28 {
29         char username[256];
30         int a;
31
32         CON_syslog(LOG_DEBUG, "cmd_user(%s)\n", cmdbuf);
33         extract_token(username, cmdbuf, 0, '|', sizeof username);
34         CON_syslog(LOG_DEBUG, "username: %s\n", username);
35         striplt(username);
36         CON_syslog(LOG_DEBUG, "username: %s\n", username);
37
38         a = CtdlLoginExistingUser(NULL, username);
39         switch (a) {
40         case login_already_logged_in:
41                 cprintf("%d Already logged in.\n", ERROR + ALREADY_LOGGED_IN);
42                 return;
43         case login_too_many_users:
44                 cprintf("%d %s: "
45                         "Too many users are already online "
46                         "(maximum is %d)\n",
47                         ERROR + MAX_SESSIONS_EXCEEDED,
48                         CtdlGetConfigStr("c_nodename"), CtdlGetConfigInt("c_maxsessions"));
49                 return;
50         case login_ok:
51                 cprintf("%d Password required for %s\n",
52                         MORE_DATA, CC->curr_user);
53                 return;
54         case login_not_found:
55                 cprintf("%d %s not found.\n", ERROR + NO_SUCH_USER, username);
56                 return;
57         default:
58                 cprintf("%d Internal error\n", ERROR + INTERNAL_ERROR);
59         }
60 }
61
62
63 void cmd_pass(char *buf)
64 {
65         char password[SIZ];
66         int a;
67         long len;
68
69         memset(password, 0, sizeof(password));
70         len = extract_token(password, buf, 0, '|', sizeof password);
71         a = CtdlTryPassword(password, len);
72
73         switch (a) {
74         case pass_already_logged_in:
75                 cprintf("%d Already logged in.\n", ERROR + ALREADY_LOGGED_IN);
76                 return;
77         case pass_no_user:
78                 cprintf("%d You must send a name with USER first.\n",
79                         ERROR + USERNAME_REQUIRED);
80                 return;
81         case pass_wrong_password:
82                 cprintf("%d Wrong password.\n", ERROR + PASSWORD_REQUIRED);
83                 return;
84         case pass_ok:
85                 logged_in_response();
86                 return;
87         }
88 }
89
90
91 /*
92  * cmd_newu()  -  create a new user account and log in as that user
93  */
94 void cmd_newu(char *cmdbuf)
95 {
96         int a;
97         long len;
98         char username[SIZ];
99
100         if (CtdlGetConfigInt("c_auth_mode") != AUTHMODE_NATIVE) {
101                 cprintf("%d This system does not use native mode authentication.\n",
102                         ERROR + NOT_HERE);
103                 return;
104         }
105
106         if (CtdlGetConfigInt("c_disable_newu")) {
107                 cprintf("%d Self-service user account creation "
108                         "is disabled on this system.\n", ERROR + NOT_HERE);
109                 return;
110         }
111
112         if (CC->logged_in) {
113                 cprintf("%d Already logged in.\n", ERROR + ALREADY_LOGGED_IN);
114                 return;
115         }
116         if (CC->nologin) {
117                 cprintf("%d %s: Too many users are already online (maximum is %d)\n",
118                         ERROR + MAX_SESSIONS_EXCEEDED,
119                         CtdlGetConfigStr("c_nodename"), CtdlGetConfigInt("c_maxsessions"));
120                 return;
121         }
122         extract_token(username, cmdbuf, 0, '|', sizeof username);
123         strproc(username);
124         len = cutuserkey(username);
125
126         if (IsEmptyStr(username)) {
127                 cprintf("%d You must supply a user name.\n", ERROR + USERNAME_REQUIRED);
128                 return;
129         }
130
131         if ((!strcasecmp(username, "bbs")) ||
132             (!strcasecmp(username, "new")) ||
133             (!strcasecmp(username, "."))) {
134                 cprintf("%d '%s' is an invalid login name.\n", ERROR + ILLEGAL_VALUE, username);
135                 return;
136         }
137
138         a = create_user(username, len, 1);
139
140         if (a == 0) {
141                 logged_in_response();
142         } else if (a == ERROR + ALREADY_EXISTS) {
143                 cprintf("%d '%s' already exists.\n",
144                         ERROR + ALREADY_EXISTS, username);
145                 return;
146         } else if (a == ERROR + INTERNAL_ERROR) {
147                 cprintf("%d Internal error - user record disappeared?\n",
148                         ERROR + INTERNAL_ERROR);
149                 return;
150         } else {
151                 cprintf("%d unknown error\n", ERROR + INTERNAL_ERROR);
152         }
153 }
154
155 /*
156  * set password - citadel protocol implementation
157  */
158 void cmd_setp(char *new_pw)
159 {
160         if (CtdlAccessCheck(ac_logged_in)) {
161                 return;
162         }
163         if ( (CC->user.uid != CTDLUID) && (CC->user.uid != (-1)) ) {
164                 cprintf("%d Not allowed.  Use the 'passwd' command.\n", ERROR + NOT_HERE);
165                 return;
166         }
167         if (CC->is_master) {
168                 cprintf("%d The master prefix password cannot be changed with this command.\n",
169                         ERROR + NOT_HERE);
170                 return;
171         }
172
173         if (!strcasecmp(new_pw, "GENERATE_RANDOM_PASSWORD")) {
174                 char random_password[17];
175                 snprintf(random_password, sizeof random_password, "%08lx%08lx", random(), random());
176                 CtdlSetPassword(random_password);
177                 cprintf("%d %s\n", CIT_OK, random_password);
178         }
179         else {
180                 strproc(new_pw);
181                 if (IsEmptyStr(new_pw)) {
182                         cprintf("%d Password unchanged.\n", CIT_OK);
183                         return;
184                 }
185                 CtdlSetPassword(new_pw);
186                 cprintf("%d Password changed.\n", CIT_OK);
187         }
188 }
189
190
191 /*
192  * cmd_creu() - administratively create a new user account (do not log in to it)
193  */
194 void cmd_creu(char *cmdbuf)
195 {
196         int a;
197         long len;
198         char username[SIZ];
199         char password[SIZ];
200         struct ctdluser tmp;
201
202         if (CtdlAccessCheck(ac_aide)) {
203                 return;
204         }
205
206         extract_token(username, cmdbuf, 0, '|', sizeof username);
207         strproc(username);
208         strproc(password);
209         if (IsEmptyStr(username)) {
210                 cprintf("%d You must supply a user name.\n", ERROR + USERNAME_REQUIRED);
211                 return;
212         }
213         len = cutuserkey(username);
214
215
216         extract_token(password, cmdbuf, 1, '|', sizeof password);
217
218         a = create_user(username, len, 0);
219
220         if (a == 0) {
221                 if (!IsEmptyStr(password)) {
222                         CtdlGetUserLock(&tmp, username);
223                         safestrncpy(tmp.password, password, sizeof(tmp.password));
224                         CtdlPutUserLock(&tmp);
225                 }
226                 cprintf("%d User '%s' created %s.\n", CIT_OK, username,
227                                 (!IsEmptyStr(password)) ? "and password set" :
228                                 "with no password");
229                 return;
230         } else if (a == ERROR + ALREADY_EXISTS) {
231                 cprintf("%d '%s' already exists.\n", ERROR + ALREADY_EXISTS, username);
232                 return;
233         } else if ( (CtdlGetConfigInt("c_auth_mode") != AUTHMODE_NATIVE) && (a == ERROR + NO_SUCH_USER) ) {
234                 cprintf("%d User accounts are not created within Citadel in host authentication mode.\n",
235                         ERROR + NO_SUCH_USER);
236                 return;
237         } else {
238                 cprintf("%d An error occurred creating the user account.\n", ERROR + INTERNAL_ERROR);
239         }
240 }
241
242
243 /*
244  * get user parameters
245  */
246 void cmd_getu(char *cmdbuf)
247 {
248         if (CtdlAccessCheck(ac_logged_in))
249                 return;
250
251         CtdlGetUser(&CC->user, CC->curr_user);
252         cprintf("%d 80|24|%d|\n", CIT_OK, (CC->user.flags & US_USER_SET));
253 }
254
255
256 /*
257  * set user parameters
258  */
259 void cmd_setu(char *new_parms)
260 {
261         if (CtdlAccessCheck(ac_logged_in))
262                 return;
263
264         if (num_parms(new_parms) < 3) {
265                 cprintf("%d Usage error.\n", ERROR + ILLEGAL_VALUE);
266                 return;
267         }
268         CtdlLockGetCurrentUser();
269         CC->user.flags = CC->user.flags & (~US_USER_SET);
270         CC->user.flags = CC->user.flags | (extract_int(new_parms, 2) & US_USER_SET);
271         CtdlPutCurrentUserLock();
272         cprintf("%d Ok\n", CIT_OK);
273 }
274
275 /*
276  * set last read pointer
277  */
278 void cmd_slrp(char *new_ptr)
279 {
280         long newlr;
281         visit vbuf;
282         visit original_vbuf;
283
284         if (CtdlAccessCheck(ac_logged_in)) {
285                 return;
286         }
287
288         if (!strncasecmp(new_ptr, "highest", 7)) {
289                 newlr = CC->room.QRhighest;
290         } else {
291                 newlr = atol(new_ptr);
292         }
293
294         CtdlLockGetCurrentUser();
295
296         CtdlGetRelationship(&vbuf, &CC->user, &CC->room);
297         memcpy(&original_vbuf, &vbuf, sizeof(visit));
298         vbuf.v_lastseen = newlr;
299         snprintf(vbuf.v_seen, sizeof vbuf.v_seen, "*:%ld", newlr);
300
301         /* Only rewrite the record if it changed */
302         if ( (vbuf.v_lastseen != original_vbuf.v_lastseen)
303            || (strcmp(vbuf.v_seen, original_vbuf.v_seen)) ) {
304                 CtdlSetRelationship(&vbuf, &CC->user, &CC->room);
305         }
306
307         CtdlPutCurrentUserLock();
308         cprintf("%d %ld\n", CIT_OK, newlr);
309 }
310
311
312 void cmd_seen(char *argbuf) {
313         long target_msgnum = 0L;
314         int target_setting = 0;
315
316         if (CtdlAccessCheck(ac_logged_in)) {
317                 return;
318         }
319
320         if (num_parms(argbuf) != 2) {
321                 cprintf("%d Invalid parameters\n", ERROR + ILLEGAL_VALUE);
322                 return;
323         }
324
325         target_msgnum = extract_long(argbuf, 0);
326         target_setting = extract_int(argbuf, 1);
327
328         CtdlSetSeen(&target_msgnum, 1, target_setting,
329                         ctdlsetseen_seen, NULL, NULL);
330         cprintf("%d OK\n", CIT_OK);
331 }
332
333
334 void cmd_gtsn(char *argbuf) {
335         visit vbuf;
336
337         if (CtdlAccessCheck(ac_logged_in)) {
338                 return;
339         }
340
341         /* Learn about the user and room in question */
342         CtdlGetRelationship(&vbuf, &CC->user, &CC->room);
343
344         cprintf("%d ", CIT_OK);
345         client_write(vbuf.v_seen, strlen(vbuf.v_seen));
346         client_write(HKEY("\n"));
347 }
348
349 /*
350  * INVT and KICK commands
351  */
352 void cmd_invt_kick(char *iuser, int op) {
353
354         /*
355          * These commands are only allowed by admins, room admins,
356          * and room namespace owners
357          */
358         if (is_room_aide()) {
359                 /* access granted */
360         } else if ( ((atol(CC->room.QRname) == CC->user.usernum) ) && (CC->user.usernum != 0) ) {
361                 /* access granted */
362         } else {
363                 /* access denied */
364                 cprintf("%d Higher access or room ownership required.\n",
365                         ERROR + HIGHER_ACCESS_REQUIRED);
366                 return;
367         }
368
369         if (!strncasecmp(CC->room.QRname, CtdlGetConfigStr("c_baseroom"),
370                          ROOMNAMELEN)) {
371                 cprintf("%d Can't add/remove users from this room.\n",
372                         ERROR + NOT_HERE);
373                 return;
374         }
375
376         if (CtdlInvtKick(iuser, op) != 0) {
377                 cprintf("%d No such user.\n", ERROR + NO_SUCH_USER);
378                 return;
379         }
380
381         cprintf("%d %s %s %s.\n",
382                 CIT_OK, iuser,
383                 ((op == 1) ? "invited to" : "kicked out of"),
384                 CC->room.QRname);
385         return;
386 }
387
388 void cmd_invt(char *iuser) {cmd_invt_kick(iuser, 1);}
389 void cmd_kick(char *iuser) {cmd_invt_kick(iuser, 0);}
390
391
392 /*
393  * forget (Zap) the current room
394  */
395 void cmd_forg(char *argbuf)
396 {
397
398         if (CtdlAccessCheck(ac_logged_in)) {
399                 return;
400         }
401
402         if (CtdlForgetThisRoom() == 0) {
403                 cprintf("%d Ok\n", CIT_OK);
404         }
405         else {
406                 cprintf("%d You may not forget this room.\n", ERROR + NOT_HERE);
407         }
408 }
409
410 /*
411  * Get Next Unregistered User
412  */
413 void cmd_gnur(char *argbuf)
414 {
415         struct cdbdata *cdbus;
416         struct ctdluser usbuf;
417
418         if (CtdlAccessCheck(ac_aide)) {
419                 return;
420         }
421
422         if ((CtdlGetConfigInt("MMflags") & MM_VALID) == 0) {
423                 cprintf("%d There are no unvalidated users.\n", CIT_OK);
424                 return;
425         }
426
427         /* There are unvalidated users.  Traverse the user database,
428          * and return the first user we find that needs validation.
429          */
430         cdb_rewind(CDB_USERS);
431         while (cdbus = cdb_next_item(CDB_USERS), cdbus != NULL) {
432                 memset(&usbuf, 0, sizeof(struct ctdluser));
433                 memcpy(&usbuf, cdbus->ptr,
434                        ((cdbus->len > sizeof(struct ctdluser)) ?
435                         sizeof(struct ctdluser) : cdbus->len));
436                 cdb_free(cdbus);
437                 if ((usbuf.flags & US_NEEDVALID)
438                     && (usbuf.axlevel > AxDeleted)) {
439                         cprintf("%d %s\n", MORE_DATA, usbuf.fullname);
440                         cdb_close_cursor(CDB_USERS);
441                         return;
442                 }
443         }
444
445         /* If we get to this point, there are no more unvalidated users.
446          * Therefore we clear the "users need validation" flag.
447          */
448
449         begin_critical_section(S_CONTROL);
450         int flags;
451         flags = CtdlGetConfigInt("MMflags");
452         flags = flags & (~MM_VALID);
453         CtdlSetConfigInt("MMflags", flags);
454         end_critical_section(S_CONTROL);
455         cprintf("%d *** End of registration.\n", CIT_OK);
456 }
457
458
459 /*
460  * validate a user
461  */
462 void cmd_vali(char *v_args)
463 {
464         char user[128];
465         int newax;
466         struct ctdluser userbuf;
467
468         extract_token(user, v_args, 0, '|', sizeof user);
469         newax = extract_int(v_args, 1);
470
471         if (CtdlAccessCheck(ac_aide) || 
472             (newax > AxAideU) ||
473             (newax < AxDeleted)) {
474                 return;
475         }
476
477         if (CtdlGetUserLock(&userbuf, user) != 0) {
478                 cprintf("%d '%s' not found.\n", ERROR + NO_SUCH_USER, user);
479                 return;
480         }
481
482         userbuf.axlevel = newax;
483         userbuf.flags = (userbuf.flags & ~US_NEEDVALID);
484
485         CtdlPutUserLock(&userbuf);
486
487         /* If the access level was set to zero, delete the user */
488         if (newax == 0) {
489                 if (purge_user(user) == 0) {
490                         cprintf("%d %s Deleted.\n", CIT_OK, userbuf.fullname);
491                         return;
492                 }
493         }
494         cprintf("%d User '%s' validated.\n", CIT_OK, userbuf.fullname);
495 }
496
497 /* 
498  *  List users (searchstring may be empty to list all users)
499  */
500 void cmd_list(char *cmdbuf)
501 {
502         char searchstring[256];
503         extract_token(searchstring, cmdbuf, 0, '|', sizeof searchstring);
504         striplt(searchstring);
505         cprintf("%d \n", LISTING_FOLLOWS);
506         ForEachUser(ListThisUser, (void *)searchstring );
507         cprintf("000\n");
508 }
509
510
511
512
513 /*
514  * assorted info we need to check at login
515  */
516 void cmd_chek(char *argbuf)
517 {
518         int mail = 0;
519         int regis = 0;
520         int vali = 0;
521
522         if (CtdlAccessCheck(ac_logged_in)) {
523                 return;
524         }
525
526         CtdlGetUser(&CC->user, CC->curr_user);  /* no lock is needed here */
527         if ((REGISCALL != 0) && ((CC->user.flags & US_REGIS) == 0))
528                 regis = 1;
529
530         if (CC->user.axlevel >= AxAideU) {
531                 if (CtdlGetConfigInt("MMflags") & MM_VALID) {
532                         vali = 1;
533                 }
534         }
535
536         /* check for mail */
537         mail = InitialMailCheck();
538
539         cprintf("%d %d|%d|%d|%s|\n", CIT_OK, mail, regis, vali, CC->cs_inet_email);
540 }
541
542
543 /*
544  * check to see if a user exists
545  */
546 void cmd_qusr(char *who)
547 {
548         struct ctdluser usbuf;
549
550         if (CtdlGetUser(&usbuf, who) == 0) {
551                 cprintf("%d %s\n", CIT_OK, usbuf.fullname);
552         } else {
553                 cprintf("%d No such user.\n", ERROR + NO_SUCH_USER);
554         }
555 }
556
557
558 /*
559  * Administrative Get User Parameters
560  */
561 void cmd_agup(char *cmdbuf)
562 {
563         struct ctdluser usbuf;
564         char requested_user[128];
565
566         if (CtdlAccessCheck(ac_aide)) {
567                 return;
568         }
569
570         extract_token(requested_user, cmdbuf, 0, '|', sizeof requested_user);
571         if (CtdlGetUser(&usbuf, requested_user) != 0) {
572                 cprintf("%d No such user.\n", ERROR + NO_SUCH_USER);
573                 return;
574         }
575         cprintf("%d %s|%s|%u|%ld|%ld|%d|%ld|%ld|%d\n",
576                 CIT_OK,
577                 usbuf.fullname,
578                 usbuf.password,
579                 usbuf.flags,
580                 usbuf.timescalled,
581                 usbuf.posted,
582                 (int) usbuf.axlevel,
583                 usbuf.usernum,
584                 (long)usbuf.lastcall,
585                 usbuf.USuserpurge);
586 }
587
588
589
590 /*
591  * Administrative Set User Parameters
592  */
593 void cmd_asup(char *cmdbuf)
594 {
595         struct ctdluser usbuf;
596         char requested_user[128];
597         char notify[SIZ];
598         int np;
599         int newax;
600         int deleted = 0;
601
602         if (CtdlAccessCheck(ac_aide))
603                 return;
604
605         extract_token(requested_user, cmdbuf, 0, '|', sizeof requested_user);
606         if (CtdlGetUserLock(&usbuf, requested_user) != 0) {
607                 cprintf("%d No such user.\n", ERROR + NO_SUCH_USER);
608                 return;
609         }
610         np = num_parms(cmdbuf);
611         if (np > 1)
612                 extract_token(usbuf.password, cmdbuf, 1, '|', sizeof usbuf.password);
613         if (np > 2)
614                 usbuf.flags = extract_int(cmdbuf, 2);
615         if (np > 3)
616                 usbuf.timescalled = extract_int(cmdbuf, 3);
617         if (np > 4)
618                 usbuf.posted = extract_int(cmdbuf, 4);
619         if (np > 5) {
620                 newax = extract_int(cmdbuf, 5);
621                 if ((newax >= AxDeleted) && (newax <= AxAideU)) {
622                         usbuf.axlevel = newax;
623                 }
624         }
625         if (np > 7) {
626                 usbuf.lastcall = extract_long(cmdbuf, 7);
627         }
628         if (np > 8) {
629                 usbuf.USuserpurge = extract_int(cmdbuf, 8);
630         }
631         CtdlPutUserLock(&usbuf);
632         if (usbuf.axlevel == AxDeleted) {
633                 if (purge_user(requested_user) == 0) {
634                         deleted = 1;
635                 }
636         }
637
638         if (deleted) {
639                 snprintf(notify, SIZ, 
640                          "User \"%s\" has been deleted by %s.\n",
641                          usbuf.fullname,
642                         (CC->logged_in ? CC->user.fullname : "an administrator")
643                 );
644                 CtdlAideMessage(notify, "User Deletion Message");
645         }
646
647         cprintf("%d Ok", CIT_OK);
648         if (deleted)
649                 cprintf(" (%s deleted)", requested_user);
650         cprintf("\n");
651 }
652
653
654 /*
655  * Citadel protocol command to do the same
656  */
657 void cmd_isme(char *argbuf) {
658         char addr[256];
659
660         if (CtdlAccessCheck(ac_logged_in)) return;
661         extract_token(addr, argbuf, 0, '|', sizeof addr);
662
663         if (CtdlIsMe(addr, sizeof addr)) {
664                 cprintf("%d %s\n", CIT_OK, addr);
665         }
666         else {
667                 cprintf("%d Not you.\n", ERROR + ILLEGAL_VALUE);
668         }
669
670 }
671
672
673 /*
674  * Set the preferred view for the current user/room combination
675  */
676 void cmd_view(char *cmdbuf) {
677         int requested_view;
678         visit vbuf;
679
680         if (CtdlAccessCheck(ac_logged_in)) {
681                 return;
682         }
683
684         requested_view = extract_int(cmdbuf, 0);
685
686         CtdlGetRelationship(&vbuf, &CC->user, &CC->room);
687         vbuf.v_view = requested_view;
688         CtdlSetRelationship(&vbuf, &CC->user, &CC->room);
689         
690         cprintf("%d ok\n", CIT_OK);
691 }
692
693
694 /*
695  * Rename a user
696  */
697 void cmd_renu(char *cmdbuf)
698 {
699         int retcode;
700         char oldname[USERNAME_SIZE];
701         char newname[USERNAME_SIZE];
702
703         if (CtdlAccessCheck(ac_aide)) {
704                 return;
705         }
706
707         extract_token(oldname, cmdbuf, 0, '|', sizeof oldname);
708         extract_token(newname, cmdbuf, 1, '|', sizeof newname);
709
710         retcode = rename_user(oldname, newname);
711         switch(retcode) {
712                 case RENAMEUSER_OK:
713                         cprintf("%d '%s' has been renamed to '%s'.\n", CIT_OK, oldname, newname);
714                         return;
715                 case RENAMEUSER_LOGGED_IN:
716                         cprintf("%d '%s' is currently logged in and cannot be renamed.\n",
717                                 ERROR + ALREADY_LOGGED_IN , oldname);
718                         return;
719                 case RENAMEUSER_NOT_FOUND:
720                         cprintf("%d '%s' does not exist.\n", ERROR + NO_SUCH_USER, oldname);
721                         return;
722                 case RENAMEUSER_ALREADY_EXISTS:
723                         cprintf("%d A user named '%s' already exists.\n", ERROR + ALREADY_EXISTS, newname);
724                         return;
725         }
726
727         cprintf("%d An unknown error occurred.\n", ERROR);
728 }
729
730
731
732 void cmd_quit(char *argbuf)
733 {
734         cprintf("%d Goodbye.\n", CIT_OK);
735         CC->kill_me = KILLME_CLIENT_LOGGED_OUT;
736 }
737
738
739 void cmd_lout(char *argbuf)
740 {
741         if (CC->logged_in) 
742                 CtdlUserLogout();
743         cprintf("%d logged out.\n", CIT_OK);
744 }
745
746
747 /*****************************************************************************/
748 /*                      MODULE INITIALIZATION STUFF                          */
749 /*****************************************************************************/
750
751
752 CTDL_MODULE_INIT(serv_user)
753 {
754         if (!threading) {
755                 CtdlRegisterProtoHook(cmd_user, "USER", "Submit username for login");
756                 CtdlRegisterProtoHook(cmd_pass, "PASS", "Complete login by submitting a password");
757                 CtdlRegisterProtoHook(cmd_quit, "QUIT", "log out and disconnect from server");
758                 CtdlRegisterProtoHook(cmd_lout, "LOUT", "log out but do not disconnect from server");
759                 CtdlRegisterProtoHook(cmd_creu, "CREU", "Create User");
760                 CtdlRegisterProtoHook(cmd_setp, "SETP", "Set the password for an account");
761                 CtdlRegisterProtoHook(cmd_getu, "GETU", "Get User parameters");
762                 CtdlRegisterProtoHook(cmd_setu, "SETU", "Set User parameters");
763                 CtdlRegisterProtoHook(cmd_slrp, "SLRP", "Set Last Read Pointer");
764                 CtdlRegisterProtoHook(cmd_invt, "INVT", "Invite a user to a room");
765                 CtdlRegisterProtoHook(cmd_kick, "KICK", "Kick a user out of a room");
766                 CtdlRegisterProtoHook(cmd_forg, "FORG", "Forget a room");
767                 CtdlRegisterProtoHook(cmd_gnur, "GNUR", "Get Next Unregistered User");
768                 CtdlRegisterProtoHook(cmd_vali, "VALI", "Validate new users");
769                 CtdlRegisterProtoHook(cmd_list, "LIST", "List users");
770                 CtdlRegisterProtoHook(cmd_chek, "CHEK", "assorted info we need to check at login");
771                 CtdlRegisterProtoHook(cmd_qusr, "QUSR", "check to see if a user exists");
772                 CtdlRegisterProtoHook(cmd_agup, "AGUP", "Administratively Get User Parameters");
773                 CtdlRegisterProtoHook(cmd_asup, "ASUP", "Administratively Set User Parameters");
774                 CtdlRegisterProtoHook(cmd_seen, "SEEN", "Manipulate seen/unread message flags");
775                 CtdlRegisterProtoHook(cmd_gtsn, "GTSN", "Fetch seen/unread message flags");
776                 CtdlRegisterProtoHook(cmd_view, "VIEW", "Set preferred view for user/room combination");
777                 CtdlRegisterProtoHook(cmd_renu, "RENU", "Rename a user");
778                 CtdlRegisterProtoHook(cmd_newu, "NEWU", "Log in as a new user");
779                 CtdlRegisterProtoHook(cmd_isme, "ISME", "Determine whether an email address belongs to a user");
780         }
781         /* return our Subversion id for the Log */
782         return "user";
783 }