Statistics
| Revision:

root / src / addritem.h @ 1546

History | View | Annotate | Download (6.7 kB)

1 1 hiro
/*
2 1 hiro
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 1 hiro
 * Copyright (C) 1999-2001 Hiroyuki Yamamoto
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
 * Address item data.
22 1 hiro
 */
23 1 hiro
24 1 hiro
#ifndef __ADDRITEM_H__
25 1 hiro
#define __ADDRITEM_H__
26 1 hiro
27 1 hiro
#include <stdio.h>
28 1 hiro
#include <glib.h>
29 1 hiro
30 1 hiro
#define ADDRITEM_OBJECT(obj)        ((AddrItemObject *)obj)
31 1 hiro
#define ADDRITEM_TYPE(obj)        (ADDRITEM_OBJECT(obj)->type)
32 1 hiro
#define ADDRITEM_NAME(obj)        (ADDRITEM_OBJECT(obj)->name)
33 1 hiro
#define ADDRITEM_ID(obj)        (ADDRITEM_OBJECT(obj)->uid)
34 1 hiro
#define ADDRITEM_PARENT(obj)        (ADDRITEM_OBJECT(obj)->parent)
35 1 hiro
#define ADDRITEM_SUBTYPE(obj)        (ADDRITEM_OBJECT(obj)->subType)
36 1 hiro
37 1 hiro
typedef enum {
38 1 hiro
        ITEMTYPE_NONE,
39 1 hiro
        ITEMTYPE_PERSON,
40 1 hiro
        ITEMTYPE_EMAIL,
41 1 hiro
        ITEMTYPE_FOLDER,
42 1 hiro
        ITEMTYPE_GROUP,
43 1 hiro
        ITEMTYPE_INDEX,
44 1 hiro
        ITEMTYPE_INTERFACE,
45 1 hiro
        ITEMTYPE_DATASOURCE
46 1 hiro
} ItemObjectType;
47 1 hiro
48 1 hiro
typedef struct _AddrItemObject AddrItemObject;
49 1 hiro
struct _AddrItemObject {
50 1 hiro
        ItemObjectType type;
51 1 hiro
        gchar          *name;
52 1 hiro
        gchar          *uid;
53 1 hiro
        AddrItemObject *parent;
54 1 hiro
        gint           subType;
55 1 hiro
};
56 1 hiro
57 1 hiro
typedef struct _ItemPerson ItemPerson;
58 1 hiro
struct _ItemPerson {
59 1 hiro
        AddrItemObject obj;
60 1 hiro
        gchar    *firstName;
61 1 hiro
        gchar    *lastName;
62 1 hiro
        gchar    *nickName;
63 1 hiro
        gchar    *externalID;
64 1 hiro
        GList    *listEMail;
65 1 hiro
        GList    *listAttrib;
66 1 hiro
        gboolean isOpened;
67 1 hiro
};
68 1 hiro
69 1 hiro
typedef struct _ItemEMail ItemEMail;
70 1 hiro
struct _ItemEMail {
71 1 hiro
        AddrItemObject obj;
72 1 hiro
        gchar *address;
73 1 hiro
        gchar *remarks;
74 1 hiro
};
75 1 hiro
76 1 hiro
typedef struct _UserAttribute UserAttribute;
77 1 hiro
struct _UserAttribute {
78 1 hiro
        gchar *uid;
79 1 hiro
        gchar *name;
80 1 hiro
        gchar *value;
81 1 hiro
};
82 1 hiro
83 1 hiro
typedef struct _ItemFolder ItemFolder;
84 1 hiro
struct _ItemFolder {
85 1 hiro
        AddrItemObject obj;
86 1 hiro
        gchar    *remarks;
87 1 hiro
        gboolean isRoot;
88 1 hiro
        GList    *listItems;
89 1 hiro
        GList    *listFolder;
90 1 hiro
        GList    *listPerson;
91 1 hiro
        GList    *listGroup;
92 1 hiro
        gpointer userData;
93 1 hiro
};
94 1 hiro
95 1 hiro
typedef struct _ItemGroup ItemGroup;
96 1 hiro
struct _ItemGroup {
97 1 hiro
        AddrItemObject obj;
98 1 hiro
        gchar *remarks;
99 1 hiro
        GList *listEMail;
100 1 hiro
};
101 1 hiro
102 1 hiro
/* Function prototypes */
103 1 hiro
ItemEMail *addritem_create_item_email        ( void );
104 1 hiro
ItemEMail *addritem_copy_item_email        ( ItemEMail *item );
105 1 hiro
void addritem_email_set_id                ( ItemEMail *email, const gchar *value );
106 1 hiro
void addritem_email_set_alias                ( ItemEMail *email, const gchar *value );
107 1 hiro
void addritem_email_set_address                ( ItemEMail *email, const gchar *value );
108 1 hiro
void addritem_email_set_remarks                ( ItemEMail *email, const gchar *value );
109 1 hiro
void addritem_free_item_email                ( ItemEMail *item );
110 1 hiro
111 1 hiro
UserAttribute *addritem_create_attribute( void );
112 1 hiro
UserAttribute *addritem_copy_attribute        ( UserAttribute *item );
113 1 hiro
void addritem_attrib_set_id                ( UserAttribute *item, const gchar *value );
114 1 hiro
void addritem_attrib_set_name                ( UserAttribute *item, const gchar *value );
115 1 hiro
void addritem_attrib_set_value                ( UserAttribute *item, const gchar *value );
116 1 hiro
void addritem_free_attribute                ( UserAttribute *item );
117 1 hiro
118 1 hiro
ItemPerson *addritem_create_item_person        ( void );
119 1 hiro
void addritem_person_set_id                ( ItemPerson *person, const gchar *value );
120 1 hiro
void addritem_person_set_first_name        ( ItemPerson *person, const gchar *value );
121 1 hiro
void addritem_person_set_last_name        ( ItemPerson *person, const gchar *value );
122 1 hiro
void addritem_person_set_nick_name        ( ItemPerson *person, const gchar *value );
123 1 hiro
void addritem_person_set_common_name        ( ItemPerson *person, const gchar *value );
124 1 hiro
void addritem_person_set_external_id        ( ItemPerson *person, const gchar *value );
125 1 hiro
void addritem_person_set_opened                ( ItemPerson *person, const gboolean value );
126 1 hiro
void addritem_free_item_person                ( ItemPerson *person );
127 1 hiro
void addritem_free_list_email                ( GList *list );
128 1 hiro
void addritem_free_list_attribute        ( GList *list );
129 1 hiro
130 1 hiro
ItemGroup *addritem_create_item_group        ( void );
131 1 hiro
void addritem_free_item_group                ( ItemGroup *group );
132 1 hiro
void addritem_print                        ( ItemGroup *group, FILE *stream );
133 1 hiro
void addritem_group_set_id                ( ItemGroup *group, const gchar *value );
134 1 hiro
void addritem_group_set_name                ( ItemGroup *group, const gchar *value );
135 1 hiro
void addritem_group_set_remarks                ( ItemGroup *group, const gchar *value );
136 1 hiro
137 1 hiro
void addritem_print_item_email                ( ItemEMail *item, FILE *stream );
138 1 hiro
void addritem_print_attribute                ( UserAttribute *item, FILE *stream );
139 1 hiro
void addritem_print_item_person                ( ItemPerson *person, FILE *stream );
140 1 hiro
void addritem_print_item_group                ( ItemGroup *group, FILE *stream );
141 1 hiro
void addritem_print_item_folder                ( ItemFolder *folder, FILE *stream );
142 1 hiro
143 1 hiro
gboolean addritem_person_add_email                ( ItemPerson *person, ItemEMail *email );
144 1 hiro
ItemEMail *addritem_person_get_email                ( ItemPerson *person, const gchar *eid );
145 1 hiro
ItemEMail *addritem_person_remove_email_id        ( ItemPerson *person, const gchar *eid );
146 1 hiro
ItemEMail *addritem_person_remove_email                ( ItemPerson *person, ItemEMail *email );
147 1 hiro
148 1 hiro
void addritem_person_add_attribute                ( ItemPerson *person, UserAttribute *attrib );
149 1 hiro
UserAttribute *addritem_person_get_attribute        ( ItemPerson *person, const gchar *aid );
150 1 hiro
UserAttribute *addritem_person_remove_attrib_id        ( ItemPerson *person, const gchar *aid );
151 1 hiro
UserAttribute *addritem_person_remove_attribute        ( ItemPerson *person, UserAttribute *attrib );
152 1 hiro
153 1 hiro
ItemFolder *addritem_create_item_folder        ( void );
154 1 hiro
void addritem_folder_set_id                ( ItemFolder *folder, const gchar *value );
155 1 hiro
void addritem_folder_set_name                ( ItemFolder *folder, const gchar *value );
156 1 hiro
void addritem_folder_set_remarks        ( ItemFolder *folder, const gchar *value );
157 1 hiro
void addritem_free_item_folder                ( ItemFolder *folder );
158 1 hiro
void addritem_free_item_folder_recurse        ( ItemFolder *parent );
159 1 hiro
160 1 hiro
gboolean addritem_group_add_email                ( ItemGroup *group, ItemEMail *email );
161 1 hiro
ItemEMail *addritem_group_remove_email                ( ItemGroup *group, ItemEMail *email );
162 1 hiro
ItemEMail *addritem_group_remove_email_id        ( ItemGroup *group, const gchar *eid );
163 1 hiro
164 1 hiro
gboolean addritem_folder_add_person        ( ItemFolder *folder, ItemPerson *item );
165 1 hiro
gboolean addritem_folder_add_folder        ( ItemFolder *folder, ItemFolder *item );
166 1 hiro
gboolean addritem_folder_add_group        ( ItemFolder *folder, ItemGroup *item );
167 1 hiro
void addritem_folder_free_person        ( ItemFolder *folder );
168 1 hiro
GList *addritem_folder_get_person_list        ( ItemFolder *folder );
169 1 hiro
GList *addritem_folder_get_group_list        ( ItemFolder *folder );
170 1 hiro
171 1 hiro
ItemEMail *addritem_move_email_before        ( ItemPerson *person, ItemEMail *itemMove, ItemEMail *itemTarget );
172 1 hiro
ItemEMail *addritem_move_email_after        ( ItemPerson *person, ItemEMail *itemMove, ItemEMail *itemTarget );
173 1 hiro
174 1 hiro
#endif /* __ADDRITEM_H__ */