* New ICAL subcommand "sgi" to enable or disable automatic server
authorArt Cancro <ajc@citadel.org>
Tue, 17 Feb 2004 03:53:11 +0000 (03:53 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 17 Feb 2004 03:53:11 +0000 (03:53 +0000)
  generated invitations.  (WebCit wants sgi's but Kontaqt doesn't.)

citadel/ChangeLog
citadel/serv_calendar.c
citadel/serv_calendar.h
citadel/techdoc/session.txt

index a5b577d207d41a0143caf71bd6e32919fe150085..2b5e3ff259e10833ed7b111ce3a1ce0473bcad1e 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 614.39  2004/02/17 03:53:11  ajc
+ * New ICAL subcommand "sgi" to enable or disable automatic server
+   generated invitations.  (WebCit wants sgi's but Kontaqt doesn't.)
+
  Revision 614.38  2004/02/16 21:54:22  ajc
  * Support POP3 over TLS
 
@@ -5356,4 +5360,3 @@ 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 6de73bff40d460bafa902b0227ba77511071baca..f8e2807e2f3bf9cdd6a37fc60bf3d21d3df06a69 100644 (file)
@@ -1232,20 +1232,28 @@ void cmd_ical(char *argbuf)
 
        /* Allow "test" and "freebusy" subcommands without logging in. */
 
-       if (!strcmp(subcmd, "test")) {
+       if (!strcasecmp(subcmd, "test")) {
                cprintf("%d This server supports calendaring\n", CIT_OK);
                return;
        }
 
-       if (!strcmp(subcmd, "freebusy")) {
+       if (!strcasecmp(subcmd, "freebusy")) {
                extract(who, argbuf, 1);
                ical_freebusy(who);
                return;
        }
 
+       if (!strcasecmp(subcmd, "sgi")) {
+               CIT_ICAL->server_generated_invitations =
+                       (extract_int(argbuf, 1) ? 1 : 0) ;
+               cprintf("%d %d\n",
+                       CIT_OK, CIT_ICAL->server_generated_invitations);
+               return;
+       }
+
        if (CtdlAccessCheck(ac_logged_in)) return;
 
-       if (!strcmp(subcmd, "respond")) {
+       if (!strcasecmp(subcmd, "respond")) {
                msgnum = extract_long(argbuf, 1);
                extract(partnum, argbuf, 2);
                extract(action, argbuf, 3);
@@ -1253,7 +1261,7 @@ void cmd_ical(char *argbuf)
                return;
        }
 
-       if (!strcmp(subcmd, "handle_rsvp")) {
+       if (!strcasecmp(subcmd, "handle_rsvp")) {
                msgnum = extract_long(argbuf, 1);
                extract(partnum, argbuf, 2);
                extract(action, argbuf, 3);
@@ -1261,7 +1269,7 @@ void cmd_ical(char *argbuf)
                return;
        }
 
-       if (!strcmp(subcmd, "conflicts")) {
+       if (!strcasecmp(subcmd, "conflicts")) {
                msgnum = extract_long(argbuf, 1);
                extract(partnum, argbuf, 2);
                ical_conflicts(msgnum, partnum);
@@ -1379,12 +1387,15 @@ void ical_send_out_invitations(icalcomponent *cal) {
                        strcpy(this_attendee, icalproperty_get_attendee(attendee) );
                        if (!strncasecmp(this_attendee, "MAILTO:", 7)) {
                                strcpy(this_attendee, &this_attendee[7]);
-                               snprintf(&attendees_string[strlen(attendees_string)],
-                                       sizeof(attendees_string) - strlen(attendees_string),
-                                       "%s, ",
-                                       this_attendee
-                               );
-                               ++num_attendees;
+
+                               if (!CtdlIsMe(this_attendee)) { /* don't send an invitation to myself! */
+                                       snprintf(&attendees_string[strlen(attendees_string)],
+                                               sizeof(attendees_string) - strlen(attendees_string),
+                                               "%s, ",
+                                               this_attendee
+                                       );
+                                       ++num_attendees;
+                               }
                        }
                }
        }
@@ -1466,9 +1477,12 @@ void ical_saving_vevent(icalcomponent *cal) {
        icalproperty *organizer = NULL;
        char organizer_string[SIZ];
 
+       /* Don't send out invitations unless the client wants us to. */
+       if (CIT_ICAL->server_generated_invitations == 0) {
+               return;
+       }
+
        /* Don't send out invitations if we've been asked not to. */
-       lprintf(9, "CIT_ICAL->avoid_sending_invitations = %d\n",
-               CIT_ICAL->avoid_sending_invitations);
        if (CIT_ICAL->avoid_sending_invitations > 0) {
                return;
        }
index f82bba58fff2302335e0f364791268896f6f0b66..dabbaad450d1814f9e88aa53c1060c3810587121 100644 (file)
@@ -5,7 +5,17 @@
  *
  */
 
+/* 
+ * "server_generated_invitations" tells the Citadel server that the
+ * client wants invitations to be generated and sent out by the
+ * server.  Set to 1 to enable this functionality.
+ *
+ * "avoid_sending_invitations" is a server-internal variable.  It is
+ * set internally during certain transactions and cleared
+ * automatically.
+ */
 struct cit_ical {
+       int server_generated_invitations;
         int avoid_sending_invitations;
 };
 
index 431bd4e21524e1fd25fa3f1220d5281fd58f78a9..facbdc5af6c67faa31e4fe92bda6815cbb7842da 100644 (file)
@@ -2048,12 +2048,16 @@ may be issued:
   TRANSP).  If there is no such user, or no calendar available, the usual
   ERROR codes will be returned.
  
+ ICAL sgi|<bool>
  Readers who are paying attention will notice that there is no subcommand to
-send out meeting invitations.  This is because that task is handled
-automatically by the Citadel server.  When an event is saved to the user's
-Calendar> room and it contains attendees, Citadel will automatically turn
-the event into vCalendar REQUEST messages and mail them out to all listed
-attendees.
+send out meeting invitations.  This is because that task can be handled
+automatically by the Citadel server.  Issue this command with <bool> set to 1
+to enable Server Generated Invitations.  In this mode, when an event is saved
+to the user's Calendar> room and it contains attendees, Citadel will
+automatically turn the event into vCalendar REQUEST messages and mail them
+out to all listed attendees.  If for some reason the client needs to disable
+Server Generated Invitations, the command may be sent again with <bool> = 0.