Back to index

webcit  8.12-dfsg
ical_subst.c
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1996-2012 by the citadel.org team
00003  *
00004  * This program is open source software.  You can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License, version 3.
00006  *
00007  * This program is distributed in the hope that it will be useful,
00008  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00009  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010  * GNU General Public License for more details.
00011  */
00012 
00013 #include "webcit.h"
00014 
00015 extern IcalEnumMap icalproperty_kind_map[];
00016 
00017 HashList *IcalComponentMap = NULL;
00018 
00019 #if 0
00020 void SortPregetMatter(HashList *Cals)
00021 {
00022        disp_cal *Cal;
00023        void *vCal;
00024        const char *Key;
00025         long KLen;
00026        IcalEnumMap *SortMap[10];
00027        IcalEnumMap *Map;
00028        void *vSort;
00029        const char *Next = NULL;
00030        const StrBuf *SortVector;
00031        StrBuf *SortBy;
00032        int i = 0;
00033        HashPos *It;
00034 
00035        SortVector = SBSTR("ICALSortVec");
00036        if (SortVector == NULL)
00037               return;
00038 
00039        for (i = 0; i < 10; i++) SortMap[i] = NULL;
00040        SortBy = NewStrBuf();
00041        while (StrBufExtract_NextToken(SortBy, SortVector, &Next, ':') > 0) {
00042               GetHash(IcalComponentMap, SKEY(SortBy), &vSort);
00043               Map = (IcalEnumMap*) vSort;
00044               SortMap[i] = Map;
00045               i++;
00046               if (i > 9)
00047                      break;
00048        }
00049 
00050        if (i == 0)
00051               return;
00052 
00053        switch (SortMap[i - 1]->map) {
00055 
00056        default:
00057               break;
00058        }
00059 
00060        It = GetNewHashPos(Cals, 0);
00061        while (GetNextHashPos(Cals, It, &KLen, &Key, &vCal)) {
00062               i = 0;
00063               Cal = (disp_cal*) vCal;
00064               Cal->Status = icalcomponent_get_status(Cal->cal);
00065               Cal->SortBy = Cal->cal;
00066               
00067 
00068               while ((SortMap[i] != NULL) && 
00069                      (Cal->SortBy != NULL)) 
00070               {
00071                      /****Cal->SortBy = icalcomponent_get_first_property(Cal->SortBy, SortMap[i++]->map); */
00072               }
00073        }
00074 }
00075 #endif
00076 
00077 
00078 void tmplput_ICalItem(StrBuf *Target, WCTemplputParams *TP)
00079 {
00080 
00081 }
00082 
00083 void CreateIcalComponendKindLookup(void)
00084 {
00085        int i = 0;
00086 
00087        IcalComponentMap = NewHash (1, NULL);
00088        while (icalproperty_kind_map[i].NameLen != 0) {
00089               RegisterNS(icalproperty_kind_map[i].Name, 
00090                         icalproperty_kind_map[i].NameLen, 
00091                         0, 
00092                         10, 
00093                         tmplput_ICalItem,
00094                         NULL, 
00095                         CTX_ICAL);
00096               Put(IcalComponentMap, 
00097                   icalproperty_kind_map[i].Name, 
00098                   icalproperty_kind_map[i].NameLen, 
00099                   &icalproperty_kind_map[i],
00100                   reference_free_handler);
00101                         
00102                         
00103               i++;
00104        }
00105 }
00106 
00107 
00108 
00109 
00110 
00111 
00112 
00113 
00114 
00115 
00116 
00117 
00118 
00119 
00120 
00121 
00122 void 
00123 InitModule_ICAL_SUBST
00124 (void)
00125 {
00126        CreateIcalComponendKindLookup ();
00127 
00128 }
00129 
00130 void 
00131 ServerShutdownModule_ICAL
00132 (void)
00133 {
00134        DeleteHash(&IcalComponentMap);
00135 }