CALENDAR: attendees are to be found on ch not on buf.
[citadel.git] / webcit / calendar.c
index 98fc8260c426eaa2ef052356f866b1555913c7f5..2e486dab8ae9b31aa30dcfdb43d26b8b4be41d47 100644 (file)
@@ -1,21 +1,15 @@
 /*
  * Functions which handle calendar objects and their processing/display.
  *
- * Copyright (c) 1996-2011 by the citadel.org team
+ * Copyright (c) 1996-2012 by the citadel.org team
  *
  * This program is open source software.  You can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 3 of the
- * License, or (at your option) any later version.
+ * modify it under the terms of the GNU General Public License, version 3.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
 #include "webcit.h"
@@ -75,7 +69,7 @@ void cal_process_object(StrBuf *Target,
                the_method = icalproperty_get_method(method);
 
                StrBufAppendPrintf(Target, "<div id=\"%s_title\">", divname);
-               StrBufAppendPrintf(Target, "<img src=\"static/calarea_48x.gif\">");
+               StrBufAppendPrintf(Target, "<img src=\"static/webcit_icons/essen/32x32/calendar.png\">");
                StrBufAppendPrintf(Target, "<span>");
                switch(the_method) {
                case ICAL_METHOD_REQUEST:
@@ -184,7 +178,7 @@ void cal_process_object(StrBuf *Target,
                StrBufAppendPrintf(Target, _("Attendee:"));
                StrBufAppendPrintf(Target, "</dt><dd>");
                ch = icalproperty_get_attendee(p);
-               if ((ch != NULL) && !strncasecmp(buf, "MAILTO:", 7)) {
+               if ((ch != NULL) && !strncasecmp(ch, "MAILTO:", 7)) {
 
                        /** screen name or email address */
                        safestrncpy(buf, ch + 7, sizeof(buf));
@@ -329,7 +323,7 @@ void respond_to_request(void)
        serv_getln(buf, sizeof buf);
 
        if (buf[0] == '2') {
-               wc_printf("<img src=\"static/calarea_48x.gif\"><span>");
+               wc_printf("<img src=\"static/webcit_icons/essen/32x32/calendar.png\"><span>");
                if (!strcasecmp(bstr("sc"), "accept")) {
                        wc_printf(_("You have accepted this meeting invitation.  "
                                "It has been entered into your calendar.")
@@ -347,7 +341,7 @@ void respond_to_request(void)
                wc_printf(_("A reply has been sent to the meeting organizer."));
                wc_printf("</span>");
        } else {
-               wc_printf("<img align=\"center\" src=\"static/error.gif\"><span>");
+               wc_printf("<img align=\"center\" src=\"static/webcit_icons/error.gif\"><span>");
                wc_printf("%s\n", &buf[4]);
                wc_printf("</span>");
        }
@@ -374,11 +368,11 @@ void handle_rsvp(void)
        serv_getln(buf, sizeof buf);
 
        if (buf[0] == '2') {
-               wc_printf("<img src=\"static/calarea_48x.gif\"><span>");
+               wc_printf("<img src=\"static/webcit_icons/calendar.png\"><span>");
                if (!strcasecmp(bstr("sc"), "update")) {
-                       /* Translators: RSVP aka Répondez s'il-vous-plaît Is the term 
-                          that the recipient of an ical-invitation should please 
-                          answer this request. */                                        
+                       /// Translators: RSVP aka Répondez s'il-vous-plaît Is the term 
+                       /// that the recipient of an ical-invitation should please 
+                       /// answer this request.
                        wc_printf(_("Your calendar has been updated to reflect this RSVP."));
                } else if (!strcasecmp(bstr("sc"), "ignore")) {
                        wc_printf(_("You have chosen to ignore this RSVP. "
@@ -387,7 +381,7 @@ void handle_rsvp(void)
                }
                wc_printf("</span>");
        } else {
-               wc_printf("<img src=\"static/error.gif\"><span> %s\n", &buf[4]);
+               wc_printf("<img src=\"static/webcit_icons/error.gif\"><span> %s\n", &buf[4]);
                wc_printf("</span>");
        }
 
@@ -504,6 +498,9 @@ void display_individual_cal(icalcomponent *event, long msgnum, char *from, int u
        if (!icaltime_is_null_time(dtend)) {            /* Need duration for recurrences */
                dur = icaltime_subtract(dtend, dtstart);
        }
+       else {
+               dur = icaltime_subtract(dtstart, dtstart);
+       }
 
        /*
         * Just let libical iterate the recurrence, and keep looping back to the top of this function,
@@ -673,7 +670,6 @@ void load_ical_object(long msgnum, int unread,
        char mime_filename[256];
        char mime_content_type[256];
        char mime_disposition[256];
-       int mime_length;
        char relevant_partnum[256];
        char *relevant_source = NULL;
        int phase = 0;                          /* 0 = citadel headers, 1 = mime headers, 2 = body */
@@ -703,7 +699,7 @@ void load_ical_object(long msgnum, int unread,
                                extract_token(mime_partnum, &bptr[5], 2, '|', sizeof mime_partnum);
                                extract_token(mime_disposition, &bptr[5], 3, '|', sizeof mime_disposition);
                                extract_token(mime_content_type, &bptr[5], 4, '|', sizeof mime_content_type);
-                               mime_length = extract_int(&bptr[5], 5);
+                               /* do we care? mime_length = */extract_int(&bptr[5], 5);
 
                                if (  (!strcasecmp(mime_content_type, "text/calendar"))
                                      || (!strcasecmp(mime_content_type, "application/ics"))
@@ -916,6 +912,7 @@ InitModule_CALENDAR
                calendar_GetParamsGetServerCall,
                NULL,
                NULL,
+               NULL,
                calendar_LoadMsgFromServer,
                calendar_RenderView_or_Tail,
                calendar_Cleanup);
@@ -925,6 +922,7 @@ InitModule_CALENDAR
                calendar_GetParamsGetServerCall,
                NULL,
                NULL,
+               NULL,
                calendar_LoadMsgFromServer,
                calendar_RenderView_or_Tail,
                calendar_Cleanup);