00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00028 #ifndef _COMMON_H__
00029 #define _COMMON_H__
00030
00031 #include <vector>
00032 #include <algorithm>
00033 #include <list>
00034 #include <string>
00035 #include <iostream>
00036 #include <sqlite3.h>
00037 #include <assert.h>
00038 #include "CCache.h"
00039 #include "CMulticalendar.h"
00040 #include "DbCalls.h"
00041 #include "CCalendar.h"
00042 #include "CCalendarDB.h"
00043 #include "CComponent.h"
00044 #include "CComponentDetails.h"
00045 #include "CEvent.h"
00046 #include "CTodo.h"
00047 #include "CJournal.h"
00048 #include "CRecurrence.h"
00049 #include "CalendarLog.h"
00050 #include "CParameters.h"
00051 #include "CAttendee.h"
00052 #include "CProperties.h"
00053 #include "COrganizer.h"
00054 #include "CAlarm.h"
00055 #include <clockd/libtime.h>
00056 using namespace std;
00057 using std::vector;
00058 using std::string;
00059
00060
00063
00064 const char DEFAULT_CALENDAR[] = "Private";
00065 const char SYNCHRONIZED_CALENDAR[] = "Synchronized";
00066 const char OPAQUE[] = "OPAQUE";
00067 const char TRANSPERANCY[] = "TRANSPARENT";
00068 const char BEGIN[] = "begin";
00069 const char END[] = "end";
00070 const char MAXID[] = "MaxId";
00071 const char CALAPP[] = "CALENDAR-UI";
00072 const char NULL_STRING[] = "NULL";
00075 const char BEGIN_EVENT[] = "BEGIN:VEVENT";
00076 const char END_EVENT[] = "END:VEVENT";
00077 const char BEGIN_TODO[] = "BEGIN:VTODO";
00078 const char END_TODO[] = "END:VTODO";
00079 const char BEGIN_JOURNAL[] = "BEGIN:VJOURNAL";
00080 const char END_JOURNAL[] = "END:VJOURNAL";
00081 const char BEGIN_CALENDAR[] = "BEGIN:VCALENDAR";
00082 const char END_CALENDAR[] = "END:VCALENDAR";
00083 const char BEGIN_ALARM[] = "BEGIN:VALARM";
00084 const char END_ALARM[] = "END:VALARM";
00085 const char BEGIN_TIMEZONE[] = "BEGIN:VTIMEZONE";
00086 const char END_TIMEZONE[] = "END:VTIMEZONE";
00087 const char ICS_DEFAULT_CALENDAR_NAME[] = "imported calendar-%";
00088 const char ICS_CALNAME_SEPERATOR[] = "-";
00089 const char ICS_FILENAME_SEPERATOR[] = "file://";
00090 const char V_EVENT[] = "VEVENT";
00091 const char V_TODO[] = "VTODO";
00092 const char VJOURNAL[] = "VJOURNAL";
00093 const char RDATE[] = "RDATE";
00094 const char EXDATE[] = "EXDATE";
00095 const char RDATE_COL[] = "RDATE:";
00096 const char EXDATE_COL[] = "EXDATE:";
00097 const char RRULE[] = "RRULE";
00098 const char EXRULE[] = "EXRULE";
00099 const char RRULE_COL[] = "RRULE:";
00100 const char EXRULE_COL[] = "EXRULE:";
00101 const char A_ALARM[] = "AALARM";
00102 const char AALARM_COL[] = "AALARM:";
00103 const char DAILY[] = "DAILY";
00104 const char WEEKLY[] = "WEEKLY";
00105 const char MONTHLY[] = "MONTHLY";
00106 const char YEARLY[] = "YEARLY";
00107 const char WEEKDAY[] = "BYDAY=MO,TU,WE,TH,FR";
00108 const char UNTIL_ICAL[] = "UNTIL=";
00109 const char PUBLIC[] = "PUBLIC";
00110 const char PRIVATE[] = "PRIVATE";
00111 const char CONFIDENTIAL[] = "CONFIDENTIAL";
00112 const char ALTREP[] = "ALTREP=";
00113 const char DOUBLE_QUOTE[] = "\"";
00114 const char T_ICAL[] ="T";
00115 const char DAY_ICAL[] = "235959";
00116 const char SIX_O[] ="T000000";
00117 const char SIX_T_SIX[] = "000000T000000";
00118 const char WHITE_SPACE[] = " ";
00119 const char FW_SLASH[] = "/";
00122 const char DCREATED[] = "DCREATED:";
00123 const char RSVP_YES[] = "RSVP=YES";
00124 const char RSVP_NO[] = "RSVP=NO";
00125 const char PARTSTAT_SENT[] = "STATUS=SENT";
00126 const char PARTSTAT_CONFIRMED[] = "STATUS=CONFIRMED";
00127 const char STATUS_SENT[] = "STATUS:SENT";
00128 const char STATUS_DECLINED[] = "STATUS:DECLINED";
00129 const char STATUS_DELEGATED[] = "STATUS:DELEGATED";
00130 const char STATUS_ACCEPTED[] = "STATUS:ACCEPTED";
00131 const char STATUS_NEEDS_ACTION[] = "STATUS:NEEDS-ACTION";
00132 const char STATUS_CONFIRMED[] = "STATUS:CONFIRMED";
00133 const char STATUS_TENTATIVE[] = "STATUS:TENTATIVE";
00134 const char STATUS_COMPLETED[] = "STATUS:COMPLETED";
00135 const char ROLE_ATTENDEE[] = "ROLE=ATTENDEE";
00136 const char ROLE_ORGANIZER[] = "ROLE=ORGANIZER";
00137 const char ROLE_OWNER[] = "ROLE=OWNER";
00138 const char ROLE_DELEGATE[] = "ROLE=DELEGATE";
00139 const char EXPECT[] = "EXPECT=";
00140 const char TRANSP_ZERO[] = "TRANSP:0";
00141 const char TRANSP_ONE[] = "TRANSP:1";
00142 const char TRANSP_GT_ONE[] = "TRANSP:>1";
00143 const char MON_DAY[] = "MO";
00144 const char TUES_DAY[] = "TU";
00145 const char WEDNES_DAY[] = "WE";
00146 const char THURS_DAY[] = "TH";
00147 const char FRI_DAY[] = "FR";
00148 const char SATUR_DAY[] = "SA";
00149 const char COMMA[] = ",";
00150 const char HYPHEN[] = "-";
00151 const char PLUS[] = "+";
00152 const char HASH[] = "#";
00153 const char SUN_DAY[] = "SU";
00154 const char COUNT_VCAL[] = ";COUNT=";
00155 const char UNTIL_VCAL[] = ";UNTIL=";
00156 const char FREQ_DAILY[] = "FREQ=DAILY";
00157 const char FREQ_WEEKLY[] = "FREQ=WEEKLY";
00158 const char FREQ_MONTHLY[] = "FREQ=MONTHLY";
00159 const char FREQ_YEARLY[] = "FREQ=YEARLY";
00160 const char INTERVAL_VCAL[] = ";INTERVAL=";
00161 const char BY_MONTH_VCAL[] = ";BYMONTH=";
00162 const char BY_MONTHDAY_VCAL[] = ";BYMONTHDAY=";
00163 const char BY_DAY_VCAL[] = ";BYDAY=";
00164 const char WKSTRT_SU_VCAL[] = ";WKST=SU";
00165 const char UNTIL[] = "UNTIL";
00166 const char COUNT[] = "COUNT";
00167 const char FREQUENCY[] = "FREQ";
00168 const char INTERVAL[] = "INTERVAL";
00169 const char BY_DAY[] = "BYDAY";
00170 const char BY_MONTHDAY[] = "BYMONTHDAY";
00171 const char BY_MONTH[] = "BYMONTH";
00172 const char TZID[] = "TZID";
00173 const char PERIOD[] = "PERIOD";
00174 const char DATE[] = "DATE";
00175 const char DURATION[] = "DURATION";
00176 const char REPEAT[] = "REPEAT";
00177 const char ACTION_AUDIO[] = "ACTION:AUDIO";
00178 const char DURATION_COL[] = "DURATION:";
00179 const char REPEAT_COL[] = "REPEAT:";
00180 const char DALARM[] = "DALARM";
00181 const char PALARM[] = "PALARM";
00182 const char M[] = "M";
00183 const char P[] = "P";
00184 const char Y[]= "Y";
00185 const char D[] = "D";
00186 const char W[] = "W";
00187 const char NEWLINE[] = "\n";
00188 const char HASH_ZERO[] = "#0";
00189 const char TIMEZONE[] = "T000000Z";
00190 const char TRIGGER_VALUE_DATE_TIME[] = "TRIGGER;VALUE=DATE-TIME:";
00191 const char ALARM_TYPE_WAVE_VALUE[] = "AALARM:";
00192 const char AUDIO_ALARM_DELIMITER[] = ":=;,";
00193 const char DATE_DELIMITER[] = ":=;,/";
00194 const char VCALRULE_DELIMITER[] = ":=;,";
00195 const char ZEROSEMI[] = "0;";
00196 const int ZEROSEC = 0;
00197 const int THREEOOSEC = 300;
00198 const int NINEOOSEC = 900;
00199 const int HALFHOUR = 1800;
00200 const int ONEHOUR = 3600;
00201 const int THREEHOUR = 10800;
00202 const int ONEDAY = 86400;
00203 const int YEARDAYS = 365;
00204 const int MAX_DAYINSEC = 2145830400;
00205 const int HALFDAY = 43200;
00206 const int TENSEVEN = 17;
00207 const int THREE = 3;
00208 const int EIGHT = 8;
00209 const int SIX = 6;
00210 const int MAX_ALARM_TIME = 9;
00211 const int MAX_SUPPORTED_YEAR_IN_SEC = 2145830400;
00212 const int MAX_SUPPORTED_YEAR_IN_YEAR = 2037;
00213 const char ENCODING[] = "ENCODING=";
00214 const int altime[MAX_ALARM_TIME] = { ZEROSEC,
00215 ZEROSEC,
00216 THREEOOSEC,
00217 NINEOOSEC,
00218 HALFHOUR ,
00219 ONEHOUR,
00220 THREEHOUR ,
00221 ONEDAY ,
00222 HALFDAY
00223 };
00224
00227 const int ZERO = 0;
00228 const int ONE = 1;
00229 const int HUNDRED = 100;
00230 const int NINETEEN_HUNDRED = 1900;
00231 const int NINE = 9;
00232 const int MAX_PRIORITY = 255;
00233 const int EXTERNAL_ENTRY = 8;
00234 const int SUCCESS = 1;
00235 const int FAILURE = 0;
00236 const int NULLID = -1;
00237 const int MAX_ENTRIES = 100;
00238 const int MAX_ENTRY_COL = 10;
00239 const int MAX_JOUR_COL = 7;
00240 const int MAX_TODO_COL = 13;
00241 const int MAX_APRIM_COL = 7;
00242 const int MAX_ORZER_COL = 6;
00243 const int MAXSIZE = 32;
00244 const int MACLENGTH = 18;
00245 const int MAX_RECUR = 6;
00246 const int ADDRESSLENGTH = 6;
00247 const int HEX_252 = 0xfc;
00248 const int HEX_3 = 0x03;
00249 const int HEX_240 = 0xf0;
00250 const int HEX_15 = 0x0f;
00251 const int HEX_192 = 0xc0;
00252 const int HEX_63 = 0x3f;
00253 const int CAL_VISIBLE = 1;
00256 const int DEFAULT_ICS_CALNAME_LENGTH = 15;
00257 const int ICS_FILENAME_SEPERATOR_LENGTH = 6;
00258 const int ALARM_DUR_DIFF1 = 600;
00259 const int ALARM_DUR_DIFF2 = 1350;
00260 const int ALARM_DUR_DIFF3 = 2700;
00261 const int ALARM_DUR_DIFF4 = 7200;
00262 const int SEC_IN_HR = 3600;
00263
00266 const char DESCRIPTION[] = "DESCRIPTION";
00267 const char SUMMARY[] = "SUMMARY";
00268 const char RESOURCES[] = "RESOURCES";
00269 const char CATEGORIES[] = "CATEGORIES";
00270 const char ATTDEE[] = "ATTEND";
00271 const char ORGZER[] = "ORGNI";
00272 const char ATTACH[] = "ATTACH";
00273 const char ATTACH_ALARM[] = "ATTACH;FMTTYPE=audio/basic:";
00276 const char RELATEDTO[] = "RELATED-TO";
00277 const char COMMENT[] = "COMMENT";
00278 const char LOCATION[] = "LOCATION";
00279 const char CONTACT[] = "CONTACT";
00280
00281 const char LANGUAGE[] = "LANGUAGE";
00282 const char ALTER[] = "ALTER";
00283 const char RELTYPE[] = "RELTYPE";
00284 const char FMTYPE[] = "FMTYPE";
00285
00286 const char SENT[] = "SENTBY";
00287 const char CNAME[] = "CNAME";
00288 const char DIRPAR[] = "DIRPARAM";
00289 const char GNMAILTO[] = "MAILTO";
00290 const char ATCUTYPE[] = "CUTYPE";
00291 const char ATMEMBER[] = "MEMBER";
00292 const char ATROLE[] = "ROLE";
00293 const char ATPSTAT[] = "PSTAT";
00294 const char ATRSVP[] = "RSVP";
00295 const char ATDELEGATEES[] = "DELEGATEES";
00296 const char ATDELEGATOR[] = "DELEGATOR";
00297 const int ATTDEE_LEN = 6;
00298 const int ORGZER_LEN = 5;
00299 const int TWO_ROWS = 2;
00303 const char COMMIT[] = "commit";
00304 const char ROLLBACK[] = "rollback";
00305 const int DEFAULT_SIZE = 50;
00310 #define ASSERTION(X) assert(X);
00311
00316 typedef enum {
00317 CNPARAM = 0,
00318 DIRPARAM,
00319 SENTBYPARAM,
00320 ORGLANGUAGE
00321 }OrganizerParams;
00322
00323 typedef enum {
00324 CALENDAR_USER_TYPE = 0,
00325 MEMBER ,
00326 ROLE,
00327 PART_STATUS,
00328 RSVP,
00329 DELEGATEES,
00330 DELEGATOR,
00331 SENTBY,
00332 COMMON_NAME,
00333 DIR_PARAM,
00334 ATTLANGUAGE,
00335 MAILTO
00336 } AttendeeParams;
00337
00338 typedef enum DATATYPE{
00339 STRING = 0,
00340 INTEGER,
00341 FLOAT,
00342 BOOL,
00343 NONE_TYPE
00344 };
00345
00346 enum EntryType{
00347 ALL_ENTRIES = 0,
00348 EVENT,
00349 TODO,
00350 JOURNAL,
00351 BIRTHDAY
00352 };
00353
00354 enum OPTION_TYPE {
00355
00356 HAS_ATTENDEE = 1,
00357 HAS_ORGANIZER,
00358 HAS_RECURRENCE,
00359 HAS_ALARM,
00360 HAS_RECURRENCE_ALARM,
00361 HAS_PARTICIPANT,
00362 HAS_CATEGORIES,
00363 HAS_COMMENT,
00364 HAS_EXTRA
00365 };
00366
00367 enum RecurrencType{
00368 E_NONE =0 ,
00369 E_DAILY,
00370 E_WEEKDAY,
00371 E_WEEKLY,
00372 E_MONTHLY,
00373 E_YEARLY,
00374 E_COMPLEX
00375 };
00376
00377 enum entryType {
00378 E_CALENDAR = 0,
00379 E_EVENT,
00380 E_TODO,
00381 E_JOURNAL,
00382 E_BDAY,
00383 E_SPARE,
00384 E_VTIMEZONE
00385 };
00386
00387 enum columnId {
00388 DB_COLUMN_ID1 = 0,
00389 DB_COLUMN_ID2,
00390 DB_COLUMN_ID3,
00391 DB_COLUMN_ID4,
00392 DB_COLUMN_ID5,
00393 DB_COLUMN_ID6,
00394 DB_COLUMN_ID7,
00395 DB_COLUMN_ID8,
00396 DB_COLUMN_ID9,
00397 DB_COLUMN_ID10,
00398 DB_COLUMN_ID11,
00399 DB_COLUMN_ID12,
00400 DB_COLUMN_ID13,
00401 DB_COLUMN_ID14,
00402 DB_COLUMN_ID15,
00403 DB_COLUMN_ID16,
00404 DB_COLUMN_ID17,
00405 DB_COLUMN_ID18,
00406 DB_COLUMN_ID19,
00407 DB_COLUMN_ID20,
00408 DB_COLUMN_ID21,
00409 DB_COLUMN_ID22,
00410 DB_COLUMN_ID23,
00411 DB_COLUMN_ID24,
00412 DB_COLUMN_ID25,
00413 DB_COLUMN_ID26,
00414 DB_COLUMN_ID27,
00415 DB_COLUMN_ID28,
00416 DB_COLUMN_ID29,
00417 DB_COLUMN_ID30,
00418 DB_COLUMN_ID31,
00419 DB_COLUMN_ID32,
00420 DB_COLUMN_ID33,
00421 DB_COLUMN_ID34,
00422 DB_COLUMN_ID35,
00423 DB_COLUMN_ID36,
00424 DB_COLUMN_ID37,
00425 DB_COLUMN_ID38,
00426 DB_COLUMN_ID39,
00427 DB_COLUMN_ID40,
00428 DB_COLUMN_ID41,
00429 DB_COLUMN_ID42,
00430 DB_COLUMN_ID43,
00431 DB_COLUMN_ID44,
00432 DB_COLUMN_ID45,
00433 DB_COLUMN_ID46,
00434 DB_COLUMN_ID47,
00435 DB_COLUMN_ID48,
00436 DB_COLUMN_ID49
00437 };
00438
00439 enum DaysOfWeek
00440 {
00441 Sunday = 1,
00442 Monday = 2,
00443 Tuesday = 4,
00444 Wednesday = 8,
00445 Thursday = 16,
00446 Friday = 32,
00447 Saturday = 64
00448 };
00449
00450 enum RecurrenceType
00451 {
00452 RecursSecondly = 0,
00453 RecursMinutely ,
00454 RecursHourly ,
00455 RecursDaily ,
00456 RecursWeekly ,
00457 RecursMonthly ,
00458 RecursMonthNth ,
00459 RecursYearly ,
00460 RecursYearNth
00461 };
00462
00463 typedef struct {
00464 RecurrenceType freq;
00465 char* interval;
00466 char* modifier;
00467 char* duration;
00468 }RecurrenceItem;
00469
00470 enum queryId {
00471 DB_QUERY_INDEX1 = 1,
00472 DB_QUERY_INDEX2,
00473 DB_QUERY_INDEX3,
00474 DB_QUERY_INDEX4,
00475 DB_QUERY_INDEX5,
00476 DB_QUERY_INDEX6,
00477 DB_QUERY_INDEX7,
00478 DB_QUERY_INDEX8
00479 };
00480
00481 #endif