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