1 /*
2  * This program is free software; you can redistribute it and/or modify it
3  * under the terms of the GNU Lesser General Public License as published by
4  * the Free Software Foundation.
5  *
6  * This program is distributed in the hope that it will be useful, but
7  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
8  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9  * for more details.
10  *
11  * You should have received a copy of the GNU Lesser General Public License
12  * along with this program; if not, see <http://www.gnu.org/licenses/>.
13  *
14  *
15  * Authors:
16  *		Srinivasa Ragavan <sragavan@gnome.org>
17  *
18  *
19  */
20 
21 #if !defined (__LIBEMAIL_ENGINE_H_INSIDE__) && !defined (LIBEMAIL_ENGINE_COMPILATION)
22 #error "Only <libemail-engine/libemail-engine.h> should be included directly."
23 #endif
24 
25 #ifndef E_MAIL_UTILS_H
26 #define E_MAIL_UTILS_H
27 
28 #include <camel/camel.h>
29 #include <libedataserver/libedataserver.h>
30 
31 typedef void	(*EMailUtilsSortSourcesFunc)	(GList **psources,
32 						 gpointer user_data);
33 
34 gboolean	em_utils_folder_is_drafts	(ESourceRegistry *registry,
35 						 CamelFolder *folder);
36 gboolean	em_utils_folder_name_is_drafts	(ESourceRegistry *registry,
37 						 CamelStore *store,
38 						 const gchar *folder_name);
39 gboolean	em_utils_folder_is_templates	(ESourceRegistry *registry,
40 						 CamelFolder *folder);
41 gboolean	em_utils_folder_is_sent		(ESourceRegistry *registry,
42 						 CamelFolder *folder);
43 gboolean	em_utils_folder_is_outbox	(ESourceRegistry *registry,
44 						 CamelFolder *folder);
45 ESource *	em_utils_guess_mail_account	(ESourceRegistry *registry,
46 						 CamelMimeMessage *message,
47 						 CamelFolder *folder,
48 						 const gchar *message_uid);
49 ESource *	em_utils_guess_mail_identity	(ESourceRegistry *registry,
50 						 CamelMimeMessage *message,
51 						 CamelFolder *folder,
52 						 const gchar *message_uid);
53 ESource *	em_utils_guess_mail_account_with_recipients
54 						(ESourceRegistry *registry,
55 						 CamelMimeMessage *message,
56 						 CamelFolder *folder,
57 						 const gchar *message_uid);
58 ESource *	em_utils_guess_mail_identity_with_recipients
59 						(ESourceRegistry *registry,
60 						 CamelMimeMessage *message,
61 						 CamelFolder *folder,
62 						 const gchar *message_uid,
63 						 gchar **identity_name,
64 						 gchar **identity_address);
65 ESource *	em_utils_guess_mail_account_with_recipients_and_sort
66 						(ESourceRegistry *registry,
67 						 CamelMimeMessage *message,
68 						 CamelFolder *folder,
69 						 const gchar *message_uid,
70 						 EMailUtilsSortSourcesFunc sort_func,
71 						 gpointer sort_func_data);
72 ESource *	em_utils_guess_mail_identity_with_recipients_and_sort
73 						(ESourceRegistry *registry,
74 						 CamelMimeMessage *message,
75 						 CamelFolder *folder,
76 						 const gchar *message_uid,
77 						 gchar **identity_name,
78 						 gchar **identity_address,
79 						 EMailUtilsSortSourcesFunc sort_func,
80 						 gpointer sort_func_data);
81 ESource *	em_utils_ref_mail_identity_for_store
82 						(ESourceRegistry *registry,
83 						 CamelStore *store);
84 gboolean	em_utils_is_local_delivery_mbox_file
85 						(CamelService *service);
86 
87 void		em_utils_expand_groups		(CamelInternetAddress *addresses);
88 void		em_utils_get_real_folder_and_message_uid
89 						(CamelFolder *folder,
90 						 const gchar *uid,
91 						 CamelFolder **out_real_folder,
92 						 gchar **folder_uri,
93 						 gchar **message_uid);
94 gboolean	em_utils_address_is_user	(ESourceRegistry *registry,
95 						 const gchar *address,
96 						 gboolean only_enabled_accounts);
97 gboolean	em_utils_sender_is_user		(ESourceRegistry *registry,
98 						 CamelMimeMessage *message,
99 						 gboolean only_enabled_accounts);
100 
101 #endif /* E_MAIL_UTILS_H */
102