source: otr.h @ 0c85c08

Last change on this file since 0c85c08 was 0c85c08, checked in by Wilmer van der Gaast <wilmer@…>, at 2010-08-31T23:18:21Z

Pluginify this thing a little bit. Not so much in the dynamically loadable
sense of the word, more in a way that core files don't have to include otr.h.

  • Property mode set to 100644
File size: 3.0 KB
Line 
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  2008, Sven Moritz Hallberg <pesco@khjk.org>
11  (c) and 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., 59 Temple Place,
28  Suite 330, Boston, MA  02111-1307  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
38struct irc;
39struct im_connection;
40struct account;
41
42
43#ifdef WITH_OTR
44#include <libotr/proto.h>
45#include <libotr/message.h>
46#include <libotr/privkey.h>
47
48/* representing a keygen job */
49typedef struct kg {
50        char *accountname;
51        char *protocol;
52       
53        struct kg *next;
54} kg_t;
55
56/* struct to encapsulate our book keeping stuff */
57typedef struct otr {
58        OtrlUserState us;
59        pid_t keygen;    /* pid of keygen slave (0 if none) */
60        FILE *to;        /* pipe to keygen slave */
61        FILE *from;      /* pipe from keygen slave */
62       
63        /* active keygen job (NULL if none) */
64        char *sent_accountname;
65        char *sent_protocol;
66       
67        /* keygen jobs waiting to be sent to slave */
68        kg_t *todo;
69} otr_t;
70
71/* called from main() */
72void otr_init(void);
73
74/* called by storage_* functions */
75void otr_load(struct irc *irc);
76void otr_save(struct irc *irc);
77void otr_remove(const char *nick);
78void otr_rename(const char *onick, const char *nnick);
79
80/* called from account_add() */
81int otr_check_for_key(struct account *a);
82
83/* called from imcb_buddy_msg() */
84char *otr_handle_message(struct im_connection *ic, const char *handle,
85        const char *msg);
86       
87/* called from imc_buddy_msg() */
88int otr_send_message(struct im_connection *ic, const char *handle, const char *msg,
89        int flags);
90
91#else
92
93typedef void otr_t;
94typedef void *OtrlMessageAppOps;
95
96#define otr_free(otr) {}
97#define otr_load(irc) {}
98#define otr_save(irc) {}
99#define otr_remove(nick) {}
100#define otr_rename(onick,nnick) {}
101#define otr_check_for_key(acc) (0)
102#define otr_handle_message(ic,handle,msg) (g_strdup(msg))
103#define otr_send_message(ic,h,m,f) (ic->acc->prpl->buddy_msg(ic,h,m,f))
104
105void cmd_otr_nosupport(void *, char **);
106
107#endif
108#endif
Note: See TracBrowser for help on using the repository browser.