2005-09-14 [paul] 1.9.14cvs26
[claws.git] / src / privacy.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2003 Hiroyuki Yamamoto & the Sylpheed-Claws team
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 #ifndef PRIVACY_H
21 #define PRIVACY_H
22
23 typedef struct _PrivacySystem PrivacySystem;
24 typedef struct _PrivacyData PrivacyData;
25
26 typedef enum {
27         SIGNATURE_UNCHECKED,
28         SIGNATURE_OK,
29         SIGNATURE_WARN,
30         SIGNATURE_INVALID,
31         SIGNATURE_CHECK_FAILED
32 } SignatureStatus;
33
34 #include <glib.h>
35
36 #include "procmime.h"
37 #include "prefs_account.h"
38
39 void privacy_register_system                    (PrivacySystem *system);
40 void privacy_unregister_system                  (PrivacySystem *system);
41
42 void privacy_free_privacydata                   (PrivacyData *);
43
44 gboolean privacy_mimeinfo_is_signed             (MimeInfo *);
45 gint privacy_mimeinfo_check_signature           (MimeInfo *);
46 SignatureStatus privacy_mimeinfo_get_sig_status (MimeInfo *);
47 gchar *privacy_mimeinfo_sig_info_short          (MimeInfo *);
48 gchar *privacy_mimeinfo_sig_info_full           (MimeInfo *);
49
50 gboolean privacy_mimeinfo_is_encrypted          (MimeInfo *);
51 gint privacy_mimeinfo_decrypt                   (MimeInfo *);
52
53 GSList *privacy_get_system_ids                  ();
54 const gchar *privacy_system_get_name            (const gchar *);
55 gboolean privacy_system_can_sign                (const gchar *);
56 gboolean privacy_system_can_encrypt             (const gchar *);
57
58 gboolean privacy_sign                           (const gchar  *system,
59                                                  MimeInfo     *mimeinfo,
60                                                  PrefsAccount *account);
61 gchar *privacy_get_encrypt_data                 (const gchar  *system,
62                                                  GSList       *recp_names);
63 gboolean privacy_encrypt                        (const gchar  *system,
64                                                  MimeInfo     *mimeinfo,
65                                                  const gchar  *encdata);
66
67 struct _PrivacySystem {
68         /** Identifier for the PrivacySystem that can use in config files */
69         gchar            *id;
70         /** Human readable name for the PrivacySystem for the user interface */
71         gchar            *name;
72
73         void             (*free_privacydata)    (PrivacyData *data);
74
75         gboolean         (*is_signed)           (MimeInfo *mimeinfo);
76         gint             (*check_signature)     (MimeInfo *mimeinfo);
77         SignatureStatus  (*get_sig_status)      (MimeInfo *mimeinfo);
78         gchar           *(*get_sig_info_short)  (MimeInfo *mimeinfo);
79         gchar           *(*get_sig_info_full)   (MimeInfo *mimeinfo);
80
81         gboolean         (*is_encrypted)        (MimeInfo *mimeinfo);
82         MimeInfo        *(*decrypt)             (MimeInfo *mimeinfo);
83
84         gboolean           can_sign;
85         gboolean         (*sign)                (MimeInfo *mimeinfo,
86                                                  PrefsAccount *account);
87
88         gboolean           can_encrypt;
89         gchar           *(*get_encrypt_data)    (GSList *recp_names);
90         gboolean         (*encrypt)             (MimeInfo *mimeinfo,
91                                                  const gchar *encrypt_data);
92 };
93
94 struct _PrivacyData {
95         PrivacySystem   *system;
96 };
97
98 #endif /* PRIVACY_H */