annotate libpurple/protocols/jabber/pep.h @ 27546:70dcaa0b6fea

Various fixes to get BOSH working with Prosody 0.5. Prosody closes the TCP socket immediately after every reply, so is an extremely good test of that corner case.
author Paul Aurich <paul@darkrain42.org>
date Wed, 15 Jul 2009 05:49:30 +0000
parents 3912f55a1633
children 8c991e09efcb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17834
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
1 /*
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
2 * purple - Jabber Protocol Plugin
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
3 *
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
4 * Copyright (C) 2007, Andreas Monitzer <andy@monitzer.com>
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
5 *
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
9 * (at your option) any later version.
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
10 *
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17845
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17841
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17834
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
14 * GNU General Public License for more details.
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
15 *
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
17845
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17841
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17834
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
19 *
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
20 */
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
21
26481
5767b7698c73 Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <paul@darkrain42.org>
parents: 23374
diff changeset
22 #ifndef PURPLE_JABBER_PEP_H_
5767b7698c73 Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <paul@darkrain42.org>
parents: 23374
diff changeset
23 #define PURPLE_JABBER_PEP_H_
17834
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
24
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
25 #include "jabber.h"
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
26 #include "message.h"
17841
df5bb342b10e implemented user mood, still missing the front end interface
Andreas Monitzer <pidgin@monitzer.com>
parents: 17839
diff changeset
27 #include "buddy.h"
17834
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
28
17839
0370da969e8a Implemented adding callbacks for PEP events. Moved the feature list to be application-global instead of per-connection (makes more sense).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17838
diff changeset
29 void jabber_pep_init(void);
25167
860ebaf275ae Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents: 25124
diff changeset
30 void jabber_pep_uninit(void);
17839
0370da969e8a Implemented adding callbacks for PEP events. Moved the feature list to be application-global instead of per-connection (makes more sense).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17838
diff changeset
31
17848
5fc8a8a25008 Implemented a mood menu action (non-functional right now for some reason)
Andreas Monitzer <pidgin@monitzer.com>
parents: 17845
diff changeset
32 void jabber_pep_init_actions(GList **m);
5fc8a8a25008 Implemented a mood menu action (non-functional right now for some reason)
Andreas Monitzer <pidgin@monitzer.com>
parents: 17845
diff changeset
33
17839
0370da969e8a Implemented adding callbacks for PEP events. Moved the feature list to be application-global instead of per-connection (makes more sense).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17838
diff changeset
34 /*
0370da969e8a Implemented adding callbacks for PEP events. Moved the feature list to be application-global instead of per-connection (makes more sense).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17838
diff changeset
35 * Callback for receiving PEP events.
0370da969e8a Implemented adding callbacks for PEP events. Moved the feature list to be application-global instead of per-connection (makes more sense).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17838
diff changeset
36 *
17845
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17841
diff changeset
37 * @parameter js The JabberStream this item was received on
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17841
diff changeset
38 * @parameter items The &lt;items/>-tag with the &lt;item/>-children
17839
0370da969e8a Implemented adding callbacks for PEP events. Moved the feature list to be application-global instead of per-connection (makes more sense).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17838
diff changeset
39 */
17841
df5bb342b10e implemented user mood, still missing the front end interface
Andreas Monitzer <pidgin@monitzer.com>
parents: 17839
diff changeset
40 typedef void (JabberPEPHandler)(JabberStream *js, const char *from, xmlnode *items);
17839
0370da969e8a Implemented adding callbacks for PEP events. Moved the feature list to be application-global instead of per-connection (makes more sense).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17838
diff changeset
41
0370da969e8a Implemented adding callbacks for PEP events. Moved the feature list to be application-global instead of per-connection (makes more sense).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17838
diff changeset
42 /*
0370da969e8a Implemented adding callbacks for PEP events. Moved the feature list to be application-global instead of per-connection (makes more sense).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17838
diff changeset
43 * Registers a callback for PEP events. Also automatically announces this receiving capability via disco#info.
0370da969e8a Implemented adding callbacks for PEP events. Moved the feature list to be application-global instead of per-connection (makes more sense).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17838
diff changeset
44 * Don't forget to use jabber_add_feature when supporting the sending of PEP events of this type.
0370da969e8a Implemented adding callbacks for PEP events. Moved the feature list to be application-global instead of per-connection (makes more sense).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17838
diff changeset
45 *
25017
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 17855
diff changeset
46 * @parameter xmlns The namespace for this event
17845
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17841
diff changeset
47 * @parameter handlerfunc The callback to be used when receiving an event with this namespace
17839
0370da969e8a Implemented adding callbacks for PEP events. Moved the feature list to be application-global instead of per-connection (makes more sense).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17838
diff changeset
48 */
25017
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 17855
diff changeset
49 void jabber_pep_register_handler(const char *xmlns, JabberPEPHandler handlerfunc);
17834
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
50
17853
7754d39d70c5 Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17848
diff changeset
51 /*
17854
5ab3c6bb95b4 Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17853
diff changeset
52 * Request a specific item from another PEP node.
5ab3c6bb95b4 Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17853
diff changeset
53 *
5ab3c6bb95b4 Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17853
diff changeset
54 * @parameter js The JabberStream that should be used
5ab3c6bb95b4 Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17853
diff changeset
55 * @parameter to The target PEP node
5ab3c6bb95b4 Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17853
diff changeset
56 * @parameter node The node name of the item that is requested
5ab3c6bb95b4 Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17853
diff changeset
57 * @parameter id The item id of the requested item (may be NULL)
5ab3c6bb95b4 Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17853
diff changeset
58 * @parameter cb The callback to be used when this item is received
5ab3c6bb95b4 Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17853
diff changeset
59 *
23374
85fc34efe733 Fix occurred to be spelled correctly. Thanks to bruce89 for noticing. Fixes #6096.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17855
diff changeset
60 * The items element passed to the callback will be NULL if any error occurred (like a permission error, node doesn't exist etc.)
17854
5ab3c6bb95b4 Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17853
diff changeset
61 */
5ab3c6bb95b4 Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17853
diff changeset
62 void jabber_pep_request_item(JabberStream *js, const char *to, const char *node, const char *id, JabberPEPHandler cb);
5ab3c6bb95b4 Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17853
diff changeset
63
5ab3c6bb95b4 Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17853
diff changeset
64 /*
17853
7754d39d70c5 Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17848
diff changeset
65 * Default callback that can be used for namespaces which should only be enabled when PEP is supported
7754d39d70c5 Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17848
diff changeset
66 *
25017
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 17855
diff changeset
67 * @parameter js The JabberStream struct for this connection
17853
7754d39d70c5 Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17848
diff changeset
68 * @parameter namespace The namespace that's queried, ignored.
7754d39d70c5 Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17848
diff changeset
69 *
7754d39d70c5 Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17848
diff changeset
70 * @returns TRUE when PEP is enabled, FALSE otherwise
7754d39d70c5 Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17848
diff changeset
71 */
25017
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 17855
diff changeset
72 gboolean jabber_pep_namespace_only_when_pep_enabled_cb(JabberStream *js, const gchar *namespace);
17853
7754d39d70c5 Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17848
diff changeset
73
17834
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
74 void jabber_handle_event(JabberMessage *jm);
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff changeset
75
26709
80437c891f92 Publish only 'new' xmlns of avatars and delete old.
Paul Aurich <paul@darkrain42.org>
parents: 26481
diff changeset
76 /**
80437c891f92 Publish only 'new' xmlns of avatars and delete old.
Paul Aurich <paul@darkrain42.org>
parents: 26481
diff changeset
77 * Delete the specified PEP node.
80437c891f92 Publish only 'new' xmlns of avatars and delete old.
Paul Aurich <paul@darkrain42.org>
parents: 26481
diff changeset
78 */
80437c891f92 Publish only 'new' xmlns of avatars and delete old.
Paul Aurich <paul@darkrain42.org>
parents: 26481
diff changeset
79 void jabber_pep_delete_node(JabberStream *js, const gchar *node);
80437c891f92 Publish only 'new' xmlns of avatars and delete old.
Paul Aurich <paul@darkrain42.org>
parents: 26481
diff changeset
80
17838
2f67cb504a51 Implemented publishing events
Andreas Monitzer <pidgin@monitzer.com>
parents: 17834
diff changeset
81 /*
2f67cb504a51 Implemented publishing events
Andreas Monitzer <pidgin@monitzer.com>
parents: 17834
diff changeset
82 * Publishes PEP item(s)
2f67cb504a51 Implemented publishing events
Andreas Monitzer <pidgin@monitzer.com>
parents: 17834
diff changeset
83 *
17845
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17841
diff changeset
84 * @parameter js The JabberStream associated with the connection this event should be published
2e0799b916b9 Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents: 17841
diff changeset
85 * @parameter publish The publish node. This could be for example &lt;publish node='http://jabber.org/protocol/tune'/> with an &lt;item/> as subnode
17838
2f67cb504a51 Implemented publishing events
Andreas Monitzer <pidgin@monitzer.com>
parents: 17834
diff changeset
86 */
2f67cb504a51 Implemented publishing events
Andreas Monitzer <pidgin@monitzer.com>
parents: 17834
diff changeset
87 void jabber_pep_publish(JabberStream *js, xmlnode *publish);
2f67cb504a51 Implemented publishing events
Andreas Monitzer <pidgin@monitzer.com>
parents: 17834
diff changeset
88
26481
5767b7698c73 Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <paul@darkrain42.org>
parents: 23374
diff changeset
89 #endif /* PURPLE_JABBER_PEP_H_ */