removed a bunch of blank comment lines
[citadel.git] / webcit / ical_subst.c
1 /*
2  * Copyright (c) 1996-2012 by the citadel.org team
3  *
4  * This program is open source software.  You can redistribute it and/or
5  * modify it under the terms of the GNU General Public License, version 3.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  */
12
13 #include "webcit.h"
14
15 extern IcalEnumMap icalproperty_kind_map[];
16
17 HashList *IcalComponentMap = NULL;
18
19 #if 0
20 void SortPregetMatter(HashList *Cals)
21 {
22         disp_cal *Cal;
23         void *vCal;
24         const char *Key;
25         long KLen;
26         IcalEnumMap *SortMap[10];
27         IcalEnumMap *Map;
28         void *vSort;
29         const char *Next = NULL;
30         const StrBuf *SortVector;
31         StrBuf *SortBy;
32         int i = 0;
33         HashPos *It;
34
35         SortVector = SBSTR("ICALSortVec");
36         if (SortVector == NULL)
37                 return;
38
39         for (i = 0; i < 10; i++) SortMap[i] = NULL;
40         SortBy = NewStrBuf();
41         while (StrBufExtract_NextToken(SortBy, SortVector, &Next, ':') > 0) {
42                 GetHash(IcalComponentMap, SKEY(SortBy), &vSort);
43                 Map = (IcalEnumMap*) vSort;
44                 SortMap[i] = Map;
45                 i++;
46                 if (i > 9)
47                         break;
48         }
49
50         if (i == 0)
51                 return;
52
53         switch (SortMap[i - 1]->map) {
54                 ///     case 
55
56         default:
57                 break;
58         }
59
60         It = GetNewHashPos(Cals, 0);
61         while (GetNextHashPos(Cals, It, &KLen, &Key, &vCal)) {
62                 i = 0;
63                 Cal = (disp_cal*) vCal;
64                 Cal->Status = icalcomponent_get_status(Cal->cal);
65                 Cal->SortBy = Cal->cal;
66                 
67
68                 while ((SortMap[i] != NULL) && 
69                        (Cal->SortBy != NULL)) 
70                 {
71                         /****Cal->SortBy = icalcomponent_get_first_property(Cal->SortBy, SortMap[i++]->map); */
72                 }
73         }
74 }
75 #endif
76
77
78 void tmplput_ICalItem(StrBuf *Target, WCTemplputParams *TP)
79 {
80
81 }
82
83 void CreateIcalComponendKindLookup(void)
84 {
85         int i = 0;
86
87         IcalComponentMap = NewHash (1, NULL);
88         while (icalproperty_kind_map[i].NameLen != 0) {
89                 RegisterNS(icalproperty_kind_map[i].Name, 
90                            icalproperty_kind_map[i].NameLen, 
91                            0, 
92                            10, 
93                            tmplput_ICalItem,
94                            NULL, 
95                            CTX_ICAL);
96                 Put(IcalComponentMap, 
97                     icalproperty_kind_map[i].Name, 
98                     icalproperty_kind_map[i].NameLen, 
99                     &icalproperty_kind_map[i],
100                     reference_free_handler);
101                            
102                            
103                 i++;
104         }
105 }
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122 void 
123 InitModule_ICAL_SUBST
124 (void)
125 {
126         CreateIcalComponendKindLookup ();
127
128 }
129
130 void 
131 ServerShutdownModule_ICAL
132 (void)
133 {
134         DeleteHash(&IcalComponentMap);
135 }