+/*
+ * When a user is being created, create his/her vCard.
+ */
+void vcard_newuser(struct ctdluser *usbuf) {
+ char buf[SIZ];
+ char vname[SIZ];
+ struct vCard *v;
+ int i;
+ int vnum;
+
+ /* Try to intelligently convert the screen name to a
+ * fully expanded vCard name based on the number of
+ * words in the name
+ */
+ vnum = num_tokens(usbuf->fullname, ' ');
+ strcpy(vname, usbuf->fullname); /* FIXME */
+
+ /* Create and save the vCard */
+ v = vcard_new();
+ if (v == NULL) return;
+ sprintf(buf, "%s@%s", usbuf->fullname, config.c_fqdn);
+ for (i=0; i<strlen(buf); ++i) {
+ if (buf[i] == ' ') buf[i] = '_';
+ }
+ vcard_add_prop(v, "n", vname);
+ vcard_add_prop(v, "email;internet", buf);
+ vcard_write_user(usbuf, v);
+ vcard_free(v);
+}
+
+