1 /*
2  * stanza.h
3  *
4  * Copyright (C) 2012 - 2019 James Booth <boothj5@gmail.com>
5  * Copyright (C) 2019 - 2021 Michael Vetter <jubalh@iodoru.org>
6  *
7  * This file is part of Profanity.
8  *
9  * Profanity is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * Profanity is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with Profanity.  If not, see <https://www.gnu.org/licenses/>.
21  *
22  * In addition, as a special exception, the copyright holders give permission to
23  * link the code of portions of this program with the OpenSSL library under
24  * certain conditions as described in each individual source file, and
25  * distribute linked combinations including the two.
26  *
27  * You must obey the GNU General Public License in all respects for all of the
28  * code used other than OpenSSL. If you modify file(s) with this exception, you
29  * may extend this exception to your version of the file(s), but you are not
30  * obligated to do so. If you do not wish to do so, delete this exception
31  * statement from your version. If you delete this exception statement from all
32  * source files in the program, then also delete it here.
33  *
34  */
35 
36 #ifndef XMPP_STANZA_H
37 #define XMPP_STANZA_H
38 
39 #include "config.h"
40 
41 #ifdef HAVE_LIBMESODE
42 #include <mesode.h>
43 #endif
44 
45 #ifdef HAVE_LIBSTROPHE
46 #include <strophe.h>
47 #endif
48 
49 #include <xmpp/xmpp.h>
50 
51 #define STANZA_NAME_ACTIVE    "active"
52 #define STANZA_NAME_INACTIVE  "inactive"
53 #define STANZA_NAME_COMPOSING "composing"
54 #define STANZA_NAME_PAUSED    "paused"
55 #define STANZA_NAME_GONE      "gone"
56 
57 #define STANZA_NAME_MESSAGE   "message"
58 #define STANZA_NAME_BODY      "body"
59 #define STANZA_NAME_BLOCK     "block"
60 #define STANZA_NAME_UNBLOCK   "unblock"
61 #define STANZA_NAME_BLOCKLIST "blocklist"
62 #define STANZA_NAME_PRESENCE  "presence"
63 #define STANZA_NAME_PRIORITY  "priority"
64 #define STANZA_NAME_X         "x"
65 // XEP-0373: OpenPGP for XMPP
66 #define STANZA_NAME_OPENPGP          "openpgp"
67 #define STANZA_NAME_PUPKEY           "pubkey"
68 #define STANZA_NAME_PUBLIC_KEYS_LIST "public-keys-list"
69 #define STANZA_NAME_PUBKEY_METADATA  "pubkey-metadata"
70 #define STANZA_NAME_DATA             "data"
71 #define STANZA_NAME_SHOW             "show"
72 #define STANZA_NAME_STATUS           "status"
73 #define STANZA_NAME_IQ               "iq"
74 #define STANZA_NAME_QUERY            "query"
75 #define STANZA_NAME_REQUEST          "request"
76 #define STANZA_NAME_DELAY            "delay"
77 #define STANZA_NAME_ERROR            "error"
78 #define STANZA_NAME_PING             "ping"
79 #define STANZA_NAME_TEXT             "text"
80 #define STANZA_NAME_SUBJECT          "subject"
81 #define STANZA_NAME_ITEM             "item"
82 #define STANZA_NAME_ITEMS            "items"
83 #define STANZA_NAME_C                "c"
84 #define STANZA_NAME_IDENTITY         "identity"
85 #define STANZA_NAME_FEATURE          "feature"
86 #define STANZA_NAME_INVITE           "invite"
87 #define STANZA_NAME_REASON           "reason"
88 #define STANZA_NAME_GROUP            "group"
89 #define STANZA_NAME_PUBSUB           "pubsub"
90 #define STANZA_NAME_PUBLISH          "publish"
91 #define STANZA_NAME_PUBLISH_OPTIONS  "publish-options"
92 #define STANZA_NAME_SUBSCRIBE        "subscribe"
93 #define STANZA_NAME_FIELD            "field"
94 #define STANZA_NAME_STORAGE          "storage"
95 #define STANZA_NAME_NICK             "nick"
96 #define STANZA_NAME_PASSWORD         "password"
97 #define STANZA_NAME_CONFERENCE       "conference"
98 #define STANZA_NAME_VALUE            "value"
99 #define STANZA_NAME_DESTROY          "destroy"
100 #define STANZA_NAME_ACTOR            "actor"
101 #define STANZA_NAME_ENABLE           "enable"
102 #define STANZA_NAME_DISABLE          "disable"
103 #define STANZA_NAME_FILENAME         "filename"
104 #define STANZA_NAME_SIZE             "size"
105 #define STANZA_NAME_CONTENT_TYPE     "content-type"
106 #define STANZA_NAME_SLOT             "slot"
107 #define STANZA_NAME_PUT              "put"
108 #define STANZA_NAME_GET              "get"
109 #define STANZA_NAME_HEADER           "header"
110 #define STANZA_HEADER_AUTHORIZATION  "Authorization"
111 #define STANZA_HEADER_COOKIE         "Cookie"
112 #define STANZA_HEADER_EXPIRES        "Expires"
113 #define STANZA_NAME_URL              "url"
114 #define STANZA_NAME_COMMAND          "command"
115 #define STANZA_NAME_CONFIGURE        "configure"
116 #define STANZA_NAME_ORIGIN_ID        "origin-id"
117 #define STANZA_NAME_STANZA_ID        "stanza-id"
118 #define STANZA_NAME_RESULT           "result"
119 #define STANZA_NAME_MINIMIZE         "minimize"
120 #define STANZA_NAME_FIN              "fin"
121 #define STANZA_NAME_LAST             "last"
122 #define STANZA_NAME_AFTER            "after"
123 #define STANZA_NAME_USERNAME         "username"
124 #define STANZA_NAME_PROPOSE          "propose"
125 #define STANZA_NAME_REPORT           "report"
126 
127 // error conditions
128 #define STANZA_NAME_BAD_REQUEST             "bad-request"
129 #define STANZA_NAME_CONFLICT                "conflict"
130 #define STANZA_NAME_FEATURE_NOT_IMPLEMENTED "feature-not-implemented"
131 #define STANZA_NAME_FORBIDDEN               "forbidden"
132 #define STANZA_NAME_GONE                    "gone"
133 #define STANZA_NAME_INTERNAL_SERVER_ERROR   "internal-server-error"
134 #define STANZA_NAME_ITEM_NOT_FOUND          "item-not-found"
135 #define STANZA_NAME_JID_MALFORMED           "jid-malformed"
136 #define STANZA_NAME_NOT_ACCEPTABLE          "not-acceptable"
137 #define STANZA_NAME_NOT_ALLOWED             "not-allowed"
138 #define STANZA_NAME_NOT_AUTHORISED          "not-authorised"
139 #define STANZA_NAME_POLICY_VIOLATION        "policy-violation"
140 #define STANZA_NAME_RECIPIENT_UNAVAILABLE   "recipient-unavailable"
141 #define STANZA_NAME_REDIRECT                "redirect"
142 #define STANZA_NAME_REGISTRATION_REQUIRED   "registration-required"
143 #define STANZA_NAME_REMOTE_SERVER_NOT_FOUND "remote-server-not-found"
144 #define STANZA_NAME_REMOTE_SERVER_TIMEOUT   "remote-server-timeout"
145 #define STANZA_NAME_RESOURCE_CONSTRAINT     "resource-constraint"
146 #define STANZA_NAME_SERVICE_UNAVAILABLE     "service-unavailable"
147 #define STANZA_NAME_SUBSCRIPTION_REQUIRED   "subscription-required"
148 #define STANZA_NAME_UNDEFINED_CONDITION     "undefined-condition"
149 #define STANZA_NAME_UNEXPECTED_REQUEST      "unexpected-request"
150 
151 #define STANZA_TYPE_CHAT         "chat"
152 #define STANZA_TYPE_GROUPCHAT    "groupchat"
153 #define STANZA_TYPE_HEADLINE     "headline"
154 #define STANZA_TYPE_NORMAL       "normal"
155 #define STANZA_TYPE_UNAVAILABLE  "unavailable"
156 #define STANZA_TYPE_SUBSCRIBE    "subscribe"
157 #define STANZA_TYPE_SUBSCRIBED   "subscribed"
158 #define STANZA_TYPE_UNSUBSCRIBED "unsubscribed"
159 #define STANZA_TYPE_GET          "get"
160 #define STANZA_TYPE_SET          "set"
161 #define STANZA_TYPE_ERROR        "error"
162 #define STANZA_TYPE_RESULT       "result"
163 #define STANZA_TYPE_SUBMIT       "submit"
164 #define STANZA_TYPE_CANCEL       "cancel"
165 #define STANZA_TYPE_MODIFY       "modify"
166 #define STANZA_TYPE_LIST_MULTI   "list-multi"
167 
168 #define STANZA_ATTR_TO             "to"
169 #define STANZA_ATTR_FROM           "from"
170 #define STANZA_ATTR_STAMP          "stamp"
171 #define STANZA_ATTR_TYPE           "type"
172 #define STANZA_ATTR_CODE           "code"
173 #define STANZA_ATTR_JID            "jid"
174 #define STANZA_ATTR_NAME           "name"
175 #define STANZA_ATTR_SUBSCRIPTION   "subscription"
176 #define STANZA_ATTR_XMLNS          "xmlns"
177 #define STANZA_ATTR_NICK           "nick"
178 #define STANZA_ATTR_ASK            "ask"
179 #define STANZA_ATTR_ID             "id"
180 #define STANZA_ATTR_SECONDS        "seconds"
181 #define STANZA_ATTR_NODE           "node"
182 #define STANZA_ATTR_VER            "ver"
183 #define STANZA_ATTR_VAR            "var"
184 #define STANZA_ATTR_HASH           "hash"
185 #define STANZA_ATTR_CATEGORY       "category"
186 #define STANZA_ATTR_REASON         "reason"
187 #define STANZA_ATTR_AUTOJOIN       "autojoin"
188 #define STANZA_ATTR_PASSWORD       "password"
189 #define STANZA_ATTR_STATUS         "status"
190 #define STANZA_ATTR_DATE           "date"
191 #define STANZA_ATTR_V4_FINGERPRINT "v4-fingerprint"
192 #define STANZA_ATTR_FILENAME       "filename"
193 #define STANZA_ATTR_SIZE           "size"
194 #define STANZA_ATTR_CONTENTTYPE    "content-type"
195 #define STANZA_ATTR_LABEL          "label"
196 
197 #define STANZA_TEXT_AWAY   "away"
198 #define STANZA_TEXT_DND    "dnd"
199 #define STANZA_TEXT_CHAT   "chat"
200 #define STANZA_TEXT_XA     "xa"
201 #define STANZA_TEXT_ONLINE "online"
202 
203 #define STANZA_NS_STANZAS      "urn:ietf:params:xml:ns:xmpp-stanzas"
204 #define STANZA_NS_CHATSTATES   "http://jabber.org/protocol/chatstates"
205 #define STANZA_NS_MUC          "http://jabber.org/protocol/muc"
206 #define STANZA_NS_MUC_USER     "http://jabber.org/protocol/muc#user"
207 #define STANZA_NS_MUC_OWNER    "http://jabber.org/protocol/muc#owner"
208 #define STANZA_NS_MUC_ADMIN    "http://jabber.org/protocol/muc#admin"
209 #define STANZA_NS_CAPS         "http://jabber.org/protocol/caps"
210 #define STANZA_NS_PING         "urn:xmpp:ping"
211 #define STANZA_NS_LASTACTIVITY "jabber:iq:last"
212 #define STANZA_NS_DATA         "jabber:x:data"
213 #define STANZA_NS_VERSION      "jabber:iq:version"
214 #define STANZA_NS_CONFERENCE   "jabber:x:conference"
215 #define STANZA_NS_CAPTCHA      "urn:xmpp:captcha"
216 #define STANZA_NS_PUBSUB       "http://jabber.org/protocol/pubsub"
217 #define STANZA_NS_PUBSUB_OWNER "http://jabber.org/protocol/pubsub#owner"
218 #define STANZA_NS_PUBSUB_EVENT "http://jabber.org/protocol/pubsub#event"
219 #define STANZA_NS_PUBSUB_ERROR "http://jabber.org/protocol/pubsub#errors"
220 #define STANZA_NS_CARBONS      "urn:xmpp:carbons:2"
221 #define STANZA_NS_HINTS        "urn:xmpp:hints"
222 #define STANZA_NS_FORWARD      "urn:xmpp:forward:0"
223 #define STANZA_NS_RECEIPTS     "urn:xmpp:receipts"
224 #define STANZA_NS_SIGNED       "jabber:x:signed"
225 #define STANZA_NS_ENCRYPTED    "jabber:x:encrypted"
226 // XEP-0373: OpenPGP for XMPP
227 #define STANZA_NS_OPENPGP_0               "urn:xmpp:openpgp:0"
228 #define STANZA_NS_OPENPGP_0_PUBLIC_KEYS   "urn:xmpp:openpgp:0:public-keys"
229 #define STANZA_NS_HTTP_UPLOAD             "urn:xmpp:http:upload:0"
230 #define STANZA_NS_X_OOB                   "jabber:x:oob"
231 #define STANZA_NS_BLOCKING                "urn:xmpp:blocking"
232 #define STANZA_NS_COMMAND                 "http://jabber.org/protocol/commands"
233 #define STANZA_NS_OMEMO                   "eu.siacs.conversations.axolotl"
234 #define STANZA_NS_OMEMO_DEVICELIST        "eu.siacs.conversations.axolotl.devicelist"
235 #define STANZA_NS_OMEMO_BUNDLES           "eu.siacs.conversations.axolotl.bundles"
236 #define STANZA_NS_STABLE_ID               "urn:xmpp:sid:0"
237 #define STANZA_NS_USER_AVATAR_DATA        "urn:xmpp:avatar:data"
238 #define STANZA_NS_USER_AVATAR_METADATA    "urn:xmpp:avatar:metadata"
239 #define STANZA_NS_LAST_MESSAGE_CORRECTION "urn:xmpp:message-correct:0"
240 #define STANZA_NS_MAM2                    "urn:xmpp:mam:2"
241 #define STANZA_NS_EXT_GAJIM_BOOKMARKS     "xmpp:gajim.org/bookmarks"
242 #define STANZA_NS_RSM                     "http://jabber.org/protocol/rsm"
243 #define STANZA_NS_REGISTER                "jabber:iq:register"
244 #define STANZA_NS_VOICEREQUEST            "http://jabber.org/protocol/muc#request"
245 #define STANZA_NS_JINGLE_MESSAGE          "urn:xmpp:jingle-message:0"
246 #define STANZA_NS_JINGLE_RTP              "urn:xmpp:jingle:apps:rtp:1"
247 #define STANZA_NS_REPORTING               "urn:xmpp:reporting:1"
248 
249 #define STANZA_DATAFORM_SOFTWARE "urn:xmpp:dataforms:softwareinfo"
250 
251 #define STANZA_REPORTING_ABUSE "urn:xmpp:reporting:abuse"
252 #define STANZA_REPORTING_SPAM  "urn:xmpp:reporting:spam"
253 
254 typedef struct caps_stanza_t
255 {
256     char* hash;
257     char* node;
258     char* ver;
259 } XMPPCaps;
260 
261 typedef struct presence_stanza_t
262 {
263     Jid* jid;
264     char* show;
265     char* status;
266     int priority;
267     GDateTime* last_activity;
268 } XMPPPresence;
269 
270 typedef enum {
271     STANZA_PARSE_ERROR_NO_FROM,
272     STANZA_PARSE_ERROR_INVALID_FROM
273 } stanza_parse_error_t;
274 
275 xmpp_stanza_t* stanza_create_bookmarks_storage_request(xmpp_ctx_t* ctx);
276 
277 xmpp_stanza_t* stanza_create_blocked_list_request(xmpp_ctx_t* ctx);
278 
279 xmpp_stanza_t* stanza_create_http_upload_request(xmpp_ctx_t* ctx, const char* const id, const char* const jid, HTTPUpload* upload);
280 
281 xmpp_stanza_t* stanza_enable_carbons(xmpp_ctx_t* ctx);
282 
283 xmpp_stanza_t* stanza_disable_carbons(xmpp_ctx_t* ctx);
284 
285 xmpp_stanza_t* stanza_create_chat_state(xmpp_ctx_t* ctx,
286                                         const char* const fulljid, const char* const state);
287 
288 xmpp_stanza_t* stanza_attach_state(xmpp_ctx_t* ctx, xmpp_stanza_t* stanza, const char* const state);
289 xmpp_stanza_t* stanza_attach_carbons_private(xmpp_ctx_t* ctx, xmpp_stanza_t* stanza);
290 xmpp_stanza_t* stanza_attach_hints_no_copy(xmpp_ctx_t* ctx, xmpp_stanza_t* stanza);
291 xmpp_stanza_t* stanza_attach_hints_no_store(xmpp_ctx_t* ctx, xmpp_stanza_t* stanza);
292 xmpp_stanza_t* stanza_attach_hints_store(xmpp_ctx_t* ctx, xmpp_stanza_t* stanza);
293 xmpp_stanza_t* stanza_attach_receipt_request(xmpp_ctx_t* ctx, xmpp_stanza_t* stanza);
294 xmpp_stanza_t* stanza_attach_x_oob_url(xmpp_ctx_t* ctx, xmpp_stanza_t* stanza, const char* const url);
295 xmpp_stanza_t* stanza_attach_origin_id(xmpp_ctx_t* ctx, xmpp_stanza_t* stanza, const char* const id);
296 xmpp_stanza_t* stanza_attach_correction(xmpp_ctx_t* ctx, xmpp_stanza_t* stanza, const char* const replace_id);
297 
298 xmpp_stanza_t* stanza_create_room_join_presence(xmpp_ctx_t* const ctx,
299                                                 const char* const full_room_jid, const char* const passwd);
300 
301 xmpp_stanza_t* stanza_create_room_newnick_presence(xmpp_ctx_t* ctx,
302                                                    const char* const full_room_jid);
303 
304 xmpp_stanza_t* stanza_create_room_leave_presence(xmpp_ctx_t* ctx,
305                                                  const char* const room, const char* const nick);
306 
307 xmpp_stanza_t* stanza_create_roster_iq(xmpp_ctx_t* ctx);
308 xmpp_stanza_t* stanza_create_ping_iq(xmpp_ctx_t* ctx, const char* const target);
309 xmpp_stanza_t* stanza_create_disco_info_iq(xmpp_ctx_t* ctx, const char* const id,
310                                            const char* const to, const char* const node);
311 
312 xmpp_stanza_t* stanza_create_last_activity_iq(xmpp_ctx_t* ctx, const char* const id,
313                                               const char* const to);
314 
315 xmpp_stanza_t* stanza_create_invite(xmpp_ctx_t* ctx, const char* const room,
316                                     const char* const contact, const char* const reason, const char* const password);
317 xmpp_stanza_t* stanza_create_mediated_invite(xmpp_ctx_t* ctx, const char* const room,
318                                              const char* const contact, const char* const reason);
319 
320 gboolean stanza_contains_chat_state(xmpp_stanza_t* stanza);
321 
322 GDateTime* stanza_get_delay(xmpp_stanza_t* const stanza);
323 GDateTime* stanza_get_delay_from(xmpp_stanza_t* const stanza, gchar* from);
324 GDateTime* stanza_get_oldest_delay(xmpp_stanza_t* const stanza);
325 
326 gboolean stanza_is_muc_presence(xmpp_stanza_t* const stanza);
327 gboolean stanza_is_muc_self_presence(xmpp_stanza_t* const stanza,
328                                      const char* const self_jid);
329 gboolean stanza_is_room_nick_change(xmpp_stanza_t* const stanza);
330 gboolean stanza_muc_requires_config(xmpp_stanza_t* const stanza);
331 
332 const char* stanza_get_new_nick(xmpp_stanza_t* const stanza);
333 xmpp_stanza_t* stanza_create_instant_room_request_iq(xmpp_ctx_t* ctx, const char* const room_jid);
334 xmpp_stanza_t* stanza_create_instant_room_destroy_iq(xmpp_ctx_t* ctx, const char* const room_jid);
335 xmpp_stanza_t* stanza_create_room_config_request_iq(xmpp_ctx_t* ctx, const char* const room_jid);
336 xmpp_stanza_t* stanza_create_room_config_cancel_iq(xmpp_ctx_t* ctx, const char* const room_jid);
337 xmpp_stanza_t* stanza_create_room_config_submit_iq(xmpp_ctx_t* ctx, const char* const room, DataForm* form);
338 xmpp_stanza_t* stanza_create_room_affiliation_list_iq(xmpp_ctx_t* ctx, const char* const room,
339                                                       const char* const affiliation);
340 xmpp_stanza_t* stanza_create_room_affiliation_set_iq(xmpp_ctx_t* ctx, const char* const room, const char* const jid,
341                                                      const char* const affiliation, const char* const reason);
342 xmpp_stanza_t* stanza_create_room_role_set_iq(xmpp_ctx_t* const ctx, const char* const room, const char* const jid,
343                                               const char* const role, const char* const reason);
344 xmpp_stanza_t* stanza_create_room_role_list_iq(xmpp_ctx_t* ctx, const char* const room, const char* const role);
345 
346 xmpp_stanza_t* stanza_create_room_subject_message(xmpp_ctx_t* ctx, const char* const room, const char* const subject);
347 xmpp_stanza_t* stanza_create_room_kick_iq(xmpp_ctx_t* const ctx, const char* const room, const char* const nick,
348                                           const char* const reason);
349 
350 xmpp_stanza_t* stanza_create_command_exec_iq(xmpp_ctx_t* ctx, const char* const target, const char* const node);
351 xmpp_stanza_t* stanza_create_command_config_submit_iq(xmpp_ctx_t* ctx, const char* const room, const char* const node, const char* const sessionid, DataForm* form);
352 
353 void stanza_attach_publish_options_va(xmpp_ctx_t* const ctx, xmpp_stanza_t* const iq, int count, ...);
354 void stanza_attach_publish_options(xmpp_ctx_t* const ctx, xmpp_stanza_t* const iq, const char* const option, const char* const value);
355 
356 xmpp_stanza_t* stanza_create_omemo_devicelist_request(xmpp_ctx_t* ctx, const char* const id, const char* const jid);
357 xmpp_stanza_t* stanza_create_omemo_devicelist_subscribe(xmpp_ctx_t* ctx, const char* const jid);
358 xmpp_stanza_t* stanza_create_omemo_devicelist_publish(xmpp_ctx_t* ctx, GList* const ids);
359 xmpp_stanza_t* stanza_create_omemo_bundle_publish(xmpp_ctx_t* ctx, const char* const id, uint32_t device_id, const unsigned char* const identity_key, size_t identity_key_length, const unsigned char* const signed_prekey, size_t signed_prekey_length, const unsigned char* const signed_prekey_signature, size_t signed_prekey_signature_length, GList* const prekeys, GList* const prekeys_id, GList* const prekeys_length);
360 xmpp_stanza_t* stanza_create_omemo_bundle_request(xmpp_ctx_t* ctx, const char* const id, const char* const jid, uint32_t device_id);
361 
362 xmpp_stanza_t* stanza_create_pubsub_configure_request(xmpp_ctx_t* ctx, const char* const id, const char* const jid, const char* const node);
363 xmpp_stanza_t* stanza_create_pubsub_configure_submit(xmpp_ctx_t* ctx, const char* const id, const char* const jid, const char* const node, DataForm* form);
364 
365 int stanza_get_idle_time(xmpp_stanza_t* const stanza);
366 
367 void stanza_attach_priority(xmpp_ctx_t* const ctx, xmpp_stanza_t* const presence, const int pri);
368 void stanza_attach_last_activity(xmpp_ctx_t* const ctx, xmpp_stanza_t* const presence, const int idle);
369 void stanza_attach_caps(xmpp_ctx_t* const ctx, xmpp_stanza_t* const presence);
370 void stanza_attach_show(xmpp_ctx_t* const ctx, xmpp_stanza_t* const presence, const char* const show);
371 void stanza_attach_status(xmpp_ctx_t* const ctx, xmpp_stanza_t* const presence, const char* const status);
372 
373 xmpp_stanza_t* stanza_create_caps_query_element(xmpp_ctx_t* ctx);
374 char* stanza_create_caps_sha1_from_query(xmpp_stanza_t* const query);
375 EntityCapabilities* stanza_create_caps_from_query_element(xmpp_stanza_t* query);
376 
377 const char* stanza_get_presence_string_from_type(resource_presence_t presence_type);
378 xmpp_stanza_t* stanza_create_software_version_iq(xmpp_ctx_t* ctx, const char* const fulljid);
379 xmpp_stanza_t* stanza_create_disco_items_iq(xmpp_ctx_t* ctx, const char* const id, const char* const jid, const char* const node);
380 
381 char* stanza_get_status(xmpp_stanza_t* stanza, char* def);
382 char* stanza_get_show(xmpp_stanza_t* stanza, char* def);
383 
384 xmpp_stanza_t* stanza_create_roster_set(xmpp_ctx_t* ctx, const char* const id, const char* const jid,
385                                         const char* const handle, GSList* groups);
386 xmpp_stanza_t* stanza_create_roster_remove_set(xmpp_ctx_t* ctx, const char* const barejid);
387 
388 char* stanza_get_error_message(xmpp_stanza_t* const stanza);
389 
390 GSList* stanza_get_status_codes_by_ns(xmpp_stanza_t* const stanza, char* ns);
391 gboolean stanza_room_destroyed(xmpp_stanza_t* stanza);
392 const char* stanza_get_muc_destroy_alternative_room(xmpp_stanza_t* stanza);
393 char* stanza_get_muc_destroy_alternative_password(xmpp_stanza_t* stanza);
394 char* stanza_get_muc_destroy_reason(xmpp_stanza_t* stanza);
395 const char* stanza_get_actor(xmpp_stanza_t* stanza);
396 char* stanza_get_reason(xmpp_stanza_t* stanza);
397 
398 GHashTable* stanza_get_service_contact_addresses(xmpp_ctx_t* ctx, xmpp_stanza_t* stanza);
399 
400 Resource* stanza_resource_from_presence(XMPPPresence* presence);
401 XMPPPresence* stanza_parse_presence(xmpp_stanza_t* stanza, int* err);
402 void stanza_free_presence(XMPPPresence* presence);
403 
404 char* stanza_text_strdup(xmpp_stanza_t* stanza);
405 
406 XMPPCaps* stanza_parse_caps(xmpp_stanza_t* const stanza);
407 void stanza_free_caps(XMPPCaps* caps);
408 
409 xmpp_stanza_t* stanza_create_avatar_retrieve_data_request(xmpp_ctx_t* ctx, const char* stanza_id, const char* const item_id, const char* const jid);
410 xmpp_stanza_t* stanza_create_mam_iq(xmpp_ctx_t* ctx, const char* const jid, const char* const startdate, const char* const lastid);
411 xmpp_stanza_t* stanza_change_password(xmpp_ctx_t* ctx, const char* const user, const char* const password);
412 xmpp_stanza_t* stanza_request_voice(xmpp_ctx_t* ctx, const char* const room);
413 xmpp_stanza_t* stanza_create_approve_voice(xmpp_ctx_t* ctx, const char* const id, const char* const jid, const char* const node, DataForm* form);
414 xmpp_stanza_t* stanza_create_muc_register_nick(xmpp_ctx_t* ctx, const char* const id, const char* const jid, const char* const node, DataForm* form);
415 
416 #endif
417