vcard.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
  3. * Copyright (C) 2001-2009 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 RFC2426 for more information.
  23. */
  24. #ifndef __VCARD_H__
  25. #define __VCARD_H__
  26. #include <stdio.h>
  27. #include <glib.h>
  28. #include "addritem.h"
  29. #include "addrcache.h"
  30. #include "adbookbase.h"
  31. #define VCARDBUFSIZE 1024
  32. #define VCARD_TAG_START "begin"
  33. #define VCARD_TAG_END "end"
  34. #define VCARD_NAME "vcard"
  35. #define VCARD_TAG_FULLNAME "fn"
  36. #define VCARD_TAG_NAME "n"
  37. #define VCARD_TAG_EMAIL "email"
  38. #define VCARD_TAG_UID "uid"
  39. #define VCARD_TYPE_QP "quoted-printable"
  40. #define VCARD_SEP_TAG ':'
  41. #define VCARD_SEP_TYPE ';'
  42. /*
  43. * Typical vCard entry:
  44. *
  45. * BEGIN:VCARD
  46. * FN:Axle Rose
  47. * N:Rose;Axle;D;Ms;Jnr
  48. * REV:2001-04-22T03:52:05
  49. * ADR;HOME:;;777 Lexington Avenue;Denver;CO;80299;USA
  50. * ADR;POSTAL:P O Box 777;;;Denver;CO;80298;Usa
  51. * TEL;HOME:303-555-1234
  52. * EMAIL;AOL:axlerose@aol.com
  53. * EMAIL;INTERNET:axlerose@netscape.net
  54. * TITLE:Janitor
  55. * ORG:The Company
  56. * URL:http://www.axlerose.com
  57. * END:VCARD
  58. */
  59. /* vCard object */
  60. typedef struct _VCardFile VCardFile;
  61. struct _VCardFile {
  62. AddressBookType type;
  63. AddressCache *addressCache;
  64. gint retVal;
  65. FILE *file;
  66. gchar *path;
  67. gchar buffer[ VCARDBUFSIZE ];
  68. gchar *bufptr;
  69. };
  70. /* Function prototypes */
  71. VCardFile *vcard_create ( void );
  72. void vcard_set_name ( VCardFile* cardFile, const gchar *value );
  73. void vcard_set_file ( VCardFile* cardFile, const gchar *value );
  74. void vcard_set_modified ( VCardFile *cardFile, const gboolean value );
  75. void vcard_set_accessed ( VCardFile *cardFile, const gboolean value );
  76. gboolean vcard_get_modified ( VCardFile *cardFile );
  77. gboolean vcard_get_accessed ( VCardFile *cardFile );
  78. gboolean vcard_get_read_flag ( VCardFile *cardFile );
  79. gint vcard_get_status ( VCardFile *cardFile );
  80. ItemFolder *vcard_get_root_folder ( VCardFile *cardFile );
  81. gchar *vcard_get_name ( VCardFile *cardFile );
  82. void vcard_free ( VCardFile *cardFile );
  83. gint vcard_read_data ( VCardFile *cardFile );
  84. GList *vcard_get_list_person ( VCardFile *cardFile );
  85. GList *vcard_get_list_folder ( VCardFile *cardFile );
  86. GList *vcard_get_all_persons ( VCardFile *cardFile );
  87. gchar *vcard_find_gnomecard ( void );
  88. gint vcard_test_read_file ( const gchar *fileSpec );
  89. #endif /* __VCARD_H__ */