2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 2001 Match Grun
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 2 of the License, or
8 * (at your option) any later version.
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.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 * Definitions for accessing JPilot database files.
22 * JPilot is Copyright(c) by Judd Montgomery.
23 * Visit http://www.jpilot.org for more details.
31 #include <pi-address.h>
39 typedef struct _JPilotFile JPilotFile;
45 AddressCache *addressCache;
46 struct AddressAppInfo addrInfo;
47 gboolean readMetadata;
56 #define JPILOT_NUM_LABELS 22 // Number of labels
57 #define JPILOT_NUM_PHONELABELS 8 // Number of phone number labels
58 #define JPILOT_NUM_CATEG 16 // Number of categories
59 #define JPILOT_LEN_LABEL 15 // Max length of label
60 #define JPILOT_LEN_CATEG 15 // Max length of category
61 #define JPILOT_NUM_ADDR_PHONE 5 // Number of phone entries a person can have
63 // Shamelessly copied from JPilot (libplugin.h)
65 unsigned char db_name[32];
66 unsigned char flags[2];
67 unsigned char version[2];
68 unsigned char creation_time[4];
69 unsigned char modification_time[4];
70 unsigned char backup_time[4];
71 unsigned char modification_number[4];
72 unsigned char app_info_offset[4];
73 unsigned char sort_info_offset[4];
74 unsigned char type[4];/*Database ID */
75 unsigned char creator_id[4];/*Application ID */
76 unsigned char unique_id_seed[4];
77 unsigned char next_record_list_id[4];
78 unsigned char number_of_records[2];
81 // Shamelessly copied from JPilot (libplugin.h)
87 time_t modification_time;
89 unsigned int modification_number;
90 unsigned int app_info_offset;
91 unsigned int sort_info_offset;
92 char type[5];/*Database ID */
93 char creator_id[5];/*Application ID */
94 char unique_id_seed[5];
95 unsigned int next_record_list_id;
96 unsigned int number_of_records;
99 // Shamelessly copied from JPilot (libplugin.h)
101 unsigned char Offset[4]; /*4 bytes offset from BOF to record */
102 unsigned char attrib;
103 unsigned char unique_ID[3];
106 // Shamelessly copied from JPilot (libplugin.h)
107 typedef struct mem_rec_header_s {
108 unsigned int rec_num;
110 unsigned int unique_id;
111 unsigned char attrib;
112 struct mem_rec_header_s *next;
115 // Shamelessly copied from JPilot (libplugin.h)
116 #define SPENT_PC_RECORD_BIT 256
120 MODIFIED_PALM_REC = 101L,
121 DELETED_PALM_REC = 102L,
123 DELETED_PC_REC = SPENT_PC_RECORD_BIT + 104L,
124 DELETED_DELETED_PALM_REC = SPENT_PC_RECORD_BIT + 105L
127 // Shamelessly copied from JPilot (libplugin.h)
130 unsigned int unique_id;
131 unsigned char attrib;
136 /* Function prototypes */
137 JPilotFile *jpilot_create();
138 JPilotFile *jpilot_create_path( const gchar *path );
139 void jpilot_free( JPilotFile *pilotFile );
140 void jpilot_force_refresh( JPilotFile *pilotFile );
141 gboolean jpilot_get_modified( JPilotFile *pilotFile );
142 void jpilot_print_file( JPilotFile *jpilotFile, FILE *stream );
143 void jpilot_print_list( GSList *list, FILE *stream );
144 gint jpilot_read_file( JPilotFile *pilotFile );
146 GList *jpilot_get_address_list( JPilotFile *pilotFile );
147 GSList *jpilot_load_label( JPilotFile *pilotFile, GSList *labelList );
148 GSList *jpilot_get_category_list( JPilotFile *pilotFile );
149 gchar *jpilot_get_category_name( JPilotFile *pilotFile, gint catID );
150 GSList *jpilot_load_phone_label( JPilotFile *pilotFile, GSList *labelList );
151 GList *jpilot_load_custom_label( JPilotFile *pilotFile, GList *labelList );
153 GList *jpilot_get_category_items( JPilotFile *pilotFile );
154 GList *jpilot_get_address_list_cat( JPilotFile *pilotFile, const gint catID );
156 void jpilot_set_file( JPilotFile* pilotFile, const gchar *path );
157 gboolean jpilot_validate( const JPilotFile *pilotFile );
158 gchar *jpilot_find_pilotdb( void );
159 gint jpilot_test_read_data( const gchar *fileSpec );
161 void jpilot_clear_custom_labels( JPilotFile *pilotFile );
162 void jpilot_add_custom_label( JPilotFile *pilotFile, const gchar *labelName );
163 GList *jpilot_get_custom_labels( JPilotFile *pilotFile );
164 gboolean jpilot_test_custom_label( JPilotFile *pilotFile, const gchar *labelName );
165 gboolean jpilot_setup_labels( JPilotFile *pilotFile );
166 gboolean jpilot_test_pilot_lib();
168 #endif /* USE_JPILOT */
170 #endif /* __JPILOT_H__ */