#include "msgbase.h"
#include "internet_addressing.h"
#include "serv_calendar.h"
+#include "room_ops.h"
#include "euidindex.h"
#include "ical_dezonify.h"
msg->cm_format_type = 4;
CM_SetField(msg, eAuthor, CCC->user.fullname, strlen(CCC->user.fullname));
CM_SetField(msg, eOriginalRoom, CCC->room.QRname, strlen(CCC->room.QRname));
- CM_SetField(msg, eNodeName, config.c_nodename, strlen(config.c_nodename));
- CM_SetField(msg, eHumanNode, config.c_humannode, strlen(config.c_humannode));
+ CM_SetField(msg, eNodeName, CFG_KEY(c_nodename));
+ CM_SetField(msg, eHumanNode, CFG_KEY(c_humannode));
MsgBody = NewStrBufPlain(NULL, serlen + 100);
StrBufAppendBufPlain(MsgBody, HKEY("Content-type: text/calendar\r\n\r\n"), 0);
/* Now write the data */
CtdlSubmitMsg(msg, NULL, "", QP_EADDR);
- CtdlFreeMessage(msg);
+ CM_Free(msg);
}
/* In either case, now we can free the serialized calendar object */
icalproperty *summary = NULL;
char summary_string[SIZ];
icalproperty *me_attend = NULL;
- struct recptypes *recp = NULL;
+ recptypes *recp = NULL;
icalparameter *partstat = NULL;
char *serialized_reply = NULL;
char *reply_message_text = NULL;
const char *ch;
struct CtdlMessage *msg = NULL;
- struct recptypes *valid = NULL;
+ recptypes *valid = NULL;
*organizer_string = '\0';
strcpy(summary_string, "Calendar item");
if (msg != NULL) {
valid = validate_recipients(organizer_string, NULL, 0);
CtdlSubmitMsg(msg, valid, "", QP_EADDR);
- CtdlFreeMessage(msg);
+ CM_Free(msg);
free_recipients(valid);
}
}
memset(&ird, 0, sizeof ird);
strcpy(ird.desired_partnum, partnum);
- mime_parser(msg->cm_fields[eMesageText],
- NULL,
- *ical_locate_part, /* callback function */
- NULL, NULL,
- (void *) &ird, /* user data */
- 0
+ mime_parser(CM_RANGE(msg, eMesageText),
+ *ical_locate_part, /* callback function */
+ NULL, NULL,
+ (void *) &ird, /* user data */
+ 0
);
/* We're done with the incoming message, because we now have a
* calendar object in memory.
*/
- CtdlFreeMessage(msg);
+ CM_Free(msg);
/*
* Here is the real meat of this function. Handle the event.
return(2); /* internal error */
}
oec.c = NULL;
- mime_parser(msg->cm_fields[eMesageText],
- NULL,
- *ical_locate_original_event, /* callback function */
- NULL, NULL,
- &oec, /* user data */
- 0
+ mime_parser(CM_RANGE(msg, eMesageText),
+ *ical_locate_original_event, /* callback function */
+ NULL, NULL,
+ &oec, /* user data */
+ 0
);
- CtdlFreeMessage(msg);
+ CM_Free(msg);
original_event = oec.c;
if (original_event == NULL) {
if (msg != NULL) {
CIT_ICAL->avoid_sending_invitations = 1;
CtdlSubmitMsg(msg, NULL, roomname, QP_EADDR);
- CtdlFreeMessage(msg);
+ CM_Free(msg);
CIT_ICAL->avoid_sending_invitations = 0;
}
}
memset(&ird, 0, sizeof ird);
strcpy(ird.desired_partnum, partnum);
- mime_parser(msg->cm_fields[eMesageText],
- NULL,
- *ical_locate_part, /* callback function */
- NULL, NULL,
- (void *) &ird, /* user data */
- 0
- );
+ mime_parser(CM_RANGE(msg, eMesageText),
+ *ical_locate_part, /* callback function */
+ NULL, NULL,
+ (void *) &ird, /* user data */
+ 0
+ );
/* We're done with the incoming message, because we now have a
* calendar object in memory.
*/
- CtdlFreeMessage(msg);
+ CM_Free(msg);
/*
* Here is the real meat of this function. Handle the event.
if (msg == NULL) return;
memset(&ird, 0, sizeof ird);
strcpy(ird.desired_partnum, "_HUNT_");
- mime_parser(msg->cm_fields[eMesageText],
- NULL,
- *ical_locate_part, /* callback function */
- NULL, NULL,
- (void *) &ird, /* user data */
- 0
+ mime_parser(CM_RANGE(msg, eMesageText),
+ *ical_locate_part, /* callback function */
+ NULL, NULL,
+ (void *) &ird, /* user data */
+ 0
);
- CtdlFreeMessage(msg);
+ CM_Free(msg);
if (ird.cal == NULL) return;
memset(&ird, 0, sizeof ird);
strcpy(ird.desired_partnum, partnum);
- mime_parser(msg->cm_fields[eMesageText],
- NULL,
- *ical_locate_part, /* callback function */
- NULL, NULL,
- (void *) &ird, /* user data */
- 0
- );
+ mime_parser(CM_RANGE(msg, eMesageText),
+ *ical_locate_part, /* callback function */
+ NULL, NULL,
+ (void *) &ird, /* user data */
+ 0
+ );
- CtdlFreeMessage(msg);
+ CM_Free(msg);
if (ird.cal != NULL) {
ical_hunt_for_conflicts(ird.cal);
if (msg == NULL) return;
memset(&ird, 0, sizeof ird);
strcpy(ird.desired_partnum, "_HUNT_");
- mime_parser(msg->cm_fields[eMesageText],
- NULL,
- *ical_locate_part, /* callback function */
- NULL, NULL,
- (void *) &ird, /* user data */
- 0
- );
- CtdlFreeMessage(msg);
+ mime_parser(CM_RANGE(msg, eMesageText),
+ *ical_locate_part, /* callback function */
+ NULL, NULL,
+ (void *) &ird, /* user data */
+ 0
+ );
+ CM_Free(msg);
if (ird.cal) {
ical_add_to_freebusy(fb, ird.cal); /* Add VEVENT times to VFREEBUSY */
icalcomponent *encaps = NULL;
icalcomponent *fb = NULL;
int found_user = (-1);
- struct recptypes *recp = NULL;
+ recptypes *recp = NULL;
char buf[256];
char host[256];
char type[256];
if (msg == NULL) return;
memset(&ird, 0, sizeof ird);
strcpy(ird.desired_partnum, "_HUNT_");
- mime_parser(msg->cm_fields[eMesageText],
- NULL,
- *ical_locate_part, /* callback function */
- NULL, NULL,
- (void *) &ird, /* user data */
- 0
+ mime_parser(CM_RANGE(msg, eMesageText),
+ *ical_locate_part, /* callback function */
+ NULL, NULL,
+ (void *) &ird, /* user data */
+ 0
);
- CtdlFreeMessage(msg);
+ CM_Free(msg);
if (ird.cal == NULL) return;
icalcomponent *encaps = NULL;
char *request_message_text = NULL;
struct CtdlMessage *msg = NULL;
- struct recptypes *valid = NULL;
+ recptypes *valid = NULL;
char attendees_string[SIZ];
int num_attendees = 0;
char this_attendee[256];
if (msg != NULL) {
valid = validate_recipients(attendees_string, NULL, 0);
CtdlSubmitMsg(msg, valid, "", QP_EADDR);
- CtdlFreeMessage(msg);
+ CM_Free(msg);
free_recipients(valid);
}
}
* If the message is being saved, we also set various message header fields
* using data found in the iCalendar object.
*/
-int ical_obj_beforesave(struct CtdlMessage *msg)
+int ical_obj_beforesave(struct CtdlMessage *msg, recptypes *recp)
{
/* First determine if this is a calendar or tasks room */
if ( (CC->room.QRdefaultview != VIEW_CALENDAR)
return(1); /* You tried to save a non-RFC822 message! */
}
- if (msg->cm_fields[eMesageText] == NULL) {
+ if (CM_IsEmpty(msg, eMesageText)) {
return(1); /* You tried to save a null message! */
}
/* Do all of our lovely back-end parsing */
- mime_parser(msg->cm_fields[eMesageText],
- NULL,
- *ical_obj_beforesave_backend,
- NULL, NULL,
- (void *)msg,
- 0
- );
+ mime_parser(CM_RANGE(msg, eMesageText),
+ *ical_obj_beforesave_backend,
+ NULL, NULL,
+ (void *)msg,
+ 0
+ );
return(0);
}
* (This will start back end tasks such as automatic generation of invitations,
* if such actions are appropriate.)
*/
-int ical_obj_aftersave(struct CtdlMessage *msg)
+int ical_obj_aftersave(struct CtdlMessage *msg, recptypes *recp)
{
char roomname[ROOMNAMELEN];
if (msg->cm_format_type != 4) return(1);
/* Reject null messages */
- if (msg->cm_fields[eMesageText] == NULL) return(1);
+ if (CM_IsEmpty(msg, eMesageText)) return(1);
/* Now recurse through it looking for our icalendar data */
- mime_parser(msg->cm_fields[eMesageText],
- NULL,
- *ical_obj_aftersave_backend,
- NULL, NULL,
- NULL,
- 0
- );
+ mime_parser(CM_RANGE(msg, eMesageText),
+ *ical_obj_aftersave_backend,
+ NULL, NULL,
+ NULL,
+ 0
+ );
return(0);
}