Revert "Since glibc 2.34, libpthread is builtin , -lpthread no longer required."
[citadel.git] / webcit / ical_subst.c
index bd44e42b96fea2efc126a8c9038b99876c894398..adb923882994665fdf53883134a02ebc672ccf77 100644 (file)
@@ -22,64 +22,6 @@ CtxType CTX_ICALMETHOD = CTX_NONE;
 CtxType CTX_ICALTIME = CTX_NONE;
 CtxType CTX_ICALATTENDEE = CTX_NONE;
 CtxType CTX_ICALCONFLICT = CTX_NONE;
-#if 0
-void SortPregetMatter(HashList *Cals)
-{
-       disp_cal *Cal;
-       void *vCal;
-       const char *Key;
-        long KLen;
-       IcalEnumMap *SortMap[10];
-       IcalEnumMap *Map;
-       void *vSort;
-       const char *Next = NULL;
-       const StrBuf *SortVector;
-       StrBuf *SortBy;
-       int i = 0;
-       HashPos *It;
-
-       SortVector = SBSTR("ICALSortVec");
-       if (SortVector == NULL)
-               return;
-
-       for (i = 0; i < 10; i++) SortMap[i] = NULL;
-       SortBy = NewStrBuf();
-       while (StrBufExtract_NextToken(SortBy, SortVector, &Next, ':') > 0) {
-               GetHash(IcalComponentMap, SKEY(SortBy), &vSort);
-               Map = (IcalEnumMap*) vSort;
-               SortMap[i] = Map;
-               i++;
-               if (i > 9)
-                       break;
-       }
-
-       if (i == 0)
-               return;
-
-       switch (SortMap[i - 1]->map) {
-               /*      case */
-
-       default:
-               break;
-       }
-
-       It = GetNewHashPos(Cals, 0);
-       while (GetNextHashPos(Cals, It, &KLen, &Key, &vCal)) {
-               i = 0;
-               Cal = (disp_cal*) vCal;
-               Cal->Status = icalcomponent_get_status(Cal->cal);
-               Cal->SortBy = Cal->cal;
-               
-
-               while ((SortMap[i] != NULL) && 
-                      (Cal->SortBy != NULL)) 
-               {
-                       /****Cal->SortBy = icalcomponent_get_first_property(Cal->SortBy, SortMap[i++]->map); */
-               }
-       }
-}
-#endif
-
 
 void tmplput_ICalItem(StrBuf *Target, WCTemplputParams *TP)
 {
@@ -272,8 +214,8 @@ void render_MIME_ICS_TPL(StrBuf *Target, WCTemplputParams *TP, StrBuf *FoundChar
        wc_mime_attachment *Mime = CTX(CTX_MIME_ATACH);
        icalproperty_method the_method = ICAL_METHOD_NONE;
        icalproperty *method = NULL;
-       icalcomponent *cal;
-       icalcomponent *c;
+       icalcomponent *cal = NULL;
+       icalcomponent *c = NULL;
         WCTemplputParams SubTP;
         WCTemplputParams SuperTP;
 
@@ -325,7 +267,8 @@ void render_MIME_ICS_TPL(StrBuf *Target, WCTemplputParams *TP, StrBuf *FoundChar
                      0,
                      SuperTP.Tokens);
        FlushStrBuf(Mime->Data);
-       DoTemplate(HKEY("ical_attachment_display"), Mime->Data, &SubTP);
+///    DoTemplate(HKEY("ical_attachment_display"), Mime->Data, &SubTP);
+       DoTemplate(HKEY("ical_edit"), Mime->Data, &SubTP);
 
        /*/ cal_process_object(Mime->Data, cal, 0, Mime->msgnum, ChrPtr(Mime->PartNum)); */
 
@@ -417,7 +360,7 @@ HashList *iterate_FindConflict(StrBuf *Target, WCTemplputParams *TP)
                                Done = 1;
                        }
                        else {
-                               Conflict = (CalendarConflict *) malloc(sizeof(CalendarConflict *));
+                               Conflict = (CalendarConflict *) malloc(sizeof(CalendarConflict));
                                Conflict->conflict_event_uid = NewStrBufPlain(NULL, StrLength(Line));
                                Conflict->conflict_event_summary = NewStrBufPlain(NULL, StrLength(Line));
 
@@ -432,7 +375,8 @@ HashList *iterate_FindConflict(StrBuf *Target, WCTemplputParams *TP)
                                Pos = NULL;
                        }
        }
-       syslog(9, "...done.\n");
+       FreeStrBuf(&Line);
+       syslog(LOG_DEBUG, "...done.\n");
        return Conflicts;
 }
 
@@ -536,7 +480,7 @@ int cond_ICalAttendeeState(StrBuf *Target, WCTemplputParams *TP)
        for (c = icalcomponent_get_first_component(cal, ICAL_ANY_COMPONENT);
             (c != 0);
             c = icalcomponent_get_next_component(cal, ICAL_ANY_COMPONENT)) {
-               /* Recursively process subcomponent * /
+               // Recursively process subcomponent
                cal_process_object(Target, c, recursion_level+1, msgnum, cal_partnum);
        }
        */
@@ -547,10 +491,10 @@ InitModule_ICAL_SUBST
 (void)
 {
        RegisterCTX(CTX_ICAL);
-//*
+/*
        RegisterMimeRenderer(HKEY("text/calendar"), render_MIME_ICS_TPL, 1, 501);
        RegisterMimeRenderer(HKEY("application/ics"), render_MIME_ICS_TPL, 1, 500);
-//*/
+*/
 
        CreateIcalComponendKindLookup ();
        RegisterConditional("COND:ICAL:PROPERTY", 1, cond_ICalHaveItem, CTX_ICAL);
@@ -558,7 +502,7 @@ InitModule_ICAL_SUBST
 
 
         RegisterIterator("ICAL:CONFLICT", 0, NULL, iterate_FindConflict, 
-                         NULL, NULL, CTX_MIME_ATACH, CTX_ICALCONFLICT, IT_NOFLAG);
+                         NULL, DeleteHash, CTX_MIME_ATACH, CTX_ICALCONFLICT, IT_NOFLAG);
        RegisterNamespace("ICAL:CONFLICT:MSGID", 0, 1, tmplput_ConflictEventMsgID, NULL, CTX_ICALCONFLICT);
        RegisterNamespace("ICAL:CONFLICT:EUID", 0, 1, tmplput_ConflictEUID, NULL, CTX_ICALCONFLICT);
        RegisterNamespace("ICAL:CONFLICT:SUMMARY", 0, 1, tmplput_ConflictSummary, NULL, CTX_ICALCONFLICT);
@@ -567,7 +511,7 @@ InitModule_ICAL_SUBST
 
        RegisterCTX(CTX_ICALATTENDEE);
         RegisterIterator("ICAL:ATTENDEES", 0, NULL, iterate_get_ical_attendees, 
-                         NULL, NULL, CTX_ICALATTENDEE, CTX_ICAL, IT_NOFLAG);
+                         NULL, DeleteHash, CTX_ICALATTENDEE, CTX_ICAL, IT_NOFLAG);
        RegisterNamespace("ICAL:ATTENDEE", 1, 2, tmplput_ICalAttendee, NULL, CTX_ICALATTENDEE);
        RegisterConditional("COND:ICAL:ATTENDEE", 1, cond_ICalAttendeeState, CTX_ICALATTENDEE);
 
@@ -593,28 +537,3 @@ ServerShutdownModule_ICAL
 {
        DeleteHash(&IcalComponentMap);
 }
-
-
-
-/*
-                       if (is_update) {
-                               snprintf(conflict_message, sizeof conflict_message,
-                                        _("This is an update of '%s' which is already in your calendar."), conflict_name);
-                       }
-                       else {
-                               snprintf(conflict_message, sizeof conflict_message,
-                                        _("This event would conflict with '%s' which is already in your calendar."), conflict_name);
-                       }
-
-                       StrBufAppendPrintf(Target, "<dt>%s",
-                                          (is_update ?
-                                           _("Update:") :
-                                           _("CONFLICT:")
-                                                  )
-                               );
-                       StrBufAppendPrintf(Target, "</dt><dd>");
-                       StrEscAppend(Target, NULL, conflict_message, 0, 0);
-                       StrBufAppendPrintf(Target, "</dd>\n");
-                       }
-               }
-/*/