]> code.citadel.org Git - citadel.git/blob - libcitadel/lib/vnote.c
more vnote skeleton code
[citadel.git] / libcitadel / lib / vnote.c
1 /*
2  * $Id: $
3  *
4  * vNote implementation for Citadel
5  *
6  * Copyright (C) 1999-2007 by the citadel.org development team.
7  * This code is freely redistributable under the terms of the GNU General
8  * Public License.  All other rights reserved.
9  */
10
11
12 #include <stdlib.h>
13 #include <unistd.h>
14 #include <stdio.h>
15 #include <fcntl.h>
16 #include <signal.h>
17
18 #if TIME_WITH_SYS_TIME
19 # include <sys/time.h>
20 # include <time.h>
21 #else
22 # if HAVE_SYS_TIME_H
23 #  include <sys/time.h>
24 # else
25 #  include <time.h>
26 # endif
27 #endif
28
29 #include <ctype.h>
30 #include <string.h>
31 #include <errno.h>
32 #include <limits.h>
33 #include <string.h>
34 #include <libcitadel.h>
35
36
37 /* move this into the header file when we're done */
38 #define CTDL_VNOTE_MAGIC        0xa1fa
39 struct vnote {
40         int magic;
41 };
42
43
44 struct vnote *vnote_new(void) {
45         struct vnote *v;
46
47         v = (struct vnote *) malloc(sizeof(struct vnote));
48         if (v) {
49                 memset(v, 0, sizeof(struct vnote));
50                 v->magic = CTDL_VNOTE_MAGIC;
51         }
52         return v;
53 }
54
55 struct vnote *vnote_new_from_str(char *s) {
56         struct vnote *v;
57
58         v = vnote_new();
59         if (!v) return NULL;
60
61         /* FIXME finish this */
62 }
63
64 void vnote_free(struct vnote *v) {
65         if (!v) return;
66         if (v->magic != CTDL_VNOTE_MAGIC) return;
67         
68         memset(v, 0, sizeof(struct vnote));
69         free(v);
70 }
71
72
73 #ifdef VNOTE_TEST_HARNESS
74
75 char *bynari_sample =
76         "BEGIN:vnote\n"
77         "VERSION:1.1\n"
78         "PRODID://Bynari Insight Connector 3.1.3-0605191//Import from Outlook//EN\n"
79         "CLASS:PUBLIC\n"
80         "UID:040000008200E00074C5B7101A82E00800000000000000000000000000820425CE8571864B8D141CB3FB8CAC62\n"
81         "NOTE;ENCODING=QUOTED-PRINTABLE:blah blah blah=0D=0A=0D=0A\n"
82         "SUMMARY:blah blah blah=0D=0A=0D=0A\n"
83         "X-OUTLOOK-COLOR:#FFFF00\n"
84         "X-OUTLOOK-WIDTH:200\n"
85         "X-OUTLOOK-HEIGHT:166\n"
86         "X-OUTLOOK-LEFT:80\n"
87         "X-OUTLOOK-TOP:80\n"
88         "X-OUTLOOK-CREATE-TIME:20070611T204615Z\n"
89         "REV:20070611T204621Z\n"
90         "END:vnote\n"
91 ;
92
93 char *horde_sample =
94         "BEGIN:VNOTE\n"
95         "VERSION:1.1\n"
96         "UID:20061129111109.7chx73xdok1s at 172.16.45.2\n"
97         "BODY:HORDE_1\n"
98         "DCREATED:20061129T101109Z\n"
99         "END:VNOTE\n"
100 ;
101
102
103 main() {
104         struct vnote *v = vnote_new_from_str(bynari_sample);
105         vnote_free(v);
106         exit(0);
107 }
108 #endif