Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions
icalcalendar.c File Reference
#include "icalcalendar.h"
#include "icalset.h"
#include "icalfileset.h"
#include "icaldirset.h"
#include <limits.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

Go to the source code of this file.

Classes

struct  icalcalendar_impl

Defines

#define PATH_MAX   512
#define BOOKED_DIR   "booked"
#define INCOMING_FILE   "incoming.ics"
#define PROP_FILE   "properties.ics"
#define FBLIST_FILE   "freebusy.ics"

Functions

struct icalcalendar_implicalcalendar_new_impl (void)
icalerrorenum icalcalendar_create (struct icalcalendar_impl *impl)
icalcalendar * icalcalendar_new (char *dir)
void icalcalendar_free (icalcalendar *impl)
int icalcalendar_lock (icalcalendar *impl)
int icalcalendar_unlock (icalcalendar *impl)
int icalcalendar_islocked (icalcalendar *impl)
int icalcalendar_ownlock (icalcalendar *impl)
icalset * icalcalendar_get_booked (icalcalendar *impl)
icalset * icalcalendar_get_incoming (icalcalendar *impl)
icalset * icalcalendar_get_properties (icalcalendar *impl)
icalset * icalcalendar_get_freebusy (icalcalendar *impl)

Class Documentation

struct icalcalendar_impl

Definition at line 56 of file icalcalendar.c.

Class Members
icalset * booked
char * dir
icalset * freebusy
icalset * incoming
icalset * properties

Define Documentation

#define BOOKED_DIR   "booked"

Definition at line 51 of file icalcalendar.c.

#define FBLIST_FILE   "freebusy.ics"

Definition at line 54 of file icalcalendar.c.

#define INCOMING_FILE   "incoming.ics"

Definition at line 52 of file icalcalendar.c.

#define PATH_MAX   512

Definition at line 43 of file icalcalendar.c.

#define PROP_FILE   "properties.ics"

Definition at line 53 of file icalcalendar.c.


Function Documentation

Definition at line 79 of file icalcalendar.c.

{
    char path[PATH_MAX];
    struct stat sbuf;
    int r;
    
    icalerror_check_arg_re((impl != 0),"impl",ICAL_BADARG_ERROR);

    path[0] = '\0';
    strcpy(path,impl->dir);
    strcat(path,"/");
    strcat(path,BOOKED_DIR);

    r = stat(path,&sbuf);

    if( r != 0 && errno == ENOENT){

       if(mkdir(path,0777)!=0){
           icalerror_set_errno(ICAL_FILE_ERROR);
           return ICAL_FILE_ERROR;
       }
    }

    return ICAL_NO_ERROR;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void icalcalendar_free ( icalcalendar *  impl)

Definition at line 131 of file icalcalendar.c.

{
    if (impl->dir !=0){
       free(impl->dir);
    }

    if (impl->freebusy !=0){
       icalset_free(impl->booked);
    }

    if (impl->properties !=0){
       icalset_free(impl->properties);
    }

    if (impl->booked !=0){
       icalset_free(impl->booked);
    }

    if (impl->incoming !=0){
       icalset_free(impl->incoming);
    }

    impl->dir = 0;
    impl->freebusy = 0;
    impl->properties = 0;
    impl->booked = 0;
    impl->incoming = 0;


    free(impl);
}

Here is the call graph for this function:

Here is the caller graph for this function:

icalset* icalcalendar_get_booked ( icalcalendar *  impl)

Definition at line 188 of file icalcalendar.c.

{
    char dir[PATH_MAX];

    icalerror_check_arg_rz((impl != 0),"impl");
    
    dir[0] = '\0';
    strcpy(dir,impl->dir);
    strcat(dir,"/");
    strcat(dir,BOOKED_DIR);

    if (impl->booked == 0){
       icalerror_clear_errno();
       impl->booked = icaldirset_new(dir);
       assert(icalerrno == ICAL_NO_ERROR);
    }

    return impl->booked;

}

Here is the call graph for this function:

Here is the caller graph for this function:

icalset* icalcalendar_get_freebusy ( icalcalendar *  impl)

Definition at line 243 of file icalcalendar.c.

{
    char path[PATH_MAX];
    icalerror_check_arg_rz((impl != 0),"impl");

    path[0] = '\0';
    strcpy(path,impl->dir);
    strcat(path,"/");
    strcat(path,FBLIST_FILE);


    if (impl->freebusy == 0){
       impl->freebusy = icalfileset_new(path);
    }

    return impl->freebusy;
}

Here is the call graph for this function:

icalset* icalcalendar_get_incoming ( icalcalendar *  impl)

Definition at line 209 of file icalcalendar.c.

{
    char path[PATH_MAX];
    icalerror_check_arg_rz((impl != 0),"impl");

    path[0] = '\0';
    strcpy(path,impl->dir);
    strcat(path,"/");
    strcat(path,INCOMING_FILE);

    if (impl->properties == 0){
       impl->properties = icalfileset_new(path);
    }

    return impl->properties;
}

Here is the call graph for this function:

icalset* icalcalendar_get_properties ( icalcalendar *  impl)

Definition at line 226 of file icalcalendar.c.

{
    char path[PATH_MAX];
    icalerror_check_arg_rz((impl != 0),"impl");

    path[0] = '\0';
    strcpy(path,impl->dir);
    strcat(path,"/");
    strcat(path,PROP_FILE);

    if (impl->properties == 0){
       impl->properties = icalfileset_new(path);
    }

    return impl->properties;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int icalcalendar_islocked ( icalcalendar *  impl)

Definition at line 176 of file icalcalendar.c.

{
    icalerror_check_arg_rz((impl != 0),"impl");
    return 0;
}
int icalcalendar_lock ( icalcalendar *  impl)

Definition at line 164 of file icalcalendar.c.

{
    icalerror_check_arg_rz((impl != 0),"impl");
    return 0;
}
icalcalendar* icalcalendar_new ( char *  dir)

Definition at line 105 of file icalcalendar.c.

{
    struct icalcalendar_impl* impl;

    icalerror_check_arg_rz((dir != 0),"dir");
    
    impl = icalcalendar_new_impl();

    if (impl == 0){
       return 0;
    }

    impl->dir = (char*)strdup(dir);
    impl->freebusy = 0;
    impl->properties = 0;
    impl->booked = 0;
    impl->incoming = 0;

    if (icalcalendar_create(impl) != ICAL_NO_ERROR){
       free(impl);
       return 0;
    }

    return impl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 65 of file icalcalendar.c.

{
    struct icalcalendar_impl* impl;

    if ( ( impl = (struct icalcalendar_impl*)
          malloc(sizeof(struct icalcalendar_impl))) == 0) {
       icalerror_set_errno(ICAL_NEWFAILED_ERROR);
       return 0;
    }

    return impl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int icalcalendar_ownlock ( icalcalendar *  impl)

Definition at line 182 of file icalcalendar.c.

{
    icalerror_check_arg_rz((impl != 0),"impl");
    return 0;
}
int icalcalendar_unlock ( icalcalendar *  impl)

Definition at line 170 of file icalcalendar.c.

{
    icalerror_check_arg_rz((impl != 0),"impl");
    return 0;
}