#include "internet_addressing.h"
#include "tools.h"
#include "vcard.h"
+#include "serv_ldap.h"
struct vcard_internal_info {
long msgnum;
* probably just the networker or something.
*/
if (CC->logged_in) {
- lprintf(9, "Checking for <%s>...\n", internet_addr);
+ lprintf(CTDL_DEBUG, "Checking for <%s>...\n", internet_addr);
if (CtdlDirectoryLookup(buf, internet_addr) == 0) {
if (strcasecmp(buf, citadel_addr)) {
/* This address belongs to someone else.
* Bail out silently without saving.
*/
- lprintf(9, "DOOP!\n");
+ lprintf(CTDL_DEBUG, "DOOP!\n");
return;
}
}
}
- lprintf(9, "ADDING!\n");
+ lprintf(CTDL_INFO, "Adding %s (%s) to directory\n",
+ citadel_addr, internet_addr);
CtdlDirectoryAddUser(internet_addr, citadel_addr);
}
vcard_extract_internet_addresses(msg, vcard_directory_add_user);
}
+#ifdef HAVE_LDAP
+ ctdl_vcard_to_ldap(msg, V2L_WRITE);
+#endif
+
CtdlFreeMessage(msg);
}
if (getroom(&CC->room, ADDRESS_BOOK_ROOM) != 0) {
getroom(&CC->room, hold_rm);
- cprintf("%d cannot get address book room\n", ERROR);
+ cprintf("%d cannot get address book room\n", ERROR + ROOM_NOT_FOUND);
return;
}
*/
CtdlDirectoryInit();
- /* We want the last (and probably only) vcard in this room */
+ /* We want *all* vCards in this room */
CtdlForEachMessage(MSGS_ALL, 0, "text/x-vcard",
NULL, vcard_add_to_directory, NULL);
char tmpcountry[SIZ];
if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
+ cprintf("%d Not logged in.\n",ERROR + NOT_LOGGED_IN);
return;
}
extract(who, argbuf, 0);
if (!(CC->logged_in)) {
- cprintf("%d Not logged in.\n", ERROR+NOT_LOGGED_IN);
+ cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN);
return;
}
if ((CC->user.axlevel < 6) && (strcasecmp(who,CC->curr_user))) {
cprintf("%d Higher access required.\n",
- ERROR+HIGHER_ACCESS_REQUIRED);
+ ERROR + HIGHER_ACCESS_REQUIRED);
return;
}
if (getuser(&usbuf, who) != 0) {
- cprintf("%d '%s' not found.\n", ERROR+NO_SUCH_USER, who);
+ cprintf("%d '%s' not found.\n", ERROR + NO_SUCH_USER, who);
return;
}
*/
vcard_extract_internet_addresses(msg,
CtdlDirectoryDelUser);
+#ifdef HAVE_LDAP
+ ctdl_vcard_to_ldap(msg, V2L_DELETE);
+#endif
}
ptr = strchr((char *)ptr, '\n');
if (ptr != NULL) ++ptr;
if (CtdlDirectoryLookup(citadel_addr, internet_addr) != 0) {
cprintf("%d %s was not found.\n",
- ERROR+NO_SUCH_USER, internet_addr);
+ ERROR + NO_SUCH_USER, internet_addr);
return;
}
/* Set expiration policy to manual; otherwise objects will be lost! */
if (lgetroom(&qr, USERCONTACTSROOM)) {
- lprintf(3, "Couldn't get the user CONTACTS room!\n");
+ lprintf(CTDL_ERR, "Couldn't get the user CONTACTS room!\n");
return;
}
qr.QRep.expire_mode = EXPIRE_MANUAL;
char *serv_vcard_init(void)
{
+ struct ctdlroom qr;
+
CtdlRegisterSessionHook(vcard_session_startup_hook, EVT_START);
CtdlRegisterSessionHook(vcard_session_login_hook, EVT_LOGIN);
CtdlRegisterMessageHook(vcard_upload_beforesave, EVT_BEFORESAVE);
CtdlRegisterProtoHook(cmd_qdir, "QDIR", "Query Directory");
CtdlRegisterUserHook(vcard_purge, EVT_PURGEUSER);
CtdlRegisterNetprocHook(vcard_extract_from_network);
+
+ /* Create the Global ADdress Book room if necessary */
create_room(ADDRESS_BOOK_ROOM, 3, "", 0, 1, 0);
+
+ /* Set expiration policy to manual; otherwise objects will be lost! */
+ if (!lgetroom(&qr, ADDRESS_BOOK_ROOM)) {
+ qr.QRep.expire_mode = EXPIRE_MANUAL;
+ qr.QRdefaultview = 2; /* 2 = address book view */
+ lputroom(&qr);
+ }
+
return "$Id$";
}