Fix crashes when filenames end up being NULL in some prpls.
[pidgin-git.git] / libpurple / protocols / bonjour / jabber.h
blobb92f7f654ff1b51857f431f2883d9eaacfdcbebe
1 /**
2 * @file jabber.h The Purple interface to mDNS and peer to peer Jabber.
4 * purple
6 * Purple is the legal property of its developers, whose names are too numerous
7 * to list here. Please refer to the COPYRIGHT file distributed with this
8 * source distribution.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26 #ifndef _BONJOUR_JABBER_H_
27 #define _BONJOUR_JABBER_H_
29 #include <libxml/parser.h>
31 #include "xmlnode.h"
33 #include "account.h"
34 #include "circbuffer.h"
36 typedef struct _BonjourJabber
38 gint port;
39 gint socket;
40 gint watcher_id;
41 PurpleAccount *account;
42 GSList *pending_conversations;
43 } BonjourJabber;
45 typedef struct _BonjourJabberConversation
47 gint socket;
48 guint rx_handler;
49 guint tx_handler;
50 guint close_timeout;
51 PurpleCircBuffer *tx_buf;
52 int sent_stream_start; /* 0 = Unsent, 1 = Partial, 2 = Complete */
53 gboolean recv_stream_start;
54 PurpleProxyConnectData *connect_data;
55 gpointer stream_data;
56 xmlParserCtxt *context;
57 xmlnode *current;
58 PurpleBuddy *pb;
59 PurpleAccount *account;
61 /* The following are only needed before attaching to a PurpleBuddy */
62 gchar *buddy_name;
63 gchar *ip;
64 } BonjourJabberConversation;
66 /**
67 * Start listening for jabber connections.
69 * @return -1 if there was a problem, else returns the listening
70 * port number.
72 gint bonjour_jabber_start(BonjourJabber *data);
74 int bonjour_jabber_send_message(BonjourJabber *data, const char *to, const char *body);
76 void bonjour_jabber_close_conversation(BonjourJabberConversation *bconv);
78 void async_bonjour_jabber_close_conversation(BonjourJabberConversation *bconv);
80 void bonjour_jabber_stream_started(BonjourJabberConversation *bconv);
82 void bonjour_jabber_process_packet(PurpleBuddy *pb, xmlnode *packet);
84 void bonjour_jabber_stop(BonjourJabber *data);
86 void bonjour_jabber_conv_match_by_ip(BonjourJabberConversation *bconv);
88 void bonjour_jabber_conv_match_by_name(BonjourJabberConversation *bconv);
90 typedef enum {
91 XEP_IQ_SET,
92 XEP_IQ_GET,
93 XEP_IQ_RESULT,
94 XEP_IQ_ERROR,
95 XEP_IQ_NONE
96 } XepIqType;
98 typedef struct _XepIq {
99 XepIqType type;
100 char *id;
101 xmlnode *node;
102 char *to;
103 void *data;
104 } XepIq;
106 XepIq *xep_iq_new(void *data, XepIqType type, const char *to, const char *from, const char *id);
107 int xep_iq_send_and_free(XepIq *iq);
108 const char *purple_network_get_my_ip_ext2(int fd);
110 #endif /* _BONJOUR_JABBER_H_ */