* Don't attempt to send out invitations when there are no attendees.
authorArt Cancro <ajc@citadel.org>
Wed, 18 Dec 2002 04:08:16 +0000 (04:08 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 18 Dec 2002 04:08:16 +0000 (04:08 +0000)
citadel/ChangeLog
citadel/serv_calendar.c

index aa7c63ec4b38e2b9b0b1164377dfb11b35430120..945977b3d01ffe9699324c4b75af4a807d1433a8 100644 (file)
@@ -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 <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
+
index f5c4dbc6a840c4b37a725a96a22f33980bac4758..e6a8ef32d4175c77941b5e20d19dc2527016f2c0 100644 (file)
@@ -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);