libpurple/protocols/jabber/message.h

Wed, 21 Jan 2009 00:19:33 +0000

author
Paul Aurich <darkrain42@pidgin.im>
date
Wed, 21 Jan 2009 00:19:33 +0000
branch
cpw.darkrain42.xmpp.bosh
changeset 25488
acdb4dbab299
parent 24715
69aaae59e205
child 26072
e8fce2b2b9fe
permissions
-rw-r--r--

Don't track a cb-per-POST and remove the PurpleHTTPResponse structure.

The only callback ever used is http_received_cb and the ordering of
responses from the server is not guaranteed to match the order of our requests,
so the metaphor of matching them doesn't make sense. Instead of that, just
track the number of requests (to ensure there is always a request outstanding).

Additionally, pass the data const-ified instead of copying it. It's just
fed to an XML parser anyway.

UPDATE:

Tobias pointed out my explanation was flat-out wrong. The server's replies *do*
correspond to a specific request (HTTP pipelining). I believe what I meant to
say is that the XML in the replies isn't guaranteed to correspond to the
request's payload.

In any event, the critical point is that the callback is always the same, so
there's no need to store it per-request.

7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
1 /**
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
2 * @file message.h Message handlers
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
3 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15709
diff changeset
4 * purple
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
5 *
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
6 * Copyright (C) 2003 Nathan Walp <faceprint@faceprint.com>
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
7 *
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
11 * (at your option) any later version.
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
12 *
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
16 * GNU General Public License for more details.
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
17 *
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 15884
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
21 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15709
diff changeset
22 #ifndef _PURPLE_JABBER_MESSAGE_H_
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15709
diff changeset
23 #define _PURPLE_JABBER_MESSAGE_H_
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
24
15709
b58646e3ce63 Sending XEP 85 'gone' messages
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
25 #include "buddy.h"
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
26 #include "jabber.h"
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
27 #include "xmlnode.h"
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
28
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
29 typedef struct _JabberMessage {
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
30 JabberStream *js;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
31 enum {
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
32 JABBER_MESSAGE_NORMAL,
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
33 JABBER_MESSAGE_CHAT,
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
34 JABBER_MESSAGE_GROUPCHAT,
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
35 JABBER_MESSAGE_HEADLINE,
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
36 JABBER_MESSAGE_ERROR,
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
37 JABBER_MESSAGE_GROUPCHAT_INVITE,
17779
773326802e26 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents: 17768
diff changeset
38 JABBER_MESSAGE_EVENT,
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
39 JABBER_MESSAGE_OTHER
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
40 } type;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
41 time_t sent;
9584
1a6198375303 [gaim-migrate @ 10427]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8400
diff changeset
42 gboolean delayed;
17822
1a183f3fa9d7 disapproval of revision 'd52c12703a8e67c41c7f95a2cae7f16ab426ad76'
Andreas Monitzer <am@adiumx.com>
parents: 17821
diff changeset
43 gboolean hasBuzz;
13484
350fd422b021 [gaim-migrate @ 15859]
Sean Egan <seanegan@pidgin.im>
parents: 12216
diff changeset
44 char *id;
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
45 char *from;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
46 char *to;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
47 char *subject;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
48 char *body;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
49 char *xhtml;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
50 char *password;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
51 char *error;
8400
09cd5dba5ca4 [gaim-migrate @ 9129]
Nathan Walp <nwalp@pidgin.im>
parents: 7971
diff changeset
52 char *thread_id;
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
53 enum {
13708
37d5bc24e5bf [gaim-migrate @ 16110]
Nathan Walp <nwalp@pidgin.im>
parents: 13484
diff changeset
54 JM_TS_NONE = 0,
37d5bc24e5bf [gaim-migrate @ 16110]
Nathan Walp <nwalp@pidgin.im>
parents: 13484
diff changeset
55 JM_TS_JEP_0022 = 0x1,
37d5bc24e5bf [gaim-migrate @ 16110]
Nathan Walp <nwalp@pidgin.im>
parents: 13484
diff changeset
56 JM_TS_JEP_0085 = 0x2
37d5bc24e5bf [gaim-migrate @ 16110]
Nathan Walp <nwalp@pidgin.im>
parents: 13484
diff changeset
57 } typing_style;
37d5bc24e5bf [gaim-migrate @ 16110]
Nathan Walp <nwalp@pidgin.im>
parents: 13484
diff changeset
58 enum {
37d5bc24e5bf [gaim-migrate @ 16110]
Nathan Walp <nwalp@pidgin.im>
parents: 13484
diff changeset
59 JM_STATE_ACTIVE,
37d5bc24e5bf [gaim-migrate @ 16110]
Nathan Walp <nwalp@pidgin.im>
parents: 13484
diff changeset
60 JM_STATE_COMPOSING,
37d5bc24e5bf [gaim-migrate @ 16110]
Nathan Walp <nwalp@pidgin.im>
parents: 13484
diff changeset
61 JM_STATE_PAUSED,
37d5bc24e5bf [gaim-migrate @ 16110]
Nathan Walp <nwalp@pidgin.im>
parents: 13484
diff changeset
62 JM_STATE_INACTIVE,
37d5bc24e5bf [gaim-migrate @ 16110]
Nathan Walp <nwalp@pidgin.im>
parents: 13484
diff changeset
63 JM_STATE_GONE
37d5bc24e5bf [gaim-migrate @ 16110]
Nathan Walp <nwalp@pidgin.im>
parents: 13484
diff changeset
64 } chat_state;
7145
c77dd3b09666 [gaim-migrate @ 7712]
Nathan Walp <nwalp@pidgin.im>
parents: 7118
diff changeset
65 GList *etc;
17779
773326802e26 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents: 17768
diff changeset
66 GList *eventitems;
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
67 } JabberMessage;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
68
7971
a9309feca3c8 [gaim-migrate @ 8648]
Nathan Walp <nwalp@pidgin.im>
parents: 7145
diff changeset
69 void jabber_message_free(JabberMessage *jm);
a9309feca3c8 [gaim-migrate @ 8648]
Nathan Walp <nwalp@pidgin.im>
parents: 7145
diff changeset
70
a9309feca3c8 [gaim-migrate @ 8648]
Nathan Walp <nwalp@pidgin.im>
parents: 7145
diff changeset
71 void jabber_message_send(JabberMessage *jm);
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
72
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
73 void jabber_message_parse(JabberStream *js, xmlnode *packet);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15709
diff changeset
74 int jabber_message_send_im(PurpleConnection *gc, const char *who, const char *msg,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15709
diff changeset
75 PurpleMessageFlags flags);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15709
diff changeset
76 int jabber_message_send_chat(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags);
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
77
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15709
diff changeset
78 unsigned int jabber_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state);
15709
b58646e3ce63 Sending XEP 85 'gone' messages
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
79 void jabber_message_conv_closed(JabberStream *js, const char *who);
7971
a9309feca3c8 [gaim-migrate @ 8648]
Nathan Walp <nwalp@pidgin.im>
parents: 7145
diff changeset
80
23586
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 19897
diff changeset
81 gboolean jabber_buzz_isenabled(JabberStream *js, const gchar *namespace);
17824
52683dfc1f7d Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <am@adiumx.com>
parents: 17822
diff changeset
82
24715
69aaae59e205 Fix compilation errors and many warnings
Paul Aurich <darkrain42@pidgin.im>
parents: 24714
diff changeset
83 gboolean jabber_custom_smileys_isenabled(JabberStream *js, const const gchar *namespace);
23626
e21afec2f485 Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents: 19897
diff changeset
84
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15709
diff changeset
85 #endif /* _PURPLE_JABBER_MESSAGE_H_ */

mercurial