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