source: protocols/jabber/jabber.h @ 995913b

Last change on this file since 995913b was 995913b, checked in by Wilmer van der Gaast <wilmer@…>, at 2006-10-02T17:46:57Z

Added some error handling for the (not very complete yet) privacy list code.

  • Property mode set to 100644
File size: 5.2 KB
RevLine 
[f06894d]1/***************************************************************************\
2*                                                                           *
3*  BitlBee - An IRC to IM gateway                                           *
4*  Jabber module - Main file                                                *
5*                                                                           *
6*  Copyright 2006 Wilmer van der Gaast <wilmer@gaast.net>                   *
7*                                                                           *
8*  This program is free software; you can redistribute it and/or modify     *
9*  it under the terms of the GNU General Public License as published by     *
10*  the Free Software Foundation; either version 2 of the License, or        *
11*  (at your option) any later version.                                      *
12*                                                                           *
13*  This program is distributed in the hope that it will be useful,          *
14*  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
15*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *
16*  GNU General Public License for more details.                             *
17*                                                                           *
18*  You should have received a copy of the GNU General Public License along  *
19*  with this program; if not, write to the Free Software Foundation, Inc.,  *
20*  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.              *
21*                                                                           *
22\***************************************************************************/
23
24#ifndef _JABBER_H
25#define _JABBER_H
26
27#include <glib.h>
28
29#include "xmltree.h"
30#include "bitlbee.h"
31
[21167d2]32typedef enum
33{
[5997488]34        JFLAG_STREAM_STARTED = 1,       /* Set when we detected the beginning of the stream and want to do auth. */
35        JFLAG_AUTHENTICATED = 2,        /* Set when we're successfully authenticatd. */
36        JFLAG_STREAM_RESTART = 4,       /* Set when we want to restart the stream (after SASL or TLS). */
[fe7a554]37        JFLAG_WAIT_SESSION = 8,         /* Set if we sent a <session> tag and need a reply before we continue. */
38        JFLAG_WAIT_BIND = 16,           /* ... for <bind> tag. */
[995913b]39        JFLAG_PRIVACY_BROKEN = 32,      /* Or just not supported, actually. */
[21167d2]40} jabber_flags_t;
41
[5e202b0]42struct jabber_data
43{
44        struct gaim_connection *gc;
45       
46        int fd;
47        void *ssl;
48        char *txq;
49        int tx_len;
50        int r_inpa, w_inpa;
51       
52        struct xt_parser *xt;
53        jabber_flags_t flags;
54       
55        char *username;         /* USERNAME@server */
56        char *server;           /* username@SERVER -=> server/domain, not hostname */
[172a73f1]57       
58        /* After changing one of these two (or the priority setting), call
59           presence_send_update() to inform the server about the changes. */
[5e202b0]60        struct jabber_away_state *away_state;
61        char *away_message;
62       
[6baca2a]63        /* Updates to this one should be synchronized using jabber_privacy_update(). */
64        struct xt_node *privacy_list;
65        char *privacy_active;
66       
[5e202b0]67        struct xt_node *node_cache;
68};
69
70struct jabber_away_state
71{
72        char code[5];
73        char *full_name;
74};
75
[6baca2a]76#define DEFAULT_PRIVACY_LIST "simple_blocklist"
77
[21167d2]78/* iq.c */
[f06894d]79xt_status jabber_pkt_iq( struct xt_node *node, gpointer data );
[8d74291]80int jabber_start_iq_auth( struct gaim_connection *gc );
[70f6aab8]81int jabber_get_roster( struct gaim_connection *gc );
[cfbb3a6]82int jabber_add_to_roster( struct gaim_connection *gc, char *handle, char *name );
83int jabber_remove_from_roster( struct gaim_connection *gc, char *handle );
[6baca2a]84int jabber_get_privacy( struct gaim_connection *gc );
85int jabber_set_privacy( struct gaim_connection *gc, char *name );
[995913b]86char *set_eval_privacy_list( set_t *set, char *value );
[21167d2]87
[cfbb3a6]88/* message.c */
[f06894d]89xt_status jabber_pkt_message( struct xt_node *node, gpointer data );
[0b4a0db]90
91/* presence.c */
[f06894d]92xt_status jabber_pkt_presence( struct xt_node *node, gpointer data );
[172a73f1]93int presence_send_update( struct gaim_connection *gc );
[cfbb3a6]94int presence_send_request( struct gaim_connection *gc, char *handle, char *request );
[f06894d]95
[21167d2]96/* jabber_util.c */
[ebe7b36]97char *set_eval_priority( set_t *set, char *value );
[f06894d]98char *set_eval_tls( set_t *set, char *value );
[21167d2]99struct xt_node *jabber_make_packet( char *name, char *type, char *to, struct xt_node *children );
[fe7a554]100void jabber_cache_packet( struct gaim_connection *gc, struct xt_node *node );
101struct xt_node *jabber_packet_from_cache( struct gaim_connection *gc, char *id );
[5e202b0]102const struct jabber_away_state *jabber_away_state_by_code( char *code );
103const struct jabber_away_state *jabber_away_state_by_name( char *name );
[8e5e2e9]104void jabber_buddy_ask( struct gaim_connection *gc, char *handle );
[5e202b0]105
106extern const struct jabber_away_state jabber_away_state_list[];
[21167d2]107
108/* io.c */
109int jabber_write_packet( struct gaim_connection *gc, struct xt_node *node );
110int jabber_write( struct gaim_connection *gc, char *buf, int len );
111gboolean jabber_connected_plain( gpointer data, gint source, b_input_condition cond );
[42127dc]112gboolean jabber_connected_ssl( gpointer data, void *source, b_input_condition cond );
[4a0614e]113gboolean jabber_start_stream( struct gaim_connection *gc );
[5bcf70a]114void jabber_end_stream( struct gaim_connection *gc );
[21167d2]115
[5997488]116/* sasl.c */
117xt_status sasl_pkt_mechanisms( struct xt_node *node, gpointer data );
118xt_status sasl_pkt_challenge( struct xt_node *node, gpointer data );
119xt_status sasl_pkt_result( struct xt_node *node, gpointer data );
[8d74291]120gboolean sasl_supported( struct gaim_connection *gc );
[5997488]121
[f06894d]122#endif
Note: See TracBrowser for help on using the repository browser.