Back to index

lightning-sunbird  0.9+nobinonly
Functions
icalclassify.h File Reference
#include "ical.h"
#include "icalset.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

icalproperty_xlicclass icalclassify (icalcomponent *c, icalcomponent *match, const char *user)
icalcomponent * icalclassify_find_overlaps (icalset *set, icalcomponent *comp)
char * icalclassify_class_to_string (icalproperty_xlicclass c)

Function Documentation

icalproperty_xlicclass icalclassify ( icalcomponent *  c,
icalcomponent *  match,
const char *  user 
)

Definition at line 684 of file icalclassify.c.

{
    icalcomponent *inner;
    icalproperty *p;
    icalproperty_method method;
    icalproperty_xlicclass class = ICAL_XLICCLASS_UNKNOWN;

    int i;

    struct icalclassify_parts comp_parts;
    struct icalclassify_parts match_parts;

    inner = icalcomponent_get_first_real_component(c);
    
    if (inner == 0) {
       return ICAL_XLICCLASS_NONE;
    }

    icalssutil_get_parts(c,&comp_parts);
    icalssutil_get_parts(match,&match_parts);

    /* Determine if the incoming component is obsoleted by the match */
    if(match != 0 && (
       comp_parts.method == ICAL_METHOD_REQUEST
       )){
       assert ( ! ((comp_parts.dtstamp.is_utc==1)^
                  (match_parts.dtstamp.is_utc==1)));

       if( comp_parts.sequence<match_parts.sequence &&
           icaltime_compare(comp_parts.dtstamp,match_parts.dtstamp)>0)
       {
           /* comp has a smaller sequence and a later DTSTAMP */
           class = ICAL_XLICCLASS_MISSEQUENCED;
           goto CLEANUP;
       }

       if( (comp_parts.sequence<match_parts.sequence )
            /*&&icaltime_compare(comp_parts.dtstamp,match_parts.dtstamp)<=0*/
            ||
          ( comp_parts.sequence == match_parts.sequence &&
            icaltime_compare(comp_parts.dtstamp,match_parts.dtstamp)<=0)){

           class = ICAL_XLICCLASS_OBSOLETE;
           goto CLEANUP;
       }

    }

    p = icalcomponent_get_first_property(c,ICAL_METHOD_PROPERTY);
    if (p == 0) {
       class = ICAL_XLICCLASS_UNKNOWN;
       goto CLEANUP;
    }
    method = icalproperty_get_method(p);

    for (i =0; icalclassify_map[i].method != ICAL_METHOD_NONE; i++){
       if(icalclassify_map[i].method == method){
           if( (*(icalclassify_map[i].fn))(&comp_parts,&match_parts,user)==1){
              class = icalclassify_map[i].class;
              break;
           }
       }
    }

CLEANUP:
    icalssutil_free_parts(&comp_parts); 
    icalssutil_free_parts(&match_parts);

    return class;

}

Here is the call graph for this function:

Here is the caller graph for this function:

icalcomponent* icalclassify_find_overlaps ( icalset *  set,
icalcomponent *  comp 
)

Definition at line 77 of file icalclassify.c.

{
    icalcomponent *return_set;
    icalcomponent *c;
    struct icaltime_span span,compspan;
    
    icalerror_clear_errno();
    compspan = icalcomponent_get_span(comp);

    if(icalerrno != ICAL_NO_ERROR){
       return 0;
    }


    return_set = icalcomponent_new(ICAL_XROOT_COMPONENT);

    for(c = icalset_get_first_component(set);
       c != 0;
       c = icalset_get_next_component(set)){

       icalerror_clear_errno();

       span = icalcomponent_get_span(c);

       if(icalerrno != ICAL_NO_ERROR){
           continue;
       }

       if (compspan.start < span.end && 
           compspan.end > span.start){

           icalcomponent *clone = icalcomponent_new_clone(c);

           icalcomponent_add_component(return_set,clone);
       }      
    }

    if(icalcomponent_count_components(return_set,ICAL_ANY_COMPONENT) !=0){
       return return_set;
    } else {
       icalcomponent_free(return_set);
       return 0;
    }
}