From: Art Cancro Date: Wed, 18 Dec 2002 04:08:16 +0000 (+0000) Subject: * Don't attempt to send out invitations when there are no attendees. X-Git-Tag: v7.86~6078 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=ca33f7046495533f8f17cef5038b3460ab4f9277;p=citadel.git * Don't attempt to send out invitations when there are no attendees. --- diff --git a/citadel/ChangeLog b/citadel/ChangeLog index aa7c63ec4..945977b3d 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,7 @@ $Log$ + Revision 601.91 2002/12/18 04:08:16 ajc + * Don't attempt to send out invitations when there are no attendees. + Revision 601.90 2002/12/15 10:53:51 error * Final touches on the new message formatter. @@ -4309,3 +4312,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/serv_calendar.c b/citadel/serv_calendar.c index f5c4dbc6a..e6a8ef32d 100644 --- a/citadel/serv_calendar.c +++ b/citadel/serv_calendar.c @@ -1038,7 +1038,7 @@ void ical_create_room(void) /* * ical_send_out_invitations() is called by ical_saving_vevent() when it - * finds a VEVENT. FIXME ... finish implementing. + * finds a VEVENT. */ void ical_send_out_invitations(icalcomponent *cal) { icalcomponent *the_request = NULL; @@ -1047,6 +1047,7 @@ void ical_send_out_invitations(icalcomponent *cal) { struct CtdlMessage *msg = NULL; struct recptypes *valid = NULL; char attendees_string[SIZ]; + int num_attendees = 0; char this_attendee[SIZ]; icalproperty *attendee = NULL; char summary_string[SIZ]; @@ -1089,11 +1090,20 @@ void ical_send_out_invitations(icalcomponent *cal) { "%s, ", this_attendee ); + ++num_attendees; } } } - lprintf(9, "attendees_string: <%s>\n", attendees_string); + lprintf(9, "<%d> attendees: <%s>\n", num_attendees, attendees_string); + + /* If there are no attendees, there are no invitations to send, so... + * don't bother putting one together! Punch out, Maverick! + */ + if (num_attendees == 0) { + icalcomponent_free(the_request); + return; + } /* Encapsulate the VEVENT component into a complete VCALENDAR */ encaps = icalcomponent_new(ICAL_VCALENDAR_COMPONENT);