mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Replace stanza_get_child_by_name_and_ns with xmpp_stanza_get_child_by_name_and_ns
Replace our own stanza_get_child_by_name_and_ns() with the upstreamed xmpp_stanza_get_child_by_name_and_ns() provided by the new libstrophe/libmesode 0.10.0.
This commit is contained in:
parent
0a9200e268
commit
17b1b431f5
@ -210,7 +210,7 @@ _avatar_request_item_result_handler(xmpp_stanza_t* const stanza, void* const use
|
||||
return 1;
|
||||
}
|
||||
|
||||
xmpp_stanza_t* st_data = stanza_get_child_by_name_and_ns(item, "data", STANZA_NS_USER_AVATAR_DATA);
|
||||
xmpp_stanza_t* st_data = xmpp_stanza_get_child_by_name_and_ns(item, "data", STANZA_NS_USER_AVATAR_DATA);
|
||||
if (!st_data) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ _bookmark_result_id_handler(xmpp_stanza_t* const stanza, void* const userdata)
|
||||
|
||||
// we save minimize, which is not standard, so that we don't remove it if it was set by gajim
|
||||
int minimize = 0;
|
||||
xmpp_stanza_t* minimize_st = stanza_get_child_by_name_and_ns(child, STANZA_NAME_MINIMIZE, STANZA_NS_EXT_GAJIM_BOOKMARKS);
|
||||
xmpp_stanza_t* minimize_st = xmpp_stanza_get_child_by_name_and_ns(child, STANZA_NAME_MINIMIZE, STANZA_NS_EXT_GAJIM_BOOKMARKS);
|
||||
if (minimize_st) {
|
||||
char* min_str = xmpp_stanza_get_text(minimize_st);
|
||||
if (strcmp(min_str, "true") == 0) {
|
||||
|
@ -947,7 +947,7 @@ _handle_groupchat(xmpp_stanza_t* const stanza)
|
||||
const char* id = xmpp_stanza_get_id(stanza);
|
||||
char* originid = NULL;
|
||||
|
||||
xmpp_stanza_t* origin = stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_ORIGIN_ID, STANZA_NS_STABLE_ID);
|
||||
xmpp_stanza_t* origin = xmpp_stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_ORIGIN_ID, STANZA_NS_STABLE_ID);
|
||||
if (origin) {
|
||||
originid = (char*)xmpp_stanza_get_attribute(origin, STANZA_ATTR_ID);
|
||||
}
|
||||
@ -1282,7 +1282,7 @@ _handle_chat(xmpp_stanza_t* const stanza, gboolean is_mam, gboolean is_carbon, c
|
||||
// live messages use XEP-0359 <stanza-id>
|
||||
// TODO: add to muc too
|
||||
char* stanzaid = NULL;
|
||||
xmpp_stanza_t* stanzaidst = stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_STANZA_ID, STANZA_NS_STABLE_ID);
|
||||
xmpp_stanza_t* stanzaidst = xmpp_stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_STANZA_ID, STANZA_NS_STABLE_ID);
|
||||
if (stanzaidst) {
|
||||
stanzaid = (char*)xmpp_stanza_get_attribute(stanzaidst, STANZA_ATTR_ID);
|
||||
if (stanzaid) {
|
||||
@ -1365,7 +1365,7 @@ _handle_ox_chat(xmpp_stanza_t* const stanza, ProfMessage* message, gboolean is_m
|
||||
message->enc = PROF_MSG_ENC_OX;
|
||||
|
||||
#ifdef HAVE_LIBGPGME
|
||||
xmpp_stanza_t* ox = stanza_get_child_by_name_and_ns(stanza, "openpgp", STANZA_NS_OPENPGP_0);
|
||||
xmpp_stanza_t* ox = xmpp_stanza_get_child_by_name_and_ns(stanza, "openpgp", STANZA_NS_OPENPGP_0);
|
||||
message->plain = p_ox_gpg_decrypt(xmpp_stanza_get_text(ox));
|
||||
|
||||
// Implementation for libstrophe 0.10.
|
||||
@ -1390,7 +1390,7 @@ _handle_ox_chat(xmpp_stanza_t* const stanza, ProfMessage* message, gboolean is_m
|
||||
static gboolean
|
||||
_handle_mam(xmpp_stanza_t* const stanza)
|
||||
{
|
||||
xmpp_stanza_t* result = stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_RESULT, STANZA_NS_MAM2);
|
||||
xmpp_stanza_t* result = xmpp_stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_RESULT, STANZA_NS_MAM2);
|
||||
if (!result) {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ _ox_metadata_result(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void*
|
||||
return FALSE;
|
||||
}
|
||||
// pubsub
|
||||
xmpp_stanza_t* pubsub = stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_PUBSUB, XMPP_FEATURE_PUBSUB);
|
||||
xmpp_stanza_t* pubsub = xmpp_stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_PUBSUB, XMPP_FEATURE_PUBSUB);
|
||||
if (!pubsub) {
|
||||
cons_show("OX: Error: No pubsub");
|
||||
return FALSE;
|
||||
@ -287,7 +287,7 @@ _ox_metadata_result(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void*
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
xmpp_stanza_t* publickeyslist = stanza_get_child_by_name_and_ns(item, STANZA_NAME_PUBLIC_KEYS_LIST, STANZA_NS_OPENPGP_0);
|
||||
xmpp_stanza_t* publickeyslist = xmpp_stanza_get_child_by_name_and_ns(item, STANZA_NAME_PUBLIC_KEYS_LIST, STANZA_NS_OPENPGP_0);
|
||||
if (!publickeyslist) {
|
||||
cons_show("OX: Error: No publickeyslist");
|
||||
return FALSE;
|
||||
@ -392,7 +392,7 @@ _ox_public_key_result(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void
|
||||
return FALSE;
|
||||
}
|
||||
// pubsub
|
||||
xmpp_stanza_t* pubsub = stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_PUBSUB, XMPP_FEATURE_PUBSUB);
|
||||
xmpp_stanza_t* pubsub = xmpp_stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_PUBSUB, XMPP_FEATURE_PUBSUB);
|
||||
if (!pubsub) {
|
||||
cons_show("Public Key import failed. Check log for details.");
|
||||
log_error("OX: Public key request response failed: No <pubsub/>");
|
||||
@ -413,7 +413,7 @@ _ox_public_key_result(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
xmpp_stanza_t* pubkey = stanza_get_child_by_name_and_ns(item, STANZA_NAME_PUPKEY, STANZA_NS_OPENPGP_0);
|
||||
xmpp_stanza_t* pubkey = xmpp_stanza_get_child_by_name_and_ns(item, STANZA_NAME_PUPKEY, STANZA_NS_OPENPGP_0);
|
||||
if (!pubkey) {
|
||||
cons_show("Public Key import failed. Check log for details.");
|
||||
log_error("OX: Public key request response failed: No <pubkey/>");
|
||||
|
@ -2574,26 +2574,6 @@ _stanza_create_sha1_hash(char* str)
|
||||
return b64;
|
||||
}
|
||||
|
||||
xmpp_stanza_t*
|
||||
stanza_get_child_by_name_and_ns(xmpp_stanza_t* const stanza, const char* const name, const char* const ns)
|
||||
{
|
||||
xmpp_stanza_t* child;
|
||||
const char* child_ns;
|
||||
const char* child_name;
|
||||
|
||||
for (child = xmpp_stanza_get_children(stanza); child; child = xmpp_stanza_get_next(child)) {
|
||||
child_name = xmpp_stanza_get_name(child);
|
||||
if (child_name && strcmp(name, child_name) == 0) {
|
||||
child_ns = xmpp_stanza_get_ns(child);
|
||||
if (child_ns && strcmp(ns, child_ns) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -375,8 +375,6 @@ char* stanza_text_strdup(xmpp_stanza_t* stanza);
|
||||
XMPPCaps* stanza_parse_caps(xmpp_stanza_t* const stanza);
|
||||
void stanza_free_caps(XMPPCaps* caps);
|
||||
|
||||
xmpp_stanza_t* stanza_get_child_by_name_and_ns(xmpp_stanza_t* const stanza, const char* const name, const char* const ns);
|
||||
|
||||
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);
|
||||
|
||||
xmpp_stanza_t* stanza_create_mam_iq(xmpp_ctx_t* ctx, const char* const jid, const char* const startdate);
|
||||
|
Loading…
Reference in New Issue
Block a user