};
/* Message number symbol used internally by these functions */
-unsigned long SYM_VCARD;
#define VC ((struct vcard_internal_info *)CtdlGetUserData(SYM_VCARD))
char *ptr;
int linelen;
char buf[SIZ];
- struct user usbuf;
+ struct ctdluser usbuf;
long what_user;
if (!CC->logged_in) return(0); /* Only do this if logged in. */
if (what_user == CC->user.usernum) {
/* It's the logged in user. That was easy. */
memcpy(&usbuf, &CC->user,
- sizeof(struct user) );
+ sizeof(struct ctdluser) );
}
else if (getuserbynumber(&usbuf, what_user) == 0) {
* If this user has a vcard on disk, read it into memory, otherwise allocate
* and return an empty vCard.
*/
-struct vCard *vcard_get_user(struct user *u) {
+struct vCard *vcard_get_user(struct ctdluser *u) {
char hold_rm[ROOMNAMELEN];
char config_rm[ROOMNAMELEN];
struct CtdlMessage *msg;
/*
* Write our config to disk
*/
-void vcard_write_user(struct user *u, struct vCard *v) {
+void vcard_write_user(struct ctdluser *u, struct vCard *v) {
char temp[PATH_MAX];
FILE *fp;
char *ser;
*/
void cmd_greg(char *argbuf)
{
- struct user usbuf;
+ struct ctdluser usbuf;
struct vCard *v;
char *s;
char who[SIZ];
}
+/*
+ * We don't know if the Contacts room exists so we just create it at login
+ */
+void vcard_create_room(void)
+{
+ struct ctdlroom qr;
+ struct visit vbuf;
+
+ /* Create the calendar room if it doesn't already exist */
+ create_room(USERCONTACTSROOM, 4, "", 0, 1, 0);
+
+ /* Set expiration policy to manual; otherwise objects will be lost! */
+ if (lgetroom(&qr, USERCONTACTSROOM)) {
+ lprintf(3, "Couldn't get the user CONTACTS room!\n");
+ return;
+ }
+ qr.QRep.expire_mode = EXPIRE_MANUAL;
+ qr.QRdefaultview = 2; /* 2 = address book view */
+ lputroom(&qr);
+
+ /* Set the view to a calendar view */
+ CtdlGetRelationship(&vbuf, &CC->user, &qr);
+ vbuf.v_view = 2; /* 2 = address book view */
+ CtdlSetRelationship(&vbuf, &CC->user, &qr);
+
+ return;
+}
+
+
/*
vcard_populate_cs_inet_email(v);
vcard_free(v);
+
+ vcard_create_room();
}
char *serv_vcard_init(void)
{
- SYM_VCARD = CtdlGetDynamicSymbol();
CtdlRegisterSessionHook(vcard_session_startup_hook, EVT_START);
CtdlRegisterSessionHook(vcard_session_login_hook, EVT_LOGIN);
CtdlRegisterMessageHook(vcard_upload_beforesave, EVT_BEFORESAVE);