Statistics
| Revision:

root / src / addrindex.h @ 2797

History | View | Annotate | Download (4.5 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
 * General functions for accessing address index file.
22 1 hiro
 */
23 1 hiro
24 1 hiro
#ifndef __ADDRINDEX_H__
25 1 hiro
#define __ADDRINDEX_H__
26 1 hiro
27 1 hiro
#include <stdio.h>
28 1 hiro
#include <glib.h>
29 1 hiro
#include "addritem.h"
30 1 hiro
31 1 hiro
#define ADDRESSBOOK_MAX_IFACE  4
32 1 hiro
#define ADDRESSBOOK_INDEX_FILE "addrbook--index.xml"
33 1 hiro
#define ADDRESSBOOK_OLD_FILE   "addressbook.xml"
34 1 hiro
35 2442 hiro
#define ADDR_DS_AUTOREG "@Auto-registered"
36 2442 hiro
37 1 hiro
typedef enum {
38 1 hiro
        ADDR_IF_NONE,
39 1 hiro
        ADDR_IF_BOOK,
40 1 hiro
        ADDR_IF_VCARD,
41 1 hiro
        ADDR_IF_JPILOT,
42 1 hiro
        ADDR_IF_LDAP,
43 1 hiro
        ADDR_IF_COMMON,
44 1 hiro
        ADDR_IF_PERSONAL
45 1 hiro
} AddressIfType;
46 1 hiro
47 1 hiro
typedef struct _AddressIndex AddressIndex;
48 1 hiro
struct _AddressIndex {
49 1 hiro
        AddrItemObject obj;
50 1 hiro
        gchar *filePath;
51 1 hiro
        gchar *fileName;
52 1 hiro
        gint  retVal;
53 1 hiro
        gboolean needsConversion;
54 1 hiro
        gboolean wasConverted;
55 1 hiro
        gboolean conversionError;
56 1 hiro
        AddressIfType lastType;
57 1 hiro
        gboolean dirtyFlag;
58 1 hiro
        GList *interfaceList;
59 1 hiro
};
60 1 hiro
61 1 hiro
typedef struct _AddressInterface AddressInterface;
62 1 hiro
struct _AddressInterface {
63 1 hiro
        AddrItemObject obj;
64 1 hiro
        AddressIfType type;
65 1 hiro
        gchar *name;
66 1 hiro
        gchar *listTag;
67 1 hiro
        gchar *itemTag;
68 1 hiro
        gboolean legacyFlag;
69 1 hiro
        gboolean useInterface;
70 1 hiro
        gboolean haveLibrary;
71 1 hiro
        gboolean readOnly;
72 1 hiro
        GList *listSource;
73 1 hiro
        gboolean (*getModifyFlag)( void * );
74 1 hiro
        gboolean (*getAccessFlag)( void * );
75 1 hiro
        gboolean (*getReadFlag)( void * );
76 1 hiro
        gint (*getStatusCode)( void * );
77 1 hiro
        gint (*getReadData)( void * );
78 1 hiro
        ItemFolder *(*getRootFolder)( void * );
79 1 hiro
        GList *(*getListFolder)( void * );
80 1 hiro
        GList *(*getListPerson)( void * );
81 1 hiro
        GList *(*getAllPersons)( void * );
82 1 hiro
        GList *(*getAllGroups)( void * );
83 1 hiro
        gchar *(*getName)( void * );
84 1 hiro
        void (*setAccessFlag)( void *, void * );
85 1 hiro
};
86 1 hiro
87 1 hiro
typedef struct _AddressDataSource AddressDataSource;
88 1 hiro
struct _AddressDataSource {
89 1 hiro
        AddrItemObject obj;
90 1 hiro
        AddressIfType type;
91 1 hiro
        AddressInterface *interface;
92 1 hiro
        gpointer rawDataSource;
93 1 hiro
};
94 1 hiro
95 1 hiro
AddressIndex *addrindex_create_index        ();
96 1 hiro
void addrindex_set_file_path                ( AddressIndex *addrIndex, const gchar *value );
97 1 hiro
void addrindex_set_file_name                ( AddressIndex *addrIndex, const gchar *value );
98 1 hiro
void addrindex_set_dirty                ( AddressIndex *addrIndex, const gboolean value );
99 1 hiro
GList *addrindex_get_interface_list        ( AddressIndex *addrIndex );
100 1 hiro
void addrindex_free_index                ( AddressIndex *addrIndex );
101 1 hiro
void addrindex_print_index                ( AddressIndex *addrIndex, FILE *stream );
102 1 hiro
103 1 hiro
AddressInterface *addrindex_get_interface                ( AddressIndex *addrIndex, AddressIfType ifType );
104 1 hiro
AddressDataSource *addrindex_index_add_datasource        ( AddressIndex *addrIndex, AddressIfType ifType, gpointer dataSource );
105 1 hiro
AddressDataSource *addrindex_index_remove_datasource        ( AddressIndex *addrIndex, AddressDataSource *dataSource );
106 1 hiro
void addrindex_free_datasource                                ( AddressIndex *addrIndex, AddressDataSource *ds );
107 1 hiro
108 1 hiro
gint addrindex_read_data                ( AddressIndex *addrIndex );
109 1 hiro
gint addrindex_write_to                        ( AddressIndex *addrIndex, const gchar *newFile );
110 1 hiro
gint addrindex_save_data                ( AddressIndex *addrIndex );
111 1 hiro
gint addrindex_create_new_books                ( AddressIndex *addrIndex );
112 1 hiro
gint addrindex_save_all_books                ( AddressIndex *addrIndex );
113 2442 hiro
gint addrindex_create_extra_books        ( AddressIndex *addrIndex );
114 1 hiro
115 1 hiro
gboolean addrindex_ds_get_modify_flag        ( AddressDataSource *ds );
116 1 hiro
gboolean addrindex_ds_get_access_flag        ( AddressDataSource *ds );
117 1 hiro
gboolean addrindex_ds_get_read_flag        ( AddressDataSource *ds );
118 1 hiro
gint addrindex_ds_get_status_code        ( AddressDataSource *ds );
119 1 hiro
gint addrindex_ds_read_data                ( AddressDataSource *ds );
120 1 hiro
ItemFolder *addrindex_ds_get_root_folder( AddressDataSource *ds );
121 1 hiro
GList *addrindex_ds_get_list_folder        ( AddressDataSource *ds );
122 1 hiro
GList *addrindex_ds_get_list_person        ( AddressDataSource *ds );
123 1 hiro
gchar *addrindex_ds_get_name                ( AddressDataSource *ds );
124 1 hiro
void addrindex_ds_set_access_flag        ( AddressDataSource *ds, gboolean *value );
125 1 hiro
gboolean addrindex_ds_get_readonly        ( AddressDataSource *ds );
126 1 hiro
GList *addrindex_ds_get_all_persons        ( AddressDataSource *ds );
127 1 hiro
GList *addrindex_ds_get_all_groups        ( AddressDataSource *ds );
128 1 hiro
129 1 hiro
#endif /* __ADDRINDEX_H__ */
130 1 hiro
131 1 hiro
/*
132 1 hiro
* End of Source.
133 1 hiro
*/