diff options
Diffstat (limited to 'linden/indra/newview/otr_wrapper.h')
-rw-r--r-- | linden/indra/newview/otr_wrapper.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/linden/indra/newview/otr_wrapper.h b/linden/indra/newview/otr_wrapper.h new file mode 100644 index 0000000..dd6d12c --- /dev/null +++ b/linden/indra/newview/otr_wrapper.h | |||
@@ -0,0 +1,58 @@ | |||
1 | /* otr_wrapper.h - wrap libotr for use in the second life viewer | ||
2 | $PLOTR$ See http://www.cypherpunks.ca/otr/ | ||
3 | |||
4 | Copyright (C) 2009 Chris Tuchs | ||
5 | |||
6 | This is free software; you can redistribute it and/or modify it | ||
7 | under the terms of the GNU Lesser General Public License as | ||
8 | published by the Free Software Foundation; either version 2.1 of | ||
9 | the License, or (at your option) any later version. | ||
10 | |||
11 | This is distributed in the hope that it will be useful, but WITHOUT | ||
12 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
13 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | ||
14 | License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU Lesser General Public | ||
17 | License along with the viewer; if not, write to the Free Software | ||
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||
19 | 02111-1307, USA. */ | ||
20 | |||
21 | #ifndef OTR_WRAPPER_H_INCLUDED | ||
22 | #define OTR_WRAPPER_H_INCLUDED 1 | ||
23 | |||
24 | extern "C" { | ||
25 | #if WIN32 | ||
26 | #include <unistd.h> // various defines needed for OTR on windows | ||
27 | #endif | ||
28 | #include <gcrypt.h> // gcrypt dependancies | ||
29 | #include <userstate.h> // OTR | ||
30 | #include <proto.h> // OTR | ||
31 | #include <privkey.h> // OTR | ||
32 | #include <../libotr/libotr-3.2.0/src/message.h> // OTR | ||
33 | #include <context.h> | ||
34 | } | ||
35 | |||
36 | class OTR_Wrapper | ||
37 | { | ||
38 | private: | ||
39 | OtrlUserState userstate; // Global state of OTR: known public keys etc. | ||
40 | OtrlMessageAppOps uistate; // UI functions collected into a structure for libotr | ||
41 | OTR_Wrapper(); | ||
42 | ~OTR_Wrapper(); | ||
43 | |||
44 | public: | ||
45 | static void init(); | ||
46 | static void stopAll(); | ||
47 | static void logout(); | ||
48 | OtrlUserState get_userstate() { return this->userstate; } | ||
49 | OtrlMessageAppOps *get_uistate() { return &(this->uistate); } | ||
50 | const char * get_protocolid() { return "SecondLife"; } | ||
51 | }; | ||
52 | |||
53 | extern OTR_Wrapper *gOTR; // the singleton OTR wrapper | ||
54 | |||
55 | #define OTR_PRIVATE_KEYS_FILE "OTR-my-private-key.dat" | ||
56 | #define OTR_PUBLIC_KEYS_FILE "OTR-public-keys.dat" | ||
57 | |||
58 | #endif // ndef OTR_WRAPPER_H_INCLUDED | ||