4 * A skeleton module to test the dynamic loader.
9 * Name of the New User Greetings room.
11 #define NEWUSERGREETINGS "New User Greetings"
22 #include <sys/types.h>
24 #if TIME_WITH_SYS_TIME
25 # include <sys/time.h>
29 # include <sys/time.h>
40 #include "sysdep_decls.h"
41 #include "citserver.h"
44 #include "dynloader.h"
51 extern struct CitContext *ContextList;
55 * Copy the contents of the New User Greetings> room to the user's Mail> room.
57 void CopyNewUserGreetings(void) {
58 struct cdbdata *cdbfr;
62 char mailboxname[ROOMNAMELEN];
65 /* Only do this for new users. */
66 if (CC->usersupp.timescalled != 1) return;
68 /* This user's mailbox. */
69 MailboxName(mailboxname, sizeof mailboxname, &CC->usersupp, MAILROOM);
71 /* Go to the source room ... bail out silently if it's not there,
72 * or if it's not private.
74 if (getroom(&CC->quickroom, NEWUSERGREETINGS) != 0) return;
75 if (! CC->quickroom.QRflags & QR_PRIVATE ) return;
77 cdbfr = cdb_fetch(CDB_MSGLISTS, &CC->quickroom.QRnumber, sizeof(long));
80 msglist = mallok(cdbfr->len);
81 memcpy(msglist, cdbfr->ptr, cdbfr->len);
82 num_msgs = cdbfr->len / sizeof(long);
87 for (i = 0; i < num_msgs; ++i) {
88 CtdlCopyMsgToRoom(msglist[i], mailboxname);
92 /* Now free the memory we used, and go away. */
93 if (msglist != NULL) phree(msglist);
97 char *serv_newuser_init(void)
99 CtdlRegisterSessionHook(CopyNewUserGreetings, EVT_LOGIN);