$Log$
+ Revision 590.52 2002/01/10 04:29:28 ajc
+ * Minor updates for directory service
+
Revision 590.51 2002/01/09 23:12:40 ajc
* Allow users to zap mailbox rooms
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
-
gdbm_reorganize(gdbms[CDB_FLOORTAB]);
end_critical_section(S_DATABASE);
end_critical_section(S_FLOORTAB);
+
+ /* defrag the directory */
+ lprintf(7, "Defragmenting the directory\n");
+ begin_critical_section(S_DIRECTORY);
+ gdbm_reorganize(gdbms[CDB_DIRECTORY]);
+ end_critical_section(S_DIRECTORY);
}
gdbm_strerror(gdbm_errno));
exit(1);
}
+ gdbms[CDB_DIRECTORY] = gdbm_open("data/directory.gdbm", 0,
+ GDBM_WRCREAT, 0600, NULL);
+ if (gdbms[CDB_DIRECTORY] == NULL) {
+ lprintf(2, "Cannot open directory: %s\n",
+ gdbm_strerror(gdbm_errno));
+ exit(1);
+ }
/*
end_critical_section(S_DATABASE);
*/
* Back end function for cmd_igab()
* FIXME use a callback that actually writes to the database, dumbass...
*/
-void vcard_igab_backend(long msgnum, void *data) {
+void vcard_add_to_directory(long msgnum, void *data) {
struct CtdlMessage *msg;
msg = CtdlFetchMessage(msgnum);
/* We want the last (and probably only) vcard in this room */
CtdlForEachMessage(MSGS_ALL, 0, (-127), "text/x-vcard",
- NULL, vcard_igab_backend, NULL);
+ NULL, vcard_add_to_directory, NULL);
getroom(&CC->quickroom, hold_rm); /* return to saved room */
cprintf("000\n");
I = atol(msg->cm_fields['I']);
if (I < 0L) return(0);
+ /* Put it in the Global Address Book room... */
CtdlSaveMsgPointerInRoom(ADDRESS_BOOK_ROOM, I,
(SM_VERIFY_GOODNESS | SM_DO_REPL_CHECK) );
+ /* ...and also in the directory database. */
+ vcard_add_to_directory(I, NULL);
+
return(0);
}
S_WORKER_LIST,
S_HOUSEKEEPING,
S_NTTLIST,
+ S_DIRECTORY,
MAX_SEMAPHORES
};
CDB_FLOORTAB, /* floor index */
CDB_MSGLISTS, /* room message lists */
CDB_VISIT, /* user/room relationships */
+ CDB_DIRECTORY, /* address book directory */
MAXCDB /* total number of CDB's defined */
};