1 /* common.h - Common declarations for GpgOL
2 * Copyright (C) 2004 Timo Schulz
3 * Copyright (C) 2005, 2006, 2007 g10 Code GmbH
5 * This file is part of GpgOL.
7 * GpgOL is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * as published by the Free Software Foundation; either version 2.1
10 * of the License, or (at your option) any later version.
12 * GpgOL is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 #ifndef GPGOL_COMMON_H
23 #define GPGOL_COMMON_H
37 /* Identifiers for the protocol. We use different one than those use
38 by gpgme. FIXME: We might want to define an unknown protocol to
39 non-null and define such a value also in gpgme. */
43 PROTOCOL_OPENPGP = 1000,
49 /* Possible options for the recipient dialog. */
60 GPG_FMT_NONE = 0, /* do not encrypt attachments */
61 GPG_FMT_CLASSIC = 1, /* encrypt attachments without any encoding */
62 GPG_FMT_PGP_PEF = 2 /* use the PGP partioned encoding format (PEF) */
66 /* Type of a message. */
73 OPENPGP_PUBKEY, /* Note, that this type is only partly supported */
74 OPENPGP_SECKEY /* Note, that this type is only partly supported */
79 extern HINSTANCE glob_hinst;
83 /* Passphrase callback structure. */
84 struct passphrase_cb_s
92 int ttl; /* TTL of the passphrase. */
93 unsigned int decrypt_cmd:1; /* 1 = show decrypt dialog, otherwise secret key
95 unsigned int hide_pwd:1;
96 unsigned int last_was_bad:1;
99 /* Global options - initialized to default by main.c. */
105 int passwd_ttl; /* Time in seconds the passphrase is stored. */
106 int encrypt_default; /* Encrypt by default. */
107 int sign_default; /* Sign by default. */
108 int save_decrypted_attach; /* Save decrypted attachments. */
109 int auto_sign_attach; /* Sign all outgoing attachments. */
110 int enc_format; /* Encryption format for attachments. */
111 char *default_key; /* The key we want to always encrypt to. */
112 int enable_default_key; /* Enable the use of DEFAULT_KEY. */
113 int preview_decrypt; /* Decrypt in preview window. */
114 int prefer_html; /* Prefer html in html/text alternatives. */
116 /* The compatibility flags. */
119 unsigned int no_msgcache:1;
120 unsigned int no_pgpmime:1;
121 unsigned int no_oom_write:1; /* Don't write using Outlooks object model. */
122 unsigned int no_preview_info:1; /* No preview info about PGP/MIME. */
123 unsigned int old_reply_hack: 1; /* See gpgmsg.cpp:decrypt. */
124 unsigned int auto_decrypt: 1; /* Try to decrypt when clicked. */
125 unsigned int no_attestation: 1; /* Don't create an attestation. */
130 /* The state object used by b64_decode. */
136 int invalid_encoding;
138 typedef struct b64_state_s b64_state_t;
143 void set_global_hinstance (HINSTANCE hinst);
144 void center_window (HWND childwnd, HWND style);
145 char *get_save_filename (HWND root, const char *srcname);
146 char *utf8_to_wincp (const char *string);
148 HRESULT w32_shgetfolderpath (HWND a, int b, HANDLE c, DWORD d, LPSTR e);
150 size_t qp_decode (char *buffer, size_t length);
151 void b64_init (b64_state_t *state);
152 size_t b64_decode (b64_state_t *state, char *buffer, size_t length);
154 /* The length of the boundary - the buffer needs to be allocated one
156 #define BOUNDARYSIZE 20
157 char *generate_boundary (char *buffer);
160 /*-- recipient-dialog.c --*/
161 unsigned int recipient_dialog_box (gpgme_key_t **ret_rset);
162 unsigned int recipient_dialog_box2 (gpgme_key_t *fnd, char **unknown,
163 gpgme_key_t **ret_rset);
165 /*-- passphrase-dialog.c --*/
166 int signer_dialog_box (gpgme_key_t *r_key, char **r_passwd, int encrypting);
167 gpgme_error_t passphrase_callback_box (void *opaque, const char *uid_hint,
168 const char *pass_info,
169 int prev_was_bad, int fd);
170 void free_decrypt_key (struct passphrase_cb_s *ctx);
171 const char *get_pubkey_algo_str (gpgme_pubkey_algo_t id);
173 /*-- config-dialog.c --*/
174 void config_dialog_box (HWND parent);
175 int start_key_manager (void);
176 int store_extension_value (const char *key, const char *val);
177 int load_extension_value (const char *key, char **val);
179 /*-- verify-dialog.c --*/
180 int verify_dialog_box (gpgme_protocol_t protocol,
181 gpgme_verify_result_t res,
182 const char *filename);
188 #endif /*GPGOL_COMMON_H*/