Back to index

lightning-sunbird  0.9+nobinonly
icalclassify.c
Go to the documentation of this file.
00001 /* -*- Mode: C -*-
00002     ======================================================================
00003     FILE: icalclassify.c
00004     CREATOR: ebusboom 23 aug 2000
00005   
00006     $Id: icalclassify.c,v 1.14 2003/11/17 22:51:53 gray-john Exp $
00007     $Locker:  $
00008     
00009     (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
00010     
00011     This program is free software; you can redistribute it and/or modify
00012     it under the terms of either: 
00013     
00014     The LGPL as published by the Free Software Foundation, version
00015     2.1, available at: http://www.fsf.org/copyleft/lesser.html
00016     
00017     Or:
00018     
00019     The Mozilla Public License Version 1.0. You may obtain a copy of
00020     the License at http://www.mozilla.org/MPL/
00021 
00022 
00023     ======================================================================*/
00024 
00025 #ifdef HAVE_CONFIG_H
00026 #include "config.h"
00027 #endif
00028 
00029 #include "ical.h"
00030 #include "icalclassify.h"
00031 #include "icalmemory.h"
00032 
00033 #include <ctype.h>   /* For tolower() */
00034 #include <string.h> /* for index() */
00035 #include <stdlib.h> /* for malloc and free */
00036 
00037 
00038 
00039 struct icalclassify_parts {
00040     icalcomponent *c;
00041     icalcomponent_kind inner_kind;
00042     icalproperty_method method;
00043     char* organizer;
00044     icalparameter_partstat reply_partstat;
00045     char* reply_attendee;
00046     char* uid;
00047     int sequence;
00048     struct icaltimetype dtstamp;   
00049     struct icaltimetype recurrence_id;
00050 }; 
00051        
00052 
00053 char* icalclassify_lowercase(const char* str)
00054 {
00055     char* p = 0;
00056     char* ret;
00057 
00058     if(str ==0){
00059        return 0;
00060     }
00061 
00062     ret = icalmemory_strdup(str);
00063 
00064     for(p = ret; *p!=0; p++){
00065        *p = tolower(*p);
00066     }
00067 
00068     return ret;
00069 }
00070 
00071 /* Return a set of components that intersect in time with comp. For
00072 component X and Y to intersect:
00073     X.DTSTART < Y.DTEND && X.DTEND > Y.DTSTART
00074 */
00075 
00076 
00077 icalcomponent* icalclassify_find_overlaps(icalset* set, icalcomponent* comp)
00078 {
00079     icalcomponent *return_set;
00080     icalcomponent *c;
00081     struct icaltime_span span,compspan;
00082     
00083     icalerror_clear_errno();
00084     compspan = icalcomponent_get_span(comp);
00085 
00086     if(icalerrno != ICAL_NO_ERROR){
00087        return 0;
00088     }
00089 
00090 
00091     return_set = icalcomponent_new(ICAL_XROOT_COMPONENT);
00092 
00093     for(c = icalset_get_first_component(set);
00094        c != 0;
00095        c = icalset_get_next_component(set)){
00096 
00097        icalerror_clear_errno();
00098 
00099        span = icalcomponent_get_span(c);
00100 
00101        if(icalerrno != ICAL_NO_ERROR){
00102            continue;
00103        }
00104 
00105        if (compspan.start < span.end && 
00106            compspan.end > span.start){
00107 
00108            icalcomponent *clone = icalcomponent_new_clone(c);
00109 
00110            icalcomponent_add_component(return_set,clone);
00111        }      
00112     }
00113 
00114     if(icalcomponent_count_components(return_set,ICAL_ANY_COMPONENT) !=0){
00115        return return_set;
00116     } else {
00117        icalcomponent_free(return_set);
00118        return 0;
00119     }
00120 }
00121 
00122 
00123 
00124 icalproperty* icalclassify_find_attendee(icalcomponent *c, 
00125                                             const char* attendee)
00126 {
00127     icalproperty *p;
00128     icalcomponent* inner;
00129     char* lattendee;
00130     char* upn;
00131 
00132     if(attendee == 0){
00133         return 0;
00134     }
00135 
00136     lattendee = icalclassify_lowercase(attendee);
00137     upn =  strchr(lattendee,':');
00138 
00139     if (upn== 0){
00140         upn = lattendee;
00141     } else {
00142         upn++; /* skip the ";"*/
00143     }
00144 
00145     inner = icalcomponent_get_first_real_component(c);
00146 
00147     for(p  = icalcomponent_get_first_property(inner,ICAL_ATTENDEE_PROPERTY);
00148        p != 0;
00149        p  = icalcomponent_get_next_property(inner,ICAL_ATTENDEE_PROPERTY))
00150     {
00151        char* this_attendee
00152            = icalclassify_lowercase(icalproperty_get_attendee(p));
00153        char* this_upn = strchr(this_attendee,':');
00154 
00155         if(this_upn == 0){
00156             continue;
00157         } else {
00158             this_upn++;
00159         }
00160 
00161        if(strcmp(this_upn,upn)==0){
00162                      free(lattendee);
00163                      free(this_attendee);
00164             return p;
00165        }
00166 
00167               free(this_attendee);
00168     }
00169        free(lattendee);
00170 
00171     return 0;
00172 
00173 }
00174 
00175 void icalssutil_free_parts(struct icalclassify_parts *parts)
00176 {
00177     if(parts == 0){
00178        return;
00179     }
00180 
00181     if(parts->organizer != 0){
00182        free(parts->organizer);
00183     }
00184 
00185     if(parts->uid != 0){
00186        free(parts->uid);
00187     }
00188 
00189     if(parts->reply_attendee){
00190        free(parts->reply_attendee);
00191     }
00192 }
00193 
00194 void icalssutil_get_parts(icalcomponent* c,  
00195                        struct icalclassify_parts* parts)
00196 {
00197     icalproperty *p;
00198     icalcomponent *inner;
00199 
00200     memset(parts,0,sizeof(struct icalclassify_parts));
00201 
00202     parts->method = ICAL_METHOD_NONE;
00203     parts->sequence = 0;
00204     parts->reply_partstat = ICAL_PARTSTAT_NONE;
00205 
00206     if(c == 0){
00207        return;
00208     }
00209 
00210     parts->c = c;
00211 
00212     p = icalcomponent_get_first_property(c,ICAL_METHOD_PROPERTY);
00213     if(p!=0){
00214        parts->method = icalproperty_get_method(p);
00215     }
00216 
00217     inner = icalcomponent_get_first_real_component(c);
00218 
00219     parts->inner_kind = icalcomponent_isa(inner);
00220 
00221     p = icalcomponent_get_first_property(inner,ICAL_ORGANIZER_PROPERTY);
00222     if(p!=0){
00223        parts->organizer = strdup(icalproperty_get_organizer(p));
00224     }
00225 
00226     p = icalcomponent_get_first_property(inner,ICAL_SEQUENCE_PROPERTY);    
00227     if(p!=0){
00228        parts->sequence = icalproperty_get_sequence(p);
00229     }
00230 
00231     p = icalcomponent_get_first_property(inner,ICAL_UID_PROPERTY);
00232     if(p!=0){
00233        parts->uid = strdup(icalproperty_get_uid(p));
00234     }
00235 
00236     p = icalcomponent_get_first_property(inner,ICAL_RECURRENCEID_PROPERTY);
00237     if(p!=0){
00238        parts->recurrence_id = icalproperty_get_recurrenceid(p);
00239     }
00240 
00241     p = icalcomponent_get_first_property(inner,ICAL_DTSTAMP_PROPERTY);
00242     if(p!=0){
00243        parts->dtstamp = icalproperty_get_dtstamp(p);
00244     }
00245 
00246     if(parts->method==ICAL_METHOD_REPLY){
00247        icalparameter *param;
00248        p  = icalcomponent_get_first_property(inner,ICAL_ATTENDEE_PROPERTY);
00249 
00250        if(p!=0){
00251 
00252            param = icalproperty_get_first_parameter(p,ICAL_PARTSTAT_PARAMETER);
00253            
00254            if(param != 0){
00255               parts->reply_partstat = 
00256                   icalparameter_get_partstat(param);
00257            }
00258            
00259            parts->reply_attendee = strdup(icalproperty_get_attendee(p));
00260        }
00261 
00262     }    
00263 
00264 
00265 }
00266 
00267 
00268 int icalssutil_is_rescheduled(icalcomponent* a,icalcomponent* b)
00269 {
00270     icalproperty *p1,*p2;
00271     icalcomponent *i1,*i2;
00272     int i;
00273 
00274     icalproperty_kind kind_array[] = {
00275        ICAL_DTSTART_PROPERTY,
00276        ICAL_DTEND_PROPERTY,
00277        ICAL_DURATION_PROPERTY,
00278        ICAL_DUE_PROPERTY,
00279        ICAL_RRULE_PROPERTY,
00280        ICAL_RDATE_PROPERTY,
00281        ICAL_EXRULE_PROPERTY,
00282        ICAL_EXDATE_PROPERTY,
00283        ICAL_NO_PROPERTY
00284     };
00285 
00286     i1 = icalcomponent_get_first_real_component(a);
00287     i2 = icalcomponent_get_first_real_component(b);
00288 
00289     for(i =0; kind_array[i] != ICAL_NO_PROPERTY; i++){
00290        p1 = icalcomponent_get_first_property(i1,kind_array[i]);
00291        p2 = icalcomponent_get_first_property(i2,kind_array[i]);
00292        
00293        if( (p1!=0)^(p2!=0) ){
00294            /* Return true if the property exists in one component and not
00295               the other */
00296            return 1;
00297        }
00298        
00299        if(p1 && strcmp(icalproperty_as_ical_string(p1),
00300                      icalproperty_as_ical_string(p2)) != 0){
00301            return 1;
00302        }
00303     }
00304 
00305     return 0;
00306     
00307 }
00308 
00309 #define icalclassify_pre \
00310     int rtrn =0; 
00311 
00312 #define icalclassify_post \
00313     return rtrn;
00314 
00315 
00316 int icalclassify_publish_new(struct icalclassify_parts *comp, 
00317                             struct icalclassify_parts *match, 
00318                             const char* user)
00319 {
00320     icalclassify_pre;
00321 
00322     if(comp->method == ICAL_METHOD_PUBLISH &&
00323        match == 0 && comp->inner_kind != ICAL_VFREEBUSY_COMPONENT){
00324        rtrn = 1;
00325     }
00326        
00327     icalclassify_post;
00328 
00329 }
00330 
00331 int icalclassify_publish_update(struct icalclassify_parts *comp, 
00332                             struct icalclassify_parts *match, 
00333                             const char* user)
00334 {
00335     icalclassify_pre;
00336 
00337     if(comp->method == ICAL_METHOD_PUBLISH &&
00338        match !=0 && comp->inner_kind != ICAL_VFREEBUSY_COMPONENT){
00339        rtrn = 1;
00340     }
00341        
00342     icalclassify_post;
00343 
00344 }
00345 
00346 int icalclassify_publish_freebusy(struct icalclassify_parts *comp, 
00347                             struct icalclassify_parts *match, 
00348                             const char* user)
00349 {
00350     icalclassify_pre;
00351 
00352     if(comp->method == ICAL_METHOD_PUBLISH &&
00353        comp->inner_kind == ICAL_VFREEBUSY_COMPONENT){
00354        rtrn = 1;
00355     }
00356        
00357     icalclassify_post;
00358 
00359 }
00360 
00361 
00362 int icalclassify_request_new(struct icalclassify_parts *comp, 
00363                                 struct icalclassify_parts *match, 
00364                                 const char* user)
00365 {
00366     /* Method is  REQUEST, and there is no match */
00367 
00368     icalclassify_pre
00369 
00370     if(match->c==0 && comp->method == ICAL_METHOD_REQUEST){
00371        rtrn = 1;
00372     }
00373 
00374     icalclassify_post
00375 
00376 }
00377 
00378 int icalclassify_request_update(
00379     struct icalclassify_parts *comp,
00380     struct icalclassify_parts *match, 
00381     const char* user)
00382 {
00383     /* REQUEST method, Higher SEQUENCE than match, and all
00384        time-related properties are unchanged */
00385     
00386     icalclassify_pre
00387 
00388     if (match != 0 &&
00389        comp->sequence >= match->sequence &&
00390        !icalssutil_is_rescheduled(comp->c,match->c)){
00391        rtrn = 1;
00392     }
00393 
00394     icalclassify_post
00395 
00396 }
00397 
00398 int icalclassify_request_reschedule(
00399     struct icalclassify_parts *comp,
00400     struct icalclassify_parts *match, 
00401     const char* user)
00402 {
00403     /* REQUEST method, Higher SEQUENCE than match, and one or more
00404        time-related properties are changed */
00405     icalclassify_pre
00406 
00407     if (match->c != 0 &&
00408        comp->sequence > match->sequence &&
00409        icalssutil_is_rescheduled(comp->c,match->c)){
00410        rtrn = 1;
00411     }
00412 
00413     icalclassify_post
00414 
00415 }
00416 
00417 int icalclassify_request_delegate(
00418     struct icalclassify_parts *comp,
00419     struct icalclassify_parts *match, 
00420     const char* user)
00421 {
00422     icalproperty* attendee;
00423     icalparameter* param;
00424     icalclassify_pre;
00425 
00426     attendee = icalclassify_find_attendee(comp->c,user);
00427 
00428     if(attendee == 0){
00429         return 0;
00430     }
00431 
00432     param = icalproperty_get_first_parameter(attendee,ICAL_DELEGATEDFROM_PARAMETER);
00433            
00434     if (param != 0){
00435        rtrn = 1;
00436     }
00437 
00438     icalclassify_post
00439 
00440 }
00441 
00442 int icalclassify_request_new_organizer(
00443     struct icalclassify_parts *comp,
00444     struct icalclassify_parts *match, 
00445     const char* user)
00446 {
00447     /*   Organizer has changed between match and component */
00448     icalclassify_pre
00449     icalerror_set_errno(ICAL_UNIMPLEMENTED_ERROR);
00450     icalclassify_post
00451 
00452 }
00453 
00454 int icalclassify_request_status(
00455     struct icalclassify_parts *comp,
00456     struct icalclassify_parts *match, 
00457     const char* user)
00458 {
00459     icalclassify_pre
00460     icalerror_set_errno(ICAL_UNIMPLEMENTED_ERROR);
00461     icalclassify_post
00462 }
00463 
00464 int icalclassify_request_forward(
00465     struct icalclassify_parts *comp,
00466     struct icalclassify_parts *match, 
00467     const char* user)
00468 {
00469     icalclassify_pre
00470     icalerror_set_errno(ICAL_UNIMPLEMENTED_ERROR);
00471     icalclassify_post
00472 }
00473 
00474 int icalclassify_request_freebusy(
00475     struct icalclassify_parts *comp,
00476     struct icalclassify_parts *match, 
00477     const char* user)
00478 {
00479     icalclassify_pre
00480     icalerror_set_errno(ICAL_UNIMPLEMENTED_ERROR);
00481     icalclassify_post
00482 }
00483 
00484 int icalclassify_reply_accept(
00485     struct icalclassify_parts *comp,
00486     struct icalclassify_parts *match, 
00487     const char* user)
00488 {
00489     icalproperty* attendee;
00490     icalclassify_pre;
00491 
00492     attendee = icalclassify_find_attendee(match->c,comp->reply_attendee);
00493 
00494     if(attendee != 0&&
00495        comp->reply_partstat == ICAL_PARTSTAT_ACCEPTED){
00496        rtrn = 1;
00497     }
00498 
00499     icalclassify_post
00500 }
00501 int icalclassify_reply_decline(
00502     struct icalclassify_parts *comp,
00503     struct icalclassify_parts *match, 
00504     const char* user)
00505 {
00506     icalproperty* attendee;
00507     icalclassify_pre;
00508 
00509     attendee = icalclassify_find_attendee(match->c,comp->reply_attendee);
00510 
00511 
00512     if( attendee != 0 &&
00513        comp->reply_partstat == ICAL_PARTSTAT_DECLINED){
00514        rtrn = 1;
00515     }
00516     icalclassify_post
00517 }
00518 int icalclassify_reply_delegate(
00519     struct icalclassify_parts *comp,
00520     struct icalclassify_parts *match, 
00521     const char* user)
00522 {
00523     icalproperty* attendee;
00524     icalclassify_pre;
00525 
00526     attendee = icalclassify_find_attendee(match->c,comp->reply_attendee);
00527 
00528     if( attendee != 0 &&
00529        comp->reply_partstat == ICAL_PARTSTAT_DELEGATED){
00530        rtrn = 1;
00531     }
00532     icalclassify_post
00533 }
00534 int icalclassify_reply_crasher_accept(
00535     struct icalclassify_parts *comp,
00536     struct icalclassify_parts *match, 
00537     const char* user)
00538 {
00539     icalproperty* attendee;
00540     icalclassify_pre;
00541 
00542     attendee= icalclassify_find_attendee(match->c,comp->reply_attendee);
00543 
00544     if(attendee == 0 &&
00545        comp->reply_partstat == ICAL_PARTSTAT_ACCEPTED){
00546        rtrn = 1;
00547     }
00548     icalclassify_post
00549 }
00550 int icalclassify_reply_crasher_decline(
00551     struct icalclassify_parts *comp,
00552     struct icalclassify_parts *match, 
00553     const char* user)
00554 {
00555     icalproperty* attendee;
00556     icalclassify_pre;
00557 
00558 
00559     attendee = icalclassify_find_attendee(match->c,comp->reply_attendee);
00560 
00561     if(attendee == 0 &&
00562        comp->reply_partstat == ICAL_PARTSTAT_DECLINED){
00563        rtrn = 1;
00564     }
00565     icalclassify_post
00566 }
00567 int icalclassify_add_instance(
00568     struct icalclassify_parts *comp,
00569     struct icalclassify_parts *match, 
00570     const char* user)
00571 {
00572     icalclassify_pre
00573     if(comp->method == ICAL_METHOD_ADD){
00574        rtrn = 1;
00575     }
00576     icalclassify_post
00577 }
00578 int icalclassify_cancel_event(
00579     struct icalclassify_parts *comp,
00580     struct icalclassify_parts *match, 
00581     const char* user)
00582 {
00583     icalclassify_pre
00584     if(comp->method == ICAL_METHOD_CANCEL){
00585        rtrn = 1;
00586     }
00587     icalclassify_post
00588 }
00589 int icalclassify_cancel_instance(
00590     struct icalclassify_parts *comp,
00591     struct icalclassify_parts *match, 
00592     const char* user)
00593 {
00594     icalclassify_pre
00595     if(comp->method == ICAL_METHOD_CANCEL){
00596        rtrn = 1;
00597     }
00598     icalclassify_post
00599 }
00600 int icalclassify_cancel_all(
00601     struct icalclassify_parts *comp,
00602     struct icalclassify_parts *match, 
00603     const char* user)
00604 {
00605     icalclassify_pre
00606     if(comp->method == ICAL_METHOD_CANCEL){
00607        rtrn = 1;
00608     }
00609     icalclassify_post
00610 }
00611 int icalclassify_refesh(
00612     struct icalclassify_parts *comp,
00613     struct icalclassify_parts *match, 
00614     const char* user)
00615 {
00616     icalclassify_pre
00617     if(comp->method == ICAL_METHOD_REFRESH){
00618        rtrn = 1;
00619     }
00620     icalclassify_post
00621 }
00622 int icalclassify_counter(
00623     struct icalclassify_parts *comp,
00624     struct icalclassify_parts *match, 
00625     const char* user)
00626 {
00627     icalclassify_pre
00628     if(comp->method == ICAL_METHOD_COUNTER){
00629        rtrn = 1;
00630     }
00631     icalclassify_post
00632 }
00633 int icalclassify_delinecounter(
00634     struct icalclassify_parts *comp,
00635     struct icalclassify_parts *match, 
00636     const char* user)
00637 {
00638     icalclassify_pre
00639 
00640     if(comp->method == ICAL_METHOD_DECLINECOUNTER){
00641        rtrn = 1;
00642     }
00643        
00644     icalclassify_post
00645 }
00646 
00647 struct icalclassify_map {
00648        icalproperty_method method;
00649        int (*fn)(struct icalclassify_parts *comp,struct icalclassify_parts *match, const char* user);
00650        icalproperty_xlicclass class;
00651 } icalclassify_map[] = 
00652 { {ICAL_METHOD_PUBLISH,icalclassify_publish_new,ICAL_XLICCLASS_PUBLISHNEW},
00653  {ICAL_METHOD_PUBLISH,icalclassify_publish_update,ICAL_XLICCLASS_PUBLISHUPDATE},
00654  {ICAL_METHOD_PUBLISH,icalclassify_publish_freebusy,ICAL_XLICCLASS_PUBLISHFREEBUSY},
00655   {ICAL_METHOD_REQUEST,icalclassify_request_delegate,ICAL_XLICCLASS_REQUESTDELEGATE},
00656   {ICAL_METHOD_REQUEST,icalclassify_request_new,ICAL_XLICCLASS_REQUESTNEW},
00657   {ICAL_METHOD_REQUEST,icalclassify_request_update,ICAL_XLICCLASS_REQUESTUPDATE},
00658   {ICAL_METHOD_REQUEST,icalclassify_request_reschedule,ICAL_XLICCLASS_REQUESTRESCHEDULE},
00659 
00660   {ICAL_METHOD_REQUEST,icalclassify_request_new_organizer,ICAL_XLICCLASS_REQUESTNEWORGANIZER},
00661   {ICAL_METHOD_REQUEST,icalclassify_request_forward,ICAL_XLICCLASS_REQUESTFORWARD},
00662   {ICAL_METHOD_REQUEST,icalclassify_request_status,ICAL_XLICCLASS_REQUESTSTATUS},
00663   {ICAL_METHOD_REQUEST,icalclassify_request_freebusy,ICAL_XLICCLASS_REQUESTFREEBUSY},
00664 
00665   {ICAL_METHOD_REPLY,icalclassify_reply_accept,ICAL_XLICCLASS_REPLYACCEPT},
00666   {ICAL_METHOD_REPLY,icalclassify_reply_decline,ICAL_XLICCLASS_REPLYDECLINE},
00667   {ICAL_METHOD_REPLY,icalclassify_reply_delegate,ICAL_XLICCLASS_REPLYDELEGATE},
00668   {ICAL_METHOD_REPLY,icalclassify_reply_crasher_accept,ICAL_XLICCLASS_REPLYCRASHERACCEPT},
00669   {ICAL_METHOD_REPLY,icalclassify_reply_crasher_decline,ICAL_XLICCLASS_REPLYCRASHERDECLINE},
00670 
00671   {ICAL_METHOD_ADD,icalclassify_add_instance,ICAL_XLICCLASS_ADDINSTANCE},
00672 
00673   {ICAL_METHOD_CANCEL,icalclassify_cancel_event,ICAL_XLICCLASS_CANCELEVENT},
00674   {ICAL_METHOD_CANCEL,icalclassify_cancel_instance,ICAL_XLICCLASS_CANCELINSTANCE},
00675   {ICAL_METHOD_CANCEL,icalclassify_cancel_all,ICAL_XLICCLASS_CANCELALL},
00676 
00677   {ICAL_METHOD_REFRESH,icalclassify_refesh,ICAL_XLICCLASS_REFRESH},
00678   {ICAL_METHOD_COUNTER,icalclassify_counter,ICAL_XLICCLASS_COUNTER},
00679   {ICAL_METHOD_DECLINECOUNTER,icalclassify_delinecounter,ICAL_XLICCLASS_DECLINECOUNTER},
00680   {ICAL_METHOD_NONE,0,ICAL_XLICCLASS_NONE}
00681 };
00682 
00683 
00684 icalproperty_xlicclass icalclassify(icalcomponent* c,icalcomponent* match, 
00685                            const char* user)
00686 {
00687     icalcomponent *inner;
00688     icalproperty *p;
00689     icalproperty_method method;
00690     icalproperty_xlicclass class = ICAL_XLICCLASS_UNKNOWN;
00691 
00692     int i;
00693 
00694     struct icalclassify_parts comp_parts;
00695     struct icalclassify_parts match_parts;
00696 
00697     inner = icalcomponent_get_first_real_component(c);
00698     
00699     if (inner == 0) {
00700        return ICAL_XLICCLASS_NONE;
00701     }
00702 
00703     icalssutil_get_parts(c,&comp_parts);
00704     icalssutil_get_parts(match,&match_parts);
00705 
00706     /* Determine if the incoming component is obsoleted by the match */
00707     if(match != 0 && (
00708        comp_parts.method == ICAL_METHOD_REQUEST
00709        )){
00710        assert ( ! ((comp_parts.dtstamp.is_utc==1)^
00711                   (match_parts.dtstamp.is_utc==1)));
00712 
00713        if( comp_parts.sequence<match_parts.sequence &&
00714            icaltime_compare(comp_parts.dtstamp,match_parts.dtstamp)>0)
00715        {
00716            /* comp has a smaller sequence and a later DTSTAMP */
00717            class = ICAL_XLICCLASS_MISSEQUENCED;
00718            goto CLEANUP;
00719        }
00720 
00721        if( (comp_parts.sequence<match_parts.sequence )
00722             /*&&icaltime_compare(comp_parts.dtstamp,match_parts.dtstamp)<=0*/
00723             ||
00724           ( comp_parts.sequence == match_parts.sequence &&
00725             icaltime_compare(comp_parts.dtstamp,match_parts.dtstamp)<=0)){
00726 
00727            class = ICAL_XLICCLASS_OBSOLETE;
00728            goto CLEANUP;
00729        }
00730 
00731     }
00732 
00733     p = icalcomponent_get_first_property(c,ICAL_METHOD_PROPERTY);
00734     if (p == 0) {
00735        class = ICAL_XLICCLASS_UNKNOWN;
00736        goto CLEANUP;
00737     }
00738     method = icalproperty_get_method(p);
00739 
00740     for (i =0; icalclassify_map[i].method != ICAL_METHOD_NONE; i++){
00741        if(icalclassify_map[i].method == method){
00742            if( (*(icalclassify_map[i].fn))(&comp_parts,&match_parts,user)==1){
00743               class = icalclassify_map[i].class;
00744               break;
00745            }
00746        }
00747     }
00748 
00749 CLEANUP:
00750     icalssutil_free_parts(&comp_parts); 
00751     icalssutil_free_parts(&match_parts);
00752 
00753     return class;
00754 
00755 }
00756