summaryrefslogtreecommitdiffstats
path: root/autocrypt/autocrypt.h
blob: a50ec31103ebfafb11d685263fb71768f4cf90c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
 * Copyright (C) 2019 Kevin J. McCarthy <kevin@8t8.us>
 *
 *     This program is free software; you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation; either version 2 of the License, or
 *     (at your option) any later version.
 *
 *     This program is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 *
 *     You should have received a copy of the GNU General Public License
 *     along with this program; if not, write to the Free Software
 *     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#ifndef _AUTOCRYPT_H
#define _AUTOCRYPT_H 1

#include <sqlite3.h>

WHERE sqlite3 *AutocryptDB;

typedef struct
{
  char *email_addr;
  char *keyid;
  char *keydata;
  int prefer_encrypt;    /* 0 = nopref, 1 = mutual */
  int enabled;
} AUTOCRYPT_ACCOUNT;

typedef struct
{
  char *email_addr;
  sqlite3_int64 last_seen;
  sqlite3_int64 autocrypt_timestamp;
  char *keyid;
  char *keydata;
  int prefer_encrypt;    /* 0 = nopref, 1 = mutual */
  sqlite3_int64 gossip_timestamp;
  char *gossip_keyid;
  char *gossip_keydata;
} AUTOCRYPT_PEER;

typedef struct
{
  char *peer_email_addr;
  char *email_msgid;
  sqlite3_int64 timestamp;
  char *keydata;
} AUTOCRYPT_PEER_HISTORY;

typedef struct
{
  char *peer_email_addr;
  char *sender_email_addr;
  char *email_msgid;
  sqlite3_int64 timestamp;
  char *gossip_keydata;
} AUTOCRYPT_GOSSIP_HISTORY;

typedef enum
{
  AUTOCRYPT_REC_OFF,
  AUTOCRYPT_REC_NO,
  AUTOCRYPT_REC_DISCOURAGE,
  AUTOCRYPT_REC_AVAILABLE,
  AUTOCRYPT_REC_YES
} autocrypt_rec_t;

int mutt_autocrypt_init (int);
void mutt_autocrypt_cleanup (void);
int mutt_autocrypt_process_autocrypt_header (HEADER *hdr, ENVELOPE *env);
int mutt_autocrypt_process_gossip_header (HEADER *hdr, ENVELOPE *prot_headers);
autocrypt_rec_t mutt_autocrypt_ui_recommendation (HEADER *hdr, char **keylist);
int mutt_autocrypt_set_sign_as_default_key (HEADER *hdr);
int mutt_autocrypt_write_autocrypt_header (ENVELOPE *env, FILE *fp);
int mutt_autocrypt_write_gossip_headers (ENVELOPE *env, FILE *fp);
int mutt_autocrypt_generate_gossip_list (HEADER *hdr);
void mutt_autocrypt_account_menu (void);

#endif