*/
void vcard_extract_vcard(char *name, char *filename, char *partnum, char *disp,
void *content, char *cbtype, char *cbcharset, size_t length,
- char *encoding, void *cbuserdata)
+ char *encoding, char *cbid, void *cbuserdata)
{
struct vCard **v = (struct vCard **) cbuserdata;
vcard_add_to_directory(I, NULL);
/* Some sites want an Aide to be notified when a
- * user registers or re-registers...
+ * user registers or re-registers
+ * But if the user was an Aide or was edited by an Aide then we can
+ * Assume they don't need validating.
*/
+ if (CC->user.axlevel >= 6) {
+ lgetuser(&CC->user, CC->curr_user);
+ CC->user.flags |= US_REGIS;
+ lputuser(&CC->user);
+ return (0);
+ }
+
set_mm_valid();
/* ...which also means we need to flag the user */
* Write our config to disk
*/
void vcard_write_user(struct ctdluser *u, struct vCard *v) {
- char temp[PATH_MAX];
- FILE *fp;
char *ser;
- CtdlMakeTempFileName(temp, sizeof temp);
ser = vcard_serialize(v);
-
- fp = fopen(temp, "w");
- if (fp == NULL) return;
if (ser == NULL) {
- fprintf(fp, "begin:vcard\r\nend:vcard\r\n");
- } else {
- fwrite(ser, strlen(ser), 1, fp);
- free(ser);
+ ser = strdup("begin:vcard\r\nend:vcard\r\n");
}
- fclose(fp);
+ if (!ser) return;
/* This handy API function does all the work for us.
* NOTE: normally we would want to set that last argument to 1, to
* have to, because the vcard_upload_beforesave() hook above
* is going to notice what we're trying to do, and delete the old vCard.
*/
- CtdlWriteObject(USERCONFIGROOM, /* which room */
- VCARD_MIME_TYPE,/* MIME type */
- temp, /* temp file */
- u, /* which user */
- 0, /* not binary */
- 0, /* don't delete others of this type */
- 0); /* no flags */
-
- unlink(temp);
+ CtdlWriteObject(USERCONFIGROOM, /* which room */
+ VCARD_MIME_TYPE, /* MIME type */
+ ser, /* data */
+ strlen(ser)+1, /* length */
+ u, /* which user */
+ 0, /* not binary */
+ 0, /* don't delete others of this type */
+ 0); /* no flags */
+
+ free(ser);
}
/* If using host auth mode, we add an email address based on the login */
if (config.c_auth_mode == AUTHMODE_HOST) {
struct passwd pwd;
- struct passwd **result = NULL;
char pwd_buffer[SIZ];
-
+
+#ifdef SOLARIS_GETPWUID
+ if (getpwuid_r(usbuf->uid, &pwd, pwd_buffer, sizeof pwd_buffer) != NULL) {
+#else // SOLARIS_GETPWUID
+ struct passwd **result = NULL;
if (getpwuid_r(usbuf->uid, &pwd, pwd_buffer, sizeof pwd_buffer, result) == 0) {
+#endif // HAVE_GETPWUID_R
snprintf(buf, sizeof buf, "%s@%s", pwd.pw_name, config.c_fqdn);
vcard_add_prop(v, "email;internet", buf);
}
msg->cm_fields['S'] = strdup("CANCEL");
- CtdlSubmitMsg(msg, NULL, ADDRESS_BOOK_ROOM);
+ CtdlSubmitMsg(msg, NULL, ADDRESS_BOOK_ROOM, QP_EADDR);
CtdlFreeMessage(msg);
}
*/
void dvca_mime_callback(char *name, char *filename, char *partnum, char *disp,
void *content, char *cbtype, char *cbcharset, size_t length, char *encoding,
- void *cbuserdata) {
+ char *cbid, void *cbuserdata) {
struct vCard *v;
char displayname[256];
vcard_free(v);
CtdlLogPrintf(CTDL_DEBUG, "Adding contact: %s\n", recipient);
- vmsgnum = CtdlSubmitMsg(vmsg, NULL, aptr->roomname);
+ vmsgnum = CtdlSubmitMsg(vmsg, NULL, aptr->roomname, QP_EADDR);
CtdlFreeMessage(vmsg);
}
}