source: otr.h @ 814aa52

Last change on this file since 814aa52 was 59ab2af, checked in by Sven Moritz Hallberg <sm@…>, at 2008-02-17T02:21:11Z

fix compilation without otr support

  • Property mode set to 100644
File size: 3.2 KB
RevLine 
[e2b15bb]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/)
[6c91e6e]9 
[e2b15bb]10  2008, Sven Moritz Hallberg <pesco@khjk.org>
[6c91e6e]11  (c) and funded by stonedcoder.org
[e2b15bb]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
[764c7d1]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// 'otr' root command, hooked up in root_commands.c
43void cmd_otr(struct irc *, char **args);
44
45
46#ifdef WITH_OTR
47#include <libotr/proto.h>
48#include <libotr/message.h>
49#include <libotr/privkey.h>
50
[dc9797f]51/* representing a keygen job */
52typedef struct kg {
[ba5add7]53        char *accountname;
54        char *protocol;
[dc9797f]55       
56        struct kg *next;
57} kg_t;
58
59/* struct to encapsulate our book keeping stuff */
60typedef struct otr {
61        OtrlUserState us;
62        pid_t keygen;    /* pid of keygen slave (0 if none) */
63        FILE *to;        /* pipe to keygen slave */
64        FILE *from;      /* pipe from keygen slave */
65       
66        /* active keygen job (NULL if none) */
[ba5add7]67        char *sent_accountname;
68        char *sent_protocol;
[dc9797f]69       
70        /* keygen jobs waiting to be sent to slave */
71        kg_t *todo;
72} otr_t;
73
[764c7d1]74/* called from main() */
75void otr_init(void);
76
[dc9797f]77/* called from irc_new()/irc_free() */
78otr_t *otr_new();
79void otr_free(otr_t *otr);
80
[764c7d1]81/* called by storage_* functions */
82void otr_load(struct irc *irc);
83void otr_save(struct irc *irc);
84void otr_remove(const char *nick);
85void otr_rename(const char *onick, const char *nnick);
86
87/* called from account_add() */
[3064ea4]88int otr_check_for_key(struct account *a);
[764c7d1]89
90/* called from imcb_buddy_msg() */
91char *otr_handle_message(struct im_connection *ic, const char *handle,
92        const char *msg);
93       
94/* called from imc_buddy_msg() */
95int otr_send_message(struct im_connection *ic, const char *handle, const char *msg,
96        int flags);
97
98#else
99
[dc9797f]100typedef void otr_t;
[764c7d1]101typedef void *OtrlMessageAppOps;
102
103#define otr_init() {}
[dc9797f]104#define otr_new() (NULL)
105#define otr_free(otr) {}
[764c7d1]106#define otr_load(irc) {}
107#define otr_save(irc) {}
108#define otr_remove(nick) {}
109#define otr_rename(onick,nnick) {}
[59ab2af]110#define otr_check_for_key(acc) (0)
[0529a7f]111#define otr_handle_message(ic,handle,msg) (g_strdup(msg))
[764c7d1]112#define otr_send_message(ic,h,m,f) (ic->acc->prpl->buddy_msg(ic,h,m,f))
113
114void cmd_otr_nosupport(void *, char **);
115
116#endif
117#endif
Note: See TracBrowser for help on using the repository browser.