Fix bug #3574: Template addressing
[claws.git] / src / privacy.h
blobebc191972355fc6200e3039401824e55908f560a
1 /*
2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2012 Hiroyuki Yamamoto 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 #ifndef PRIVACY_H
21 #define PRIVACY_H
23 typedef struct _PrivacySystem PrivacySystem;
24 typedef struct _PrivacyData PrivacyData;
26 typedef enum {
27 SIGNATURE_UNCHECKED,
28 SIGNATURE_OK,
29 SIGNATURE_WARN,
30 SIGNATURE_KEY_EXPIRED,
31 SIGNATURE_INVALID,
32 SIGNATURE_CHECK_FAILED,
33 SIGNATURE_CHECK_TIMEOUT
34 } SignatureStatus;
36 #include <glib.h>
38 #include "procmime.h"
39 #include "prefs_account.h"
41 void privacy_register_system (PrivacySystem *system);
42 void privacy_unregister_system (PrivacySystem *system);
44 void privacy_free_privacydata (PrivacyData *);
46 void privacy_msginfo_get_signed_state (MsgInfo *, gchar **system);
47 gboolean privacy_mimeinfo_is_signed (MimeInfo *);
48 gint privacy_mimeinfo_check_signature (MimeInfo *);
49 SignatureStatus privacy_mimeinfo_get_sig_status (MimeInfo *);
50 gchar *privacy_mimeinfo_sig_info_short (MimeInfo *);
51 gchar *privacy_mimeinfo_sig_info_full (MimeInfo *);
53 gboolean privacy_mimeinfo_is_encrypted (MimeInfo *);
54 gint privacy_mimeinfo_decrypt (MimeInfo *);
56 GSList *privacy_get_system_ids ();
57 const gchar *privacy_system_get_name (const gchar *);
58 gboolean privacy_system_can_sign (const gchar *);
59 gboolean privacy_system_can_encrypt (const gchar *);
61 gboolean privacy_sign (const gchar *system,
62 MimeInfo *mimeinfo,
63 PrefsAccount *account,
64 const gchar *from_addr);
65 gchar *privacy_get_encrypt_data (const gchar *system,
66 GSList *recp_names);
67 const gchar *privacy_get_encrypt_warning (const gchar *system);
68 gboolean privacy_encrypt (const gchar *system,
69 MimeInfo *mimeinfo,
70 const gchar *encdata);
72 void privacy_set_error (const gchar *format, ...) G_GNUC_PRINTF(1, 2);
73 void privacy_reset_error (void);
74 gboolean privacy_peek_error (void);
75 const gchar *privacy_get_error (void);
77 struct _PrivacySystem {
78 /** Identifier for the PrivacySystem that can use in config files */
79 gchar *id;
80 /** Human readable name for the PrivacySystem for the user interface */
81 gchar *name;
83 void (*free_privacydata) (PrivacyData *data);
85 gboolean (*is_signed) (MimeInfo *mimeinfo);
86 gint (*check_signature) (MimeInfo *mimeinfo);
87 SignatureStatus (*get_sig_status) (MimeInfo *mimeinfo);
88 gchar *(*get_sig_info_short) (MimeInfo *mimeinfo);
89 gchar *(*get_sig_info_full) (MimeInfo *mimeinfo);
91 gboolean (*is_encrypted) (MimeInfo *mimeinfo);
92 MimeInfo *(*decrypt) (MimeInfo *mimeinfo);
94 gboolean can_sign;
95 gboolean (*sign) (MimeInfo *mimeinfo,
96 PrefsAccount *account,
97 const gchar *from_addr);
99 gboolean can_encrypt;
100 gchar *(*get_encrypt_data) (GSList *recp_names);
101 gboolean (*encrypt) (MimeInfo *mimeinfo,
102 const gchar *encrypt_data);
103 const gchar *(*get_encrypt_warning) (void);
104 void (*inhibit_encrypt_warning) (gboolean inhibit);
105 gboolean (*auto_check_signatures)(void);
108 struct _PrivacyData {
109 PrivacySystem *system;
112 void privacy_inhibit_encrypt_warning (const gchar *id,
113 gboolean inhibit);
114 gboolean privacy_auto_check_signatures(MimeInfo *mimeinfo);
116 #endif /* PRIVACY_H */