source: protocols/jabber/jabber.h @ 5e202b0

Last change on this file since 5e202b0 was 5e202b0, checked in by Wilmer van der Gaast <wilmer@…>, at 2006-09-23T16:18:24Z

Implemented a list of away states, using this for a better set_away(), and
got rid of the double <presence> tag sent because of presence_announce().

  • Property mode set to 100644
File size: 4.3 KB
Line 
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
32typedef enum
33{
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). */
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. */
39} jabber_flags_t;
40
41struct jabber_data
42{
43        struct gaim_connection *gc;
44       
45        int fd;
46        void *ssl;
47        char *txq;
48        int tx_len;
49        int r_inpa, w_inpa;
50       
51        struct xt_parser *xt;
52        jabber_flags_t flags;
53       
54        char *username;         /* USERNAME@server */
55        char *server;           /* username@SERVER -=> server/domain, not hostname */
56        struct jabber_away_state *away_state;
57        char *away_message;
58       
59        struct xt_node *node_cache;
60};
61
62struct jabber_away_state
63{
64        char code[5];
65        char *full_name;
66};
67
68/* iq.c */
69xt_status jabber_pkt_iq( struct xt_node *node, gpointer data );
70int jabber_start_iq_auth( struct gaim_connection *gc );
71int jabber_get_roster( struct gaim_connection *gc );
72
73xt_status jabber_pkt_message( struct xt_node *node, gpointer data );
74
75/* presence.c */
76xt_status jabber_pkt_presence( struct xt_node *node, gpointer data );
77int presence_send( struct gaim_connection *gc, char *to, char *show, char *status );
78
79/* jabber_util.c */
80char *set_eval_resprio( set_t *set, char *value );
81char *set_eval_tls( set_t *set, char *value );
82struct xt_node *jabber_make_packet( char *name, char *type, char *to, struct xt_node *children );
83void jabber_cache_packet( struct gaim_connection *gc, struct xt_node *node );
84struct xt_node *jabber_packet_from_cache( struct gaim_connection *gc, char *id );
85const struct jabber_away_state *jabber_away_state_by_code( char *code );
86const struct jabber_away_state *jabber_away_state_by_name( char *name );
87
88extern const struct jabber_away_state jabber_away_state_list[];
89
90/* io.c */
91int jabber_write_packet( struct gaim_connection *gc, struct xt_node *node );
92int jabber_write( struct gaim_connection *gc, char *buf, int len );
93gboolean jabber_connected_plain( gpointer data, gint source, b_input_condition cond );
94gboolean jabber_start_stream( struct gaim_connection *gc );
95void jabber_end_stream( struct gaim_connection *gc );
96
97/* sasl.c */
98xt_status sasl_pkt_mechanisms( struct xt_node *node, gpointer data );
99xt_status sasl_pkt_challenge( struct xt_node *node, gpointer data );
100xt_status sasl_pkt_result( struct xt_node *node, gpointer data );
101gboolean sasl_supported( struct gaim_connection *gc );
102
103#endif
Note: See TracBrowser for help on using the repository browser.