Statistics
| Revision:

root / src / addritem.h @ 1

History | View | Annotate | Download (6.65 KB)

1
/*
2
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3
 * Copyright (C) 1999-2001 Hiroyuki Yamamoto
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 2 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, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
 */
19

    
20
/*
21
 * Address item data.
22
 */
23

    
24
#ifndef __ADDRITEM_H__
25
#define __ADDRITEM_H__
26

    
27
#include <stdio.h>
28
#include <glib.h>
29

    
30
#define ADDRITEM_OBJECT(obj)        ((AddrItemObject *)obj)
31
#define ADDRITEM_TYPE(obj)        (ADDRITEM_OBJECT(obj)->type)
32
#define ADDRITEM_NAME(obj)        (ADDRITEM_OBJECT(obj)->name)
33
#define ADDRITEM_ID(obj)        (ADDRITEM_OBJECT(obj)->uid)
34
#define ADDRITEM_PARENT(obj)        (ADDRITEM_OBJECT(obj)->parent)
35
#define ADDRITEM_SUBTYPE(obj)        (ADDRITEM_OBJECT(obj)->subType)
36

    
37
typedef enum {
38
        ITEMTYPE_NONE,
39
        ITEMTYPE_PERSON,
40
        ITEMTYPE_EMAIL,
41
        ITEMTYPE_FOLDER,
42
        ITEMTYPE_GROUP,
43
        ITEMTYPE_INDEX,
44
        ITEMTYPE_INTERFACE,
45
        ITEMTYPE_DATASOURCE
46
} ItemObjectType;
47

    
48
typedef struct _AddrItemObject AddrItemObject;
49
struct _AddrItemObject {
50
        ItemObjectType type;
51
        gchar          *name;
52
        gchar          *uid;
53
        AddrItemObject *parent;
54
        gint           subType;
55
};
56

    
57
typedef struct _ItemPerson ItemPerson;
58
struct _ItemPerson {
59
        AddrItemObject obj;
60
        gchar    *firstName;
61
        gchar    *lastName;
62
        gchar    *nickName;
63
        gchar    *externalID;
64
        GList    *listEMail;
65
        GList    *listAttrib;
66
        gboolean isOpened;
67
};
68

    
69
typedef struct _ItemEMail ItemEMail;
70
struct _ItemEMail {
71
        AddrItemObject obj;
72
        gchar *address;
73
        gchar *remarks;
74
};
75

    
76
typedef struct _UserAttribute UserAttribute;
77
struct _UserAttribute {
78
        gchar *uid;
79
        gchar *name;
80
        gchar *value;
81
};
82

    
83
typedef struct _ItemFolder ItemFolder;
84
struct _ItemFolder {
85
        AddrItemObject obj;
86
        gchar    *remarks;
87
        gboolean isRoot;
88
        GList    *listItems;
89
        GList    *listFolder;
90
        GList    *listPerson;
91
        GList    *listGroup;
92
        gpointer userData;
93
};
94

    
95
typedef struct _ItemGroup ItemGroup;
96
struct _ItemGroup {
97
        AddrItemObject obj;
98
        gchar *remarks;
99
        GList *listEMail;
100
};
101

    
102
/* Function prototypes */
103
ItemEMail *addritem_create_item_email        ( void );
104
ItemEMail *addritem_copy_item_email        ( ItemEMail *item );
105
void addritem_email_set_id                ( ItemEMail *email, const gchar *value );
106
void addritem_email_set_alias                ( ItemEMail *email, const gchar *value );
107
void addritem_email_set_address                ( ItemEMail *email, const gchar *value );
108
void addritem_email_set_remarks                ( ItemEMail *email, const gchar *value );
109
void addritem_free_item_email                ( ItemEMail *item );
110

    
111
UserAttribute *addritem_create_attribute( void );
112
UserAttribute *addritem_copy_attribute        ( UserAttribute *item );
113
void addritem_attrib_set_id                ( UserAttribute *item, const gchar *value );
114
void addritem_attrib_set_name                ( UserAttribute *item, const gchar *value );
115
void addritem_attrib_set_value                ( UserAttribute *item, const gchar *value );
116
void addritem_free_attribute                ( UserAttribute *item );
117

    
118
ItemPerson *addritem_create_item_person        ( void );
119
void addritem_person_set_id                ( ItemPerson *person, const gchar *value );
120
void addritem_person_set_first_name        ( ItemPerson *person, const gchar *value );
121
void addritem_person_set_last_name        ( ItemPerson *person, const gchar *value );
122
void addritem_person_set_nick_name        ( ItemPerson *person, const gchar *value );
123
void addritem_person_set_common_name        ( ItemPerson *person, const gchar *value );
124
void addritem_person_set_external_id        ( ItemPerson *person, const gchar *value );
125
void addritem_person_set_opened                ( ItemPerson *person, const gboolean value );
126
void addritem_free_item_person                ( ItemPerson *person );
127
void addritem_free_list_email                ( GList *list );
128
void addritem_free_list_attribute        ( GList *list );
129

    
130
ItemGroup *addritem_create_item_group        ( void );
131
void addritem_free_item_group                ( ItemGroup *group );
132
void addritem_print                        ( ItemGroup *group, FILE *stream );
133
void addritem_group_set_id                ( ItemGroup *group, const gchar *value );
134
void addritem_group_set_name                ( ItemGroup *group, const gchar *value );
135
void addritem_group_set_remarks                ( ItemGroup *group, const gchar *value );
136

    
137
void addritem_print_item_email                ( ItemEMail *item, FILE *stream );
138
void addritem_print_attribute                ( UserAttribute *item, FILE *stream );
139
void addritem_print_item_person                ( ItemPerson *person, FILE *stream );
140
void addritem_print_item_group                ( ItemGroup *group, FILE *stream );
141
void addritem_print_item_folder                ( ItemFolder *folder, FILE *stream );
142

    
143
gboolean addritem_person_add_email                ( ItemPerson *person, ItemEMail *email );
144
ItemEMail *addritem_person_get_email                ( ItemPerson *person, const gchar *eid );
145
ItemEMail *addritem_person_remove_email_id        ( ItemPerson *person, const gchar *eid );
146
ItemEMail *addritem_person_remove_email                ( ItemPerson *person, ItemEMail *email );
147

    
148
void addritem_person_add_attribute                ( ItemPerson *person, UserAttribute *attrib );
149
UserAttribute *addritem_person_get_attribute        ( ItemPerson *person, const gchar *aid );
150
UserAttribute *addritem_person_remove_attrib_id        ( ItemPerson *person, const gchar *aid );
151
UserAttribute *addritem_person_remove_attribute        ( ItemPerson *person, UserAttribute *attrib );
152

    
153
ItemFolder *addritem_create_item_folder        ( void );
154
void addritem_folder_set_id                ( ItemFolder *folder, const gchar *value );
155
void addritem_folder_set_name                ( ItemFolder *folder, const gchar *value );
156
void addritem_folder_set_remarks        ( ItemFolder *folder, const gchar *value );
157
void addritem_free_item_folder                ( ItemFolder *folder );
158
void addritem_free_item_folder_recurse        ( ItemFolder *parent );
159

    
160
gboolean addritem_group_add_email                ( ItemGroup *group, ItemEMail *email );
161
ItemEMail *addritem_group_remove_email                ( ItemGroup *group, ItemEMail *email );
162
ItemEMail *addritem_group_remove_email_id        ( ItemGroup *group, const gchar *eid );
163

    
164
gboolean addritem_folder_add_person        ( ItemFolder *folder, ItemPerson *item );
165
gboolean addritem_folder_add_folder        ( ItemFolder *folder, ItemFolder *item );
166
gboolean addritem_folder_add_group        ( ItemFolder *folder, ItemGroup *item );
167
void addritem_folder_free_person        ( ItemFolder *folder );
168
GList *addritem_folder_get_person_list        ( ItemFolder *folder );
169
GList *addritem_folder_get_group_list        ( ItemFolder *folder );
170

    
171
ItemEMail *addritem_move_email_before        ( ItemPerson *person, ItemEMail *itemMove, ItemEMail *itemTarget );
172
ItemEMail *addritem_move_email_after        ( ItemPerson *person, ItemEMail *itemMove, ItemEMail *itemTarget );
173

    
174
#endif /* __ADDRITEM_H__ */