aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/otr_wrapper.h
blob: dd6d12c5e74f74f8ba7b0c03dd5bdb5173b99006 (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
/* otr_wrapper.h - wrap libotr for use in the second life viewer
   $PLOTR$ See http://www.cypherpunks.ca/otr/

   Copyright (C) 2009 Chris Tuchs

   This is free software; you can redistribute it and/or modify it
   under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2.1 of
   the License, or (at your option) any later version.
 
   This 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 Lesser General Public
   License along with the viewer; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
   02111-1307, USA.  */

#ifndef OTR_WRAPPER_H_INCLUDED
#define OTR_WRAPPER_H_INCLUDED 1

extern "C" {
#if WIN32
#include <unistd.h>     // various defines needed for OTR on windows
#endif
#include <gcrypt.h>     // gcrypt dependancies
#include <userstate.h>  // OTR
#include <proto.h>      // OTR
#include <privkey.h>    // OTR
#include <../libotr/libotr-3.2.0/src/message.h> // OTR
#include <context.h>
}

class OTR_Wrapper
{
private:
    OtrlUserState userstate; // Global state of OTR: known public keys etc.
    OtrlMessageAppOps uistate; // UI functions collected into a structure for libotr   
    OTR_Wrapper();
    ~OTR_Wrapper();

public:
    static void init();
    static void stopAll();
    static void logout();
    OtrlUserState get_userstate()    { return this->userstate; }
    OtrlMessageAppOps *get_uistate() { return &(this->uistate); }
    const char * get_protocolid()    { return "SecondLife"; }
};

extern OTR_Wrapper *gOTR; // the singleton OTR wrapper

#define OTR_PRIVATE_KEYS_FILE "OTR-my-private-key.dat"
#define OTR_PUBLIC_KEYS_FILE  "OTR-public-keys.dat"

#endif // ndef OTR_WRAPPER_H_INCLUDED