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