X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fserv_vcard.c;h=443783172a31781ffeb00da5022a9802a9373a32;hb=bdc77140d696fe60e35ef9ca597ca813496faa6c;hp=08d1280168a008585afa39217245e8dc2d66e685;hpb=039cc16055c2015612417f99f9d3a13acf63d0ce;p=citadel.git diff --git a/citadel/serv_vcard.c b/citadel/serv_vcard.c index 08d128016..443783172 100644 --- a/citadel/serv_vcard.c +++ b/citadel/serv_vcard.c @@ -757,6 +757,35 @@ void cmd_qdir(char *argbuf) { } +/* + * 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; +} + + /* @@ -777,6 +806,8 @@ void vcard_session_login_hook(void) { vcard_populate_cs_inet_email(v); vcard_free(v); + + vcard_create_room(); }