enable external editor on windows. patch by Thorsten Maerz
[claws.git] / src / addritem.h
blob9bccdf8f2ddd1af5681e42217dc5236fd9ff19c6
1 /*
2 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 2001-2017 Match Grun and the Claws Mail team
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.
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, see <http://www.gnu.org/licenses/>.
20 * Address item data.
23 #ifndef __ADDRITEM_H__
24 #define __ADDRITEM_H__
26 #include <stdio.h>
27 #include <glib.h>
29 #define ADDRITEM_OBJECT(obj) ((AddrItemObject *)obj)
30 #define ADDRITEM_TYPE(obj) (ADDRITEM_OBJECT(obj)->type)
31 #define ADDRITEM_NAME(obj) (ADDRITEM_OBJECT(obj)->name)
32 #define ADDRITEM_ID(obj) (ADDRITEM_OBJECT(obj)->uid)
33 #define ADDRITEM_PARENT(obj) (ADDRITEM_OBJECT(obj)->parent)
34 #define ADDRITEM_SUBTYPE(obj) (ADDRITEM_OBJECT(obj)->subType)
36 typedef enum {
37 ITEMTYPE_NONE,
38 ITEMTYPE_PERSON,
39 ITEMTYPE_EMAIL,
40 ITEMTYPE_FOLDER,
41 ITEMTYPE_GROUP,
42 ITEMTYPE_INDEX,
43 ITEMTYPE_INTERFACE,
44 ITEMTYPE_DATASOURCE
45 } ItemObjectType;
47 typedef enum {
48 ADDRFOLDER_NONE,
49 ADDRFOLDER_ROOT,
50 ADDRFOLDER_REGULAR,
51 ADDRFOLDER_CATEGORY,
52 ADDRFOLDER_QUERY_RESULTS
53 } AddressFolderType;
55 typedef enum {
56 NONE,
57 ADD_ENTRY,
58 UPDATE_ENTRY,
59 DELETE_ENTRY
60 } ContactStatus;
62 typedef struct _AddrItemObject AddrItemObject;
63 struct _AddrItemObject {
64 ItemObjectType type;
65 gchar *name;
66 gchar *uid;
67 AddrItemObject *parent;
68 gint subType;
71 typedef struct _ItemPerson ItemPerson;
72 struct _ItemPerson {
73 AddrItemObject obj;
74 gchar *picture;
75 gchar *firstName;
76 gchar *lastName;
77 gchar *nickName;
78 gchar *externalID;
79 GList *listEMail;
80 GList *listAttrib;
81 gboolean isOpened;
82 ContactStatus status;
85 typedef struct _ItemEMail ItemEMail;
86 struct _ItemEMail {
87 AddrItemObject obj;
88 gchar *address;
89 gchar *remarks;
92 typedef struct _UserAttribute UserAttribute;
93 struct _UserAttribute {
94 gchar *uid;
95 gchar *name;
96 gchar *value;
99 typedef struct _ItemFolder ItemFolder;
100 struct _ItemFolder {
101 AddrItemObject obj;
102 gchar *remarks;
103 gboolean isRoot; /* TRUE if root folder */
104 GList *listItems; /* Used for temporary items only */
105 GList *listFolder; /* List of contained (child) folders */
106 GList *listPerson; /* List of contained persons */
107 GList *listGroup; /* List of contained (child) groups */
108 AddressFolderType folderType; /* Folder type */
109 gpointer *folderData; /* Pointer to folder's data */
110 gboolean isHidden; /* TRUE if folder is hidden */
113 typedef struct _ItemGroup ItemGroup;
114 struct _ItemGroup {
115 AddrItemObject obj;
116 gchar *remarks;
117 GList *listEMail;
120 /* Function prototypes */
121 ItemEMail *addritem_create_item_email ( void );
122 ItemEMail *addritem_copy_item_email ( ItemEMail *item );
123 ItemEMail *addritem_copyfull_item_email ( ItemEMail *item );
124 void addritem_email_set_alias ( ItemEMail *email, const gchar *value );
125 void addritem_email_set_address ( ItemEMail *email, const gchar *value );
126 void addritem_email_set_remarks ( ItemEMail *email, const gchar *value );
127 void addritem_free_item_email ( ItemEMail *item );
129 UserAttribute *addritem_create_attribute( void );
130 UserAttribute *addritem_copy_attribute ( UserAttribute *item );
131 void addritem_attrib_set_id ( UserAttribute *item, const gchar *value );
132 void addritem_attrib_set_name ( UserAttribute *item, const gchar *value );
133 void addritem_attrib_set_value ( UserAttribute *item, const gchar *value );
134 void addritem_free_attribute ( UserAttribute *item );
136 ItemPerson *addritem_create_item_person ( void );
137 ItemPerson *addritem_copy_item_person ( ItemPerson *item );
138 void addritem_person_set_picture ( ItemPerson *person, const gchar *value );
139 gchar *addritem_person_get_picture ( ItemPerson *person);
140 void addritem_person_remove_picture ( ItemPerson *person);
141 void addritem_person_set_first_name ( ItemPerson *person, const gchar *value );
142 void addritem_person_set_last_name ( ItemPerson *person, const gchar *value );
143 void addritem_person_set_nick_name ( ItemPerson *person, const gchar *value );
144 void addritem_person_set_common_name ( ItemPerson *person, const gchar *value );
145 void addritem_person_set_external_id ( ItemPerson *person, const gchar *value );
146 void addritem_person_set_opened ( ItemPerson *person, const gboolean value );
147 void addritem_free_item_person ( ItemPerson *person );
148 void addritem_free_list_email ( GList *list );
149 void addritem_free_list_attribute ( GList *list );
151 ItemGroup *addritem_create_item_group ( void );
152 ItemGroup *addritem_copy_item_group ( ItemGroup *item );
153 void addritem_free_item_group ( ItemGroup *group );
154 void addritem_group_set_name ( ItemGroup *group, const gchar *value );
156 void addritem_print_item_email ( ItemEMail *item, FILE *stream );
157 void addritem_print_item_person ( ItemPerson *person, FILE *stream );
158 void addritem_print_item_group ( ItemGroup *group, FILE *stream );
159 void addritem_print_item_folder ( ItemFolder *folder, FILE *stream );
161 gboolean addritem_person_add_email ( ItemPerson *person, ItemEMail *email );
162 ItemEMail *addritem_person_remove_email ( ItemPerson *person, ItemEMail *email );
164 void addritem_person_add_attribute ( ItemPerson *person, UserAttribute *attrib );
165 void addritem_person_remove_attribute ( ItemPerson *person, const gchar *attrib );
167 ItemFolder *addritem_create_item_folder ( void );
168 ItemFolder *addritem_copy_item_folder ( ItemFolder *item );
169 void addritem_folder_set_name ( ItemFolder *folder, const gchar *value );
170 void addritem_folder_set_remarks ( ItemFolder *folder, const gchar *value );
171 void addritem_folder_set_hidden ( ItemFolder *folder, const gboolean value );
172 void addritem_free_item_folder ( ItemFolder *folder );
174 gboolean addritem_group_add_email ( ItemGroup *group, ItemEMail *email );
176 gboolean addritem_folder_add_person ( ItemFolder *folder, ItemPerson *item );
177 ItemPerson *addritem_folder_remove_person( ItemFolder *group, ItemPerson *person );
179 gboolean addritem_folder_add_folder ( ItemFolder *folder, ItemFolder *item );
180 gboolean addritem_folder_add_group ( ItemFolder *folder, ItemGroup *item );
181 GList *addritem_folder_get_person_list ( ItemFolder *folder );
182 GList *addritem_folder_get_group_list ( ItemFolder *folder );
184 void addritem_parse_first_last ( ItemPerson *person );
185 GList *addritem_folder_path ( const ItemFolder *folder,
186 const gboolean seq );
187 gchar *addritem_format_email ( ItemEMail *email );
189 #endif /* __ADDRITEM_H__ */