- /* This handy API function does all the work for us.
- */
- CtdlWriteObject(USERCALENDARROOM, /* which room */
- "text/calendar", /* MIME type */
- temp, /* temp file */
- u, /* which user */
- 0, /* not binary */
- 0, /* don't delete others of this type */
- 0); /* no flags */
-
- unlink(temp);
+ /* If the caller did not supply a user, write to the currently selected room */
+ if (!u) {
+ msg = malloc(sizeof(struct CtdlMessage));
+ memset(msg, 0, sizeof(struct CtdlMessage));
+ msg->cm_magic = CTDLMESSAGE_MAGIC;
+ msg->cm_anon_type = MES_NORMAL;
+ msg->cm_format_type = 4;
+ msg->cm_fields['A'] = strdup(CC->user.fullname);
+ msg->cm_fields['O'] = strdup(CC->room.QRname);
+ msg->cm_fields['N'] = strdup(config.c_nodename);
+ msg->cm_fields['H'] = strdup(config.c_humannode);
+ msg->cm_fields['M'] = malloc(strlen(ser) + 40);
+ strcpy(msg->cm_fields['M'], "Content-type: text/calendar\r\n\r\n");
+ strcat(msg->cm_fields['M'], ser);
+
+ /* Now write the data */
+ CtdlSubmitMsg(msg, NULL, "");
+ CtdlFreeMessage(msg);
+ }
+
+ /* In either case, now we can free the serialized calendar object */
+// free(ser);