1 | /********************************************************************\ |
---|
2 | * BitlBee -- An IRC to other IM-networks gateway * |
---|
3 | * * |
---|
4 | * Copyright 2002-2008 Wilmer van der Gaast and others * |
---|
5 | \********************************************************************/ |
---|
6 | |
---|
7 | /* |
---|
8 | OTR support (cf. http://www.cypherpunks.ca/otr/) |
---|
9 | |
---|
10 | (c) 2008,2013 Sven Moritz Hallberg <pesco@khjk.org> |
---|
11 | funded by stonedcoder.org |
---|
12 | */ |
---|
13 | |
---|
14 | /* |
---|
15 | This program is free software; you can redistribute it and/or modify |
---|
16 | it under the terms of the GNU General Public License as published by |
---|
17 | the Free Software Foundation; either version 2 of the License, or |
---|
18 | (at your option) any later version. |
---|
19 | |
---|
20 | This program is distributed in the hope that it will be useful, |
---|
21 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
23 | GNU General Public License for more details. |
---|
24 | |
---|
25 | You should have received a copy of the GNU General Public License with |
---|
26 | the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL; |
---|
27 | if not, write to the Free Software Foundation, Inc., 51 Franklin St., |
---|
28 | Fifth Floor, Boston, MA 02110-1301 USA |
---|
29 | */ |
---|
30 | |
---|
31 | #ifndef BITLBEE_PROTOCOLS_OTR_H |
---|
32 | #define BITLBEE_PROTOCOLS_OTR_H |
---|
33 | |
---|
34 | #include "bitlbee.h" |
---|
35 | |
---|
36 | |
---|
37 | // forward decls to avoid mutual dependencies |
---|
38 | struct irc; |
---|
39 | struct im_connection; |
---|
40 | struct account; |
---|
41 | |
---|
42 | |
---|
43 | #include <libotr/proto.h> |
---|
44 | #include <libotr/message.h> |
---|
45 | #include <libotr/privkey.h> |
---|
46 | |
---|
47 | /* representing a keygen job */ |
---|
48 | typedef struct kg { |
---|
49 | char *accountname; |
---|
50 | char *protocol; |
---|
51 | |
---|
52 | struct kg *next; |
---|
53 | } kg_t; |
---|
54 | |
---|
55 | /* struct to encapsulate our book keeping stuff */ |
---|
56 | typedef struct otr { |
---|
57 | OtrlUserState us; |
---|
58 | pid_t keygen; /* pid of keygen slave (0 if none) */ |
---|
59 | FILE *to; /* pipe to keygen slave */ |
---|
60 | FILE *from; /* pipe from keygen slave */ |
---|
61 | |
---|
62 | /* active keygen job (NULL if none) */ |
---|
63 | char *sent_accountname; |
---|
64 | char *sent_protocol; |
---|
65 | |
---|
66 | /* keygen jobs waiting to be sent to slave */ |
---|
67 | kg_t *todo; |
---|
68 | |
---|
69 | /* event timer for otrl_message_poll */ |
---|
70 | gint timer; |
---|
71 | } otr_t; |
---|
72 | |
---|
73 | /* called from main() */ |
---|
74 | void otr_init(void); |
---|
75 | |
---|
76 | /* called by storage_* functions */ |
---|
77 | void otr_load(struct irc *irc); |
---|
78 | void otr_save(struct irc *irc); |
---|
79 | void otr_remove(const char *nick); |
---|
80 | void otr_rename(const char *onick, const char *nnick); |
---|
81 | |
---|
82 | /* called from account_add() */ |
---|
83 | int otr_check_for_key(struct account *a); |
---|
84 | |
---|
85 | #endif |
---|