2006-11-18 [paul] 2.6.0cvs55
[claws.git] / src / privacy.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2006 Hiroyuki Yamamoto & the Claws Mail 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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         SIGNATURE_CHECK_TIMEOUT
33 } SignatureStatus;
34
35 #include <glib.h>
36
37 #include "procmime.h"
38 #include "prefs_account.h"
39
40 void privacy_register_system                    (PrivacySystem *system);
41 void privacy_unregister_system                  (PrivacySystem *system);
42
43 void privacy_free_privacydata                   (PrivacyData *);
44
45 gboolean privacy_mimeinfo_is_signed             (MimeInfo *);
46 gint privacy_mimeinfo_check_signature           (MimeInfo *);
47 SignatureStatus privacy_mimeinfo_get_sig_status (MimeInfo *);
48 gchar *privacy_mimeinfo_sig_info_short          (MimeInfo *);
49 gchar *privacy_mimeinfo_sig_info_full           (MimeInfo *);
50
51 gboolean privacy_mimeinfo_is_encrypted          (MimeInfo *);
52 gint privacy_mimeinfo_decrypt                   (MimeInfo *);
53
54 GSList *privacy_get_system_ids                  ();
55 const gchar *privacy_system_get_name            (const gchar *);
56 gboolean privacy_system_can_sign                (const gchar *);
57 gboolean privacy_system_can_encrypt             (const gchar *);
58
59 gboolean privacy_sign                           (const gchar  *system,
60                                                  MimeInfo     *mimeinfo,
61                                                  PrefsAccount *account);
62 gchar *privacy_get_encrypt_data                 (const gchar  *system,
63                                                  GSList       *recp_names);
64 gboolean privacy_encrypt                        (const gchar  *system,
65                                                  MimeInfo     *mimeinfo,
66                                                  const gchar  *encdata);
67
68 void privacy_set_error                          (const gchar *format, ...);
69 void privacy_reset_error                                (void);
70 gboolean privacy_peek_error                             (void);
71 const gchar *privacy_get_error                  (void);
72
73 struct _PrivacySystem {
74         /** Identifier for the PrivacySystem that can use in config files */
75         gchar            *id;
76         /** Human readable name for the PrivacySystem for the user interface */
77         gchar            *name;
78
79         void             (*free_privacydata)    (PrivacyData *data);
80
81         gboolean         (*is_signed)           (MimeInfo *mimeinfo);
82         gint             (*check_signature)     (MimeInfo *mimeinfo);
83         SignatureStatus  (*get_sig_status)      (MimeInfo *mimeinfo);
84         gchar           *(*get_sig_info_short)  (MimeInfo *mimeinfo);
85         gchar           *(*get_sig_info_full)   (MimeInfo *mimeinfo);
86
87         gboolean         (*is_encrypted)        (MimeInfo *mimeinfo);
88         MimeInfo        *(*decrypt)             (MimeInfo *mimeinfo);
89
90         gboolean           can_sign;
91         gboolean         (*sign)                (MimeInfo *mimeinfo,
92                                                  PrefsAccount *account);
93
94         gboolean           can_encrypt;
95         gchar           *(*get_encrypt_data)    (GSList *recp_names);
96         gboolean         (*encrypt)             (MimeInfo *mimeinfo,
97                                                  const gchar *encrypt_data);
98 };
99
100 struct _PrivacyData {
101         PrivacySystem   *system;
102 };
103
104 #endif /* PRIVACY_H */