root / src / vcard.h @ 291
History | View | Annotate | Download (3.3 kB)
| 1 | 1 | hiro | /*
|
|---|---|---|---|
| 2 | 1 | hiro | * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client |
| 3 | 1 | hiro | * Copyright (C) 2001 Match Grun |
| 4 | 1 | hiro | * |
| 5 | 1 | hiro | * This program is free software; you can redistribute it and/or modify |
| 6 | 1 | hiro | * it under the terms of the GNU General Public License as published by |
| 7 | 1 | hiro | * the Free Software Foundation; either version 2 of the License, or |
| 8 | 1 | hiro | * (at your option) any later version. |
| 9 | 1 | hiro | * |
| 10 | 1 | hiro | * This program is distributed in the hope that it will be useful, |
| 11 | 1 | hiro | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | 1 | hiro | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | 1 | hiro | * GNU General Public License for more details. |
| 14 | 1 | hiro | * |
| 15 | 1 | hiro | * You should have received a copy of the GNU General Public License |
| 16 | 1 | hiro | * along with this program; if not, write to the Free Software |
| 17 | 1 | hiro | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | 1 | hiro | */ |
| 19 | 1 | hiro | |
| 20 | 1 | hiro | /*
|
| 21 | 1 | hiro | * Definitions necessary to access vCard files. vCard files are used |
| 22 | 1 | hiro | * by GnomeCard for addressbook, and Netscape for sending business |
| 23 | 1 | hiro | * card information. Refer to RFC2426 for more information. |
| 24 | 1 | hiro | */ |
| 25 | 1 | hiro | |
| 26 | 1 | hiro | #ifndef __VCARD_H__
|
| 27 | 1 | hiro | #define __VCARD_H__
|
| 28 | 1 | hiro | |
| 29 | 1 | hiro | #include <stdio.h> |
| 30 | 1 | hiro | #include <glib.h> |
| 31 | 1 | hiro | |
| 32 | 1 | hiro | #include "addritem.h" |
| 33 | 1 | hiro | #include "addrcache.h" |
| 34 | 1 | hiro | |
| 35 | 1 | hiro | #define VCARDBUFSIZE 1024 |
| 36 | 1 | hiro | |
| 37 | 1 | hiro | #define VCARD_TAG_START "begin" |
| 38 | 1 | hiro | #define VCARD_TAG_END "end" |
| 39 | 1 | hiro | #define VCARD_NAME "vcard" |
| 40 | 1 | hiro | |
| 41 | 1 | hiro | #define VCARD_TAG_FULLNAME "fn" |
| 42 | 1 | hiro | #define VCARD_TAG_NAME "n" |
| 43 | 1 | hiro | #define VCARD_TAG_EMAIL "email" |
| 44 | 1 | hiro | #define VCARD_TAG_UID "uid" |
| 45 | 1 | hiro | |
| 46 | 1 | hiro | #define VCARD_TYPE_QP "quoted-printable" |
| 47 | 1 | hiro | |
| 48 | 1 | hiro | #define VCARD_SEP_TAG ':' |
| 49 | 1 | hiro | #define VCARD_SEP_TYPE ';' |
| 50 | 1 | hiro | |
| 51 | 1 | hiro | /*
|
| 52 | 1 | hiro | // Typical vCard entry: |
| 53 | 1 | hiro | // |
| 54 | 1 | hiro | // BEGIN:VCARD |
| 55 | 1 | hiro | // FN:Axle Rose |
| 56 | 1 | hiro | // N:Rose;Axle;D;Ms;Jnr |
| 57 | 1 | hiro | // REV:2001-04-22T03:52:05 |
| 58 | 1 | hiro | // ADR;HOME:;;777 Lexington Avenue;Denver;CO;80299;USA |
| 59 | 1 | hiro | // ADR;POSTAL:P O Box 777;;;Denver;CO;80298;Usa |
| 60 | 1 | hiro | // TEL;HOME:303-555-1234 |
| 61 | 1 | hiro | // EMAIL;AOL:axlerose@aol.com |
| 62 | 1 | hiro | // EMAIL;INTERNET:axlerose@netscape.net |
| 63 | 1 | hiro | // TITLE:Janitor |
| 64 | 1 | hiro | // ORG:The Company |
| 65 | 1 | hiro | // URL:http://www.axlerose.com |
| 66 | 1 | hiro | // END:VCARD |
| 67 | 1 | hiro | */ |
| 68 | 1 | hiro | |
| 69 | 1 | hiro | /* vCard object */
|
| 70 | 1 | hiro | typedef struct _VCardFile VCardFile; |
| 71 | 1 | hiro | struct _VCardFile {
|
| 72 | 1 | hiro | gchar *name; |
| 73 | 1 | hiro | FILE *file; |
| 74 | 1 | hiro | gchar *path; |
| 75 | 1 | hiro | gchar buffer[ VCARDBUFSIZE ]; |
| 76 | 1 | hiro | gchar *bufptr; |
| 77 | 1 | hiro | AddressCache *addressCache; |
| 78 | 1 | hiro | gint retVal; |
| 79 | 1 | hiro | gboolean accessFlag; |
| 80 | 1 | hiro | }; |
| 81 | 1 | hiro | |
| 82 | 1 | hiro | /* Function prototypes */
|
| 83 | 1 | hiro | VCardFile *vcard_create ( void );
|
| 84 | 1 | hiro | VCardFile *vcard_create_path ( const gchar *path );
|
| 85 | 1 | hiro | void vcard_set_name ( VCardFile* cardFile, const gchar *value ); |
| 86 | 1 | hiro | void vcard_set_file ( VCardFile* cardFile, const gchar *value ); |
| 87 | 1 | hiro | void vcard_set_modified ( VCardFile *vcardFile, const gboolean value ); |
| 88 | 1 | hiro | void vcard_set_accessed ( VCardFile *vcardFile, const gboolean value ); |
| 89 | 1 | hiro | gboolean vcard_get_modified ( VCardFile *vcardFile ); |
| 90 | 1 | hiro | gboolean vcard_get_accessed ( VCardFile *vcardFile ); |
| 91 | 1 | hiro | gboolean vcard_get_read_flag ( VCardFile *vcardFile ); |
| 92 | 1 | hiro | gint vcard_get_status ( VCardFile *cardFile ); |
| 93 | 1 | hiro | ItemFolder *vcard_get_root_folder ( VCardFile *cardFile ); |
| 94 | 1 | hiro | gchar *vcard_get_name ( VCardFile *cardFile ); |
| 95 | 1 | hiro | void vcard_free ( VCardFile *cardFile );
|
| 96 | 1 | hiro | void vcard_force_refresh ( VCardFile *cardFile );
|
| 97 | 1 | hiro | gint vcard_read_data ( VCardFile *cardFile ); |
| 98 | 1 | hiro | GList *vcard_get_list_person ( VCardFile *cardFile ); |
| 99 | 1 | hiro | GList *vcard_get_list_folder ( VCardFile *cardFile ); |
| 100 | 1 | hiro | GList *vcard_get_all_persons ( VCardFile *cardFile ); |
| 101 | 1 | hiro | gboolean vcard_validate ( const VCardFile *cardFile );
|
| 102 | 1 | hiro | gchar *vcard_find_gnomecard ( void );
|
| 103 | 1 | hiro | gint vcard_test_read_file ( const gchar *fileSpec );
|
| 104 | 1 | hiro | |
| 105 | 1 | hiro | #endif /* __VCARD_H__ */ |