1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-16 21:35:24 +00:00

Use libstrophe convenience functions for stanza attributes

This commit is contained in:
James Booth 2016-08-20 18:16:51 +01:00
parent a978bb12bf
commit 24c3eff428
7 changed files with 117 additions and 117 deletions

View File

@ -239,7 +239,7 @@ _block_add_result_handler(xmpp_stanza_t *const stanza, void *const userdata)
{
char *jid = (char*)userdata;
const char *type = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_TYPE);
const char *type = xmpp_stanza_get_type(stanza);
if (type == NULL) {
log_info("Block response received for %s with no type attribute.", jid);
free(jid);
@ -263,7 +263,7 @@ _block_remove_result_handler(xmpp_stanza_t *const stanza, void *const userdata)
{
char *jid = (char*)userdata;
const char *type = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_TYPE);
const char *type = xmpp_stanza_get_type(stanza);
if (type == NULL) {
log_info("Unblock response received for %s with no type attribute.", jid);
free(jid);

View File

@ -67,7 +67,7 @@ _is_valid_form_element(xmpp_stanza_t *stanza)
return FALSE;
}
const char *type = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_TYPE);
const char *type = xmpp_stanza_get_type(stanza);
if ((g_strcmp0(type, "form") != 0) &&
(g_strcmp0(type, "submit") != 0) &&
(g_strcmp0(type, "cancel") != 0) &&

View File

@ -673,7 +673,7 @@ iq_send_ping(const char *const target)
static void
_error_handler(xmpp_stanza_t *const stanza)
{
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *id = xmpp_stanza_get_id(stanza);
char *error_msg = stanza_get_error_message(stanza);
if (id) {
@ -690,7 +690,7 @@ _error_handler(xmpp_stanza_t *const stanza)
static int
_caps_response_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
{
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *id = xmpp_stanza_get_id(stanza);
xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY);
const char *type = xmpp_stanza_get_type(stanza);
@ -705,7 +705,7 @@ _caps_response_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
log_info("Capabilities response handler fired");
}
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
if (!from) {
log_info("No from attribute");
return 0;
@ -764,7 +764,7 @@ static int
_caps_response_for_jid_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
{
char *jid = (char *)userdata;
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *id = xmpp_stanza_get_id(stanza);
xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY);
const char *type = xmpp_stanza_get_type(stanza);
@ -780,7 +780,7 @@ _caps_response_for_jid_id_handler(xmpp_stanza_t *const stanza, void *const userd
log_info("Capabilities response handler fired");
}
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
if (!from) {
log_info("No from attribute");
free(jid);
@ -821,7 +821,7 @@ _caps_response_for_jid_id_handler(xmpp_stanza_t *const stanza, void *const userd
static int
_caps_response_legacy_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
{
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *id = xmpp_stanza_get_id(stanza);
xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY);
char *expected_node = (char *)userdata;
@ -838,7 +838,7 @@ _caps_response_legacy_id_handler(xmpp_stanza_t *const stanza, void *const userda
log_info("Capabilities response handler fired");
}
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
if (!from) {
log_info("No from attribute");
free(expected_node);
@ -925,7 +925,7 @@ _disable_carbons_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
static int
_manual_pong_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
{
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
const char *type = xmpp_stanza_get_type(stanza);
GDateTime *sent = (GDateTime *)userdata;
@ -1053,7 +1053,7 @@ _version_result_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
}
const char *type = xmpp_stanza_get_type(stanza);
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
if (g_strcmp0(type, STANZA_TYPE_RESULT) != 0) {
if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) {
@ -1068,7 +1068,7 @@ _version_result_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
return 0;
}
const char *jid = xmpp_stanza_get_attribute(stanza, "from");
const char *jid = xmpp_stanza_get_from(stanza);
xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY);
if (query == NULL) {
@ -1144,9 +1144,9 @@ static void
_ping_get_handler(xmpp_stanza_t *const stanza)
{
xmpp_ctx_t * const ctx = connection_get_ctx();
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *to = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_TO);
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *id = xmpp_stanza_get_id(stanza);
const char *to = xmpp_stanza_get_to(stanza);
const char *from = xmpp_stanza_get_from(stanza);
if (id) {
log_debug("IQ ping get handler fired, id: %s.", id);
@ -1160,12 +1160,12 @@ _ping_get_handler(xmpp_stanza_t *const stanza)
xmpp_stanza_t *pong = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(pong, STANZA_NAME_IQ);
xmpp_stanza_set_attribute(pong, STANZA_ATTR_TO, from);
xmpp_stanza_set_attribute(pong, STANZA_ATTR_FROM, to);
xmpp_stanza_set_attribute(pong, STANZA_ATTR_TYPE, STANZA_TYPE_RESULT);
xmpp_stanza_set_to(pong, from);
xmpp_stanza_set_from(pong, to);
xmpp_stanza_set_type(pong, STANZA_TYPE_RESULT);
if (id) {
xmpp_stanza_set_attribute(pong, STANZA_ATTR_ID, id);
xmpp_stanza_set_id(pong, id);
}
iq_send_stanza(pong);
@ -1176,8 +1176,8 @@ static void
_version_get_handler(xmpp_stanza_t *const stanza)
{
xmpp_ctx_t * const ctx = connection_get_ctx();
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *id = xmpp_stanza_get_id(stanza);
const char *from = xmpp_stanza_get_from(stanza);
if (id) {
log_debug("IQ version get handler fired, id: %s.", id);
@ -1191,7 +1191,7 @@ _version_get_handler(xmpp_stanza_t *const stanza)
if (id) {
xmpp_stanza_set_id(response, id);
}
xmpp_stanza_set_attribute(response, STANZA_ATTR_TO, from);
xmpp_stanza_set_to(response, from);
xmpp_stanza_set_type(response, STANZA_TYPE_RESULT);
xmpp_stanza_t *query = xmpp_stanza_new(ctx);
@ -1241,8 +1241,8 @@ static void
_disco_items_get_handler(xmpp_stanza_t *const stanza)
{
xmpp_ctx_t * const ctx = connection_get_ctx();
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *id = xmpp_stanza_get_id(stanza);
const char *from = xmpp_stanza_get_from(stanza);
if (id) {
log_debug("IQ disco items get handler fired, id: %s.", id);
@ -1254,7 +1254,7 @@ _disco_items_get_handler(xmpp_stanza_t *const stanza)
xmpp_stanza_t *response = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(response, STANZA_NAME_IQ);
xmpp_stanza_set_id(response, xmpp_stanza_get_id(stanza));
xmpp_stanza_set_attribute(response, STANZA_ATTR_TO, from);
xmpp_stanza_set_to(response, from);
xmpp_stanza_set_type(response, STANZA_TYPE_RESULT);
xmpp_stanza_t *query = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(query, STANZA_NAME_QUERY);
@ -1271,7 +1271,7 @@ static void
_last_activity_get_handler(xmpp_stanza_t *const stanza)
{
xmpp_ctx_t *ctx = connection_get_ctx();
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
if (!from) {
return;
@ -1285,7 +1285,7 @@ _last_activity_get_handler(xmpp_stanza_t *const stanza)
xmpp_stanza_t *response = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(response, STANZA_NAME_IQ);
xmpp_stanza_set_id(response, xmpp_stanza_get_id(stanza));
xmpp_stanza_set_attribute(response, STANZA_ATTR_TO, from);
xmpp_stanza_set_to(response, from);
xmpp_stanza_set_type(response, STANZA_TYPE_RESULT);
xmpp_stanza_t *query = xmpp_stanza_new(ctx);
@ -1303,7 +1303,7 @@ _last_activity_get_handler(xmpp_stanza_t *const stanza)
xmpp_stanza_t *response = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(response, STANZA_NAME_IQ);
xmpp_stanza_set_id(response, xmpp_stanza_get_id(stanza));
xmpp_stanza_set_attribute(response, STANZA_ATTR_TO, from);
xmpp_stanza_set_to(response, from);
xmpp_stanza_set_type(response, STANZA_TYPE_ERROR);
xmpp_stanza_t *error = xmpp_stanza_new(ctx);
@ -1330,12 +1330,12 @@ static void
_disco_info_get_handler(xmpp_stanza_t *const stanza)
{
xmpp_ctx_t * const ctx = connection_get_ctx();
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
xmpp_stanza_t *incoming_query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY);
const char *node_str = xmpp_stanza_get_attribute(incoming_query, STANZA_ATTR_NODE);
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *id = xmpp_stanza_get_id(stanza);
if (id) {
log_debug("IQ disco info get handler fired, id: %s.", id);
@ -1347,7 +1347,7 @@ _disco_info_get_handler(xmpp_stanza_t *const stanza)
xmpp_stanza_t *response = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(response, STANZA_NAME_IQ);
xmpp_stanza_set_id(response, xmpp_stanza_get_id(stanza));
xmpp_stanza_set_attribute(response, STANZA_ATTR_TO, from);
xmpp_stanza_set_to(response, from);
xmpp_stanza_set_type(response, STANZA_TYPE_RESULT);
xmpp_stanza_t *query = stanza_create_caps_query_element(ctx);
if (node_str) {
@ -1364,7 +1364,7 @@ _disco_info_get_handler(xmpp_stanza_t *const stanza)
static int
_destroy_room_result_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
{
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *id = xmpp_stanza_get_id(stanza);
if (id) {
log_debug("IQ destroy room result handler fired, id: %s.", id);
@ -1372,7 +1372,7 @@ _destroy_room_result_id_handler(xmpp_stanza_t *const stanza, void *const userdat
log_debug("IQ destroy room result handler fired.");
}
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
if (from == NULL) {
log_error("No from attribute for IQ destroy room result");
} else {
@ -1385,9 +1385,9 @@ _destroy_room_result_id_handler(xmpp_stanza_t *const stanza, void *const userdat
static int
_room_config_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
{
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *id = xmpp_stanza_get_id(stanza);
const char *type = xmpp_stanza_get_type(stanza);
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
if (id) {
log_debug("IQ room config handler fired, id: %s.", id);
@ -1423,7 +1423,7 @@ _room_config_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
return 0;
}
const char *form_type = xmpp_stanza_get_attribute(x, STANZA_ATTR_TYPE);
const char *form_type = xmpp_stanza_get_type(x);
if (g_strcmp0(form_type, "form") != 0) {
log_warning("x element not of type 'form' parsing room config response");
ui_handle_room_configuration_form_error(from, "Form not of type 'form' parsing room config response.");
@ -1440,9 +1440,9 @@ _room_config_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
static int
_room_affiliation_set_result_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
{
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *id = xmpp_stanza_get_id(stanza);
const char *type = xmpp_stanza_get_type(stanza);
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
ProfPrivilegeSet *affiliation_set = (ProfPrivilegeSet*)userdata;
if (id) {
@ -1472,9 +1472,9 @@ _room_affiliation_set_result_id_handler(xmpp_stanza_t *const stanza, void *const
static int
_room_role_set_result_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
{
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *id = xmpp_stanza_get_id(stanza);
const char *type = xmpp_stanza_get_type(stanza);
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
ProfPrivilegeSet *role_set = (ProfPrivilegeSet*)userdata;
if (id) {
@ -1504,9 +1504,9 @@ _room_role_set_result_id_handler(xmpp_stanza_t *const stanza, void *const userda
static int
_room_affiliation_list_result_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
{
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *id = xmpp_stanza_get_id(stanza);
const char *type = xmpp_stanza_get_type(stanza);
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
char *affiliation = (char *)userdata;
if (id) {
@ -1558,9 +1558,9 @@ _room_affiliation_list_result_id_handler(xmpp_stanza_t *const stanza, void *cons
static int
_room_role_list_result_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
{
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *id = xmpp_stanza_get_id(stanza);
const char *type = xmpp_stanza_get_type(stanza);
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
char *role = (char *)userdata;
if (id) {
@ -1611,9 +1611,9 @@ _room_role_list_result_id_handler(xmpp_stanza_t *const stanza, void *const userd
static int
_room_config_submit_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
{
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *id = xmpp_stanza_get_id(stanza);
const char *type = xmpp_stanza_get_type(stanza);
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
if (id) {
log_debug("IQ room config submit handler fired, id: %s.", id);
@ -1637,9 +1637,9 @@ _room_config_submit_id_handler(xmpp_stanza_t *const stanza, void *const userdata
static int
_room_kick_result_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
{
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *id = xmpp_stanza_get_id(stanza);
const char *type = xmpp_stanza_get_type(stanza);
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
char *nick = (char *)userdata;
if (id) {
@ -1717,7 +1717,7 @@ _room_info_response_id_handler(xmpp_stanza_t *const stanza, void *const userdata
}
} else if (g_strcmp0(stanza_name, STANZA_NAME_IDENTITY) == 0) {
const char *name = xmpp_stanza_get_attribute(child, STANZA_ATTR_NAME);
const char *type = xmpp_stanza_get_attribute(child, STANZA_ATTR_TYPE);
const char *type = xmpp_stanza_get_type(child);
const char *category = xmpp_stanza_get_attribute(child, STANZA_ATTR_CATEGORY);
if (name || category || type) {
@ -1765,7 +1765,7 @@ _room_info_response_id_handler(xmpp_stanza_t *const stanza, void *const userdata
static int
_last_activity_response_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
{
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
if (!from) {
cons_show_error("Invalid last activity response received.");
log_info("Received last activity response with no from attribute.");
@ -1819,7 +1819,7 @@ _last_activity_response_id_handler(xmpp_stanza_t *const stanza, void *const user
static int
_disco_info_response_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
{
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
const char *type = xmpp_stanza_get_type(stanza);
if (from) {
@ -1855,7 +1855,7 @@ _disco_info_response_id_handler(xmpp_stanza_t *const stanza, void *const userdat
}
} else if (g_strcmp0(stanza_name, STANZA_NAME_IDENTITY) == 0) {
const char *name = xmpp_stanza_get_attribute(child, STANZA_ATTR_NAME);
const char *type = xmpp_stanza_get_attribute(child, STANZA_ATTR_TYPE);
const char *type = xmpp_stanza_get_type(child);
const char *category = xmpp_stanza_get_attribute(child, STANZA_ATTR_CATEGORY);
if (name || category || type) {
@ -1896,7 +1896,7 @@ _disco_info_response_id_handler(xmpp_stanza_t *const stanza, void *const userdat
static int
_disco_info_response_id_handler_onconnect(xmpp_stanza_t *const stanza, void *const userdata)
{
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
const char *type = xmpp_stanza_get_type(stanza);
if (from) {
@ -1946,7 +1946,7 @@ static int
_http_upload_response_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
{
HTTPUpload *upload = (HTTPUpload *)userdata;
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
const char *type = xmpp_stanza_get_type(stanza);
if (from) {
@ -2000,8 +2000,8 @@ static void
_disco_items_result_handler(xmpp_stanza_t *const stanza)
{
log_debug("Received disco#items response");
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *id = xmpp_stanza_get_id(stanza);
const char *from = xmpp_stanza_get_from(stanza);
GSList *items = NULL;
if ((g_strcmp0(id, "confreq") != 0) &&

View File

@ -353,11 +353,11 @@ static void
_handle_error(xmpp_stanza_t *const stanza)
{
const char *id = xmpp_stanza_get_id(stanza);
const char *jid = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *jid = xmpp_stanza_get_from(stanza);
xmpp_stanza_t *error_stanza = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_ERROR);
const char *type = NULL;
if (error_stanza) {
type = xmpp_stanza_get_attribute(error_stanza, STANZA_ATTR_TYPE);
type = xmpp_stanza_get_type(error_stanza);
}
// stanza_get_error never returns NULL
@ -402,7 +402,7 @@ _handel_muc_user(xmpp_stanza_t *const stanza)
{
xmpp_ctx_t *ctx = connection_get_ctx();
xmpp_stanza_t *xns_muc_user = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_MUC_USER);
const char *room = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *room = xmpp_stanza_get_from(stanza);
if (!room) {
log_warning("Message received with no from attribute, ignoring");
@ -415,7 +415,7 @@ _handel_muc_user(xmpp_stanza_t *const stanza)
return;
}
const char *invitor_jid = xmpp_stanza_get_attribute(invite, STANZA_ATTR_FROM);
const char *invitor_jid = xmpp_stanza_get_from(invite);
if (!invitor_jid) {
log_warning("Chat room invite received with no from attribute");
return;
@ -454,7 +454,7 @@ _handle_conference(xmpp_stanza_t *const stanza)
{
xmpp_stanza_t *xns_conference = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_CONFERENCE);
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
if (!from) {
log_warning("Message received with no from attribute, ignoring");
return;
@ -483,7 +483,7 @@ static void
_handle_captcha(xmpp_stanza_t *const stanza)
{
xmpp_ctx_t *ctx = connection_get_ctx();
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
if (!from) {
log_warning("Message received with no from attribute, ignoring");
@ -510,7 +510,7 @@ _handle_groupchat(xmpp_stanza_t *const stanza)
{
xmpp_ctx_t *ctx = connection_get_ctx();
char *message = NULL;
const char *room_jid = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *room_jid = xmpp_stanza_get_from(stanza);
Jid *jid = jid_create(room_jid);
// handle room subject
@ -594,12 +594,12 @@ _message_send_receipt(const char *const fulljid, const char *const message_id)
char *id = create_unique_id("receipt");
xmpp_stanza_set_id(message, id);
free(id);
xmpp_stanza_set_attribute(message, STANZA_ATTR_TO, fulljid);
xmpp_stanza_set_to(message, fulljid);
xmpp_stanza_t *receipt = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(receipt, "received");
xmpp_stanza_set_ns(receipt, STANZA_NS_RECEIPTS);
xmpp_stanza_set_attribute(receipt, STANZA_ATTR_ID, message_id);
xmpp_stanza_set_id(receipt, message_id);
xmpp_stanza_add_child(message, receipt);
xmpp_stanza_release(receipt);
@ -617,12 +617,12 @@ _handle_receipt_received(xmpp_stanza_t *const stanza)
return;
}
const char *id = xmpp_stanza_get_attribute(receipt, STANZA_ATTR_ID);
const char *id = xmpp_stanza_get_id(receipt);
if (!id) {
return;
}
const char *fulljid = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *fulljid = xmpp_stanza_get_from(stanza);
if (!fulljid) {
return;
}
@ -654,7 +654,7 @@ _receipt_request_handler(xmpp_stanza_t *const stanza)
return;
}
const gchar *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const gchar *from = xmpp_stanza_get_from(stanza);
Jid *jid = jid_create(from);
_message_send_receipt(jid->fulljid, id);
jid_destroy(jid);
@ -700,8 +700,8 @@ _handle_carbons(xmpp_stanza_t *const stanza)
xmpp_ctx_t *ctx = connection_get_ctx();
const gchar *to = xmpp_stanza_get_attribute(message, STANZA_ATTR_TO);
const gchar *from = xmpp_stanza_get_attribute(message, STANZA_ATTR_FROM);
const gchar *to = xmpp_stanza_get_to(message);
const gchar *from = xmpp_stanza_get_from(message);
// happens when receive a carbon of a self sent message
if (!to) to = from;
@ -776,7 +776,7 @@ _handle_chat(xmpp_stanza_t *const stanza)
return;
}
const gchar *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const gchar *from = xmpp_stanza_get_from(stanza);
Jid *jid = jid_create(from);
// private message from chat room use full jid (room/nick)

View File

@ -177,7 +177,7 @@ presence_subscription(const char *const jid, const jabber_subscr_t action)
xmpp_stanza_set_id(presence, id);
xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE);
xmpp_stanza_set_type(presence, type);
xmpp_stanza_set_attribute(presence, STANZA_ATTR_TO, jidp->barejid);
xmpp_stanza_set_to(presence, jidp->barejid);
_send_presence_stanza(presence);
xmpp_stanza_release(presence);
@ -310,7 +310,7 @@ _send_room_presence(xmpp_stanza_t *presence)
if (nick) {
char *full_room_jid = create_fulljid(room, nick);
xmpp_stanza_set_attribute(presence, STANZA_ATTR_TO, full_room_jid);
xmpp_stanza_set_to(presence, full_room_jid);
log_debug("Sending presence to room: %s", full_room_jid);
_send_presence_stanza(presence);
free(full_room_jid);
@ -397,7 +397,7 @@ static void
_presence_error_handler(xmpp_stanza_t *const stanza)
{
const char *id = xmpp_stanza_get_id(stanza);
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
xmpp_stanza_t *error_stanza = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_ERROR);
xmpp_stanza_t *x = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_X);
const char *xmlns = NULL;
@ -406,7 +406,7 @@ _presence_error_handler(xmpp_stanza_t *const stanza)
}
const char *type = NULL;
if (error_stanza) {
type = xmpp_stanza_get_attribute(error_stanza, STANZA_ATTR_TYPE);
type = xmpp_stanza_get_type(error_stanza);
}
// handle MUC join errors
@ -467,7 +467,7 @@ _presence_error_handler(xmpp_stanza_t *const stanza)
static void
_unsubscribed_handler(xmpp_stanza_t *const stanza)
{
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
Jid *from_jid = jid_create(from);
log_debug("Unsubscribed presence handler fired for %s", from);
@ -480,7 +480,7 @@ _unsubscribed_handler(xmpp_stanza_t *const stanza)
static void
_subscribed_handler(xmpp_stanza_t *const stanza)
{
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
Jid *from_jid = jid_create(from);
log_debug("Subscribed presence handler fired for %s", from);
@ -493,7 +493,7 @@ _subscribed_handler(xmpp_stanza_t *const stanza)
static void
_subscribe_handler(xmpp_stanza_t *const stanza)
{
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
log_debug("Subscribe presence handler fired for %s", from);
Jid *from_jid = jid_create(from);
@ -514,7 +514,7 @@ _unavailable_handler(xmpp_stanza_t *const stanza)
xmpp_conn_t *conn = connection_get_conn();
const char *jid = xmpp_conn_get_jid(conn);
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
log_debug("Unavailable presence handler fired for %s", from);
Jid *my_jid = jid_create(jid);
@ -615,7 +615,7 @@ _available_handler(xmpp_stanza_t *const stanza)
log_warning("Available presence handler fired with no from attribute.");
break;
case STANZA_PARSE_ERROR_INVALID_FROM:
from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
from = xmpp_stanza_get_from(stanza);
log_warning("Available presence handler fired with invalid from attribute: %s", from);
break;
default:
@ -684,8 +684,8 @@ _muc_user_handler(xmpp_stanza_t *const stanza)
{
inp_nonblocking(TRUE);
const char *type = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_TYPE);
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *type = xmpp_stanza_get_type(stanza);
const char *from = xmpp_stanza_get_from(stanza);
// handler still fires if error
if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) {

View File

@ -218,7 +218,7 @@ roster_set_handler(xmpp_stanza_t *const stanza)
// if from attribute exists and it is not current users barejid, ignore push
Jid *my_jid = jid_create(connection_get_fulljid());
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
if (from && (strcmp(from, my_jid->barejid) != 0)) {
jid_destroy(my_jid);
return;
@ -276,7 +276,7 @@ roster_set_handler(xmpp_stanza_t *const stanza)
void
roster_result_handler(xmpp_stanza_t *const stanza)
{
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *id = xmpp_stanza_get_id(stanza);
if (g_strcmp0(id, "roster") != 0) {
return;

View File

@ -185,13 +185,13 @@ stanza_create_bookmarks_pubsub_add(xmpp_ctx_t *ctx, const char *const jid,
xmpp_stanza_t *x = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(x, STANZA_NAME_X);
xmpp_stanza_set_ns(x, STANZA_NS_DATA);
xmpp_stanza_set_attribute(x, STANZA_ATTR_TYPE, "submit");
xmpp_stanza_set_type(x, "submit");
xmpp_stanza_add_child(publish_options, x);
xmpp_stanza_t *form_type = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(form_type, STANZA_NAME_FIELD);
xmpp_stanza_set_attribute(form_type, STANZA_ATTR_VAR, "FORM_TYPE");
xmpp_stanza_set_attribute(form_type, STANZA_ATTR_TYPE, "hidden");
xmpp_stanza_set_type(form_type, "hidden");
xmpp_stanza_t *form_type_value = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(form_type_value, STANZA_NAME_VALUE);
xmpp_stanza_t *form_type_value_text = xmpp_stanza_new(ctx);
@ -233,7 +233,7 @@ stanza_create_http_upload_request(xmpp_ctx_t *ctx, const char *const id,
xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ);
xmpp_stanza_set_type(iq, STANZA_TYPE_GET);
xmpp_stanza_set_attribute(iq, STANZA_ATTR_TO, jid);
xmpp_stanza_set_to(iq, jid);
xmpp_stanza_set_id(iq, id);
xmpp_stanza_t *request = xmpp_stanza_new(ctx);
@ -322,7 +322,7 @@ stanza_create_chat_state(xmpp_ctx_t *ctx, const char *const fulljid, const char
xmpp_stanza_t *msg = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(msg, STANZA_NAME_MESSAGE);
xmpp_stanza_set_type(msg, STANZA_TYPE_CHAT);
xmpp_stanza_set_attribute(msg, STANZA_ATTR_TO, fulljid);
xmpp_stanza_set_to(msg, fulljid);
_stanza_add_unique_id(msg, NULL);
@ -341,7 +341,7 @@ stanza_create_room_subject_message(xmpp_ctx_t *ctx, const char *const room, cons
xmpp_stanza_t *msg = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(msg, STANZA_NAME_MESSAGE);
xmpp_stanza_set_type(msg, STANZA_TYPE_GROUPCHAT);
xmpp_stanza_set_attribute(msg, STANZA_ATTR_TO, room);
xmpp_stanza_set_to(msg, room);
xmpp_stanza_t *subject_st = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(subject_st, STANZA_NAME_SUBJECT);
@ -449,7 +449,7 @@ stanza_create_message(xmpp_ctx_t *ctx, char *id, const char *const recipient,
xmpp_stanza_t *msg = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(msg, STANZA_NAME_MESSAGE);
xmpp_stanza_set_type(msg, type);
xmpp_stanza_set_attribute(msg, STANZA_ATTR_TO, recipient);
xmpp_stanza_set_to(msg, recipient);
xmpp_stanza_set_id(msg, id);
xmpp_stanza_t *body = xmpp_stanza_new(ctx);
@ -542,7 +542,7 @@ stanza_create_invite(xmpp_ctx_t *ctx, const char *const room,
{
xmpp_stanza_t *message = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(message, STANZA_NAME_MESSAGE);
xmpp_stanza_set_attribute(message, STANZA_ATTR_TO, contact);
xmpp_stanza_set_to(message, contact);
_stanza_add_unique_id(message, NULL);
xmpp_stanza_t *x = xmpp_stanza_new(ctx);
@ -569,7 +569,7 @@ stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char *const room,
{
xmpp_stanza_t *message = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(message, STANZA_NAME_MESSAGE);
xmpp_stanza_set_attribute(message, STANZA_ATTR_TO, room);
xmpp_stanza_set_to(message, room);
_stanza_add_unique_id(message, NULL);
xmpp_stanza_t *x = xmpp_stanza_new(ctx);
@ -578,7 +578,7 @@ stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char *const room,
xmpp_stanza_t *invite = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(invite, STANZA_NAME_INVITE);
xmpp_stanza_set_attribute(invite, STANZA_ATTR_TO, contact);
xmpp_stanza_set_to(invite, contact);
if (reason) {
xmpp_stanza_t *reason_st = xmpp_stanza_new(ctx);
@ -605,7 +605,7 @@ stanza_create_room_join_presence(xmpp_ctx_t *const ctx,
{
xmpp_stanza_t *presence = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE);
xmpp_stanza_set_attribute(presence, STANZA_ATTR_TO, full_room_jid);
xmpp_stanza_set_to(presence, full_room_jid);
_stanza_add_unique_id(presence, "join");
xmpp_stanza_t *x = xmpp_stanza_new(ctx);
@ -636,7 +636,7 @@ stanza_create_room_newnick_presence(xmpp_ctx_t *ctx,
xmpp_stanza_t *presence = xmpp_stanza_new(ctx);
_stanza_add_unique_id(presence, "sub");
xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE);
xmpp_stanza_set_attribute(presence, STANZA_ATTR_TO, full_room_jid);
xmpp_stanza_set_to(presence, full_room_jid);
return presence;
}
@ -652,7 +652,7 @@ stanza_create_room_leave_presence(xmpp_ctx_t *ctx, const char *const room,
xmpp_stanza_t *presence = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE);
xmpp_stanza_set_type(presence, STANZA_TYPE_UNAVAILABLE);
xmpp_stanza_set_attribute(presence, STANZA_ATTR_TO, full_jid->str);
xmpp_stanza_set_to(presence, full_jid->str);
_stanza_add_unique_id(presence, "leave");
g_string_free(full_jid, TRUE);
@ -666,7 +666,7 @@ stanza_create_instant_room_request_iq(xmpp_ctx_t *ctx, const char *const room_ji
xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ);
xmpp_stanza_set_type(iq, STANZA_TYPE_SET);
xmpp_stanza_set_attribute(iq, STANZA_ATTR_TO, room_jid);
xmpp_stanza_set_to(iq, room_jid);
_stanza_add_unique_id(iq, "room");
xmpp_stanza_t *query = xmpp_stanza_new(ctx);
@ -693,7 +693,7 @@ stanza_create_instant_room_destroy_iq(xmpp_ctx_t *ctx, const char *const room_ji
xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ);
xmpp_stanza_set_type(iq, STANZA_TYPE_SET);
xmpp_stanza_set_attribute(iq, STANZA_ATTR_TO, room_jid);
xmpp_stanza_set_to(iq, room_jid);
_stanza_add_unique_id(iq, "room");
xmpp_stanza_t *query = xmpp_stanza_new(ctx);
@ -718,7 +718,7 @@ stanza_create_room_config_request_iq(xmpp_ctx_t *ctx, const char *const room_jid
xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ);
xmpp_stanza_set_type(iq, STANZA_TYPE_GET);
xmpp_stanza_set_attribute(iq, STANZA_ATTR_TO, room_jid);
xmpp_stanza_set_to(iq, room_jid);
_stanza_add_unique_id(iq, "room");
xmpp_stanza_t *query = xmpp_stanza_new(ctx);
@ -737,7 +737,7 @@ stanza_create_room_config_cancel_iq(xmpp_ctx_t *ctx, const char *const room_jid)
xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ);
xmpp_stanza_set_type(iq, STANZA_TYPE_SET);
xmpp_stanza_set_attribute(iq, STANZA_ATTR_TO, room_jid);
xmpp_stanza_set_to(iq, room_jid);
_stanza_add_unique_id(iq, "room");
xmpp_stanza_t *query = xmpp_stanza_new(ctx);
@ -764,7 +764,7 @@ stanza_create_room_affiliation_list_iq(xmpp_ctx_t *ctx, const char *const room,
xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ);
xmpp_stanza_set_type(iq, STANZA_TYPE_GET);
xmpp_stanza_set_attribute(iq, STANZA_ATTR_TO, room);
xmpp_stanza_set_to(iq, room);
_stanza_add_unique_id(iq, "affiliation_get");
xmpp_stanza_t *query = xmpp_stanza_new(ctx);
@ -789,7 +789,7 @@ stanza_create_room_role_list_iq(xmpp_ctx_t *ctx, const char *const room, const c
xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ);
xmpp_stanza_set_type(iq, STANZA_TYPE_GET);
xmpp_stanza_set_attribute(iq, STANZA_ATTR_TO, room);
xmpp_stanza_set_to(iq, room);
_stanza_add_unique_id(iq, "role_get");
xmpp_stanza_t *query = xmpp_stanza_new(ctx);
@ -815,7 +815,7 @@ stanza_create_room_affiliation_set_iq(xmpp_ctx_t *ctx, const char *const room, c
xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ);
xmpp_stanza_set_type(iq, STANZA_TYPE_SET);
xmpp_stanza_set_attribute(iq, STANZA_ATTR_TO, room);
xmpp_stanza_set_to(iq, room);
_stanza_add_unique_id(iq, "affiliation_set");
xmpp_stanza_t *query = xmpp_stanza_new(ctx);
@ -854,7 +854,7 @@ stanza_create_room_role_set_iq(xmpp_ctx_t *const ctx, const char *const room, co
xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ);
xmpp_stanza_set_type(iq, STANZA_TYPE_SET);
xmpp_stanza_set_attribute(iq, STANZA_ATTR_TO, room);
xmpp_stanza_set_to(iq, room);
_stanza_add_unique_id(iq, "role_set");
xmpp_stanza_t *query = xmpp_stanza_new(ctx);
@ -893,7 +893,7 @@ stanza_create_room_kick_iq(xmpp_ctx_t *const ctx, const char *const room, const
xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ);
xmpp_stanza_set_type(iq, STANZA_TYPE_SET);
xmpp_stanza_set_attribute(iq, STANZA_ATTR_TO, room);
xmpp_stanza_set_to(iq, room);
_stanza_add_unique_id(iq, "room_kick");
xmpp_stanza_t *query = xmpp_stanza_new(ctx);
@ -941,7 +941,7 @@ stanza_create_software_version_iq(xmpp_ctx_t *ctx, const char *const fulljid)
xmpp_stanza_set_name(iq, STANZA_NAME_IQ);
xmpp_stanza_set_type(iq, STANZA_TYPE_GET);
_stanza_add_unique_id(iq, "sv");
xmpp_stanza_set_attribute(iq, "to", fulljid);
xmpp_stanza_set_to(iq, fulljid);
xmpp_stanza_t *query = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(query, STANZA_NAME_QUERY);
@ -978,7 +978,7 @@ stanza_create_disco_info_iq(xmpp_ctx_t *ctx, const char *const id, const char *c
xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ);
xmpp_stanza_set_type(iq, STANZA_TYPE_GET);
xmpp_stanza_set_attribute(iq, STANZA_ATTR_TO, to);
xmpp_stanza_set_to(iq, to);
xmpp_stanza_set_id(iq, id);
xmpp_stanza_t *query = xmpp_stanza_new(ctx);
@ -1001,7 +1001,7 @@ stanza_create_disco_items_iq(xmpp_ctx_t *ctx, const char *const id,
xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ);
xmpp_stanza_set_type(iq, STANZA_TYPE_GET);
xmpp_stanza_set_attribute(iq, STANZA_ATTR_TO, jid);
xmpp_stanza_set_to(iq, jid);
xmpp_stanza_set_id(iq, id);
xmpp_stanza_t *query = xmpp_stanza_new(ctx);
@ -1020,7 +1020,7 @@ stanza_create_last_activity_iq(xmpp_ctx_t *ctx, const char *const id, const char
xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ);
xmpp_stanza_set_type(iq, STANZA_TYPE_GET);
xmpp_stanza_set_attribute(iq, STANZA_ATTR_TO, to);
xmpp_stanza_set_to(iq, to);
xmpp_stanza_set_id(iq, id);
xmpp_stanza_t *query = xmpp_stanza_new(ctx);
@ -1039,7 +1039,7 @@ stanza_create_room_config_submit_iq(xmpp_ctx_t *ctx, const char *const room, Dat
xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ);
xmpp_stanza_set_type(iq, STANZA_TYPE_SET);
xmpp_stanza_set_attribute(iq, STANZA_ATTR_TO, room);
xmpp_stanza_set_to(iq, room);
_stanza_add_unique_id(iq, "roomconf_submit");
xmpp_stanza_t *query = xmpp_stanza_new(ctx);
@ -1066,7 +1066,7 @@ stanza_create_caps_query_element(xmpp_ctx_t *ctx)
xmpp_stanza_t *identity = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(identity, "identity");
xmpp_stanza_set_attribute(identity, "category", "client");
xmpp_stanza_set_attribute(identity, "type", "console");
xmpp_stanza_set_type(identity, "console");
GString *name_str = g_string_new("Profanity ");
g_string_append(name_str, PACKAGE_VERSION);
@ -1118,7 +1118,7 @@ stanza_create_ping_iq(xmpp_ctx_t *ctx, const char *const target)
xmpp_stanza_set_name(iq, STANZA_NAME_IQ);
xmpp_stanza_set_type(iq, STANZA_TYPE_GET);
if (target) {
xmpp_stanza_set_attribute(iq, STANZA_ATTR_TO, target);
xmpp_stanza_set_to(iq, target);
}
_stanza_add_unique_id(iq, "ping");
@ -1145,7 +1145,7 @@ stanza_create_caps_sha1_from_query(xmpp_stanza_t *const query)
while (child) {
if (g_strcmp0(xmpp_stanza_get_name(child), STANZA_NAME_IDENTITY) == 0) {
const char *category = xmpp_stanza_get_attribute(child, "category");
const char *type = xmpp_stanza_get_attribute(child, "type");
const char *type = xmpp_stanza_get_type(child);
const char *lang = xmpp_stanza_get_attribute(child, "xml:lang");
const char *name = xmpp_stanza_get_attribute(child, "name");
@ -1398,7 +1398,7 @@ stanza_is_muc_self_presence(xmpp_stanza_t *const stanza,
}
// check if 'from' attribute identifies this user
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
if (from) {
Jid *from_jid = jid_create(from);
if (muc_active(from_jid->barejid)) {
@ -1825,7 +1825,7 @@ stanza_create_caps_from_query_element(xmpp_stanza_t *query)
const char *name = NULL;
if (found) {
category = xmpp_stanza_get_attribute(found, "category");
type = xmpp_stanza_get_attribute(found, "type");
type = xmpp_stanza_get_type(found);
name = xmpp_stanza_get_attribute(found, "name");
}
@ -2062,7 +2062,7 @@ stanza_free_presence(XMPPPresence *presence)
XMPPPresence*
stanza_parse_presence(xmpp_stanza_t *stanza, int *err)
{
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *from = xmpp_stanza_get_from(stanza);
if (!from) {
*err = STANZA_PARSE_ERROR_NO_FROM;
return NULL;