| [168] | 1 | /* |
|---|
| 2 | * purple - Jabber Protocol Plugin |
|---|
| 3 | * |
|---|
| 4 | * Copyright (C) 2007, Andreas Monitzer <andy@monitzer.com> |
|---|
| 5 | * |
|---|
| 6 | * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | * it under the terms of the GNU General Public License as published by |
|---|
| 8 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | * (at your option) any later version. |
|---|
| 10 | * |
|---|
| 11 | * This program is distributed in the hope that it will be useful, |
|---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | * GNU General Public License for more details. |
|---|
| 15 | * |
|---|
| 16 | * You should have received a copy of the GNU General Public License |
|---|
| 17 | * along with this program; if not, write to the Free Software |
|---|
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 19 | * |
|---|
| 20 | */ |
|---|
| 21 | |
|---|
| 22 | #ifndef _PURPLE_JABBER_PEP_H_ |
|---|
| 23 | #define _PURPLE_JABBER_PEP_H_ |
|---|
| 24 | |
|---|
| 25 | #include "jabber.h" |
|---|
| 26 | #include "message.h" |
|---|
| 27 | #include "buddy.h" |
|---|
| 28 | |
|---|
| 29 | void jabber_pep_init(void); |
|---|
| 30 | |
|---|
| 31 | void jabber_pep_init_actions(GList **m); |
|---|
| 32 | |
|---|
| 33 | /* |
|---|
| 34 | * Callback for receiving PEP events. |
|---|
| 35 | * |
|---|
| 36 | * @parameter js The JabberStream this item was received on |
|---|
| 37 | * @parameter items The <items/>-tag with the <item/>-children |
|---|
| 38 | */ |
|---|
| 39 | typedef void (JabberPEPHandler)(JabberStream *js, const char *from, xmlnode *items); |
|---|
| 40 | |
|---|
| 41 | /* |
|---|
| 42 | * Registers a callback for PEP events. Also automatically announces this receiving capability via disco#info. |
|---|
| 43 | * Don't forget to use jabber_add_feature when supporting the sending of PEP events of this type. |
|---|
| 44 | * |
|---|
| 45 | * @parameter shortname A short name for this feature for XEP-0115. It has no semantic meaning, it just has to be unique. |
|---|
| 46 | * @parameter xmlns The namespace for this event |
|---|
| 47 | * @parameter handlerfunc The callback to be used when receiving an event with this namespace |
|---|
| 48 | */ |
|---|
| 49 | void jabber_pep_register_handler(const char *shortname, const char *xmlns, JabberPEPHandler handlerfunc); |
|---|
| 50 | |
|---|
| 51 | /* |
|---|
| 52 | * Request a specific item from another PEP node. |
|---|
| 53 | * |
|---|
| 54 | * @parameter js The JabberStream that should be used |
|---|
| 55 | * @parameter to The target PEP node |
|---|
| 56 | * @parameter node The node name of the item that is requested |
|---|
| 57 | * @parameter id The item id of the requested item (may be NULL) |
|---|
| 58 | * @parameter cb The callback to be used when this item is received |
|---|
| 59 | * |
|---|
| 60 | * The items element passed to the callback will be NULL if any error occurred (like a permission error, node doesn't exist etc.) |
|---|
| 61 | */ |
|---|
| 62 | void jabber_pep_request_item(JabberStream *js, const char *to, const char *node, const char *id, JabberPEPHandler cb); |
|---|
| 63 | |
|---|
| 64 | /* |
|---|
| 65 | * Default callback that can be used for namespaces which should only be enabled when PEP is supported |
|---|
| 66 | * |
|---|
| 67 | * @parameter js The JabberStream struct for this connection |
|---|
| 68 | * @parameter shortname The namespace's shortname (for caps), ignored. |
|---|
| 69 | * @parameter namespace The namespace that's queried, ignored. |
|---|
| 70 | * |
|---|
| 71 | * @returns TRUE when PEP is enabled, FALSE otherwise |
|---|
| 72 | */ |
|---|
| 73 | gboolean jabber_pep_namespace_only_when_pep_enabled_cb(JabberStream *js, const gchar *shortname, const gchar *namespace); |
|---|
| 74 | |
|---|
| 75 | void jabber_handle_event(JabberMessage *jm); |
|---|
| 76 | |
|---|
| 77 | /* |
|---|
| 78 | * Publishes PEP item(s) |
|---|
| 79 | * |
|---|
| 80 | * @parameter js The JabberStream associated with the connection this event should be published |
|---|
| 81 | * @parameter publish The publish node. This could be for example <publish node='http://jabber.org/protocol/tune'/> with an <item/> as subnode |
|---|
| 82 | */ |
|---|
| 83 | void jabber_pep_publish(JabberStream *js, xmlnode *publish); |
|---|
| 84 | |
|---|
| 85 | #endif /* _PURPLE_JABBER_PEP_H_ */ |
|---|