diff options
author | Ankit Vani <a@nevitus.org> | 2013-09-07 00:10:19 +0530 |
---|---|---|
committer | Ankit Vani <a@nevitus.org> | 2013-09-07 00:10:19 +0530 |
commit | e6732d355c44689cc6f85ff18fa6f8ae0e9a502b (patch) | |
tree | c2429dc7f1118352c71b577d3dd8cae56e34815d | |
parent | f5ba1e23e499971a530d22f1d69b6dff10f47585 (diff) | |
download | pidgin-e6732d355c44689cc6f85ff18fa6f8ae0e9a502b.tar.gz |
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
121 files changed, 3994 insertions, 3994 deletions
diff --git a/libpurple/account.c b/libpurple/account.c index 2e2d537c20..c68871d206 100644 --- a/libpurple/account.c +++ b/libpurple/account.c @@ -2425,11 +2425,11 @@ purple_account_clear_current_error(PurpleAccount *account) _purple_account_set_current_error(account, NULL); } -static xmlnode * +static PurpleXmlNode * status_attribute_to_xmlnode(const PurpleStatus *status, const PurpleStatusType *type, const PurpleStatusAttribute *attr) { - xmlnode *node; + PurpleXmlNode *node; const char *id; char *value = NULL; PurpleStatusAttribute *default_attr; @@ -2487,61 +2487,61 @@ status_attribute_to_xmlnode(const PurpleStatus *status, const PurpleStatusType * g_return_val_if_fail(value, NULL); - node = xmlnode_new("attribute"); + node = purple_xmlnode_new("attribute"); - xmlnode_set_attrib(node, "id", id); - xmlnode_set_attrib(node, "value", value); + purple_xmlnode_set_attrib(node, "id", id); + purple_xmlnode_set_attrib(node, "value", value); g_free(value); return node; } -static xmlnode * +static PurpleXmlNode * status_attrs_to_xmlnode(const PurpleStatus *status) { PurpleStatusType *type = purple_status_get_status_type(status); - xmlnode *node, *child; + PurpleXmlNode *node, *child; GList *attrs, *attr; - node = xmlnode_new("attributes"); + node = purple_xmlnode_new("attributes"); attrs = purple_status_type_get_attrs(type); for (attr = attrs; attr != NULL; attr = attr->next) { child = status_attribute_to_xmlnode(status, type, (const PurpleStatusAttribute *)attr->data); if (child) - xmlnode_insert_child(node, child); + purple_xmlnode_insert_child(node, child); } return node; } -static xmlnode * +static PurpleXmlNode * status_to_xmlnode(const PurpleStatus *status) { - xmlnode *node, *child; + PurpleXmlNode *node, *child; - node = xmlnode_new("status"); - xmlnode_set_attrib(node, "type", purple_status_get_id(status)); + node = purple_xmlnode_new("status"); + purple_xmlnode_set_attrib(node, "type", purple_status_get_id(status)); if (purple_status_get_name(status) != NULL) - xmlnode_set_attrib(node, "name", purple_status_get_name(status)); - xmlnode_set_attrib(node, "active", purple_status_is_active(status) ? "true" : "false"); + purple_xmlnode_set_attrib(node, "name", purple_status_get_name(status)); + purple_xmlnode_set_attrib(node, "active", purple_status_is_active(status) ? "true" : "false"); child = status_attrs_to_xmlnode(status); - xmlnode_insert_child(node, child); + purple_xmlnode_insert_child(node, child); return node; } -static xmlnode * +static PurpleXmlNode * statuses_to_xmlnode(const PurplePresence *presence) { - xmlnode *node, *child; + PurpleXmlNode *node, *child; GList *statuses; PurpleStatus *status; - node = xmlnode_new("statuses"); + node = purple_xmlnode_new("statuses"); statuses = purple_presence_get_statuses(presence); for (; statuses != NULL; statuses = statuses->next) @@ -2550,17 +2550,17 @@ statuses_to_xmlnode(const PurplePresence *presence) if (purple_status_type_is_saveable(purple_status_get_status_type(status))) { child = status_to_xmlnode(status); - xmlnode_insert_child(node, child); + purple_xmlnode_insert_child(node, child); } } return node; } -static xmlnode * +static PurpleXmlNode * proxy_settings_to_xmlnode(PurpleProxyInfo *proxy_info) { - xmlnode *node, *child; + PurpleXmlNode *node, *child; PurpleProxyType proxy_type; const char *value; int int_value; @@ -2568,10 +2568,10 @@ proxy_settings_to_xmlnode(PurpleProxyInfo *proxy_info) proxy_type = purple_proxy_info_get_type(proxy_info); - node = xmlnode_new("proxy"); + node = purple_xmlnode_new("proxy"); - child = xmlnode_new_child(node, "type"); - xmlnode_insert_data(child, + child = purple_xmlnode_new_child(node, "type"); + purple_xmlnode_insert_data(child, (proxy_type == PURPLE_PROXY_USE_GLOBAL ? "global" : proxy_type == PURPLE_PROXY_NONE ? "none" : proxy_type == PURPLE_PROXY_HTTP ? "http" : @@ -2582,39 +2582,39 @@ proxy_settings_to_xmlnode(PurpleProxyInfo *proxy_info) if ((value = purple_proxy_info_get_host(proxy_info)) != NULL) { - child = xmlnode_new_child(node, "host"); - xmlnode_insert_data(child, value, -1); + child = purple_xmlnode_new_child(node, "host"); + purple_xmlnode_insert_data(child, value, -1); } if ((int_value = purple_proxy_info_get_port(proxy_info)) != 0) { g_snprintf(buf, sizeof(buf), "%d", int_value); - child = xmlnode_new_child(node, "port"); - xmlnode_insert_data(child, buf, -1); + child = purple_xmlnode_new_child(node, "port"); + purple_xmlnode_insert_data(child, buf, -1); } if ((value = purple_proxy_info_get_username(proxy_info)) != NULL) { - child = xmlnode_new_child(node, "username"); - xmlnode_insert_data(child, value, -1); + child = purple_xmlnode_new_child(node, "username"); + purple_xmlnode_insert_data(child, value, -1); } if ((value = purple_proxy_info_get_password(proxy_info)) != NULL) { - child = xmlnode_new_child(node, "password"); - xmlnode_insert_data(child, value, -1); + child = purple_xmlnode_new_child(node, "password"); + purple_xmlnode_insert_data(child, value, -1); } return node; } -static xmlnode * +static PurpleXmlNode * current_error_to_xmlnode(PurpleConnectionErrorInfo *err) { - xmlnode *node, *child; + PurpleXmlNode *node, *child; char type_str[3]; - node = xmlnode_new("current_error"); + node = purple_xmlnode_new("current_error"); if(err == NULL) return node; @@ -2625,16 +2625,16 @@ current_error_to_xmlnode(PurpleConnectionErrorInfo *err) if(!purple_connection_error_is_fatal (err->type)) return node; - child = xmlnode_new_child(node, "type"); + child = purple_xmlnode_new_child(node, "type"); g_snprintf(type_str, sizeof(type_str), "%u", err->type); - xmlnode_insert_data(child, type_str, -1); + purple_xmlnode_insert_data(child, type_str, -1); - child = xmlnode_new_child(node, "description"); + child = purple_xmlnode_new_child(node, "description"); if(err->description) { char *utf8ized = purple_utf8_try_convert(err->description); if(utf8ized == NULL) utf8ized = purple_utf8_salvage(err->description); - xmlnode_insert_data(child, utf8ized, -1); + purple_xmlnode_insert_data(child, utf8ized, -1); g_free(utf8ized); } @@ -2646,29 +2646,29 @@ setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data) { const char *name; PurpleAccountSetting *setting; - xmlnode *node, *child; + PurpleXmlNode *node, *child; char buf[21]; name = (const char *)key; setting = (PurpleAccountSetting *)value; - node = (xmlnode *)user_data; + node = (PurpleXmlNode *)user_data; - child = xmlnode_new_child(node, "setting"); - xmlnode_set_attrib(child, "name", name); + child = purple_xmlnode_new_child(node, "setting"); + purple_xmlnode_set_attrib(child, "name", name); if (G_VALUE_HOLDS_INT(&setting->value)) { - xmlnode_set_attrib(child, "type", "int"); + purple_xmlnode_set_attrib(child, "type", "int"); g_snprintf(buf, sizeof(buf), "%d", g_value_get_int(&setting->value)); - xmlnode_insert_data(child, buf, -1); + purple_xmlnode_insert_data(child, buf, -1); } else if (G_VALUE_HOLDS_STRING(&setting->value) && g_value_get_string(&setting->value) != NULL) { - xmlnode_set_attrib(child, "type", "string"); - xmlnode_insert_data(child, g_value_get_string(&setting->value), -1); + purple_xmlnode_set_attrib(child, "type", "string"); + purple_xmlnode_insert_data(child, g_value_get_string(&setting->value), -1); } else if (G_VALUE_HOLDS_BOOLEAN(&setting->value)) { - xmlnode_set_attrib(child, "type", "bool"); + purple_xmlnode_set_attrib(child, "type", "bool"); g_snprintf(buf, sizeof(buf), "%d", g_value_get_boolean(&setting->value)); - xmlnode_insert_data(child, buf, -1); + purple_xmlnode_insert_data(child, buf, -1); } } @@ -2677,36 +2677,36 @@ ui_setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data) { const char *ui; GHashTable *table; - xmlnode *node, *child; + PurpleXmlNode *node, *child; ui = (const char *)key; table = (GHashTable *)value; - node = (xmlnode *)user_data; + node = (PurpleXmlNode *)user_data; if (g_hash_table_size(table) > 0) { - child = xmlnode_new_child(node, "settings"); - xmlnode_set_attrib(child, "ui", ui); + child = purple_xmlnode_new_child(node, "settings"); + purple_xmlnode_set_attrib(child, "ui", ui); g_hash_table_foreach(table, setting_to_xmlnode, child); } } -xmlnode * +PurpleXmlNode * purple_account_to_xmlnode(PurpleAccount *account) { - xmlnode *node, *child; + PurpleXmlNode *node, *child; const char *tmp; PurplePresence *presence; PurpleProxyInfo *proxy_info; PurpleAccountPrivate *priv = PURPLE_ACCOUNT_GET_PRIVATE(account); - node = xmlnode_new("account"); + node = purple_xmlnode_new("account"); - child = xmlnode_new_child(node, "protocol"); - xmlnode_insert_data(child, purple_account_get_protocol_id(account), -1); + child = purple_xmlnode_new_child(node, "protocol"); + purple_xmlnode_insert_data(child, purple_account_get_protocol_id(account), -1); - child = xmlnode_new_child(node, "name"); - xmlnode_insert_data(child, purple_account_get_username(account), -1); + child = purple_xmlnode_new_child(node, "name"); + purple_xmlnode_insert_data(child, purple_account_get_username(account), -1); if (purple_account_get_remember_password(account)) { @@ -2724,13 +2724,13 @@ purple_account_to_xmlnode(PurpleAccount *account) purple_account_get_username(account), error->message); } else if (exported) { - child = xmlnode_new_child(node, "password"); + child = purple_xmlnode_new_child(node, "password"); if (keyring_id != NULL) - xmlnode_set_attrib(child, "keyring_id", keyring_id); + purple_xmlnode_set_attrib(child, "keyring_id", keyring_id); if (mode != NULL) - xmlnode_set_attrib(child, "mode", mode); + purple_xmlnode_set_attrib(child, "mode", mode); if (data != NULL) - xmlnode_insert_data(child, data, -1); + purple_xmlnode_insert_data(child, data, -1); if (destroy != NULL) destroy(data); @@ -2739,26 +2739,26 @@ purple_account_to_xmlnode(PurpleAccount *account) if ((tmp = purple_account_get_private_alias(account)) != NULL) { - child = xmlnode_new_child(node, "alias"); - xmlnode_insert_data(child, tmp, -1); + child = purple_xmlnode_new_child(node, "alias"); + purple_xmlnode_insert_data(child, tmp, -1); } if ((presence = purple_account_get_presence(account)) != NULL) { child = statuses_to_xmlnode(presence); - xmlnode_insert_child(node, child); + purple_xmlnode_insert_child(node, child); } if ((tmp = purple_account_get_user_info(account)) != NULL) { /* TODO: Do we need to call purple_str_strip_char(tmp, '\r') here? */ - child = xmlnode_new_child(node, "userinfo"); - xmlnode_insert_data(child, tmp, -1); + child = purple_xmlnode_new_child(node, "userinfo"); + purple_xmlnode_insert_data(child, tmp, -1); } if (g_hash_table_size(priv->settings) > 0) { - child = xmlnode_new_child(node, "settings"); + child = purple_xmlnode_new_child(node, "settings"); g_hash_table_foreach(priv->settings, setting_to_xmlnode, child); } @@ -2770,11 +2770,11 @@ purple_account_to_xmlnode(PurpleAccount *account) if ((proxy_info = purple_account_get_proxy_info(account)) != NULL) { child = proxy_settings_to_xmlnode(proxy_info); - xmlnode_insert_child(node, child); + purple_xmlnode_insert_child(node, child); } child = current_error_to_xmlnode(priv->current_error); - xmlnode_insert_child(node, child); + purple_xmlnode_insert_child(node, child); return node; } diff --git a/libpurple/account.h b/libpurple/account.h index 4cdb7ef6a0..86ebf312a8 100644 --- a/libpurple/account.h +++ b/libpurple/account.h @@ -1157,7 +1157,7 @@ void purple_account_clear_current_error(PurpleAccount *account); * @param account The account * @return The XML description of the account. */ -xmlnode *purple_account_to_xmlnode(PurpleAccount *account); +PurpleXmlNode *purple_account_to_xmlnode(PurpleAccount *account); /*@}*/ diff --git a/libpurple/accounts.c b/libpurple/accounts.c index a8a852f7c7..3523bea758 100644 --- a/libpurple/accounts.c +++ b/libpurple/accounts.c @@ -44,19 +44,19 @@ void _purple_account_set_current_error(PurpleAccount *account, /********************************************************************* * Writing to disk * *********************************************************************/ -static xmlnode * +static PurpleXmlNode * accounts_to_xmlnode(void) { - xmlnode *node, *child; + PurpleXmlNode *node, *child; GList *cur; - node = xmlnode_new("account"); - xmlnode_set_attrib(node, "version", "1.0"); + node = purple_xmlnode_new("account"); + purple_xmlnode_set_attrib(node, "version", "1.0"); for (cur = purple_accounts_get_all(); cur != NULL; cur = cur->next) { child = purple_account_to_xmlnode(cur->data); - xmlnode_insert_child(node, child); + purple_xmlnode_insert_child(node, child); } return node; @@ -65,7 +65,7 @@ accounts_to_xmlnode(void) static void sync_accounts(void) { - xmlnode *node; + PurpleXmlNode *node; char *data; if (!accounts_loaded) @@ -76,10 +76,10 @@ sync_accounts(void) } node = accounts_to_xmlnode(); - data = xmlnode_to_formatted_str(node, NULL); + data = purple_xmlnode_to_formatted_str(node, NULL); purple_util_write_data_to_file("accounts.xml", data, -1); g_free(data); - xmlnode_free(node); + purple_xmlnode_free(node); } static gboolean @@ -170,28 +170,28 @@ migrate_xmpp_encryption(PurpleAccount *account) } static void -parse_settings(xmlnode *node, PurpleAccount *account) +parse_settings(PurpleXmlNode *node, PurpleAccount *account) { const char *ui; - xmlnode *child; + PurpleXmlNode *child; /* Get the UI string, if these are UI settings */ - ui = xmlnode_get_attrib(node, "ui"); + ui = purple_xmlnode_get_attrib(node, "ui"); /* Read settings, one by one */ - for (child = xmlnode_get_child(node, "setting"); child != NULL; - child = xmlnode_get_next_twin(child)) + for (child = purple_xmlnode_get_child(node, "setting"); child != NULL; + child = purple_xmlnode_get_next_twin(child)) { const char *name, *str_type; PurplePrefType type; char *data; - name = xmlnode_get_attrib(child, "name"); + name = purple_xmlnode_get_attrib(child, "name"); if (name == NULL) /* Ignore this setting */ continue; - str_type = xmlnode_get_attrib(child, "type"); + str_type = purple_xmlnode_get_attrib(child, "type"); if (str_type == NULL) /* Ignore this setting */ continue; @@ -206,7 +206,7 @@ parse_settings(xmlnode *node, PurpleAccount *account) /* Ignore this setting */ continue; - data = xmlnode_get_data(child); + data = purple_xmlnode_get_data(child); if (data == NULL) /* Ignore this setting */ continue; @@ -245,17 +245,17 @@ parse_settings(xmlnode *node, PurpleAccount *account) } static GList * -parse_status_attrs(xmlnode *node, PurpleStatus *status) +parse_status_attrs(PurpleXmlNode *node, PurpleStatus *status) { GList *list = NULL; - xmlnode *child; + PurpleXmlNode *child; GValue *attr_value; - for (child = xmlnode_get_child(node, "attribute"); child != NULL; - child = xmlnode_get_next_twin(child)) + for (child = purple_xmlnode_get_child(node, "attribute"); child != NULL; + child = purple_xmlnode_get_next_twin(child)) { - const char *id = xmlnode_get_attrib(child, "id"); - const char *value = xmlnode_get_attrib(child, "value"); + const char *id = purple_xmlnode_get_attrib(child, "id"); + const char *value = purple_xmlnode_get_attrib(child, "value"); if (!id || !*id || !value || !*value) continue; @@ -290,16 +290,16 @@ parse_status_attrs(xmlnode *node, PurpleStatus *status) } static void -parse_status(xmlnode *node, PurpleAccount *account) +parse_status(PurpleXmlNode *node, PurpleAccount *account) { gboolean active = FALSE; const char *data; const char *type; - xmlnode *child; + PurpleXmlNode *child; GList *attrs = NULL; /* Get the active/inactive state */ - data = xmlnode_get_attrib(node, "active"); + data = purple_xmlnode_get_attrib(node, "active"); if (data == NULL) return; if (g_ascii_strcasecmp(data, "true") == 0) @@ -310,12 +310,12 @@ parse_status(xmlnode *node, PurpleAccount *account) return; /* Get the type of the status */ - type = xmlnode_get_attrib(node, "type"); + type = purple_xmlnode_get_attrib(node, "type"); if (type == NULL) return; /* Read attributes into a GList */ - child = xmlnode_get_child(node, "attributes"); + child = purple_xmlnode_get_child(node, "attributes"); if (child != NULL) { attrs = parse_status_attrs(child, @@ -328,22 +328,22 @@ parse_status(xmlnode *node, PurpleAccount *account) } static void -parse_statuses(xmlnode *node, PurpleAccount *account) +parse_statuses(PurpleXmlNode *node, PurpleAccount *account) { - xmlnode *child; + PurpleXmlNode *child; - for (child = xmlnode_get_child(node, "status"); child != NULL; - child = xmlnode_get_next_twin(child)) + for (child = purple_xmlnode_get_child(node, "status"); child != NULL; + child = purple_xmlnode_get_next_twin(child)) { parse_status(child, account); } } static void -parse_proxy_info(xmlnode *node, PurpleAccount *account) +parse_proxy_info(PurpleXmlNode *node, PurpleAccount *account) { PurpleProxyInfo *proxy_info; - xmlnode *child; + PurpleXmlNode *child; char *data; proxy_info = purple_proxy_info_new(); @@ -352,8 +352,8 @@ parse_proxy_info(xmlnode *node, PurpleAccount *account) purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_USE_GLOBAL); /* Read proxy type */ - child = xmlnode_get_child(node, "type"); - if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) + child = purple_xmlnode_get_child(node, "type"); + if ((child != NULL) && ((data = purple_xmlnode_get_data(child)) != NULL)) { if (purple_strequal(data, "global")) purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_USE_GLOBAL); @@ -379,32 +379,32 @@ parse_proxy_info(xmlnode *node, PurpleAccount *account) } /* Read proxy host */ - child = xmlnode_get_child(node, "host"); - if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) + child = purple_xmlnode_get_child(node, "host"); + if ((child != NULL) && ((data = purple_xmlnode_get_data(child)) != NULL)) { purple_proxy_info_set_host(proxy_info, data); g_free(data); } /* Read proxy port */ - child = xmlnode_get_child(node, "port"); - if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) + child = purple_xmlnode_get_child(node, "port"); + if ((child != NULL) && ((data = purple_xmlnode_get_data(child)) != NULL)) { purple_proxy_info_set_port(proxy_info, atoi(data)); g_free(data); } /* Read proxy username */ - child = xmlnode_get_child(node, "username"); - if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) + child = purple_xmlnode_get_child(node, "username"); + if ((child != NULL) && ((data = purple_xmlnode_get_data(child)) != NULL)) { purple_proxy_info_set_username(proxy_info, data); g_free(data); } /* Read proxy password */ - child = xmlnode_get_child(node, "password"); - if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) + child = purple_xmlnode_get_child(node, "password"); + if ((child != NULL) && ((data = purple_xmlnode_get_data(child)) != NULL)) { purple_proxy_info_set_password(proxy_info, data); g_free(data); @@ -425,15 +425,15 @@ parse_proxy_info(xmlnode *node, PurpleAccount *account) } static void -parse_current_error(xmlnode *node, PurpleAccount *account) +parse_current_error(PurpleXmlNode *node, PurpleAccount *account) { guint type; char *type_str = NULL, *description = NULL; - xmlnode *child; + PurpleXmlNode *child; PurpleConnectionErrorInfo *current_error = NULL; - child = xmlnode_get_child(node, "type"); - if (child == NULL || (type_str = xmlnode_get_data(child)) == NULL) + child = purple_xmlnode_get_child(node, "type"); + if (child == NULL || (type_str = purple_xmlnode_get_data(child)) == NULL) return; type = atoi(type_str); g_free(type_str); @@ -447,9 +447,9 @@ parse_current_error(xmlnode *node, PurpleAccount *account) type = PURPLE_CONNECTION_ERROR_OTHER_ERROR; } - child = xmlnode_get_child(node, "description"); + child = purple_xmlnode_get_child(node, "description"); if (child) - description = xmlnode_get_data(child); + description = purple_xmlnode_get_data(child); if (description == NULL) description = g_strdup(""); @@ -462,27 +462,27 @@ parse_current_error(xmlnode *node, PurpleAccount *account) } static PurpleAccount * -parse_account(xmlnode *node) +parse_account(PurpleXmlNode *node) { PurpleAccount *ret; - xmlnode *child; + PurpleXmlNode *child; char *protocol_id = NULL; char *name = NULL; char *data; - child = xmlnode_get_child(node, "protocol"); + child = purple_xmlnode_get_child(node, "protocol"); if (child != NULL) - protocol_id = xmlnode_get_data(child); + protocol_id = purple_xmlnode_get_data(child); - child = xmlnode_get_child(node, "name"); + child = purple_xmlnode_get_child(node, "name"); if (child != NULL) - name = xmlnode_get_data(child); + name = purple_xmlnode_get_data(child); if (name == NULL) { /* Do we really need to do this? */ - child = xmlnode_get_child(node, "username"); + child = purple_xmlnode_get_child(node, "username"); if (child != NULL) - name = xmlnode_get_data(child); + name = purple_xmlnode_get_data(child); } if ((protocol_id == NULL) || (name == NULL)) @@ -497,8 +497,8 @@ parse_account(xmlnode *node) g_free(protocol_id); /* Read the alias */ - child = xmlnode_get_child(node, "alias"); - if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) + child = purple_xmlnode_get_child(node, "alias"); + if ((child != NULL) && ((data = purple_xmlnode_get_data(child)) != NULL)) { if (*data != '\0') purple_account_set_private_alias(ret, data); @@ -506,23 +506,23 @@ parse_account(xmlnode *node) } /* Read the statuses */ - child = xmlnode_get_child(node, "statuses"); + child = purple_xmlnode_get_child(node, "statuses"); if (child != NULL) { parse_statuses(child, ret); } /* Read the userinfo */ - child = xmlnode_get_child(node, "userinfo"); - if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) + child = purple_xmlnode_get_child(node, "userinfo"); + if ((child != NULL) && ((data = purple_xmlnode_get_data(child)) != NULL)) { purple_account_set_user_info(ret, data); g_free(data); } /* Read an old buddyicon */ - child = xmlnode_get_child(node, "buddyicon"); - if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) + child = purple_xmlnode_get_child(node, "buddyicon"); + if ((child != NULL) && ((data = purple_xmlnode_get_data(child)) != NULL)) { const char *dirname = purple_buddy_icons_get_cache_dir(); char *filename = g_build_filename(dirname, data, NULL); @@ -539,35 +539,35 @@ parse_account(xmlnode *node) } /* Read settings (both core and UI) */ - for (child = xmlnode_get_child(node, "settings"); child != NULL; - child = xmlnode_get_next_twin(child)) + for (child = purple_xmlnode_get_child(node, "settings"); child != NULL; + child = purple_xmlnode_get_next_twin(child)) { parse_settings(child, ret); } /* Read proxy */ - child = xmlnode_get_child(node, "proxy"); + child = purple_xmlnode_get_child(node, "proxy"); if (child != NULL) { parse_proxy_info(child, ret); } /* Read current error */ - child = xmlnode_get_child(node, "current_error"); + child = purple_xmlnode_get_child(node, "current_error"); if (child != NULL) { parse_current_error(child, ret); } /* Read the password */ - child = xmlnode_get_child(node, "password"); + child = purple_xmlnode_get_child(node, "password"); if (child != NULL) { - const char *keyring_id = xmlnode_get_attrib(child, "keyring_id"); - const char *mode = xmlnode_get_attrib(child, "mode"); + const char *keyring_id = purple_xmlnode_get_attrib(child, "keyring_id"); + const char *mode = purple_xmlnode_get_attrib(child, "mode"); gboolean result; - data = xmlnode_get_data(child); + data = purple_xmlnode_get_data(child); result = purple_keyring_import_password(ret, keyring_id, mode, data, NULL); if (result == TRUE || purple_keyring_get_inuse() == NULL) { @@ -584,7 +584,7 @@ parse_account(xmlnode *node) static void load_accounts(void) { - xmlnode *node, *child; + PurpleXmlNode *node, *child; accounts_loaded = TRUE; @@ -593,15 +593,15 @@ load_accounts(void) if (node == NULL) return; - for (child = xmlnode_get_child(node, "account"); child != NULL; - child = xmlnode_get_next_twin(child)) + for (child = purple_xmlnode_get_child(node, "account"); child != NULL; + child = purple_xmlnode_get_next_twin(child)) { PurpleAccount *new_acct; new_acct = parse_account(child); purple_accounts_add(new_acct); } - xmlnode_free(node); + purple_xmlnode_free(node); _purple_buddy_icons_account_loaded_cb(); } diff --git a/libpurple/buddylist.c b/libpurple/buddylist.c index 11c2092d5d..5bc369709a 100644 --- a/libpurple/buddylist.c +++ b/libpurple/buddylist.c @@ -142,31 +142,31 @@ value_to_xmlnode(gpointer key, gpointer hvalue, gpointer user_data) { const char *name; GValue *value; - xmlnode *node, *child; + PurpleXmlNode *node, *child; char buf[21]; name = (const char *)key; value = (GValue *)hvalue; - node = (xmlnode *)user_data; + node = (PurpleXmlNode *)user_data; g_return_if_fail(value != NULL); - child = xmlnode_new_child(node, "setting"); - xmlnode_set_attrib(child, "name", name); + child = purple_xmlnode_new_child(node, "setting"); + purple_xmlnode_set_attrib(child, "name", name); if (G_VALUE_HOLDS_INT(value)) { - xmlnode_set_attrib(child, "type", "int"); + purple_xmlnode_set_attrib(child, "type", "int"); g_snprintf(buf, sizeof(buf), "%d", g_value_get_int(value)); - xmlnode_insert_data(child, buf, -1); + purple_xmlnode_insert_data(child, buf, -1); } else if (G_VALUE_HOLDS_STRING(value)) { - xmlnode_set_attrib(child, "type", "string"); - xmlnode_insert_data(child, g_value_get_string(value), -1); + purple_xmlnode_set_attrib(child, "type", "string"); + purple_xmlnode_insert_data(child, g_value_get_string(value), -1); } else if (G_VALUE_HOLDS_BOOLEAN(value)) { - xmlnode_set_attrib(child, "type", "bool"); + purple_xmlnode_set_attrib(child, "type", "bool"); g_snprintf(buf, sizeof(buf), "%d", g_value_get_boolean(value)); - xmlnode_insert_data(child, buf, -1); + purple_xmlnode_insert_data(child, buf, -1); } } @@ -175,37 +175,37 @@ chat_component_to_xmlnode(gpointer key, gpointer value, gpointer user_data) { const char *name; const char *data; - xmlnode *node, *child; + PurpleXmlNode *node, *child; name = (const char *)key; data = (const char *)value; - node = (xmlnode *)user_data; + node = (PurpleXmlNode *)user_data; g_return_if_fail(data != NULL); - child = xmlnode_new_child(node, "component"); - xmlnode_set_attrib(child, "name", name); - xmlnode_insert_data(child, data, -1); + child = purple_xmlnode_new_child(node, "component"); + purple_xmlnode_set_attrib(child, "name", name); + purple_xmlnode_insert_data(child, data, -1); } -static xmlnode * +static PurpleXmlNode * buddy_to_xmlnode(PurpleBuddy *buddy) { - xmlnode *node, *child; + PurpleXmlNode *node, *child; PurpleAccount *account = purple_buddy_get_account(buddy); const char *alias = purple_buddy_get_local_alias(buddy); - node = xmlnode_new("buddy"); - xmlnode_set_attrib(node, "account", purple_account_get_username(account)); - xmlnode_set_attrib(node, "proto", purple_account_get_protocol_id(account)); + node = purple_xmlnode_new("buddy"); + purple_xmlnode_set_attrib(node, "account", purple_account_get_username(account)); + purple_xmlnode_set_attrib(node, "proto", purple_account_get_protocol_id(account)); - child = xmlnode_new_child(node, "name"); - xmlnode_insert_data(child, purple_buddy_get_name(buddy), -1); + child = purple_xmlnode_new_child(node, "name"); + purple_xmlnode_insert_data(child, purple_buddy_get_name(buddy), -1); if (alias != NULL) { - child = xmlnode_new_child(node, "alias"); - xmlnode_insert_data(child, alias, -1); + child = purple_xmlnode_new_child(node, "alias"); + purple_xmlnode_insert_data(child, alias, -1); } /* Write buddy settings */ @@ -215,19 +215,19 @@ buddy_to_xmlnode(PurpleBuddy *buddy) return node; } -static xmlnode * +static PurpleXmlNode * contact_to_xmlnode(PurpleContact *contact) { - xmlnode *node, *child; + PurpleXmlNode *node, *child; PurpleBlistNode *bnode; gchar *alias; - node = xmlnode_new("contact"); + node = purple_xmlnode_new("contact"); g_object_get(contact, "alias", &alias, NULL); if (alias != NULL) { - xmlnode_set_attrib(node, "alias", alias); + purple_xmlnode_set_attrib(node, "alias", alias); } /* Write buddies */ @@ -238,7 +238,7 @@ contact_to_xmlnode(PurpleContact *contact) if (PURPLE_IS_BUDDY(bnode)) { child = buddy_to_xmlnode(PURPLE_BUDDY(bnode)); - xmlnode_insert_child(node, child); + purple_xmlnode_insert_child(node, child); } } @@ -250,23 +250,23 @@ contact_to_xmlnode(PurpleContact *contact) return node; } -static xmlnode * +static PurpleXmlNode * chat_to_xmlnode(PurpleChat *chat) { - xmlnode *node, *child; + PurpleXmlNode *node, *child; PurpleAccount *account = purple_chat_get_account(chat); gchar *alias; g_object_get(chat, "alias", &alias, NULL); - node = xmlnode_new("chat"); - xmlnode_set_attrib(node, "proto", purple_account_get_protocol_id(account)); - xmlnode_set_attrib(node, "account", purple_account_get_username(account)); + node = purple_xmlnode_new("chat"); + purple_xmlnode_set_attrib(node, "proto", purple_account_get_protocol_id(account)); + purple_xmlnode_set_attrib(node, "account", purple_account_get_username(account)); if (alias != NULL) { - child = xmlnode_new_child(node, "alias"); - xmlnode_insert_data(child, alias, -1); + child = purple_xmlnode_new_child(node, "alias"); + purple_xmlnode_insert_data(child, alias, -1); } /* Write chat components */ @@ -281,14 +281,14 @@ chat_to_xmlnode(PurpleChat *chat) return node; } -static xmlnode * +static PurpleXmlNode * group_to_xmlnode(PurpleGroup *group) { - xmlnode *node, *child; + PurpleXmlNode *node, *child; PurpleBlistNode *cnode; - node = xmlnode_new("group"); - xmlnode_set_attrib(node, "name", purple_group_get_name(group)); + node = purple_xmlnode_new("group"); + purple_xmlnode_set_attrib(node, "name", purple_group_get_name(group)); /* Write settings */ g_hash_table_foreach(purple_blist_node_get_settings(PURPLE_BLIST_NODE(group)), @@ -302,58 +302,58 @@ group_to_xmlnode(PurpleGroup *group) if (PURPLE_IS_CONTACT(cnode)) { child = contact_to_xmlnode(PURPLE_CONTACT(cnode)); - xmlnode_insert_child(node, child); + purple_xmlnode_insert_child(node, child); } else if (PURPLE_IS_CHAT(cnode)) { child = chat_to_xmlnode(PURPLE_CHAT(cnode)); - xmlnode_insert_child(node, child); + purple_xmlnode_insert_child(node, child); } } return node; } -static xmlnode * +static PurpleXmlNode * accountprivacy_to_xmlnode(PurpleAccount *account) { - xmlnode *node, *child; + PurpleXmlNode *node, *child; GSList *cur; char buf[10]; - node = xmlnode_new("account"); - xmlnode_set_attrib(node, "proto", purple_account_get_protocol_id(account)); - xmlnode_set_attrib(node, "name", purple_account_get_username(account)); + node = purple_xmlnode_new("account"); + purple_xmlnode_set_attrib(node, "proto", purple_account_get_protocol_id(account)); + purple_xmlnode_set_attrib(node, "name", purple_account_get_username(account)); g_snprintf(buf, sizeof(buf), "%d", purple_account_get_privacy_type(account)); - xmlnode_set_attrib(node, "mode", buf); + purple_xmlnode_set_attrib(node, "mode", buf); for (cur = purple_account_privacy_get_permitted(account); cur; cur = cur->next) { - child = xmlnode_new_child(node, "permit"); - xmlnode_insert_data(child, cur->data, -1); + child = purple_xmlnode_new_child(node, "permit"); + purple_xmlnode_insert_data(child, cur->data, -1); } for (cur = purple_account_privacy_get_denied(account); cur; cur = cur->next) { - child = xmlnode_new_child(node, "block"); - xmlnode_insert_data(child, cur->data, -1); + child = purple_xmlnode_new_child(node, "block"); + purple_xmlnode_insert_data(child, cur->data, -1); } return node; } -static xmlnode * +static PurpleXmlNode * blist_to_xmlnode(void) { - xmlnode *node, *child, *grandchild; + PurpleXmlNode *node, *child, *grandchild; PurpleBlistNode *gnode; GList *cur; - node = xmlnode_new("purple"); - xmlnode_set_attrib(node, "version", "1.0"); + node = purple_xmlnode_new("purple"); + purple_xmlnode_set_attrib(node, "version", "1.0"); /* Write groups */ - child = xmlnode_new_child(node, "blist"); + child = purple_xmlnode_new_child(node, "blist"); for (gnode = purplebuddylist->root; gnode != NULL; gnode = gnode->next) { if (purple_blist_node_is_transient(gnode)) @@ -361,16 +361,16 @@ blist_to_xmlnode(void) if (PURPLE_IS_GROUP(gnode)) { grandchild = group_to_xmlnode(PURPLE_GROUP(gnode)); - xmlnode_insert_child(child, grandchild); + purple_xmlnode_insert_child(child, grandchild); } } /* Write privacy settings */ - child = xmlnode_new_child(node, "privacy"); + child = purple_xmlnode_new_child(node, "privacy"); for (cur = purple_accounts_get_all(); cur != NULL; cur = cur->next) { grandchild = accountprivacy_to_xmlnode(cur->data); - xmlnode_insert_child(child, grandchild); + purple_xmlnode_insert_child(child, grandchild); } return node; @@ -379,7 +379,7 @@ blist_to_xmlnode(void) static void purple_blist_sync(void) { - xmlnode *node; + PurpleXmlNode *node; char *data; if (!blist_loaded) @@ -390,10 +390,10 @@ purple_blist_sync(void) } node = blist_to_xmlnode(); - data = xmlnode_to_formatted_str(node, NULL); + data = purple_xmlnode_to_formatted_str(node, NULL); purple_util_write_data_to_file("blist.xml", data, -1); g_free(data); - xmlnode_free(node); + purple_xmlnode_free(node); } static gboolean @@ -445,11 +445,11 @@ void purple_blist_schedule_save() *********************************************************************/ static void -parse_setting(PurpleBlistNode *node, xmlnode *setting) +parse_setting(PurpleBlistNode *node, PurpleXmlNode *setting) { - const char *name = xmlnode_get_attrib(setting, "name"); - const char *type = xmlnode_get_attrib(setting, "type"); - char *value = xmlnode_get_data(setting); + const char *name = purple_xmlnode_get_attrib(setting, "name"); + const char *type = purple_xmlnode_get_attrib(setting, "type"); + char *value = purple_xmlnode_get_data(setting); if (!value) return; @@ -465,16 +465,16 @@ parse_setting(PurpleBlistNode *node, xmlnode *setting) } static void -parse_buddy(PurpleGroup *group, PurpleContact *contact, xmlnode *bnode) +parse_buddy(PurpleGroup *group, PurpleContact *contact, PurpleXmlNode *bnode) { PurpleAccount *account; PurpleBuddy *buddy; char *name = NULL, *alias = NULL; const char *acct_name, *proto; - xmlnode *x; + PurpleXmlNode *x; - acct_name = xmlnode_get_attrib(bnode, "account"); - proto = xmlnode_get_attrib(bnode, "proto"); + acct_name = purple_xmlnode_get_attrib(bnode, "account"); + proto = purple_xmlnode_get_attrib(bnode, "proto"); if (!acct_name || !proto) return; @@ -484,20 +484,20 @@ parse_buddy(PurpleGroup *group, PurpleContact *contact, xmlnode *bnode) if (!account) return; - if ((x = xmlnode_get_child(bnode, "name"))) - name = xmlnode_get_data(x); + if ((x = purple_xmlnode_get_child(bnode, "name"))) + name = purple_xmlnode_get_data(x); if (!name) return; - if ((x = xmlnode_get_child(bnode, "alias"))) - alias = xmlnode_get_data(x); + if ((x = purple_xmlnode_get_child(bnode, "alias"))) + alias = purple_xmlnode_get_data(x); buddy = purple_buddy_new(account, name, alias); purple_blist_add_buddy(buddy, contact, group, _purple_blist_get_last_child((PurpleBlistNode*)contact)); - for (x = xmlnode_get_child(bnode, "setting"); x; x = xmlnode_get_next_twin(x)) { + for (x = purple_xmlnode_get_child(bnode, "setting"); x; x = purple_xmlnode_get_next_twin(x)) { parse_setting((PurpleBlistNode*)buddy, x); } @@ -506,21 +506,21 @@ parse_buddy(PurpleGroup *group, PurpleContact *contact, xmlnode *bnode) } static void -parse_contact(PurpleGroup *group, xmlnode *cnode) +parse_contact(PurpleGroup *group, PurpleXmlNode *cnode) { PurpleContact *contact = purple_contact_new(); - xmlnode *x; + PurpleXmlNode *x; const char *alias; purple_blist_add_contact(contact, group, _purple_blist_get_last_child((PurpleBlistNode*)group)); - if ((alias = xmlnode_get_attrib(cnode, "alias"))) { + if ((alias = purple_xmlnode_get_attrib(cnode, "alias"))) { purple_contact_set_alias(contact, alias); } for (x = cnode->child; x; x = x->next) { - if (x->type != XMLNODE_TYPE_TAG) + if (x->type != PURPLE_XMLNODE_TYPE_TAG) continue; if (purple_strequal(x->name, "buddy")) parse_buddy(group, contact, x); @@ -534,17 +534,17 @@ parse_contact(PurpleGroup *group, xmlnode *cnode) } static void -parse_chat(PurpleGroup *group, xmlnode *cnode) +parse_chat(PurpleGroup *group, PurpleXmlNode *cnode) { PurpleChat *chat; PurpleAccount *account; const char *acct_name, *proto; - xmlnode *x; + PurpleXmlNode *x; char *alias = NULL; GHashTable *components; - acct_name = xmlnode_get_attrib(cnode, "account"); - proto = xmlnode_get_attrib(cnode, "proto"); + acct_name = purple_xmlnode_get_attrib(cnode, "account"); + proto = purple_xmlnode_get_attrib(cnode, "proto"); if (!acct_name || !proto) return; @@ -554,17 +554,17 @@ parse_chat(PurpleGroup *group, xmlnode *cnode) if (!account) return; - if ((x = xmlnode_get_child(cnode, "alias"))) - alias = xmlnode_get_data(x); + if ((x = purple_xmlnode_get_child(cnode, "alias"))) + alias = purple_xmlnode_get_data(x); components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - for (x = xmlnode_get_child(cnode, "component"); x; x = xmlnode_get_next_twin(x)) { + for (x = purple_xmlnode_get_child(cnode, "component"); x; x = purple_xmlnode_get_next_twin(x)) { const char *name; char *value; - name = xmlnode_get_attrib(x, "name"); - value = xmlnode_get_data(x); + name = purple_xmlnode_get_attrib(x, "name"); + value = purple_xmlnode_get_data(x); g_hash_table_replace(components, g_strdup(name), value); } @@ -572,7 +572,7 @@ parse_chat(PurpleGroup *group, xmlnode *cnode) purple_blist_add_chat(chat, group, _purple_blist_get_last_child((PurpleBlistNode*)group)); - for (x = xmlnode_get_child(cnode, "setting"); x; x = xmlnode_get_next_twin(x)) { + for (x = purple_xmlnode_get_child(cnode, "setting"); x; x = purple_xmlnode_get_next_twin(x)) { parse_setting((PurpleBlistNode*)chat, x); } @@ -580,11 +580,11 @@ parse_chat(PurpleGroup *group, xmlnode *cnode) } static void -parse_group(xmlnode *groupnode) +parse_group(PurpleXmlNode *groupnode) { - const char *name = xmlnode_get_attrib(groupnode, "name"); + const char *name = purple_xmlnode_get_attrib(groupnode, "name"); PurpleGroup *group; - xmlnode *cnode; + PurpleXmlNode *cnode; if (!name) name = _("Buddies"); @@ -594,7 +594,7 @@ parse_group(xmlnode *groupnode) purple_blist_get_last_sibling(purplebuddylist->root)); for (cnode = groupnode->child; cnode; cnode = cnode->next) { - if (cnode->type != XMLNODE_TYPE_TAG) + if (cnode->type != PURPLE_XMLNODE_TYPE_TAG) continue; if (purple_strequal(cnode->name, "setting")) parse_setting((PurpleBlistNode*)group, cnode); @@ -609,7 +609,7 @@ parse_group(xmlnode *groupnode) static void load_blist(void) { - xmlnode *purple, *blist, *privacy; + PurpleXmlNode *purple, *blist, *privacy; blist_loaded = TRUE; @@ -618,27 +618,27 @@ load_blist(void) if (purple == NULL) return; - blist = xmlnode_get_child(purple, "blist"); + blist = purple_xmlnode_get_child(purple, "blist"); if (blist) { - xmlnode *groupnode; - for (groupnode = xmlnode_get_child(blist, "group"); groupnode != NULL; - groupnode = xmlnode_get_next_twin(groupnode)) { + PurpleXmlNode *groupnode; + for (groupnode = purple_xmlnode_get_child(blist, "group"); groupnode != NULL; + groupnode = purple_xmlnode_get_next_twin(groupnode)) { parse_group(groupnode); } } - privacy = xmlnode_get_child(purple, "privacy"); + privacy = purple_xmlnode_get_child(purple, "privacy"); if (privacy) { - xmlnode *anode; + PurpleXmlNode *anode; for (anode = privacy->child; anode; anode = anode->next) { - xmlnode *x; + PurpleXmlNode *x; PurpleAccount *account; int imode; const char *acct_name, *proto, *mode; - acct_name = xmlnode_get_attrib(anode, "name"); - proto = xmlnode_get_attrib(anode, "proto"); - mode = xmlnode_get_attrib(anode, "mode"); + acct_name = purple_xmlnode_get_attrib(anode, "name"); + proto = purple_xmlnode_get_attrib(anode, "proto"); + mode = purple_xmlnode_get_attrib(anode, "mode"); if (!acct_name || !proto || !mode) continue; @@ -653,15 +653,15 @@ load_blist(void) for (x = anode->child; x; x = x->next) { char *name; - if (x->type != XMLNODE_TYPE_TAG) + if (x->type != PURPLE_XMLNODE_TYPE_TAG) continue; if (purple_strequal(x->name, "permit")) { - name = xmlnode_get_data(x); + name = purple_xmlnode_get_data(x); purple_account_privacy_permit_add(account, name, TRUE); g_free(name); } else if (purple_strequal(x->name, "block")) { - name = xmlnode_get_data(x); + name = purple_xmlnode_get_data(x); purple_account_privacy_deny_add(account, name, TRUE); g_free(name); } @@ -669,7 +669,7 @@ load_blist(void) } } - xmlnode_free(purple); + purple_xmlnode_free(purple); /* This tells the buddy icon code to do its thing. */ _purple_buddy_icons_blist_loaded_cb(); diff --git a/libpurple/plugins/log_reader.c b/libpurple/plugins/log_reader.c index 3c73b6537d..bff05e1a1d 100644 --- a/libpurple/plugins/log_reader.c +++ b/libpurple/plugins/log_reader.c @@ -440,8 +440,8 @@ static void messenger_plus_logger_finalize(PurpleLog *log) static PurpleLogLogger *msn_logger; struct msn_logger_data { - xmlnode *root; - xmlnode *message; + PurpleXmlNode *root; + PurpleXmlNode *message; const char *session_id; int last_log; GString *text; @@ -450,7 +450,7 @@ struct msn_logger_data { /* This function is really confusing. It makes baby rlaager cry... In other news: "You lost a lot of blood but we found most of it." */ -static time_t msn_logger_parse_timestamp(xmlnode *message, struct tm **tm_out) +static time_t msn_logger_parse_timestamp(PurpleXmlNode *message, struct tm **tm_out) { const char *datetime; static struct tm tm2; @@ -479,7 +479,7 @@ static time_t msn_logger_parse_timestamp(xmlnode *message, struct tm **tm_out) } #endif - datetime = xmlnode_get_attrib(message, "DateTime"); + datetime = purple_xmlnode_get_attrib(message, "DateTime"); if (!(datetime && *datetime)) { purple_debug_error("MSN log timestamp parse", @@ -500,7 +500,7 @@ static time_t msn_logger_parse_timestamp(xmlnode *message, struct tm **tm_out) #endif - date = xmlnode_get_attrib(message, "Date"); + date = purple_xmlnode_get_attrib(message, "Date"); if (!(date && *date)) { purple_debug_error("MSN log timestamp parse", @@ -509,7 +509,7 @@ static time_t msn_logger_parse_timestamp(xmlnode *message, struct tm **tm_out) return stamp; } - time = xmlnode_get_attrib(message, "Time"); + time = purple_xmlnode_get_attrib(message, "Time"); if (!(time && *time)) { purple_debug_error("MSN log timestamp parse", @@ -627,8 +627,8 @@ static GList *msn_logger_list(PurpleLogType type, const char *sn, PurpleAccount GError *error = NULL; gchar *contents = NULL; gsize length; - xmlnode *root; - xmlnode *message; + PurpleXmlNode *root; + PurpleXmlNode *message; const char *old_session_id = ""; struct msn_logger_data *data = NULL; @@ -829,16 +829,16 @@ static GList *msn_logger_list(PurpleLogType type, const char *sn, PurpleAccount g_free(logfile); } - root = xmlnode_from_str(contents, length); + root = purple_xmlnode_from_str(contents, length); g_free(contents); if (!root) return list; - for (message = xmlnode_get_child(root, "Message"); message; - message = xmlnode_get_next_twin(message)) { + for (message = purple_xmlnode_get_child(root, "Message"); message; + message = purple_xmlnode_get_next_twin(message)) { const char *session_id; - session_id = xmlnode_get_attrib(message, "SessionID"); + session_id = purple_xmlnode_get_attrib(message, "SessionID"); if (!session_id) { purple_debug_error("MSN log parse", "Error parsing message: %s\n", "SessionID missing"); @@ -882,7 +882,7 @@ static char * msn_logger_read (PurpleLog *log, PurpleLogReadFlags *flags) { struct msn_logger_data *data; GString *text = NULL; - xmlnode *message; + PurpleXmlNode *message; if (flags != NULL) *flags = PURPLE_LOG_READ_NO_NEWLINE; @@ -911,14 +911,14 @@ static char * msn_logger_read (PurpleLog *log, PurpleLogReadFlags *flags) } for (message = data->message; message; - message = xmlnode_get_next_twin(message)) { + message = purple_xmlnode_get_next_twin(message)) { const char *new_session_id; - xmlnode *text_node; + PurpleXmlNode *text_node; const char *from_name = NULL; const char *to_name = NULL; - xmlnode *from; - xmlnode *to; + PurpleXmlNode *from; + PurpleXmlNode *to; enum name_guesses name_guessed = NAME_GUESS_UNKNOWN; const char *their_name; struct tm *tm; @@ -926,7 +926,7 @@ static char * msn_logger_read (PurpleLog *log, PurpleLogReadFlags *flags) char *tmp; const char *style; - new_session_id = xmlnode_get_attrib(message, "SessionID"); + new_session_id = purple_xmlnode_get_attrib(message, "SessionID"); /* If this triggers, something is wrong with the XML. */ if (!new_session_id) { @@ -942,16 +942,16 @@ static char * msn_logger_read (PurpleLog *log, PurpleLogReadFlags *flags) break; } - text_node = xmlnode_get_child(message, "Text"); + text_node = purple_xmlnode_get_child(message, "Text"); if (!text_node) continue; - from = xmlnode_get_child(message, "From"); + from = purple_xmlnode_get_child(message, "From"); if (from) { - xmlnode *user = xmlnode_get_child(from, "User"); + PurpleXmlNode *user = purple_xmlnode_get_child(from, "User"); if (user) { - from_name = xmlnode_get_attrib(user, "FriendlyName"); + from_name = purple_xmlnode_get_attrib(user, "FriendlyName"); /* This saves a check later. */ if (!*from_name) @@ -959,11 +959,11 @@ static char * msn_logger_read (PurpleLog *log, PurpleLogReadFlags *flags) } } - to = xmlnode_get_child(message, "To"); + to = purple_xmlnode_get_child(message, "To"); if (to) { - xmlnode *user = xmlnode_get_child(to, "User"); + PurpleXmlNode *user = purple_xmlnode_get_child(to, "User"); if (user) { - to_name = xmlnode_get_attrib(user, "FriendlyName"); + to_name = purple_xmlnode_get_attrib(user, "FriendlyName"); /* This saves a check later. */ if (!*to_name) @@ -1127,9 +1127,9 @@ static char * msn_logger_read (PurpleLog *log, PurpleLogReadFlags *flags) if (name_guessed != NAME_GUESS_UNKNOWN) text = g_string_append(text, "</span>"); - style = xmlnode_get_attrib(text_node, "Style"); + style = purple_xmlnode_get_attrib(text_node, "Style"); - tmp = xmlnode_get_data(text_node); + tmp = purple_xmlnode_get_data(text_node); if (style && *style) { text = g_string_append(text, "<span style=\""); text = g_string_append(text, style); @@ -1174,7 +1174,7 @@ static void msn_logger_finalize(PurpleLog *log) data = log->logger_data; if (data->last_log) - xmlnode_free(data->root); + purple_xmlnode_free(data->root); if (data->text) g_string_free(data->text, FALSE); diff --git a/libpurple/plugins/perl/common/XMLNode.xs b/libpurple/plugins/perl/common/XMLNode.xs index 0c02e58427..bb7adb7666 100644 --- a/libpurple/plugins/perl/common/XMLNode.xs +++ b/libpurple/plugins/perl/common/XMLNode.xs @@ -1,22 +1,22 @@ #include "module.h" -MODULE = Purple::XMLNode PACKAGE = Purple::XMLNode PREFIX = xmlnode_ +MODULE = Purple::XMLNode PACKAGE = Purple::XMLNode PREFIX = purple_xmlnode_ PROTOTYPES: ENABLE Purple::XMLNode -xmlnode_copy(src) +purple_xmlnode_copy(src) Purple::XMLNode src void -xmlnode_free(node) +purple_xmlnode_free(node) Purple::XMLNode node Purple::XMLNode -xmlnode_from_str(const char *str, gssize length(str)) +purple_xmlnode_from_str(const char *str, gssize length(str)) PROTOTYPE: $ const char * -xmlnode_get_name(node) +purple_xmlnode_get_name(node) Purple::XMLNode node CODE: RETVAL = node->name; @@ -24,99 +24,99 @@ xmlnode_get_name(node) RETVAL const char * -xmlnode_get_attrib(node, attr) +purple_xmlnode_get_attrib(node, attr) Purple::XMLNode node const char *attr Purple::XMLNode -xmlnode_get_child(parent, name) +purple_xmlnode_get_child(parent, name) Purple::XMLNode parent const char *name PREINIT: - xmlnode *tmp; + PurpleXmlNode *tmp; CODE: if (!name || *name == '\0') { tmp = parent->child; - while (tmp && tmp->type != XMLNODE_TYPE_TAG) + while (tmp && tmp->type != PURPLE_XMLNODE_TYPE_TAG) tmp = tmp->next; RETVAL = tmp; } else - RETVAL = xmlnode_get_child(parent, name); + RETVAL = purple_xmlnode_get_child(parent, name); OUTPUT: RETVAL Purple::XMLNode -xmlnode_get_child_with_namespace(parent, name, xmlns) +purple_xmlnode_get_child_with_namespace(parent, name, xmlns) Purple::XMLNode parent const char *name const char *xmlns gchar_own * -xmlnode_get_data(node) +purple_xmlnode_get_data(node) Purple::XMLNode node Purple::XMLNode -xmlnode_get_next(node) +purple_xmlnode_get_next(node) Purple::XMLNode node PREINIT: - xmlnode *tmp; + PurpleXmlNode *tmp; CODE: tmp = node->next; - while (tmp && tmp->type != XMLNODE_TYPE_TAG) + while (tmp && tmp->type != PURPLE_XMLNODE_TYPE_TAG) tmp = tmp->next; RETVAL = tmp; OUTPUT: RETVAL Purple::XMLNode -xmlnode_get_next_twin(node) +purple_xmlnode_get_next_twin(node) Purple::XMLNode node void -xmlnode_insert_child(parent, child) +purple_xmlnode_insert_child(parent, child) Purple::XMLNode parent Purple::XMLNode child void -xmlnode_insert_data(node, data, size) +purple_xmlnode_insert_data(node, data, size) Purple::XMLNode node const char *data gssize size Purple::XMLNode -xmlnode_new(class, name) +purple_xmlnode_new(class, name) const char *name C_ARGS: name Purple::XMLNode -xmlnode_new_child(parent, name) +purple_xmlnode_new_child(parent, name) Purple::XMLNode parent const char *name void -xmlnode_remove_attrib(node, attr) +purple_xmlnode_remove_attrib(node, attr) Purple::XMLNode node const char *attr void -xmlnode_set_attrib(node, attr, value) +purple_xmlnode_set_attrib(node, attr, value) Purple::XMLNode node const char *attr const char *value gchar_own * -xmlnode_to_formatted_str(node) +purple_xmlnode_to_formatted_str(node) Purple::XMLNode node CODE: - RETVAL = xmlnode_to_formatted_str(node, NULL); + RETVAL = purple_xmlnode_to_formatted_str(node, NULL); OUTPUT: RETVAL gchar_own * -xmlnode_to_str(node) +purple_xmlnode_to_str(node) Purple::XMLNode node CODE: - RETVAL = xmlnode_to_str(node, NULL); + RETVAL = purple_xmlnode_to_str(node, NULL); OUTPUT: RETVAL diff --git a/libpurple/plugins/perl/common/module.h b/libpurple/plugins/perl/common/module.h index 33f44115ba..df2429d7fb 100644 --- a/libpurple/plugins/perl/common/module.h +++ b/libpurple/plugins/perl/common/module.h @@ -286,8 +286,8 @@ typedef PurpleMenuAction * Purple__Menu__Action; typedef PurpleWhiteboard * Purple__Whiteboard; /* xmlnode.h */ -typedef xmlnode * Purple__XMLNode; -typedef XMLNodeType XMLNode__Type; +typedef PurpleXmlNode * Purple__XMLNode; +typedef PurpleXmlNodeType XMLNode__Type; /* other */ typedef void * Purple__Handle; diff --git a/libpurple/plugins/signals-test.c b/libpurple/plugins/signals-test.c index 132c1b0a94..2c97aa85d5 100644 --- a/libpurple/plugins/signals-test.c +++ b/libpurple/plugins/signals-test.c @@ -627,7 +627,7 @@ notify_emails_cb(char **subjects, char **froms, char **tos, char **urls, guint c **************************************************************************/ static gboolean jabber_iq_received(PurpleConnection *pc, const char *type, const char *id, - const char *from, xmlnode *iq) + const char *from, PurpleXmlNode *iq) { purple_debug_misc("signals test", "jabber IQ (type=%s, id=%s, from=%s) %p\n", type, id, from ? from : "(null)", iq); @@ -638,7 +638,7 @@ jabber_iq_received(PurpleConnection *pc, const char *type, const char *id, static gboolean jabber_message_received(PurpleConnection *pc, const char *type, const char *id, - const char *from, const char *to, xmlnode *message) + const char *from, const char *to, PurpleXmlNode *message) { purple_debug_misc("signals test", "jabber message (type=%s, id=%s, " "from=%s to=%s) %p\n", @@ -651,7 +651,7 @@ jabber_message_received(PurpleConnection *pc, const char *type, const char *id, static gboolean jabber_presence_received(PurpleConnection *pc, const char *type, - const char *from, xmlnode *presence) + const char *from, PurpleXmlNode *presence) { purple_debug_misc("signals test", "jabber presence (type=%s, from=%s) %p\n", type ? type : "(null)", from ? from : "(null)", presence); @@ -662,24 +662,24 @@ jabber_presence_received(PurpleConnection *pc, const char *type, static gboolean jabber_watched_iq(PurpleConnection *pc, const char *type, const char *id, - const char *from, xmlnode *child) + const char *from, PurpleXmlNode *child) { purple_debug_misc("signals test", "jabber watched IQ (type=%s, id=%s, from=%s)\n" "child %p name=%s, namespace=%s\n", type, id, from, child, child->name, - xmlnode_get_namespace(child)); + purple_xmlnode_get_namespace(child)); if (g_str_equal(type, "get") || g_str_equal(type, "set")) { /* Send the requisite reply */ - xmlnode *iq = xmlnode_new("iq"); - xmlnode_set_attrib(iq, "to", from); - xmlnode_set_attrib(iq, "id", id); - xmlnode_set_attrib(iq, "type", "result"); + PurpleXmlNode *iq = purple_xmlnode_new("iq"); + purple_xmlnode_set_attrib(iq, "to", from); + purple_xmlnode_set_attrib(iq, "id", id); + purple_xmlnode_set_attrib(iq, "type", "result"); purple_signal_emit(purple_connection_get_prpl(pc), "jabber-sending-xmlnode", pc, &iq); if (iq != NULL) - xmlnode_free(iq); + purple_xmlnode_free(iq); } /* Cookie monster eats IQ stanzas; the prpl shouldn't keep processing */ diff --git a/libpurple/pounce.c b/libpurple/pounce.c index ca9940c226..4d0f951d44 100644 --- a/libpurple/pounce.c +++ b/libpurple/pounce.c @@ -140,15 +140,15 @@ static void action_parameter_to_xmlnode(gpointer key, gpointer value, gpointer user_data) { const char *name, *param_value; - xmlnode *node, *child; + PurpleXmlNode *node, *child; name = (const char *)key; param_value = (const char *)value; - node = (xmlnode *)user_data; + node = (PurpleXmlNode *)user_data; - child = xmlnode_new_child(node, "param"); - xmlnode_set_attrib(child, "name", name); - xmlnode_insert_data(child, param_value, -1); + child = purple_xmlnode_new_child(node, "param"); + purple_xmlnode_set_attrib(child, "name", name); + purple_xmlnode_insert_data(child, param_value, -1); } static void @@ -156,43 +156,43 @@ action_parameter_list_to_xmlnode(gpointer key, gpointer value, gpointer user_dat { const char *action; PurplePounceActionData *action_data; - xmlnode *node, *child; + PurpleXmlNode *node, *child; action = (const char *)key; action_data = (PurplePounceActionData *)value; - node = (xmlnode *)user_data; + node = (PurpleXmlNode *)user_data; if (!action_data->enabled) return; - child = xmlnode_new_child(node, "action"); - xmlnode_set_attrib(child, "type", action); + child = purple_xmlnode_new_child(node, "action"); + purple_xmlnode_set_attrib(child, "type", action); g_hash_table_foreach(action_data->atts, action_parameter_to_xmlnode, child); } static void -add_event_to_xmlnode(xmlnode *node, const char *type) +add_event_to_xmlnode(PurpleXmlNode *node, const char *type) { - xmlnode *child; + PurpleXmlNode *child; - child = xmlnode_new_child(node, "event"); - xmlnode_set_attrib(child, "type", type); + child = purple_xmlnode_new_child(node, "event"); + purple_xmlnode_set_attrib(child, "type", type); } static void -add_option_to_xmlnode(xmlnode *node, const char *type) +add_option_to_xmlnode(PurpleXmlNode *node, const char *type) { - xmlnode *child; + PurpleXmlNode *child; - child = xmlnode_new_child(node, "option"); - xmlnode_set_attrib(child, "type", type); + child = purple_xmlnode_new_child(node, "option"); + purple_xmlnode_set_attrib(child, "type", type); } -static xmlnode * +static PurpleXmlNode * pounce_to_xmlnode(PurplePounce *pounce) { - xmlnode *node, *child; + PurpleXmlNode *node, *child; PurpleAccount *pouncer; PurplePounceEvent events; PurplePounceOption options; @@ -201,24 +201,24 @@ pounce_to_xmlnode(PurplePounce *pounce) events = purple_pounce_get_events(pounce); options = purple_pounce_get_options(pounce); - node = xmlnode_new("pounce"); - xmlnode_set_attrib(node, "ui", pounce->ui_type); + node = purple_xmlnode_new("pounce"); + purple_xmlnode_set_attrib(node, "ui", pounce->ui_type); - child = xmlnode_new_child(node, "account"); - xmlnode_set_attrib(child, "protocol", purple_account_get_protocol_id(pouncer)); - xmlnode_insert_data(child, + child = purple_xmlnode_new_child(node, "account"); + purple_xmlnode_set_attrib(child, "protocol", purple_account_get_protocol_id(pouncer)); + purple_xmlnode_insert_data(child, purple_normalize(pouncer, purple_account_get_username(pouncer)), -1); - child = xmlnode_new_child(node, "pouncee"); - xmlnode_insert_data(child, purple_pounce_get_pouncee(pounce), -1); + child = purple_xmlnode_new_child(node, "pouncee"); + purple_xmlnode_insert_data(child, purple_pounce_get_pouncee(pounce), -1); /* Write pounce options */ - child = xmlnode_new_child(node, "options"); + child = purple_xmlnode_new_child(node, "options"); if (options & PURPLE_POUNCE_OPTION_AWAY) add_option_to_xmlnode(child, "on-away"); /* Write pounce events */ - child = xmlnode_new_child(node, "events"); + child = purple_xmlnode_new_child(node, "events"); if (events & PURPLE_POUNCE_SIGNON) add_event_to_xmlnode(child, "sign-on"); if (events & PURPLE_POUNCE_SIGNOFF) @@ -241,28 +241,28 @@ pounce_to_xmlnode(PurplePounce *pounce) add_event_to_xmlnode(child, "message-received"); /* Write pounce actions */ - child = xmlnode_new_child(node, "actions"); + child = purple_xmlnode_new_child(node, "actions"); g_hash_table_foreach(pounce->actions, action_parameter_list_to_xmlnode, child); if (purple_pounce_get_save(pounce)) - xmlnode_new_child(node, "save"); + purple_xmlnode_new_child(node, "save"); return node; } -static xmlnode * +static PurpleXmlNode * pounces_to_xmlnode(void) { - xmlnode *node, *child; + PurpleXmlNode *node, *child; GList *cur; - node = xmlnode_new("pounces"); - xmlnode_set_attrib(node, "version", "1.0"); + node = purple_xmlnode_new("pounces"); + purple_xmlnode_set_attrib(node, "version", "1.0"); for (cur = purple_pounces_get_all(); cur != NULL; cur = cur->next) { child = pounce_to_xmlnode(cur->data); - xmlnode_insert_child(node, child); + purple_xmlnode_insert_child(node, child); } return node; @@ -271,7 +271,7 @@ pounces_to_xmlnode(void) static void sync_pounces(void) { - xmlnode *node; + PurpleXmlNode *node; char *data; if (!pounces_loaded) @@ -282,10 +282,10 @@ sync_pounces(void) } node = pounces_to_xmlnode(); - data = xmlnode_to_formatted_str(node, NULL); + data = purple_xmlnode_to_formatted_str(node, NULL); purple_util_write_data_to_file("pounces.xml", data, -1); g_free(data); - xmlnode_free(node); + purple_xmlnode_free(node); } static gboolean diff --git a/libpurple/prefs.c b/libpurple/prefs.c index 132facc18e..84edbb0eca 100644 --- a/libpurple/prefs.c +++ b/libpurple/prefs.c @@ -109,59 +109,59 @@ purple_pref *find_pref(const char *name) *********************************************************************/ /* - * This function recursively creates the xmlnode tree from the prefs + * This function recursively creates the PurpleXmlNode tree from the prefs * tree structure. Yay recursion! */ static void -pref_to_xmlnode(xmlnode *parent, struct purple_pref *pref) +pref_to_xmlnode(PurpleXmlNode *parent, struct purple_pref *pref) { - xmlnode *node, *childnode; + PurpleXmlNode *node, *childnode; struct purple_pref *child; char buf[21]; GList *cur; /* Create a new node */ - node = xmlnode_new_child(parent, "pref"); - xmlnode_set_attrib(node, "name", pref->name); + node = purple_xmlnode_new_child(parent, "pref"); + purple_xmlnode_set_attrib(node, "name", pref->name); /* Set the type of this node (if type == PURPLE_PREF_NONE then do nothing) */ if (pref->type == PURPLE_PREF_INT) { - xmlnode_set_attrib(node, "type", "int"); + purple_xmlnode_set_attrib(node, "type", "int"); g_snprintf(buf, sizeof(buf), "%d", pref->value.integer); - xmlnode_set_attrib(node, "value", buf); + purple_xmlnode_set_attrib(node, "value", buf); } else if (pref->type == PURPLE_PREF_STRING) { - xmlnode_set_attrib(node, "type", "string"); - xmlnode_set_attrib(node, "value", pref->value.string ? pref->value.string : ""); + purple_xmlnode_set_attrib(node, "type", "string"); + purple_xmlnode_set_attrib(node, "value", pref->value.string ? pref->value.string : ""); } else if (pref->type == PURPLE_PREF_STRING_LIST) { - xmlnode_set_attrib(node, "type", "stringlist"); + purple_xmlnode_set_attrib(node, "type", "stringlist"); for (cur = pref->value.stringlist; cur != NULL; cur = cur->next) { - childnode = xmlnode_new_child(node, "item"); - xmlnode_set_attrib(childnode, "value", cur->data ? cur->data : ""); + childnode = purple_xmlnode_new_child(node, "item"); + purple_xmlnode_set_attrib(childnode, "value", cur->data ? cur->data : ""); } } else if (pref->type == PURPLE_PREF_PATH) { char *encoded = g_filename_to_utf8(pref->value.string ? pref->value.string : "", -1, NULL, NULL, NULL); - xmlnode_set_attrib(node, "type", "path"); - xmlnode_set_attrib(node, "value", encoded); + purple_xmlnode_set_attrib(node, "type", "path"); + purple_xmlnode_set_attrib(node, "value", encoded); g_free(encoded); } else if (pref->type == PURPLE_PREF_PATH_LIST) { - xmlnode_set_attrib(node, "type", "pathlist"); + purple_xmlnode_set_attrib(node, "type", "pathlist"); for (cur = pref->value.stringlist; cur != NULL; cur = cur->next) { char *encoded = g_filename_to_utf8(cur->data ? cur->data : "", -1, NULL, NULL, NULL); - childnode = xmlnode_new_child(node, "item"); - xmlnode_set_attrib(childnode, "value", encoded); + childnode = purple_xmlnode_new_child(node, "item"); + purple_xmlnode_set_attrib(childnode, "value", encoded); g_free(encoded); } } else if (pref->type == PURPLE_PREF_BOOLEAN) { - xmlnode_set_attrib(node, "type", "bool"); + purple_xmlnode_set_attrib(node, "type", "bool"); g_snprintf(buf, sizeof(buf), "%d", pref->value.boolean); - xmlnode_set_attrib(node, "value", buf); + purple_xmlnode_set_attrib(node, "value", buf); } /* All My Children */ @@ -169,18 +169,18 @@ pref_to_xmlnode(xmlnode *parent, struct purple_pref *pref) pref_to_xmlnode(node, child); } -static xmlnode * +static PurpleXmlNode * prefs_to_xmlnode(void) { - xmlnode *node; + PurpleXmlNode *node; struct purple_pref *pref, *child; pref = &prefs; /* Create the root preference node */ - node = xmlnode_new("pref"); - xmlnode_set_attrib(node, "version", "1"); - xmlnode_set_attrib(node, "name", "/"); + node = purple_xmlnode_new("pref"); + purple_xmlnode_set_attrib(node, "version", "1"); + purple_xmlnode_set_attrib(node, "name", "/"); /* All My Children */ for (child = pref->first_child; child != NULL; child = child->sibling) @@ -192,7 +192,7 @@ prefs_to_xmlnode(void) static void sync_prefs(void) { - xmlnode *node; + PurpleXmlNode *node; char *data; if (!prefs_loaded) @@ -207,10 +207,10 @@ sync_prefs(void) } node = prefs_to_xmlnode(); - data = xmlnode_to_formatted_str(node, NULL); + data = purple_xmlnode_to_formatted_str(node, NULL); purple_util_write_data_to_file("prefs.xml", data, -1); g_free(data); - xmlnode_free(node); + purple_xmlnode_free(node); } static gboolean diff --git a/libpurple/protocols/bonjour/bonjour_ft.c b/libpurple/protocols/bonjour/bonjour_ft.c index 258f3c6915..7a86095afb 100644 --- a/libpurple/protocols/bonjour/bonjour_ft.c +++ b/libpurple/protocols/bonjour/bonjour_ft.c @@ -47,7 +47,7 @@ static unsigned int next_id = 0; static void xep_ft_si_reject(BonjourData *bd, const char *id, const char *to, const char *error_code, const char *error_type) { - xmlnode *error_node; + PurpleXmlNode *error_node; XepIq *iq; g_return_if_fail(error_code != NULL); @@ -62,21 +62,21 @@ xep_ft_si_reject(BonjourData *bd, const char *id, const char *to, const char *er if(iq == NULL) return; - error_node = xmlnode_new_child(iq->node, "error"); - xmlnode_set_attrib(error_node, "code", error_code); - xmlnode_set_attrib(error_node, "type", error_type); + error_node = purple_xmlnode_new_child(iq->node, "error"); + purple_xmlnode_set_attrib(error_node, "code", error_code); + purple_xmlnode_set_attrib(error_node, "type", error_type); /* TODO: Make this better */ if (!strcmp(error_code, "403")) { - xmlnode *tmp_node = xmlnode_new_child(error_node, "forbidden"); - xmlnode_set_namespace(tmp_node, "urn:ietf:params:xml:ns:xmpp-stanzas"); + PurpleXmlNode *tmp_node = purple_xmlnode_new_child(error_node, "forbidden"); + purple_xmlnode_set_namespace(tmp_node, "urn:ietf:params:xml:ns:xmpp-stanzas"); - tmp_node = xmlnode_new_child(error_node, "text"); - xmlnode_set_namespace(tmp_node, "urn:ietf:params:xml:ns:xmpp-stanzas"); - xmlnode_insert_data(tmp_node, "Offer Declined", -1); + tmp_node = purple_xmlnode_new_child(error_node, "text"); + purple_xmlnode_set_namespace(tmp_node, "urn:ietf:params:xml:ns:xmpp-stanzas"); + purple_xmlnode_insert_data(tmp_node, "Offer Declined", -1); } else if (!strcmp(error_code, "404")) { - xmlnode *tmp_node = xmlnode_new_child(error_node, "item-not-found"); - xmlnode_set_namespace(tmp_node, "urn:ietf:params:xml:ns:xmpp-stanzas"); + PurpleXmlNode *tmp_node = purple_xmlnode_new_child(error_node, "item-not-found"); + purple_xmlnode_set_namespace(tmp_node, "urn:ietf:params:xml:ns:xmpp-stanzas"); } xep_iq_send_and_free(iq); @@ -178,7 +178,7 @@ bonjour_si_xfer_find(BonjourData *bd, const char *sid, const char *from) static void xep_ft_si_offer(PurpleXfer *xfer, const gchar *to) { - xmlnode *si_node, *feature, *field, *file, *x; + PurpleXmlNode *si_node, *feature, *field, *file, *x; XepIq *iq; XepXfer *xf = purple_xfer_get_protocol_data(xfer); BonjourData *bd = NULL; @@ -201,39 +201,39 @@ xep_ft_si_offer(PurpleXfer *xfer, const gchar *to) return; /*Construct Stream initialization offer message.*/ - si_node = xmlnode_new_child(iq->node, "si"); - xmlnode_set_namespace(si_node, "http://jabber.org/protocol/si"); - xmlnode_set_attrib(si_node, "profile", "http://jabber.org/protocol/si/profile/file-transfer"); + si_node = purple_xmlnode_new_child(iq->node, "si"); + purple_xmlnode_set_namespace(si_node, "http://jabber.org/protocol/si"); + purple_xmlnode_set_attrib(si_node, "profile", "http://jabber.org/protocol/si/profile/file-transfer"); g_free(xf->sid); xf->sid = g_strdup(xf->iq_id); - xmlnode_set_attrib(si_node, "id", xf->sid); + purple_xmlnode_set_attrib(si_node, "id", xf->sid); - file = xmlnode_new_child(si_node, "file"); - xmlnode_set_namespace(file, "http://jabber.org/protocol/si/profile/file-transfer"); - xmlnode_set_attrib(file, "name", purple_xfer_get_filename(xfer)); + file = purple_xmlnode_new_child(si_node, "file"); + purple_xmlnode_set_namespace(file, "http://jabber.org/protocol/si/profile/file-transfer"); + purple_xmlnode_set_attrib(file, "name", purple_xfer_get_filename(xfer)); g_snprintf(buf, sizeof(buf), "%" G_GOFFSET_FORMAT, purple_xfer_get_size(xfer)); - xmlnode_set_attrib(file, "size", buf); + purple_xmlnode_set_attrib(file, "size", buf); - feature = xmlnode_new_child(si_node, "feature"); - xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg"); + feature = purple_xmlnode_new_child(si_node, "feature"); + purple_xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg"); - x = xmlnode_new_child(feature, "x"); - xmlnode_set_namespace(x, "jabber:x:data"); - xmlnode_set_attrib(x, "type", "form"); + x = purple_xmlnode_new_child(feature, "x"); + purple_xmlnode_set_namespace(x, "jabber:x:data"); + purple_xmlnode_set_attrib(x, "type", "form"); - field = xmlnode_new_child(x, "field"); - xmlnode_set_attrib(field, "var", "stream-method"); - xmlnode_set_attrib(field, "type", "list-single"); + field = purple_xmlnode_new_child(x, "field"); + purple_xmlnode_set_attrib(field, "var", "stream-method"); + purple_xmlnode_set_attrib(field, "type", "list-single"); if (xf->mode & XEP_BYTESTREAMS) { - xmlnode *option = xmlnode_new_child(field, "option"); - xmlnode *value = xmlnode_new_child(option, "value"); - xmlnode_insert_data(value, "http://jabber.org/protocol/bytestreams", -1); + PurpleXmlNode *option = purple_xmlnode_new_child(field, "option"); + PurpleXmlNode *value = purple_xmlnode_new_child(option, "value"); + purple_xmlnode_insert_data(value, "http://jabber.org/protocol/bytestreams", -1); } if (xf->mode & XEP_IBB) { - xmlnode *option = xmlnode_new_child(field, "option"); - xmlnode *value = xmlnode_new_child(option, "value"); - xmlnode_insert_data(value, "http://jabber.org/protocol/ibb", -1); + PurpleXmlNode *option = purple_xmlnode_new_child(field, "option"); + PurpleXmlNode *value = purple_xmlnode_new_child(option, "value"); + purple_xmlnode_insert_data(value, "http://jabber.org/protocol/ibb", -1); } xep_iq_send_and_free(iq); @@ -242,7 +242,7 @@ xep_ft_si_offer(PurpleXfer *xfer, const gchar *to) static void xep_ft_si_result(PurpleXfer *xfer, const char *to) { - xmlnode *si_node, *feature, *field, *value, *x; + PurpleXmlNode *si_node, *feature, *field, *value, *x; XepIq *iq; XepXfer *xf; BonjourData *bd; @@ -260,22 +260,22 @@ xep_ft_si_result(PurpleXfer *xfer, const char *to) if(iq == NULL) return; - si_node = xmlnode_new_child(iq->node, "si"); - xmlnode_set_namespace(si_node, "http://jabber.org/protocol/si"); - /*xmlnode_set_attrib(si_node, "profile", "http://jabber.org/protocol/si/profile/file-transfer");*/ + si_node = purple_xmlnode_new_child(iq->node, "si"); + purple_xmlnode_set_namespace(si_node, "http://jabber.org/protocol/si"); + /*purple_xmlnode_set_attrib(si_node, "profile", "http://jabber.org/protocol/si/profile/file-transfer");*/ - feature = xmlnode_new_child(si_node, "feature"); - xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg"); + feature = purple_xmlnode_new_child(si_node, "feature"); + purple_xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg"); - x = xmlnode_new_child(feature, "x"); - xmlnode_set_namespace(x, "jabber:x:data"); - xmlnode_set_attrib(x, "type", "submit"); + x = purple_xmlnode_new_child(feature, "x"); + purple_xmlnode_set_namespace(x, "jabber:x:data"); + purple_xmlnode_set_attrib(x, "type", "submit"); - field = xmlnode_new_child(x, "field"); - xmlnode_set_attrib(field, "var", "stream-method"); + field = purple_xmlnode_new_child(x, "field"); + purple_xmlnode_set_attrib(field, "var", "stream-method"); - value = xmlnode_new_child(field, "value"); - xmlnode_insert_data(value, "http://jabber.org/protocol/bytestreams", -1); + value = purple_xmlnode_new_child(field, "value"); + purple_xmlnode_insert_data(value, "http://jabber.org/protocol/bytestreams", -1); xep_iq_send_and_free(iq); } @@ -289,14 +289,14 @@ xep_ft_si_result(PurpleXfer *xfer, const char *to) * @param node The node to free the tree from */ static void -xmlnode_free_tree(xmlnode *node) +purple_xmlnode_free_tree(PurpleXmlNode *node) { g_return_if_fail(node != NULL); - while(xmlnode_get_parent(node)) - node = xmlnode_get_parent(node); + while(purple_xmlnode_get_parent(node)) + node = purple_xmlnode_get_parent(node); - xmlnode_free(node); + purple_xmlnode_free(node); } static void @@ -330,7 +330,7 @@ bonjour_free_xfer(PurpleXfer *xfer) g_free(xf->buddy_ip); g_free(xf->sid); - xmlnode_free_tree(xf->streamhost); + purple_xmlnode_free_tree(xf->streamhost); g_free(xf); purple_xfer_set_protocol_data(xfer, NULL); @@ -428,7 +428,7 @@ bonjour_xfer_init(PurpleXfer *xfer) } void -xep_si_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb) +xep_si_parse(PurpleConnection *pc, PurpleXmlNode *packet, PurpleBuddy *pb) { const char *type, *id; BonjourData *bd; @@ -447,30 +447,30 @@ xep_si_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb) name = purple_buddy_get_name(pb); - type = xmlnode_get_attrib(packet, "type"); - id = xmlnode_get_attrib(packet, "id"); + type = purple_xmlnode_get_attrib(packet, "type"); + id = purple_xmlnode_get_attrib(packet, "id"); if(!type) return; if(!strcmp(type, "set")) { const char *profile; - xmlnode *si; + PurpleXmlNode *si; gboolean parsed_receive = FALSE; - si = xmlnode_get_child(packet, "si"); + si = purple_xmlnode_get_child(packet, "si"); purple_debug_info("bonjour", "si offer Message type - SET.\n"); - if (si && (profile = xmlnode_get_attrib(si, "profile")) + if (si && (profile = purple_xmlnode_get_attrib(si, "profile")) && !strcmp(profile, "http://jabber.org/protocol/si/profile/file-transfer")) { const char *filename = NULL, *filesize_str = NULL; goffset filesize = 0; - xmlnode *file; + PurpleXmlNode *file; - const char *sid = xmlnode_get_attrib(si, "id"); + const char *sid = purple_xmlnode_get_attrib(si, "id"); - if ((file = xmlnode_get_child(si, "file"))) { - filename = xmlnode_get_attrib(file, "name"); - if((filesize_str = xmlnode_get_attrib(file, "size"))) + if ((file = purple_xmlnode_get_child(si, "file"))) { + filename = purple_xmlnode_get_attrib(file, "name"); + if((filesize_str = purple_xmlnode_get_attrib(file, "size"))) filesize = g_ascii_strtoll(filesize_str, NULL, 10); } @@ -585,13 +585,13 @@ xep_addr_differ(const char *buddy_ip, const char *host) * @return A pointer to the new, cloned twin if successful * or NULL otherwise. */ -static xmlnode * -xmlnode_insert_twin_copy(xmlnode *node) { - xmlnode *copy; +static PurpleXmlNode * +purple_xmlnode_insert_twin_copy(PurpleXmlNode *node) { + PurpleXmlNode *copy; g_return_val_if_fail(node != NULL, NULL); - copy = xmlnode_copy(node); + copy = purple_xmlnode_copy(node); g_return_val_if_fail(copy != NULL, NULL); copy->next = node->next; @@ -620,9 +620,9 @@ xmlnode_insert_twin_copy(xmlnode *node) { * Otherwise returns FALSE. */ static gboolean -add_ipv6_link_local_ifaces(xmlnode *cur_streamhost, const char *host, +add_ipv6_link_local_ifaces(PurpleXmlNode *cur_streamhost, const char *host, const PurpleBuddy *pb) { - xmlnode *new_streamhost = NULL; + PurpleXmlNode *new_streamhost = NULL; struct in6_addr in6_addr; BonjourBuddy *bb; GSList *ip_elem; @@ -637,10 +637,10 @@ add_ipv6_link_local_ifaces(xmlnode *cur_streamhost, const char *host, for (ip_elem = bb->ips; (ip_elem = g_slist_find_custom(ip_elem, host, (GCompareFunc)&xep_addr_differ)); ip_elem = ip_elem->next) { - purple_debug_info("bonjour", "Inserting an xmlnode twin copy for %s with new host address %s\n", + purple_debug_info("bonjour", "Inserting an PurpleXmlNode twin copy for %s with new host address %s\n", host, (char*)ip_elem->data); - new_streamhost = xmlnode_insert_twin_copy(cur_streamhost); - xmlnode_set_attrib(new_streamhost, "host", ip_elem->data); + new_streamhost = purple_xmlnode_insert_twin_copy(cur_streamhost); + purple_xmlnode_set_attrib(new_streamhost, "host", ip_elem->data); } if (!new_streamhost) @@ -651,7 +651,7 @@ add_ipv6_link_local_ifaces(xmlnode *cur_streamhost, const char *host, } static gboolean -__xep_bytestreams_parse(PurpleBuddy *pb, PurpleXfer *xfer, xmlnode *streamhost, +__xep_bytestreams_parse(PurpleBuddy *pb, PurpleXfer *xfer, PurpleXmlNode *streamhost, const char *iq_id) { char *tmp_iq_id; @@ -659,10 +659,10 @@ __xep_bytestreams_parse(PurpleBuddy *pb, PurpleXfer *xfer, xmlnode *streamhost, int portnum; XepXfer *xf = purple_xfer_get_protocol_data(xfer); - for(; streamhost; streamhost = xmlnode_get_next_twin(streamhost)) { - if(!(jid = xmlnode_get_attrib(streamhost, "jid")) || - !(host = xmlnode_get_attrib(streamhost, "host")) || - !(port = xmlnode_get_attrib(streamhost, "port")) || + for(; streamhost; streamhost = purple_xmlnode_get_next_twin(streamhost)) { + if(!(jid = purple_xmlnode_get_attrib(streamhost, "jid")) || + !(host = purple_xmlnode_get_attrib(streamhost, "host")) || + !(port = purple_xmlnode_get_attrib(streamhost, "port")) || !(portnum = atoi(port))) { purple_debug_info("bonjour", "bytestream offer Message parse error.\n"); continue; @@ -694,10 +694,10 @@ __xep_bytestreams_parse(PurpleBuddy *pb, PurpleXfer *xfer, xmlnode *streamhost, } void -xep_bytestreams_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb) +xep_bytestreams_parse(PurpleConnection *pc, PurpleXmlNode *packet, PurpleBuddy *pb) { const char *type, *from, *iq_id, *sid; - xmlnode *query, *streamhost; + PurpleXmlNode *query, *streamhost; BonjourData *bd; PurpleXfer *xfer; @@ -711,13 +711,13 @@ xep_bytestreams_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb) purple_debug_info("bonjour", "xep-bytestreams-parse.\n"); - type = xmlnode_get_attrib(packet, "type"); + type = purple_xmlnode_get_attrib(packet, "type"); from = purple_buddy_get_name(pb); - query = xmlnode_get_child(packet,"query"); + query = purple_xmlnode_get_child(packet,"query"); if(!type) return; - query = xmlnode_copy(query); + query = purple_xmlnode_copy(query); if (!query) return; @@ -728,11 +728,11 @@ xep_bytestreams_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb) purple_debug_info("bonjour", "bytestream offer Message type - SET.\n"); - iq_id = xmlnode_get_attrib(packet, "id"); + iq_id = purple_xmlnode_get_attrib(packet, "id"); - sid = xmlnode_get_attrib(query, "sid"); + sid = purple_xmlnode_get_attrib(query, "sid"); xfer = bonjour_si_xfer_find(bd, sid, from); - streamhost = xmlnode_get_child(query, "streamhost"); + streamhost = purple_xmlnode_get_child(query, "streamhost"); if(xfer && streamhost && __xep_bytestreams_parse(pb, xfer, streamhost, iq_id)) return; /* success */ @@ -908,7 +908,7 @@ bonjour_bytestreams_listen(int sock, gpointer data) PurpleXfer *xfer = data; XepXfer *xf; XepIq *iq; - xmlnode *query, *streamhost; + PurpleXmlNode *query, *streamhost; gchar *port; GSList *local_ips; BonjourData *bd; @@ -928,10 +928,10 @@ bonjour_bytestreams_listen(int sock, gpointer data) iq = xep_iq_new(bd, XEP_IQ_SET, purple_xfer_get_remote_user(xfer), bonjour_get_jid(bd->jabber_data->account), xf->sid); - query = xmlnode_new_child(iq->node, "query"); - xmlnode_set_namespace(query, "http://jabber.org/protocol/bytestreams"); - xmlnode_set_attrib(query, "sid", xf->sid); - xmlnode_set_attrib(query, "mode", "tcp"); + query = purple_xmlnode_new_child(iq->node, "query"); + purple_xmlnode_set_namespace(query, "http://jabber.org/protocol/bytestreams"); + purple_xmlnode_set_attrib(query, "sid", xf->sid); + purple_xmlnode_set_attrib(query, "mode", "tcp"); purple_xfer_set_local_port(xfer, purple_network_get_port_from_fd(sock)); @@ -939,10 +939,10 @@ bonjour_bytestreams_listen(int sock, gpointer data) port = g_strdup_printf("%hu", purple_xfer_get_local_port(xfer)); while(local_ips) { - streamhost = xmlnode_new_child(query, "streamhost"); - xmlnode_set_attrib(streamhost, "jid", xf->sid); - xmlnode_set_attrib(streamhost, "host", local_ips->data); - xmlnode_set_attrib(streamhost, "port", port); + streamhost = purple_xmlnode_new_child(query, "streamhost"); + purple_xmlnode_set_attrib(streamhost, "jid", xf->sid); + purple_xmlnode_set_attrib(streamhost, "host", local_ips->data); + purple_xmlnode_set_attrib(streamhost, "port", port); g_free(local_ips->data); local_ips = g_slist_delete_link(local_ips, local_ips); } @@ -975,7 +975,7 @@ bonjour_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_me PurpleXfer *xfer = data; XepXfer *xf = purple_xfer_get_protocol_data(xfer); XepIq *iq; - xmlnode *q_node, *tmp_node; + PurpleXmlNode *q_node, *tmp_node; BonjourData *bd; gboolean ret = FALSE; @@ -985,7 +985,7 @@ bonjour_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_me purple_debug_error("bonjour", "Error connecting via SOCKS5 to %s - %s\n", xf->proxy_host, error_message ? error_message : "(null)"); - tmp_node = xmlnode_get_next_twin(xf->streamhost); + tmp_node = purple_xmlnode_get_next_twin(xf->streamhost); ret = __xep_bytestreams_parse(xf->pb, xfer, tmp_node, xf->iq_id); if (!ret) { @@ -1004,10 +1004,10 @@ bonjour_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_me /* Notify Initiator of Connection */ iq = xep_iq_new(bd, XEP_IQ_RESULT, purple_xfer_get_remote_user(xfer), bonjour_get_jid(bd->jabber_data->account), xf->iq_id); - q_node = xmlnode_new_child(iq->node, "query"); - xmlnode_set_namespace(q_node, "http://jabber.org/protocol/bytestreams"); - tmp_node = xmlnode_new_child(q_node, "streamhost-used"); - xmlnode_set_attrib(tmp_node, "jid", xf->jid); + q_node = purple_xmlnode_new_child(iq->node, "query"); + purple_xmlnode_set_namespace(q_node, "http://jabber.org/protocol/bytestreams"); + tmp_node = purple_xmlnode_new_child(q_node, "streamhost-used"); + purple_xmlnode_set_attrib(tmp_node, "jid", xf->jid); xep_iq_send_and_free(iq); purple_xfer_start(xfer, source, NULL, -1); diff --git a/libpurple/protocols/bonjour/bonjour_ft.h b/libpurple/protocols/bonjour/bonjour_ft.h index 8effca94dc..6f8d62464f 100644 --- a/libpurple/protocols/bonjour/bonjour_ft.h +++ b/libpurple/protocols/bonjour/bonjour_ft.h @@ -50,7 +50,7 @@ struct _XepXfer char *jid; char *proxy_host; int proxy_port; - xmlnode *streamhost; + PurpleXmlNode *streamhost; PurpleBuddy *pb; }; @@ -71,7 +71,7 @@ PurpleXfer *bonjour_new_xfer(PurpleConnection *gc, const char *who); */ void bonjour_send_file(PurpleConnection *gc, const char *who, const char *file); -void xep_si_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb); +void xep_si_parse(PurpleConnection *pc, PurpleXmlNode *packet, PurpleBuddy *pb); void -xep_bytestreams_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb); +xep_bytestreams_parse(PurpleConnection *pc, PurpleXmlNode *packet, PurpleBuddy *pb); #endif diff --git a/libpurple/protocols/bonjour/jabber.c b/libpurple/protocols/bonjour/jabber.c index 241abf16be..1660f0a89d 100644 --- a/libpurple/protocols/bonjour/jabber.c +++ b/libpurple/protocols/bonjour/jabber.c @@ -82,7 +82,7 @@ enum sent_stream_start_types { }; static void -xep_iq_parse(xmlnode *packet, PurpleBuddy *pb); +xep_iq_parse(PurpleXmlNode *packet, PurpleBuddy *pb); static BonjourJabberConversation * bonjour_jabber_conv_new(PurpleBuddy *pb, PurpleAccount *account, const char *ip) { @@ -122,14 +122,14 @@ _font_size_ichat_to_purple(int size) } static gchar * -get_xmlnode_contents(xmlnode *node) +get_xmlnode_contents(PurpleXmlNode *node) { gchar *contents; - contents = xmlnode_to_str(node, NULL); + contents = purple_xmlnode_to_str(node, NULL); /* we just want the stuff inside <font></font> - * There isn't stuff exposed in xmlnode.c to do this more cleanly. */ + * There isn't stuff exposed in PurpleXmlNode.c to do this more cleanly. */ if (contents) { char *bodystart = strchr(contents, '>'); @@ -144,27 +144,27 @@ get_xmlnode_contents(xmlnode *node) } static void -_jabber_parse_and_write_message_to_ui(xmlnode *message_node, PurpleBuddy *pb) +_jabber_parse_and_write_message_to_ui(PurpleXmlNode *message_node, PurpleBuddy *pb) { - xmlnode *body_node, *html_node, *events_node; + PurpleXmlNode *body_node, *html_node, *events_node; PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(pb)); gchar *body = NULL; - body_node = xmlnode_get_child(message_node, "body"); - html_node = xmlnode_get_child(message_node, "html"); + body_node = purple_xmlnode_get_child(message_node, "body"); + html_node = purple_xmlnode_get_child(message_node, "html"); if (body_node == NULL && html_node == NULL) { purple_debug_error("bonjour", "No body or html node found, discarding message.\n"); return; } - events_node = xmlnode_get_child_with_namespace(message_node, "x", "jabber:x:event"); + events_node = purple_xmlnode_get_child_with_namespace(message_node, "x", "jabber:x:event"); if (events_node != NULL) { #if 0 - if (xmlnode_get_child(events_node, "composing") != NULL) + if (purple_xmlnode_get_child(events_node, "composing") != NULL) composing_event = TRUE; #endif - if (xmlnode_get_child(events_node, "id") != NULL) { + if (purple_xmlnode_get_child(events_node, "id") != NULL) { /* The user is just typing */ /* TODO: Deal with typing notification */ return; @@ -172,33 +172,33 @@ _jabber_parse_and_write_message_to_ui(xmlnode *message_node, PurpleBuddy *pb) } if (html_node != NULL) { - xmlnode *html_body_node; + PurpleXmlNode *html_body_node; - html_body_node = xmlnode_get_child(html_node, "body"); + html_body_node = purple_xmlnode_get_child(html_node, "body"); if (html_body_node != NULL) { - xmlnode *html_body_font_node; + PurpleXmlNode *html_body_font_node; - html_body_font_node = xmlnode_get_child(html_body_node, "font"); + html_body_font_node = purple_xmlnode_get_child(html_body_node, "font"); /* Types of messages sent by iChat */ if (html_body_font_node != NULL) { gchar *html_body; const char *font_face, *font_size, *font_color, *ichat_balloon_color, *ichat_text_color; - font_face = xmlnode_get_attrib(html_body_font_node, "face"); + font_face = purple_xmlnode_get_attrib(html_body_font_node, "face"); /* The absolute iChat font sizes should be converted to 1..7 range */ - font_size = xmlnode_get_attrib(html_body_font_node, "ABSZ"); + font_size = purple_xmlnode_get_attrib(html_body_font_node, "ABSZ"); if (font_size != NULL) font_size = _font_size_ichat_to_purple(atoi(font_size)); - font_color = xmlnode_get_attrib(html_body_font_node, "color"); - ichat_balloon_color = xmlnode_get_attrib(html_body_node, "ichatballooncolor"); - ichat_text_color = xmlnode_get_attrib(html_body_node, "ichattextcolor"); + font_color = purple_xmlnode_get_attrib(html_body_font_node, "color"); + ichat_balloon_color = purple_xmlnode_get_attrib(html_body_node, "ichatballooncolor"); + ichat_text_color = purple_xmlnode_get_attrib(html_body_node, "ichattextcolor"); html_body = get_xmlnode_contents(html_body_font_node); if (html_body == NULL) /* This is the kind of formatted messages that Purple creates */ - html_body = xmlnode_to_str(html_body_font_node, NULL); + html_body = purple_xmlnode_to_str(html_body_font_node, NULL); if (html_body != NULL) { GString *str = g_string_new("<font"); @@ -225,7 +225,7 @@ _jabber_parse_and_write_message_to_ui(xmlnode *message_node, PurpleBuddy *pb) /* Compose the message */ if (body == NULL && body_node != NULL) - body = xmlnode_get_data(body_node); + body = purple_xmlnode_get_data(body_node); if (body == NULL) { purple_debug_error("bonjour", "No html body or regular body found.\n"); @@ -370,7 +370,7 @@ _send_data(PurpleBuddy *pb, char *message) return ret; } -void bonjour_jabber_process_packet(PurpleBuddy *pb, xmlnode *packet) { +void bonjour_jabber_process_packet(PurpleBuddy *pb, PurpleXmlNode *packet) { g_return_if_fail(packet != NULL); g_return_if_fail(pb != NULL); @@ -1070,7 +1070,7 @@ _find_or_start_conversation(BonjourJabber *jdata, const gchar *to) int bonjour_jabber_send_message(BonjourJabber *jdata, const gchar *to, const gchar *body) { - xmlnode *message_node, *node, *node2; + PurpleXmlNode *message_node, *node, *node2; gchar *message, *xhtml; PurpleBuddy *pb; BonjourBuddy *bb; @@ -1085,32 +1085,32 @@ bonjour_jabber_send_message(BonjourJabber *jdata, const gchar *to, const gchar * purple_markup_html_to_xhtml(body, &xhtml, &message); - message_node = xmlnode_new("message"); - xmlnode_set_attrib(message_node, "to", bb->name); - xmlnode_set_attrib(message_node, "from", bonjour_get_jid(jdata->account)); - xmlnode_set_attrib(message_node, "type", "chat"); + message_node = purple_xmlnode_new("message"); + purple_xmlnode_set_attrib(message_node, "to", bb->name); + purple_xmlnode_set_attrib(message_node, "from", bonjour_get_jid(jdata->account)); + purple_xmlnode_set_attrib(message_node, "type", "chat"); /* Enclose the message from the UI within a "font" node */ - node = xmlnode_new_child(message_node, "body"); - xmlnode_insert_data(node, message, strlen(message)); + node = purple_xmlnode_new_child(message_node, "body"); + purple_xmlnode_insert_data(node, message, strlen(message)); g_free(message); - node = xmlnode_new_child(message_node, "html"); - xmlnode_set_namespace(node, "http://www.w3.org/1999/xhtml"); + node = purple_xmlnode_new_child(message_node, "html"); + purple_xmlnode_set_namespace(node, "http://www.w3.org/1999/xhtml"); - node = xmlnode_new_child(node, "body"); + node = purple_xmlnode_new_child(node, "body"); message = g_strdup_printf("<font>%s</font>", xhtml); - node2 = xmlnode_from_str(message, strlen(message)); + node2 = purple_xmlnode_from_str(message, strlen(message)); g_free(xhtml); g_free(message); - xmlnode_insert_child(node, node2); + purple_xmlnode_insert_child(node, node2); - node = xmlnode_new_child(message_node, "x"); - xmlnode_set_namespace(node, "jabber:x:event"); - xmlnode_insert_child(node, xmlnode_new("composing")); + node = purple_xmlnode_new_child(message_node, "x"); + purple_xmlnode_set_namespace(node, "jabber:x:event"); + purple_xmlnode_insert_child(node, purple_xmlnode_new("composing")); - message = xmlnode_to_str(message_node, NULL); - xmlnode_free(message_node); + message = purple_xmlnode_to_str(message_node, NULL); + purple_xmlnode_free(message_node); ret = _send_data(pb, message) >= 0; @@ -1251,34 +1251,34 @@ bonjour_jabber_stop(BonjourJabber *jdata) XepIq * xep_iq_new(void *data, XepIqType type, const char *to, const char *from, const char *id) { - xmlnode *iq_node = NULL; + PurpleXmlNode *iq_node = NULL; XepIq *iq = NULL; g_return_val_if_fail(data != NULL, NULL); g_return_val_if_fail(to != NULL, NULL); g_return_val_if_fail(id != NULL, NULL); - iq_node = xmlnode_new("iq"); + iq_node = purple_xmlnode_new("iq"); - xmlnode_set_attrib(iq_node, "to", to); - xmlnode_set_attrib(iq_node, "from", from); - xmlnode_set_attrib(iq_node, "id", id); + purple_xmlnode_set_attrib(iq_node, "to", to); + purple_xmlnode_set_attrib(iq_node, "from", from); + purple_xmlnode_set_attrib(iq_node, "id", id); switch (type) { case XEP_IQ_SET: - xmlnode_set_attrib(iq_node, "type", "set"); + purple_xmlnode_set_attrib(iq_node, "type", "set"); break; case XEP_IQ_GET: - xmlnode_set_attrib(iq_node, "type", "get"); + purple_xmlnode_set_attrib(iq_node, "type", "get"); break; case XEP_IQ_RESULT: - xmlnode_set_attrib(iq_node, "type", "result"); + purple_xmlnode_set_attrib(iq_node, "type", "result"); break; case XEP_IQ_ERROR: - xmlnode_set_attrib(iq_node, "type", "error"); + purple_xmlnode_set_attrib(iq_node, "type", "error"); break; case XEP_IQ_NONE: default: - xmlnode_set_attrib(iq_node, "type", "none"); + purple_xmlnode_set_attrib(iq_node, "type", "none"); break; } @@ -1317,7 +1317,7 @@ check_if_blocked(PurpleBuddy *pb) } static void -xep_iq_parse(xmlnode *packet, PurpleBuddy *pb) +xep_iq_parse(PurpleXmlNode *packet, PurpleBuddy *pb) { PurpleAccount *account; PurpleConnection *gc; @@ -1328,7 +1328,7 @@ xep_iq_parse(xmlnode *packet, PurpleBuddy *pb) account = purple_buddy_get_account(pb); gc = purple_account_get_connection(account); - if (xmlnode_get_child(packet, "si") != NULL || xmlnode_get_child(packet, "error") != NULL) + if (purple_xmlnode_get_child(packet, "si") != NULL || purple_xmlnode_get_child(packet, "error") != NULL) xep_si_parse(gc, packet, pb); else xep_bytestreams_parse(gc, packet, pb); @@ -1345,12 +1345,12 @@ xep_iq_send_and_free(XepIq *iq) /* Send the message */ if (pb != NULL) { /* Convert xml node into stream */ - gchar *msg = xmlnode_to_str(iq->node, NULL); + gchar *msg = purple_xmlnode_to_str(iq->node, NULL); ret = _send_data(pb, msg); g_free(msg); } - xmlnode_free(iq->node); + purple_xmlnode_free(iq->node); iq->node = NULL; g_free(iq); diff --git a/libpurple/protocols/bonjour/jabber.h b/libpurple/protocols/bonjour/jabber.h index e0a1d0a2cd..390e76367a 100644 --- a/libpurple/protocols/bonjour/jabber.h +++ b/libpurple/protocols/bonjour/jabber.h @@ -56,7 +56,7 @@ typedef struct _BonjourJabberConversation PurpleProxyConnectData *connect_data; gpointer stream_data; xmlParserCtxt *context; - xmlnode *current; + PurpleXmlNode *current; PurpleBuddy *pb; PurpleAccount *account; @@ -83,7 +83,7 @@ void async_bonjour_jabber_close_conversation(BonjourJabberConversation *bconv); void bonjour_jabber_stream_started(BonjourJabberConversation *bconv); -void bonjour_jabber_process_packet(PurpleBuddy *pb, xmlnode *packet); +void bonjour_jabber_process_packet(PurpleBuddy *pb, PurpleXmlNode *packet); void bonjour_jabber_stop(BonjourJabber *data); @@ -102,7 +102,7 @@ typedef enum { typedef struct _XepIq { XepIqType type; char *id; - xmlnode *node; + PurpleXmlNode *node; char *to; void *data; } XepIq; diff --git a/libpurple/protocols/bonjour/parser.c b/libpurple/protocols/bonjour/parser.c index 113cef5d52..eaef50a76a 100644 --- a/libpurple/protocols/bonjour/parser.c +++ b/libpurple/protocols/bonjour/parser.c @@ -57,7 +57,7 @@ bonjour_parser_element_start_libxml(void *user_data, { BonjourJabberConversation *bconv = user_data; - xmlnode *node; + PurpleXmlNode *node; int i; g_return_if_fail(element_name != NULL); @@ -85,10 +85,10 @@ bonjour_parser_element_start_libxml(void *user_data, bonjour_jabber_conv_match_by_ip(bconv); if(bconv->current) - node = xmlnode_new_child(bconv->current, (const char*) element_name); + node = purple_xmlnode_new_child(bconv->current, (const char*) element_name); else - node = xmlnode_new((const char*) element_name); - xmlnode_set_namespace(node, (const char*) namespace); + node = purple_xmlnode_new((const char*) element_name); + purple_xmlnode_set_namespace(node, (const char*) namespace); for(i=0; i < nb_attributes * 5; i+=5) { const char *name = (const char *)attributes[i]; @@ -104,7 +104,7 @@ bonjour_parser_element_start_libxml(void *user_data, txt = attrib; attrib = purple_unescape_text(txt); g_free(txt); - xmlnode_set_attrib_full(node, name, attrib_ns, prefix, attrib); + purple_xmlnode_set_attrib_full(node, name, attrib_ns, prefix, attrib); g_free(attrib); } @@ -119,7 +119,7 @@ bonjour_parser_element_end_libxml(void *user_data, const xmlChar *element_name, BonjourJabberConversation *bconv = user_data; if(!bconv->current) { - /* We don't keep a reference to the start stream xmlnode, + /* We don't keep a reference to the start stream PurpleXmlNode, * so we have to check for it here to close the conversation */ if(!xmlStrcmp(element_name, (xmlChar*) "stream")) /* Asynchronously close the conversation to prevent bonjour_parser_setup() @@ -132,10 +132,10 @@ bonjour_parser_element_end_libxml(void *user_data, const xmlChar *element_name, if(!xmlStrcmp((xmlChar*) bconv->current->name, element_name)) bconv->current = bconv->current->parent; } else { - xmlnode *packet = bconv->current; + PurpleXmlNode *packet = bconv->current; bconv->current = NULL; bonjour_jabber_process_packet(bconv->pb, packet); - xmlnode_free(packet); + purple_xmlnode_free(packet); } } @@ -150,7 +150,7 @@ bonjour_parser_element_text_libxml(void *user_data, const xmlChar *text, int tex if(!text || !text_len) return; - xmlnode_insert_data(bconv->current, (const char*) text, text_len); + purple_xmlnode_insert_data(bconv->current, (const char*) text, text_len); } static void diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index 11f561062e..efef4be35c 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -475,40 +475,40 @@ static void ggp_typing_notification_handler(PurpleConnection *gc, uin_t uin, int */ static void ggp_xml_event_handler(PurpleConnection *gc, char *data) { - xmlnode *xml = NULL; - xmlnode *xmlnode_next_event; + PurpleXmlNode *xml = NULL; + PurpleXmlNode *purple_xmlnode_next_event; - xml = xmlnode_from_str(data, -1); + xml = purple_xmlnode_from_str(data, -1); if (xml == NULL) goto out; - xmlnode_next_event = xmlnode_get_child(xml, "event"); - while (xmlnode_next_event != NULL) + purple_xmlnode_next_event = purple_xmlnode_get_child(xml, "event"); + while (purple_xmlnode_next_event != NULL) { - xmlnode *xmlnode_current_event = xmlnode_next_event; + PurpleXmlNode *purple_xmlnode_current_event = purple_xmlnode_next_event; - xmlnode *xmlnode_type; + PurpleXmlNode *purple_xmlnode_type; char *event_type_raw; int event_type = 0; - xmlnode *xmlnode_sender; + PurpleXmlNode *purple_xmlnode_sender; char *event_sender_raw; uin_t event_sender = 0; - xmlnode_next_event = xmlnode_get_next_twin(xmlnode_next_event); + purple_xmlnode_next_event = purple_xmlnode_get_next_twin(purple_xmlnode_next_event); - xmlnode_type = xmlnode_get_child(xmlnode_current_event, "type"); - if (xmlnode_type == NULL) + purple_xmlnode_type = purple_xmlnode_get_child(purple_xmlnode_current_event, "type"); + if (purple_xmlnode_type == NULL) continue; - event_type_raw = xmlnode_get_data(xmlnode_type); + event_type_raw = purple_xmlnode_get_data(purple_xmlnode_type); if (event_type_raw != NULL) event_type = atoi(event_type_raw); g_free(event_type_raw); - xmlnode_sender = xmlnode_get_child(xmlnode_current_event, "sender"); - if (xmlnode_sender != NULL) + purple_xmlnode_sender = purple_xmlnode_get_child(purple_xmlnode_current_event, "sender"); + if (purple_xmlnode_sender != NULL) { - event_sender_raw = xmlnode_get_data(xmlnode_sender); + event_sender_raw = purple_xmlnode_get_data(purple_xmlnode_sender); if (event_sender_raw != NULL) event_sender = ggp_str_to_uin(event_sender_raw); g_free(event_sender_raw); @@ -530,7 +530,7 @@ static void ggp_xml_event_handler(PurpleConnection *gc, char *data) out: if (xml) - xmlnode_free(xml); + purple_xmlnode_free(xml); } static void ggp_callback_recv(gpointer _gc, gint fd, PurpleInputCondition cond) diff --git a/libpurple/protocols/gg/oauth/oauth-purple.c b/libpurple/protocols/gg/oauth/oauth-purple.c index 9e1b0f307b..9925db876d 100644 --- a/libpurple/protocols/gg/oauth/oauth-purple.c +++ b/libpurple/protocols/gg/oauth/oauth-purple.c @@ -110,7 +110,7 @@ static void ggp_oauth_request_token_got(PurpleHttpConnection *http_conn, ggp_oauth_data *data = user_data; PurpleAccount *account; PurpleHttpRequest *req; - xmlnode *xml; + PurpleXmlNode *xml; gchar *request_data; gboolean succ = TRUE; const gchar *xml_raw; @@ -134,7 +134,7 @@ static void ggp_oauth_request_token_got(PurpleHttpConnection *http_conn, "got request token, doing authorization...\n"); xml_raw = purple_http_response_get_data(response, NULL); - xml = xmlnode_from_str(xml_raw, -1); + xml = purple_xmlnode_from_str(xml_raw, -1); if (xml == NULL) { purple_debug_error("gg", "ggp_oauth_request_token_got: " @@ -146,7 +146,7 @@ static void ggp_oauth_request_token_got(PurpleHttpConnection *http_conn, succ &= ggp_xml_get_string(xml, "oauth_token", &data->token); succ &= ggp_xml_get_string(xml, "oauth_token_secret", &data->token_secret); - xmlnode_free(xml); + purple_xmlnode_free(xml); if (!succ) { purple_debug_error("gg", "ggp_oauth_request_token_got: " @@ -224,12 +224,12 @@ static void ggp_oauth_access_token_got(PurpleHttpConnection *http_conn, { ggp_oauth_data *data = user_data; gchar *token, *token_secret; - xmlnode *xml; + PurpleXmlNode *xml; const gchar *xml_raw; gboolean succ = TRUE; xml_raw = purple_http_response_get_data(response, NULL); - xml = xmlnode_from_str(xml_raw, -1); + xml = purple_xmlnode_from_str(xml_raw, -1); if (xml == NULL) { purple_debug_error("gg", "ggp_oauth_access_token_got: " @@ -241,7 +241,7 @@ static void ggp_oauth_access_token_got(PurpleHttpConnection *http_conn, succ &= ggp_xml_get_string(xml, "oauth_token", &token); succ &= ggp_xml_get_string(xml, "oauth_token_secret", &token_secret); - xmlnode_free(xml); + purple_xmlnode_free(xml); if (!succ || strlen(token) < 10) { purple_debug_error("gg", "ggp_oauth_access_token_got: " diff --git a/libpurple/protocols/gg/pubdir-prpl.c b/libpurple/protocols/gg/pubdir-prpl.c index 1065f27a4e..928575ddb5 100644 --- a/libpurple/protocols/gg/pubdir-prpl.c +++ b/libpurple/protocols/gg/pubdir-prpl.c @@ -221,7 +221,7 @@ static void ggp_pubdir_got_data(PurpleHttpConnection *http_conn, ggp_pubdir_request *request = _request; PurpleConnection *gc = request->gc; gboolean succ = TRUE; - xmlnode *xml; + PurpleXmlNode *xml; const gchar *xml_raw; unsigned int status, next_offset; int record_count, i; @@ -234,7 +234,7 @@ static void ggp_pubdir_got_data(PurpleHttpConnection *http_conn, xml_raw); } - xml = xmlnode_from_str(xml_raw, -1); + xml = purple_xmlnode_from_str(xml_raw, -1); if (xml == NULL) { purple_debug_error("gg", "ggp_pubdir_got_data: " @@ -247,7 +247,7 @@ static void ggp_pubdir_got_data(PurpleHttpConnection *http_conn, succ &= ggp_xml_get_uint(xml, "status", &status); if (!ggp_xml_get_uint(xml, "nextOffset", &next_offset)) next_offset = 0; - xml = xmlnode_get_child(xml, "users"); + xml = purple_xmlnode_get_child(xml, "users"); if (!succ || status != 0 || !xml) { purple_debug_error("gg", "ggp_pubdir_got_data: " @@ -260,7 +260,7 @@ static void ggp_pubdir_got_data(PurpleHttpConnection *http_conn, record_count = ggp_xml_child_count(xml, "user"); records = g_new0(ggp_pubdir_record, record_count); - xml = xmlnode_get_child(xml, "user"); + xml = purple_xmlnode_get_child(xml, "user"); i = 0; while (xml) { @@ -271,7 +271,7 @@ static void ggp_pubdir_got_data(PurpleHttpConnection *http_conn, g_assert(i <= record_count); - record->uin = ggp_str_to_uin(xmlnode_get_attrib(xml, "uin")); + record->uin = ggp_str_to_uin(purple_xmlnode_get_attrib(xml, "uin")); if (record->uin == 0) ggp_xml_get_uint(xml, "uin", &record->uin); if (record->uin == 0) @@ -341,7 +341,7 @@ static void ggp_pubdir_got_data(PurpleHttpConnection *http_conn, g_free(city); - xml = xmlnode_get_next_twin(xml); + xml = purple_xmlnode_get_next_twin(xml); } request->cb(gc, record_count, records, next_offset, request->user_data); diff --git a/libpurple/protocols/gg/roster.c b/libpurple/protocols/gg/roster.c index 6bf4abdb02..fcc052bcc2 100644 --- a/libpurple/protocols/gg/roster.c +++ b/libpurple/protocols/gg/roster.c @@ -48,19 +48,19 @@ typedef struct { int version; - xmlnode *xml; + PurpleXmlNode *xml; - xmlnode *groups_node, *contacts_node; + PurpleXmlNode *groups_node, *contacts_node; /** * Key: (uin_t) user identifier - * Value: (xmlnode*) xml node for contact + * Value: (PurpleXmlNode*) xml node for contact */ GHashTable *contact_nodes; /** * Key: (gchar*) group id - * Value: (xmlnode*) xml node for group + * Value: (PurpleXmlNode*) xml node for group */ GHashTable *group_nodes; @@ -116,10 +116,10 @@ static void ggp_roster_set_synchronized(PurpleConnection *gc, PurpleBuddy *buddy, gboolean synchronized); // buddy list import -static gboolean ggp_roster_reply_list_read_group(xmlnode *node, +static gboolean ggp_roster_reply_list_read_group(PurpleXmlNode *node, ggp_roster_content *content); static gboolean ggp_roster_reply_list_read_buddy(PurpleConnection *gc, - xmlnode *node, ggp_roster_content *content, GHashTable *remove_buddies); + PurpleXmlNode *node, ggp_roster_content *content, GHashTable *remove_buddies); static void ggp_roster_reply_list(PurpleConnection *gc, uint32_t version, const char *reply); @@ -150,7 +150,7 @@ static void ggp_roster_content_free(ggp_roster_content *content) if (content == NULL) return; if (content->xml) - xmlnode_free(content->xml); + purple_xmlnode_free(content->xml); if (content->contact_nodes) g_hash_table_destroy(content->contact_nodes); if (content->group_nodes) @@ -205,7 +205,7 @@ static void ggp_roster_dump(ggp_roster_content *content) g_return_if_fail(content != NULL); g_return_if_fail(content->xml != NULL); - str = xmlnode_to_formatted_str(content->xml, &len); + str = purple_xmlnode_to_formatted_str(content->xml, &len); purple_debug_misc("gg", "ggp_roster_dump: [%s]\n", str); g_free(str); } @@ -434,7 +434,7 @@ void ggp_roster_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, * Buddy list import. ******************************************************************************/ -static gboolean ggp_roster_reply_list_read_group(xmlnode *node, +static gboolean ggp_roster_reply_list_read_group(PurpleXmlNode *node, ggp_roster_content *content) { char *name, *id; @@ -476,12 +476,12 @@ static gboolean ggp_roster_reply_list_read_group(xmlnode *node, } static gboolean ggp_roster_reply_list_read_buddy(PurpleConnection *gc, - xmlnode *node, ggp_roster_content *content, GHashTable *remove_buddies) + PurpleXmlNode *node, ggp_roster_content *content, GHashTable *remove_buddies) { gchar *alias, *group_name; uin_t uin; gboolean succ = TRUE; - xmlnode *group_list, *group_elem; + PurpleXmlNode *group_list, *group_elem; PurpleBuddy *buddy = NULL; PurpleGroup *group = NULL; PurpleGroup *currentGroup; @@ -491,7 +491,7 @@ static gboolean ggp_roster_reply_list_read_buddy(PurpleConnection *gc, succ &= ggp_xml_get_string(node, "ShowName", &alias); succ &= ggp_xml_get_uint(node, "GGNumber", &uin); - group_list = xmlnode_get_child(node, "Groups"); + group_list = purple_xmlnode_get_child(node, "Groups"); succ &= (group_list != NULL); if (!succ) @@ -511,7 +511,7 @@ static gboolean ggp_roster_reply_list_read_buddy(PurpleConnection *gc, } // getting (eventually creating) group - group_elem = xmlnode_get_child(group_list, "GroupId"); + group_elem = purple_xmlnode_get_child(group_list, "GroupId"); while (group_elem != NULL) { gchar *id; @@ -534,7 +534,7 @@ static gboolean ggp_roster_reply_list_read_buddy(PurpleConnection *gc, if (group_name != NULL) break; - group_elem = xmlnode_get_next_twin(group_elem); + group_elem = purple_xmlnode_get_next_twin(group_elem); } if (group_name) { @@ -599,7 +599,7 @@ static void ggp_roster_reply_list(PurpleConnection *gc, uint32_t version, const char *data) { ggp_roster_session_data *rdata = ggp_roster_get_rdata(gc); - xmlnode *xml, *xml_it; + PurpleXmlNode *xml, *xml_it; PurpleAccount *account; GSList *local_buddies; GHashTable *remove_buddies; @@ -614,7 +614,7 @@ static void ggp_roster_reply_list(PurpleConnection *gc, uint32_t version, purple_debug_info("gg", "ggp_roster_reply_list: got list, version=%u\n", version); - xml = xmlnode_from_str(data, -1); + xml = purple_xmlnode_from_str(data, -1); if (xml == NULL) { purple_debug_warning("gg", "ggp_roster_reply_list: " @@ -641,13 +641,13 @@ static void ggp_roster_reply_list(PurpleConnection *gc, uint32_t version, #endif // reading groups - content->groups_node = xmlnode_get_child(xml, "Groups"); + content->groups_node = purple_xmlnode_get_child(xml, "Groups"); if (content->groups_node == NULL) { ggp_roster_content_free(content); g_return_if_reached(); } - xml_it = xmlnode_get_child(content->groups_node, "Group"); + xml_it = purple_xmlnode_get_child(content->groups_node, "Group"); while (xml_it != NULL) { if (!ggp_roster_reply_list_read_group(xml_it, content)) @@ -656,7 +656,7 @@ static void ggp_roster_reply_list(PurpleConnection *gc, uint32_t version, g_return_if_reached(); } - xml_it = xmlnode_get_next_twin(xml_it); + xml_it = purple_xmlnode_get_next_twin(xml_it); } // dumping current group list @@ -686,7 +686,7 @@ static void ggp_roster_reply_list(PurpleConnection *gc, uint32_t version, } // reading buddies - content->contacts_node = xmlnode_get_child(xml, "Contacts"); + content->contacts_node = purple_xmlnode_get_child(xml, "Contacts"); if (content->contacts_node == NULL) { g_hash_table_destroy(remove_buddies); @@ -694,7 +694,7 @@ static void ggp_roster_reply_list(PurpleConnection *gc, uint32_t version, ggp_roster_content_free(content); g_return_if_reached(); } - xml_it = xmlnode_get_child(content->contacts_node, "Contact"); + xml_it = purple_xmlnode_get_child(content->contacts_node, "Contact"); while (xml_it != NULL) { if (!ggp_roster_reply_list_read_buddy(gc, xml_it, content, @@ -706,7 +706,7 @@ static void ggp_roster_reply_list(PurpleConnection *gc, uint32_t version, g_return_if_reached(); } - xml_it = xmlnode_get_next_twin(xml_it); + xml_it = purple_xmlnode_get_next_twin(xml_it); } // removing buddies, which are not present in roster @@ -778,7 +778,7 @@ static const gchar * ggp_roster_send_update_group_add( gchar *id_dyn; const char *id_existing, *group_name; static gchar id[40]; - xmlnode *group_node; + PurpleXmlNode *group_node; gboolean succ = TRUE; if (group) @@ -799,7 +799,7 @@ static const gchar * ggp_roster_send_update_group_add( g_snprintf(id, sizeof(id), "%s", id_dyn); g_free(id_dyn); - group_node = xmlnode_new_child(content->groups_node, "Group"); + group_node = purple_xmlnode_new_child(content->groups_node, "Group"); succ &= ggp_xml_set_string(group_node, "Id", id); succ &= ggp_xml_set_string(group_node, "Name", group_name); succ &= ggp_xml_set_string(group_node, "IsExpanded", "true"); @@ -822,7 +822,7 @@ static gboolean ggp_roster_send_update_contact_update(PurpleConnection *gc, ggp_roster_content *content = ggp_roster_get_rdata(gc)->content; uin_t uin = change->data.uin; PurpleBuddy *buddy; - xmlnode *buddy_node, *contact_groups; + PurpleXmlNode *buddy_node, *contact_groups; gboolean succ = TRUE; const char *group_id; @@ -846,7 +846,7 @@ static gboolean ggp_roster_send_update_contact_update(PurpleConnection *gc, succ &= ggp_xml_set_string(buddy_node, "ShowName", purple_buddy_get_alias(buddy)); - contact_groups = xmlnode_get_child(buddy_node, "Groups"); + contact_groups = purple_xmlnode_get_child(buddy_node, "Groups"); g_assert(contact_groups); ggp_xmlnode_remove_children(contact_groups); succ &= ggp_xml_set_string(contact_groups, "GroupId", group_id); @@ -859,17 +859,17 @@ static gboolean ggp_roster_send_update_contact_update(PurpleConnection *gc, // add new purple_debug_misc("gg", "ggp_roster_send_update_contact_update: " "adding %u...\n", uin); - buddy_node = xmlnode_new_child(content->contacts_node, "Contact"); + buddy_node = purple_xmlnode_new_child(content->contacts_node, "Contact"); succ &= ggp_xml_set_string(buddy_node, "Guid", purple_uuid_random()); succ &= ggp_xml_set_uint(buddy_node, "GGNumber", uin); succ &= ggp_xml_set_string(buddy_node, "ShowName", purple_buddy_get_alias(buddy)); - contact_groups = xmlnode_new_child(buddy_node, "Groups"); + contact_groups = purple_xmlnode_new_child(buddy_node, "Groups"); g_assert(contact_groups); succ &= ggp_xml_set_string(contact_groups, "GroupId", group_id); - xmlnode_new_child(buddy_node, "Avatars"); + purple_xmlnode_new_child(buddy_node, "Avatars"); succ &= ggp_xml_set_bool(buddy_node, "FlagBuddy", TRUE); succ &= ggp_xml_set_bool(buddy_node, "FlagNormal", TRUE); succ &= ggp_xml_set_bool(buddy_node, "FlagFriend", TRUE); @@ -892,7 +892,7 @@ static gboolean ggp_roster_send_update_contact_remove(PurpleConnection *gc, ggp_roster_content *content = ggp_roster_get_rdata(gc)->content; uin_t uin = change->data.uin; PurpleBuddy *buddy; - xmlnode *buddy_node; + PurpleXmlNode *buddy_node; g_return_val_if_fail(change->type == GGP_ROSTER_CHANGE_CONTACT_REMOVE, FALSE); @@ -912,7 +912,7 @@ static gboolean ggp_roster_send_update_contact_remove(PurpleConnection *gc, purple_debug_info("gg", "ggp_roster_send_update_contact_remove: " "removing %u\n", uin); - xmlnode_free(buddy_node); + purple_xmlnode_free(buddy_node); g_hash_table_remove(content->contact_nodes, GINT_TO_POINTER(uin)); return TRUE; @@ -925,7 +925,7 @@ static gboolean ggp_roster_send_update_group_rename(PurpleConnection *gc, ggp_roster_content *content = ggp_roster_get_rdata(gc)->content; const char *old_name = change->data.group_rename.old_name; const char *new_name = change->data.group_rename.new_name; - xmlnode *group_node; + PurpleXmlNode *group_node; const char *group_id; g_return_val_if_fail(change->type == GGP_ROSTER_CHANGE_GROUP_RENAME, @@ -1032,7 +1032,7 @@ static void ggp_roster_send_update(PurpleConnection *gc) ggp_roster_dump(content); #endif - str = xmlnode_to_str(content->xml, &len); + str = purple_xmlnode_to_str(content->xml, &len); gg_userlist100_request(accdata->session, GG_USERLIST100_PUT, content->version, GG_USERLIST100_FORMAT_TYPE_GG100, str); g_free(str); diff --git a/libpurple/protocols/gg/xml.c b/libpurple/protocols/gg/xml.c index 6ae92961ad..1e0fff1f07 100644 --- a/libpurple/protocols/gg/xml.c +++ b/libpurple/protocols/gg/xml.c @@ -31,7 +31,7 @@ #include "debug.h" -gboolean ggp_xml_get_string(const xmlnode *xml, gchar *childName, gchar **var) +gboolean ggp_xml_get_string(const PurpleXmlNode *xml, gchar *childName, gchar **var) { char *str; @@ -40,12 +40,12 @@ gboolean ggp_xml_get_string(const xmlnode *xml, gchar *childName, gchar **var) if (childName != NULL) { - xml = xmlnode_get_child(xml, childName); + xml = purple_xmlnode_get_child(xml, childName); if (xml == NULL) return FALSE; } - str = xmlnode_get_data(xml); + str = purple_xmlnode_get_data(xml); if (str == NULL) return FALSE; @@ -53,7 +53,7 @@ gboolean ggp_xml_get_string(const xmlnode *xml, gchar *childName, gchar **var) return TRUE; } -gboolean ggp_xml_get_bool(const xmlnode *xml, gchar *childName, gboolean *var) +gboolean ggp_xml_get_bool(const PurpleXmlNode *xml, gchar *childName, gboolean *var) { char *str; gboolean succ; @@ -71,7 +71,7 @@ gboolean ggp_xml_get_bool(const xmlnode *xml, gchar *childName, gboolean *var) return TRUE; } -gboolean ggp_xml_get_uint(const xmlnode *xml, gchar *childName, unsigned int *var) +gboolean ggp_xml_get_uint(const PurpleXmlNode *xml, gchar *childName, unsigned int *var) { char *str, *endptr; gboolean succ; @@ -92,62 +92,62 @@ gboolean ggp_xml_get_uint(const xmlnode *xml, gchar *childName, unsigned int *va return succ; } -gboolean ggp_xml_set_string(xmlnode *xml, gchar *childName, const gchar *val) +gboolean ggp_xml_set_string(PurpleXmlNode *xml, gchar *childName, const gchar *val) { g_return_val_if_fail(xml != NULL, FALSE); g_return_val_if_fail(val != NULL, FALSE); if (childName != NULL) { - xmlnode *child = xmlnode_get_child(xml, childName); + PurpleXmlNode *child = purple_xmlnode_get_child(xml, childName); if (child == NULL) - child = xmlnode_new_child(xml, childName); + child = purple_xmlnode_new_child(xml, childName); xml = child; } ggp_xmlnode_remove_children(xml); - xmlnode_insert_data(xml, val, -1); + purple_xmlnode_insert_data(xml, val, -1); return TRUE; } -gboolean ggp_xml_set_bool(xmlnode *xml, gchar *childName, gboolean val) +gboolean ggp_xml_set_bool(PurpleXmlNode *xml, gchar *childName, gboolean val) { return ggp_xml_set_string(xml, childName, val ? "true" : "false"); } -gboolean ggp_xml_set_uint(xmlnode *xml, gchar *childName, unsigned int val) +gboolean ggp_xml_set_uint(PurpleXmlNode *xml, gchar *childName, unsigned int val) { gchar buff[20]; g_snprintf(buff, sizeof(buff), "%u", val); return ggp_xml_set_string(xml, childName, buff); } -void ggp_xmlnode_remove_children(xmlnode *xml) +void ggp_xmlnode_remove_children(PurpleXmlNode *xml) { - xmlnode *child = xml->child; + PurpleXmlNode *child = xml->child; while (child) { - xmlnode *next = child->next; - if (child->type != XMLNODE_TYPE_ATTRIB) - xmlnode_free(child); + PurpleXmlNode *next = child->next; + if (child->type != PURPLE_XMLNODE_TYPE_ATTRIB) + purple_xmlnode_free(child); child = next; } } -unsigned int ggp_xml_child_count(xmlnode *xml, const gchar *childName) +unsigned int ggp_xml_child_count(PurpleXmlNode *xml, const gchar *childName) { - xmlnode *child; + PurpleXmlNode *child; unsigned int count = 0; g_return_val_if_fail(xml != NULL, 0); if (childName) { - child = xmlnode_get_child(xml, childName); + child = purple_xmlnode_get_child(xml, childName); while (child) { - child = xmlnode_get_next_twin(child); + child = purple_xmlnode_get_next_twin(child); count++; } } diff --git a/libpurple/protocols/gg/xml.h b/libpurple/protocols/gg/xml.h index 3665bc0a89..313b0e3e8c 100644 --- a/libpurple/protocols/gg/xml.h +++ b/libpurple/protocols/gg/xml.h @@ -33,16 +33,16 @@ #include <internal.h> #include <xmlnode.h> -gboolean ggp_xml_get_string(const xmlnode *xml, gchar *childName, gchar **var); -gboolean ggp_xml_get_bool(const xmlnode *xml, gchar *childName, gboolean *var); -gboolean ggp_xml_get_uint(const xmlnode *xml, gchar *childName, unsigned int *var); +gboolean ggp_xml_get_string(const PurpleXmlNode *xml, gchar *childName, gchar **var); +gboolean ggp_xml_get_bool(const PurpleXmlNode *xml, gchar *childName, gboolean *var); +gboolean ggp_xml_get_uint(const PurpleXmlNode *xml, gchar *childName, unsigned int *var); -gboolean ggp_xml_set_string(xmlnode *xml, gchar *childName, const gchar *val); -gboolean ggp_xml_set_bool(xmlnode *xml, gchar *childName, gboolean val); -gboolean ggp_xml_set_uint(xmlnode *xml, gchar *childName, unsigned int val); +gboolean ggp_xml_set_string(PurpleXmlNode *xml, gchar *childName, const gchar *val); +gboolean ggp_xml_set_bool(PurpleXmlNode *xml, gchar *childName, gboolean val); +gboolean ggp_xml_set_uint(PurpleXmlNode *xml, gchar *childName, unsigned int val); -void ggp_xmlnode_remove_children(xmlnode *xml); +void ggp_xmlnode_remove_children(PurpleXmlNode *xml); -unsigned int ggp_xml_child_count(xmlnode *xml, const gchar *childName); +unsigned int ggp_xml_child_count(PurpleXmlNode *xml, const gchar *childName); #endif /* _GGP_XML_H */ diff --git a/libpurple/protocols/jabber/adhoccommands.c b/libpurple/protocols/jabber/adhoccommands.c index 23e8286047..e2d4720753 100644 --- a/libpurple/protocols/jabber/adhoccommands.c +++ b/libpurple/protocols/jabber/adhoccommands.c @@ -42,12 +42,12 @@ typedef struct _JabberAdHocActionInfo { } JabberAdHocActionInfo; static void -jabber_adhoc_got_buddy_list(JabberStream *js, const char *from, xmlnode *query) +jabber_adhoc_got_buddy_list(JabberStream *js, const char *from, PurpleXmlNode *query) { JabberID *jid; JabberBuddy *jb; JabberBuddyResource *jbr = NULL; - xmlnode *item; + PurpleXmlNode *item; if ((jid = jabber_id_new(from))) { if (jid->resource && (jb = jabber_buddy_find(js, from, TRUE))) @@ -72,15 +72,15 @@ jabber_adhoc_got_buddy_list(JabberStream *js, const char *from, xmlnode *query) for(item = query->child; item; item = item->next) { JabberAdHocCommands *cmd; - if(item->type != XMLNODE_TYPE_TAG) + if(item->type != PURPLE_XMLNODE_TYPE_TAG) continue; if(strcmp(item->name, "item")) continue; cmd = g_new0(JabberAdHocCommands, 1); - cmd->jid = g_strdup(xmlnode_get_attrib(item,"jid")); - cmd->node = g_strdup(xmlnode_get_attrib(item,"node")); - cmd->name = g_strdup(xmlnode_get_attrib(item,"name")); + cmd->jid = g_strdup(purple_xmlnode_get_attrib(item,"jid")); + cmd->node = g_strdup(purple_xmlnode_get_attrib(item,"node")); + cmd->name = g_strdup(purple_xmlnode_get_attrib(item,"name")); jbr->commands = g_list_append(jbr->commands,cmd); } @@ -89,18 +89,18 @@ jabber_adhoc_got_buddy_list(JabberStream *js, const char *from, xmlnode *query) void jabber_adhoc_disco_result_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { - xmlnode *query; + PurpleXmlNode *query; const char *node; if (type == JABBER_IQ_ERROR) return; - query = xmlnode_get_child_with_namespace(packet, "query", NS_DISCO_ITEMS); + query = purple_xmlnode_get_child_with_namespace(packet, "query", NS_DISCO_ITEMS); if (!query) return; - node = xmlnode_get_attrib(query, "node"); + node = purple_xmlnode_get_attrib(query, "node"); if (!purple_strequal(node, "http://jabber.org/protocol/commands")) return; @@ -109,29 +109,29 @@ jabber_adhoc_disco_result_cb(JabberStream *js, const char *from, static void jabber_adhoc_parse(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data); + PurpleXmlNode *packet, gpointer data); -static void do_adhoc_action_cb(JabberStream *js, xmlnode *result, const char *actionhandle, gpointer user_data) { - xmlnode *command; +static void do_adhoc_action_cb(JabberStream *js, PurpleXmlNode *result, const char *actionhandle, gpointer user_data) { + PurpleXmlNode *command; GList *action; JabberAdHocActionInfo *actionInfo = user_data; JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET); jabber_iq_set_callback(iq, jabber_adhoc_parse, NULL); - xmlnode_set_attrib(iq->node, "to", actionInfo->who); - command = xmlnode_new_child(iq->node,"command"); - xmlnode_set_namespace(command,"http://jabber.org/protocol/commands"); - xmlnode_set_attrib(command,"sessionid",actionInfo->sessionid); - xmlnode_set_attrib(command,"node",actionInfo->node); + purple_xmlnode_set_attrib(iq->node, "to", actionInfo->who); + command = purple_xmlnode_new_child(iq->node,"command"); + purple_xmlnode_set_namespace(command,"http://jabber.org/protocol/commands"); + purple_xmlnode_set_attrib(command,"sessionid",actionInfo->sessionid); + purple_xmlnode_set_attrib(command,"node",actionInfo->node); /* cancel is handled differently on ad-hoc commands than regular forms */ - if (purple_strequal(xmlnode_get_namespace(result), "jabber:x:data") && - purple_strequal(xmlnode_get_attrib(result, "type"), "cancel")) { - xmlnode_set_attrib(command,"action","cancel"); + if (purple_strequal(purple_xmlnode_get_namespace(result), "jabber:x:data") && + purple_strequal(purple_xmlnode_get_attrib(result, "type"), "cancel")) { + purple_xmlnode_set_attrib(command,"action","cancel"); } else { if(actionhandle) - xmlnode_set_attrib(command,"action",actionhandle); - xmlnode_insert_child(command,result); + purple_xmlnode_set_attrib(command,"action",actionhandle); + purple_xmlnode_insert_child(command,result); } for(action = actionInfo->actionslist; action; action = g_list_next(action)) { @@ -149,11 +149,11 @@ static void do_adhoc_action_cb(JabberStream *js, xmlnode *result, const char *ac static void jabber_adhoc_parse(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { - xmlnode *command = xmlnode_get_child_with_namespace(packet, "command", "http://jabber.org/protocol/commands"); - const char *status = xmlnode_get_attrib(command,"status"); - xmlnode *xdata = xmlnode_get_child_with_namespace(command,"x","jabber:x:data"); + PurpleXmlNode *command = purple_xmlnode_get_child_with_namespace(packet, "command", "http://jabber.org/protocol/commands"); + const char *status = purple_xmlnode_get_attrib(command,"status"); + PurpleXmlNode *xdata = purple_xmlnode_get_child_with_namespace(command,"x","jabber:x:data"); if (type == JABBER_IQ_ERROR) { char *msg = jabber_parse_error(js, packet, NULL); @@ -171,10 +171,10 @@ jabber_adhoc_parse(JabberStream *js, const char *from, if(!strcmp(status,"completed")) { /* display result */ - xmlnode *note = xmlnode_get_child(command,"note"); + PurpleXmlNode *note = purple_xmlnode_get_child(command,"note"); if(note) { - char *data = xmlnode_get_data(note); + char *data = purple_xmlnode_get_data(note); purple_notify_info(NULL, from, data, NULL); g_free(data); } @@ -185,24 +185,24 @@ jabber_adhoc_parse(JabberStream *js, const char *from, } if(!strcmp(status,"executing")) { /* this command needs more steps */ - xmlnode *actions, *action; + PurpleXmlNode *actions, *action; int actionindex = 0; GList *actionslist = NULL; JabberAdHocActionInfo *actionInfo; if(!xdata) return; /* shouldn't happen */ - actions = xmlnode_get_child(command,"actions"); + actions = purple_xmlnode_get_child(command,"actions"); if(!actions) { JabberXDataAction *defaultaction = g_new0(JabberXDataAction, 1); defaultaction->name = g_strdup(_("execute")); defaultaction->handle = g_strdup("execute"); actionslist = g_list_append(actionslist, defaultaction); } else { - const char *defaultactionhandle = xmlnode_get_attrib(actions, "execute"); + const char *defaultactionhandle = purple_xmlnode_get_attrib(actions, "execute"); int index = 0; for(action = actions->child; action; action = action->next, ++index) { - if(action->type == XMLNODE_TYPE_TAG) { + if(action->type == PURPLE_XMLNODE_TYPE_TAG) { JabberXDataAction *newaction = g_new0(JabberXDataAction, 1); newaction->name = g_strdup(_(action->name)); newaction->handle = g_strdup(action->name); @@ -214,9 +214,9 @@ jabber_adhoc_parse(JabberStream *js, const char *from, } actionInfo = g_new0(JabberAdHocActionInfo, 1); - actionInfo->sessionid = g_strdup(xmlnode_get_attrib(command,"sessionid")); + actionInfo->sessionid = g_strdup(purple_xmlnode_get_attrib(command,"sessionid")); actionInfo->who = g_strdup(from); - actionInfo->node = g_strdup(xmlnode_get_attrib(command,"node")); + actionInfo->node = g_strdup(purple_xmlnode_get_attrib(command,"node")); actionInfo->actionslist = actionslist; jabber_x_data_request_with_actions(js,xdata,actionslist,actionindex,do_adhoc_action_cb,actionInfo); @@ -236,9 +236,9 @@ void jabber_adhoc_execute_action(PurpleBlistNode *node, gpointer data) { } static void -jabber_adhoc_got_server_list(JabberStream *js, const char *from, xmlnode *query) +jabber_adhoc_got_server_list(JabberStream *js, const char *from, PurpleXmlNode *query) { - xmlnode *item; + PurpleXmlNode *item; if(!query) return; @@ -256,14 +256,14 @@ jabber_adhoc_got_server_list(JabberStream *js, const char *from, xmlnode *query) /* re-fill list */ for(item = query->child; item; item = item->next) { JabberAdHocCommands *cmd; - if(item->type != XMLNODE_TYPE_TAG) + if(item->type != PURPLE_XMLNODE_TYPE_TAG) continue; if(strcmp(item->name, "item")) continue; cmd = g_new0(JabberAdHocCommands, 1); - cmd->jid = g_strdup(xmlnode_get_attrib(item,"jid")); - cmd->node = g_strdup(xmlnode_get_attrib(item,"node")); - cmd->name = g_strdup(xmlnode_get_attrib(item,"name")); + cmd->jid = g_strdup(purple_xmlnode_get_attrib(item,"jid")); + cmd->node = g_strdup(purple_xmlnode_get_attrib(item,"node")); + cmd->name = g_strdup(purple_xmlnode_get_attrib(item,"name")); js->commands = g_list_append(js->commands,cmd); } @@ -275,16 +275,16 @@ jabber_adhoc_got_server_list(JabberStream *js, const char *from, xmlnode *query) static void jabber_adhoc_server_got_list_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { - xmlnode *query = xmlnode_get_child_with_namespace(packet, "query", + PurpleXmlNode *query = purple_xmlnode_get_child_with_namespace(packet, "query", NS_DISCO_ITEMS); jabber_adhoc_got_server_list(js, from, query); } -void jabber_adhoc_got_list(JabberStream *js, const char *from, xmlnode *query) +void jabber_adhoc_got_list(JabberStream *js, const char *from, PurpleXmlNode *query) { if (purple_strequal(from, js->user->domain)) { jabber_adhoc_got_server_list(js, from, query); @@ -295,11 +295,11 @@ void jabber_adhoc_got_list(JabberStream *js, const char *from, xmlnode *query) void jabber_adhoc_server_get_list(JabberStream *js) { JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_ITEMS); - xmlnode *query = xmlnode_get_child_with_namespace(iq->node, "query", + PurpleXmlNode *query = purple_xmlnode_get_child_with_namespace(iq->node, "query", NS_DISCO_ITEMS); - xmlnode_set_attrib(iq->node,"to",js->user->domain); - xmlnode_set_attrib(query,"node","http://jabber.org/protocol/commands"); + purple_xmlnode_set_attrib(iq->node,"to",js->user->domain); + purple_xmlnode_set_attrib(query,"node","http://jabber.org/protocol/commands"); jabber_iq_set_callback(iq,jabber_adhoc_server_got_list_cb,NULL); jabber_iq_send(iq); @@ -307,11 +307,11 @@ void jabber_adhoc_server_get_list(JabberStream *js) { void jabber_adhoc_execute(JabberStream *js, JabberAdHocCommands *cmd) { JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET); - xmlnode *command = xmlnode_new_child(iq->node,"command"); - xmlnode_set_attrib(iq->node,"to",cmd->jid); - xmlnode_set_namespace(command,"http://jabber.org/protocol/commands"); - xmlnode_set_attrib(command,"node",cmd->node); - xmlnode_set_attrib(command,"action","execute"); + PurpleXmlNode *command = purple_xmlnode_new_child(iq->node,"command"); + purple_xmlnode_set_attrib(iq->node,"to",cmd->jid); + purple_xmlnode_set_namespace(command,"http://jabber.org/protocol/commands"); + purple_xmlnode_set_attrib(command,"node",cmd->node); + purple_xmlnode_set_attrib(command,"action","execute"); jabber_iq_set_callback(iq,jabber_adhoc_parse,NULL); diff --git a/libpurple/protocols/jabber/adhoccommands.h b/libpurple/protocols/jabber/adhoccommands.h index 67958c09bb..4052f0a385 100644 --- a/libpurple/protocols/jabber/adhoccommands.h +++ b/libpurple/protocols/jabber/adhoccommands.h @@ -30,13 +30,13 @@ void jabber_adhoc_disco_result_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data); + PurpleXmlNode *packet, gpointer data); void jabber_adhoc_execute(JabberStream *js, JabberAdHocCommands *cmd); void jabber_adhoc_execute_action(PurpleBlistNode *node, gpointer data); -void jabber_adhoc_got_list(JabberStream *js, const char *from, xmlnode *query); +void jabber_adhoc_got_list(JabberStream *js, const char *from, PurpleXmlNode *query); void jabber_adhoc_server_get_list(JabberStream *js); diff --git a/libpurple/protocols/jabber/auth.c b/libpurple/protocols/jabber/auth.c index df5bdeadc6..55918927c5 100644 --- a/libpurple/protocols/jabber/auth.c +++ b/libpurple/protocols/jabber/auth.c @@ -45,21 +45,21 @@ static GSList *auth_mechs = NULL; static void auth_old_result_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data); + PurpleXmlNode *packet, gpointer data); static void finish_plaintext_authentication(JabberStream *js) { JabberIq *iq; - xmlnode *query, *x; + PurpleXmlNode *query, *x; iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:auth"); - query = xmlnode_get_child(iq->node, "query"); - x = xmlnode_new_child(query, "username"); - xmlnode_insert_data(x, js->user->node, -1); - x = xmlnode_new_child(query, "resource"); - xmlnode_insert_data(x, js->user->resource, -1); - x = xmlnode_new_child(query, "password"); - xmlnode_insert_data(x, purple_connection_get_password(js->gc), -1); + query = purple_xmlnode_get_child(iq->node, "query"); + x = purple_xmlnode_new_child(query, "username"); + purple_xmlnode_insert_data(x, js->user->node, -1); + x = purple_xmlnode_new_child(query, "resource"); + purple_xmlnode_insert_data(x, js->user->resource, -1); + x = purple_xmlnode_new_child(query, "password"); + purple_xmlnode_insert_data(x, purple_connection_get_password(js->gc), -1); jabber_iq_set_callback(iq, auth_old_result_cb, NULL); jabber_iq_send(iq); } @@ -131,12 +131,12 @@ auth_no_pass_cb(PurpleConnection *gc, PurpleRequestFields *fields) #endif void -jabber_auth_start(JabberStream *js, xmlnode *packet) +jabber_auth_start(JabberStream *js, PurpleXmlNode *packet) { GSList *mechanisms = NULL; GSList *l; - xmlnode *response = NULL; - xmlnode *mechs, *mechnode; + PurpleXmlNode *response = NULL; + PurpleXmlNode *mechs, *mechnode; JabberSaslState state; char *msg = NULL; @@ -145,7 +145,7 @@ jabber_auth_start(JabberStream *js, xmlnode *packet) return; } - mechs = xmlnode_get_child(packet, "mechanisms"); + mechs = purple_xmlnode_get_child(packet, "mechanisms"); if(!mechs) { purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, @@ -153,10 +153,10 @@ jabber_auth_start(JabberStream *js, xmlnode *packet) return; } - for(mechnode = xmlnode_get_child(mechs, "mechanism"); mechnode; - mechnode = xmlnode_get_next_twin(mechnode)) + for(mechnode = purple_xmlnode_get_child(mechs, "mechanism"); mechnode; + mechnode = purple_xmlnode_get_next_twin(mechnode)) { - char *mech_name = xmlnode_get_data(mechnode); + char *mech_name = purple_xmlnode_get_data(mechnode); if (mech_name && *mech_name) mechanisms = g_slist_prepend(mechanisms, mech_name); @@ -201,7 +201,7 @@ jabber_auth_start(JabberStream *js, xmlnode *packet) msg ? msg : _("Unknown Error")); } else if (response) { jabber_send(js, response); - xmlnode_free(response); + purple_xmlnode_free(response); } g_free(msg); @@ -209,7 +209,7 @@ jabber_auth_start(JabberStream *js, xmlnode *packet) static void auth_old_result_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { if (type == JABBER_IQ_RESULT) { jabber_stream_set_state(js, JABBER_STREAM_POST_AUTH); @@ -218,14 +218,14 @@ static void auth_old_result_cb(JabberStream *js, const char *from, PurpleAccount *account; PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; char *msg = jabber_parse_error(js, packet, &reason); - xmlnode *error; + PurpleXmlNode *error; const char *err_code; account = purple_connection_get_account(js->gc); /* FIXME: Why is this not in jabber_parse_error? */ - if((error = xmlnode_get_child(packet, "error")) && - (err_code = xmlnode_get_attrib(error, "code")) && + if((error = purple_xmlnode_get_child(packet, "error")) && + (err_code = purple_xmlnode_get_attrib(error, "code")) && g_str_equal(err_code, "401")) { reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; /* Clear the pasword if it isn't being saved */ @@ -240,10 +240,10 @@ static void auth_old_result_cb(JabberStream *js, const char *from, static void auth_old_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { JabberIq *iq; - xmlnode *query, *x; + PurpleXmlNode *query, *x; const char *pw = purple_connection_get_password(js->gc); if (type == JABBER_IQ_ERROR) { @@ -252,27 +252,27 @@ static void auth_old_cb(JabberStream *js, const char *from, purple_connection_error(js->gc, reason, msg); g_free(msg); } else if (type == JABBER_IQ_RESULT) { - query = xmlnode_get_child(packet, "query"); + query = purple_xmlnode_get_child(packet, "query"); if (js->stream_id && *js->stream_id && - xmlnode_get_child(query, "digest")) { + purple_xmlnode_get_child(query, "digest")) { char *s, *hash; iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:auth"); - query = xmlnode_get_child(iq->node, "query"); - x = xmlnode_new_child(query, "username"); - xmlnode_insert_data(x, js->user->node, -1); - x = xmlnode_new_child(query, "resource"); - xmlnode_insert_data(x, js->user->resource, -1); + query = purple_xmlnode_get_child(iq->node, "query"); + x = purple_xmlnode_new_child(query, "username"); + purple_xmlnode_insert_data(x, js->user->node, -1); + x = purple_xmlnode_new_child(query, "resource"); + purple_xmlnode_insert_data(x, js->user->resource, -1); - x = xmlnode_new_child(query, "digest"); + x = purple_xmlnode_new_child(query, "digest"); s = g_strdup_printf("%s%s", js->stream_id, pw); hash = jabber_calculate_data_hash(s, strlen(s), "sha1"); - xmlnode_insert_data(x, hash, -1); + purple_xmlnode_insert_data(x, hash, -1); g_free(hash); g_free(s); jabber_iq_set_callback(iq, auth_old_result_cb, NULL); jabber_iq_send(iq); - } else if ((x = xmlnode_get_child(query, "crammd5"))) { + } else if ((x = purple_xmlnode_get_child(query, "crammd5"))) { /* For future reference, this appears to be a custom OS X extension * to non-SASL authentication. */ @@ -284,7 +284,7 @@ static void auth_old_cb(JabberStream *js, const char *from, /* Calculate the MHAC-MD5 digest */ md5 = purple_md5_hash_new(); hmac = purple_hmac_cipher_new(md5); - challenge = xmlnode_get_attrib(x, "challenge"); + challenge = purple_xmlnode_get_attrib(x, "challenge"); purple_cipher_set_key(hmac, (guchar *)pw, strlen(pw)); purple_cipher_append(hmac, (guchar *)challenge, strlen(challenge)); purple_cipher_digest_to_str(hmac, digest, 33); @@ -293,21 +293,21 @@ static void auth_old_cb(JabberStream *js, const char *from, /* Create the response query */ iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:auth"); - query = xmlnode_get_child(iq->node, "query"); + query = purple_xmlnode_get_child(iq->node, "query"); - x = xmlnode_new_child(query, "username"); - xmlnode_insert_data(x, js->user->node, -1); - x = xmlnode_new_child(query, "resource"); - xmlnode_insert_data(x, js->user->resource, -1); + x = purple_xmlnode_new_child(query, "username"); + purple_xmlnode_insert_data(x, js->user->node, -1); + x = purple_xmlnode_new_child(query, "resource"); + purple_xmlnode_insert_data(x, js->user->resource, -1); - x = xmlnode_new_child(query, "crammd5"); + x = purple_xmlnode_new_child(query, "crammd5"); - xmlnode_insert_data(x, digest, 32); + purple_xmlnode_insert_data(x, digest, 32); jabber_iq_set_callback(iq, auth_old_result_cb, NULL); jabber_iq_send(iq); - } else if(xmlnode_get_child(query, "password")) { + } else if(purple_xmlnode_get_child(query, "password")) { PurpleAccount *account = purple_connection_get_account(js->gc); if(!jabber_stream_is_ssl(js) && !purple_account_get_bool(account, "auth_plain_in_clear", FALSE)) { @@ -337,7 +337,7 @@ void jabber_auth_start_old(JabberStream *js) { PurpleAccount *account; JabberIq *iq; - xmlnode *query, *username; + PurpleXmlNode *query, *username; account = purple_connection_get_account(js->gc); @@ -383,9 +383,9 @@ void jabber_auth_start_old(JabberStream *js) #endif iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:auth"); - query = xmlnode_get_child(iq->node, "query"); - username = xmlnode_new_child(query, "username"); - xmlnode_insert_data(username, js->user->node, -1); + query = purple_xmlnode_get_child(iq->node, "query"); + username = purple_xmlnode_new_child(query, "username"); + purple_xmlnode_insert_data(username, js->user->node, -1); jabber_iq_set_callback(iq, auth_old_cb, NULL); @@ -393,9 +393,9 @@ void jabber_auth_start_old(JabberStream *js) } void -jabber_auth_handle_challenge(JabberStream *js, xmlnode *packet) +jabber_auth_handle_challenge(JabberStream *js, PurpleXmlNode *packet) { - const char *ns = xmlnode_get_namespace(packet); + const char *ns = purple_xmlnode_get_namespace(packet); if (!purple_strequal(ns, NS_XMPP_SASL)) { purple_connection_error(js->gc, @@ -405,7 +405,7 @@ jabber_auth_handle_challenge(JabberStream *js, xmlnode *packet) } if (js->auth_mech && js->auth_mech->handle_challenge) { - xmlnode *response = NULL; + PurpleXmlNode *response = NULL; char *msg = NULL; JabberSaslState state = js->auth_mech->handle_challenge(js, packet, &response, &msg); if (state == JABBER_SASL_STATE_FAIL) { @@ -414,7 +414,7 @@ jabber_auth_handle_challenge(JabberStream *js, xmlnode *packet) msg ? msg : _("Invalid challenge from server")); } else if (response) { jabber_send(js, response); - xmlnode_free(response); + purple_xmlnode_free(response); } g_free(msg); @@ -422,9 +422,9 @@ jabber_auth_handle_challenge(JabberStream *js, xmlnode *packet) purple_debug_warning("jabber", "Received unexpected (and unhandled) <challenge/>\n"); } -void jabber_auth_handle_success(JabberStream *js, xmlnode *packet) +void jabber_auth_handle_success(JabberStream *js, PurpleXmlNode *packet) { - const char *ns = xmlnode_get_namespace(packet); + const char *ns = purple_xmlnode_get_namespace(packet); if (!purple_strequal(ns, NS_XMPP_SASL)) { purple_connection_error(js->gc, @@ -460,19 +460,19 @@ void jabber_auth_handle_success(JabberStream *js, xmlnode *packet) jabber_stream_set_state(js, JABBER_STREAM_POST_AUTH); } -void jabber_auth_handle_failure(JabberStream *js, xmlnode *packet) +void jabber_auth_handle_failure(JabberStream *js, PurpleXmlNode *packet) { PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; char *msg = NULL; if (js->auth_mech && js->auth_mech->handle_failure) { - xmlnode *stanza = NULL; + PurpleXmlNode *stanza = NULL; JabberSaslState state = js->auth_mech->handle_failure(js, packet, &stanza, &msg); if (state != JABBER_SASL_STATE_FAIL) { if (stanza) { jabber_send(js, stanza); - xmlnode_free(stanza); + purple_xmlnode_free(stanza); } return; diff --git a/libpurple/protocols/jabber/auth.h b/libpurple/protocols/jabber/auth.h index b226fb5733..946d3a3b1b 100644 --- a/libpurple/protocols/jabber/auth.h +++ b/libpurple/protocols/jabber/auth.h @@ -38,18 +38,18 @@ typedef enum { struct _JabberSaslMech { gint8 priority; /* Higher priority will be tried before lower priority */ const gchar *name; - JabberSaslState (*start)(JabberStream *js, xmlnode *mechanisms, xmlnode **reply, char **msg); - JabberSaslState (*handle_challenge)(JabberStream *js, xmlnode *packet, xmlnode **reply, char **msg); - JabberSaslState (*handle_success)(JabberStream *js, xmlnode *packet, char **msg); - JabberSaslState (*handle_failure)(JabberStream *js, xmlnode *packet, xmlnode **reply, char **msg); + JabberSaslState (*start)(JabberStream *js, PurpleXmlNode *mechanisms, PurpleXmlNode **reply, char **msg); + JabberSaslState (*handle_challenge)(JabberStream *js, PurpleXmlNode *packet, PurpleXmlNode **reply, char **msg); + JabberSaslState (*handle_success)(JabberStream *js, PurpleXmlNode *packet, char **msg); + JabberSaslState (*handle_failure)(JabberStream *js, PurpleXmlNode *packet, PurpleXmlNode **reply, char **msg); void (*dispose)(JabberStream *js); }; -void jabber_auth_start(JabberStream *js, xmlnode *packet); +void jabber_auth_start(JabberStream *js, PurpleXmlNode *packet); void jabber_auth_start_old(JabberStream *js); -void jabber_auth_handle_challenge(JabberStream *js, xmlnode *packet); -void jabber_auth_handle_success(JabberStream *js, xmlnode *packet); -void jabber_auth_handle_failure(JabberStream *js, xmlnode *packet); +void jabber_auth_handle_challenge(JabberStream *js, PurpleXmlNode *packet); +void jabber_auth_handle_success(JabberStream *js, PurpleXmlNode *packet); +void jabber_auth_handle_failure(JabberStream *js, PurpleXmlNode *packet); JabberSaslMech *jabber_auth_get_plain_mech(void); JabberSaslMech *jabber_auth_get_digest_md5_mech(void); diff --git a/libpurple/protocols/jabber/auth_cyrus.c b/libpurple/protocols/jabber/auth_cyrus.c index 9a8fdca39c..fde9af7848 100644 --- a/libpurple/protocols/jabber/auth_cyrus.c +++ b/libpurple/protocols/jabber/auth_cyrus.c @@ -28,7 +28,7 @@ #include "auth.h" #include "jabber.h" -static JabberSaslState jabber_auth_start_cyrus(JabberStream *js, xmlnode **reply, +static JabberSaslState jabber_auth_start_cyrus(JabberStream *js, PurpleXmlNode **reply, char **error); static void jabber_sasl_build_callbacks(JabberStream *); @@ -42,7 +42,7 @@ static void disallow_plaintext_auth(PurpleAccount *account) static void start_cyrus_wrapper(JabberStream *js) { char *error = NULL; - xmlnode *response = NULL; + PurpleXmlNode *response = NULL; JabberSaslState state = jabber_auth_start_cyrus(js, &response, &error); if (state == JABBER_SASL_STATE_FAIL) { @@ -52,7 +52,7 @@ static void start_cyrus_wrapper(JabberStream *js) g_free(error); } else if (response) { jabber_send(js, response); - xmlnode_free(response); + purple_xmlnode_free(response); } } @@ -196,7 +196,7 @@ static gboolean remove_current_mech(JabberStream *js) { } static JabberSaslState -jabber_auth_start_cyrus(JabberStream *js, xmlnode **reply, char **error) +jabber_auth_start_cyrus(JabberStream *js, PurpleXmlNode **reply, char **error) { PurpleAccount *account; const char *clientout = NULL; @@ -326,19 +326,19 @@ jabber_auth_start_cyrus(JabberStream *js, xmlnode **reply, char **error) } while (again); if (js->sasl_state == SASL_CONTINUE || js->sasl_state == SASL_OK) { - xmlnode *auth = xmlnode_new("auth"); - xmlnode_set_namespace(auth, NS_XMPP_SASL); - xmlnode_set_attrib(auth, "mechanism", js->current_mech); + PurpleXmlNode *auth = purple_xmlnode_new("auth"); + purple_xmlnode_set_namespace(auth, NS_XMPP_SASL); + purple_xmlnode_set_attrib(auth, "mechanism", js->current_mech); - xmlnode_set_attrib(auth, "xmlns:ga", "http://www.google.com/talk/protocol/auth"); - xmlnode_set_attrib(auth, "ga:client-uses-full-bind-result", "true"); + purple_xmlnode_set_attrib(auth, "xmlns:ga", "http://www.google.com/talk/protocol/auth"); + purple_xmlnode_set_attrib(auth, "ga:client-uses-full-bind-result", "true"); if (clientout) { if (coutlen == 0) { - xmlnode_insert_data(auth, "=", -1); + purple_xmlnode_insert_data(auth, "=", -1); } else { enc_out = purple_base64_encode((unsigned char*)clientout, coutlen); - xmlnode_insert_data(auth, enc_out, -1); + purple_xmlnode_insert_data(auth, enc_out, -1); g_free(enc_out); } } @@ -400,18 +400,18 @@ jabber_sasl_build_callbacks(JabberStream *js) } static JabberSaslState -jabber_cyrus_start(JabberStream *js, xmlnode *mechanisms, - xmlnode **reply, char **error) +jabber_cyrus_start(JabberStream *js, PurpleXmlNode *mechanisms, + PurpleXmlNode **reply, char **error) { - xmlnode *mechnode; + PurpleXmlNode *mechnode; JabberSaslState ret; js->sasl_mechs = g_string_new(""); - for(mechnode = xmlnode_get_child(mechanisms, "mechanism"); mechnode; - mechnode = xmlnode_get_next_twin(mechnode)) + for(mechnode = purple_xmlnode_get_child(mechanisms, "mechanism"); mechnode; + mechnode = purple_xmlnode_get_next_twin(mechnode)) { - char *mech_name = xmlnode_get_data(mechnode); + char *mech_name = purple_xmlnode_get_data(mechnode); /* Ignore blank mechanisms and EXTERNAL. External isn't * supported, and Cyrus SASL's mechanism returns @@ -448,10 +448,10 @@ jabber_cyrus_start(JabberStream *js, xmlnode *mechanisms, } static JabberSaslState -jabber_cyrus_handle_challenge(JabberStream *js, xmlnode *packet, - xmlnode **reply, char **error) +jabber_cyrus_handle_challenge(JabberStream *js, PurpleXmlNode *packet, + PurpleXmlNode **reply, char **error) { - char *enc_in = xmlnode_get_data(packet); + char *enc_in = purple_xmlnode_get_data(packet); unsigned char *dec_in; char *enc_out; const char *c_out; @@ -472,8 +472,8 @@ jabber_cyrus_handle_challenge(JabberStream *js, xmlnode *packet, *error = tmp; return JABBER_SASL_STATE_FAIL; } else { - xmlnode *response = xmlnode_new("response"); - xmlnode_set_namespace(response, NS_XMPP_SASL); + PurpleXmlNode *response = purple_xmlnode_new("response"); + purple_xmlnode_set_namespace(response, NS_XMPP_SASL); if (clen > 0) { /* Cyrus SASL 2.1.22 appears to contain code to add the charset * to the response for DIGEST-MD5 but there is no possibility @@ -493,7 +493,7 @@ jabber_cyrus_handle_challenge(JabberStream *js, xmlnode *packet, g_free(tmp); } - xmlnode_insert_data(response, enc_out, -1); + purple_xmlnode_insert_data(response, enc_out, -1); g_free(enc_out); } @@ -503,7 +503,7 @@ jabber_cyrus_handle_challenge(JabberStream *js, xmlnode *packet, } static JabberSaslState -jabber_cyrus_handle_success(JabberStream *js, xmlnode *packet, +jabber_cyrus_handle_success(JabberStream *js, PurpleXmlNode *packet, char **error) { const void *x; @@ -512,7 +512,7 @@ jabber_cyrus_handle_success(JabberStream *js, xmlnode *packet, * should try one more round against it */ if (js->sasl_state != SASL_OK) { - char *enc_in = xmlnode_get_data(packet); + char *enc_in = purple_xmlnode_get_data(packet); unsigned char *dec_in = NULL; const char *c_out; unsigned int clen; @@ -549,8 +549,8 @@ jabber_cyrus_handle_success(JabberStream *js, xmlnode *packet, } static JabberSaslState -jabber_cyrus_handle_failure(JabberStream *js, xmlnode *packet, - xmlnode **reply, char **error) +jabber_cyrus_handle_failure(JabberStream *js, PurpleXmlNode *packet, + PurpleXmlNode **reply, char **error) { if (js->auth_fail_count++ < 5) { if (js->current_mech && *js->current_mech) { diff --git a/libpurple/protocols/jabber/auth_digest_md5.c b/libpurple/protocols/jabber/auth_digest_md5.c index e729cea978..3de3fc7d15 100644 --- a/libpurple/protocols/jabber/auth_digest_md5.c +++ b/libpurple/protocols/jabber/auth_digest_md5.c @@ -32,12 +32,12 @@ #include "jabber.h" static JabberSaslState -digest_md5_start(JabberStream *js, xmlnode *packet, xmlnode **response, +digest_md5_start(JabberStream *js, PurpleXmlNode *packet, PurpleXmlNode **response, char **error) { - xmlnode *auth = xmlnode_new("auth"); - xmlnode_set_namespace(auth, NS_XMPP_SASL); - xmlnode_set_attrib(auth, "mechanism", "DIGEST-MD5"); + PurpleXmlNode *auth = purple_xmlnode_new("auth"); + purple_xmlnode_set_namespace(auth, NS_XMPP_SASL); + purple_xmlnode_set_attrib(auth, "mechanism", "DIGEST-MD5"); *response = auth; return JABBER_SASL_STATE_CONTINUE; @@ -164,11 +164,11 @@ generate_response_value(JabberID *jid, const char *passwd, const char *nonce, } static JabberSaslState -digest_md5_handle_challenge(JabberStream *js, xmlnode *packet, - xmlnode **response, char **msg) +digest_md5_handle_challenge(JabberStream *js, PurpleXmlNode *packet, + PurpleXmlNode **response, char **msg) { - xmlnode *reply = NULL; - char *enc_in = xmlnode_get_data(packet); + PurpleXmlNode *reply = NULL; + char *enc_in = purple_xmlnode_get_data(packet); char *dec_in; char *enc_out; GHashTable *parts; @@ -192,8 +192,8 @@ digest_md5_handle_challenge(JabberStream *js, xmlnode *packet, char *expected_rspauth = js->auth_mech_data; if (rspauth && purple_strequal(rspauth, expected_rspauth)) { - reply = xmlnode_new("response"); - xmlnode_set_namespace(reply, NS_XMPP_SASL); + reply = purple_xmlnode_new("response"); + purple_xmlnode_set_namespace(reply, NS_XMPP_SASL); } else { *msg = g_strdup(_("Invalid challenge from server")); state = JABBER_SASL_STATE_FAIL; @@ -260,9 +260,9 @@ digest_md5_handle_challenge(JabberStream *js, xmlnode *packet, G_GSIZE_FORMAT "): %s\n", response->len, response->str); - reply = xmlnode_new("response"); - xmlnode_set_namespace(reply, NS_XMPP_SASL); - xmlnode_insert_data(reply, enc_out, -1); + reply = purple_xmlnode_new("response"); + purple_xmlnode_set_namespace(reply, NS_XMPP_SASL); + purple_xmlnode_insert_data(reply, enc_out, -1); g_free(enc_out); diff --git a/libpurple/protocols/jabber/auth_plain.c b/libpurple/protocols/jabber/auth_plain.c index a609237bbf..de233cfc35 100644 --- a/libpurple/protocols/jabber/auth_plain.c +++ b/libpurple/protocols/jabber/auth_plain.c @@ -31,17 +31,17 @@ #include "jabber.h" #include "auth.h" -static xmlnode *finish_plaintext_authentication(JabberStream *js) +static PurpleXmlNode *finish_plaintext_authentication(JabberStream *js) { - xmlnode *auth; + PurpleXmlNode *auth; GString *response; gchar *enc_out; - auth = xmlnode_new("auth"); - xmlnode_set_namespace(auth, NS_XMPP_SASL); + auth = purple_xmlnode_new("auth"); + purple_xmlnode_set_namespace(auth, NS_XMPP_SASL); - xmlnode_set_attrib(auth, "xmlns:ga", "http://www.google.com/talk/protocol/auth"); - xmlnode_set_attrib(auth, "ga:client-uses-full-bind-result", "true"); + purple_xmlnode_set_attrib(auth, "xmlns:ga", "http://www.google.com/talk/protocol/auth"); + purple_xmlnode_set_attrib(auth, "ga:client-uses-full-bind-result", "true"); response = g_string_new(""); response = g_string_append_c(response, '\0'); @@ -52,8 +52,8 @@ static xmlnode *finish_plaintext_authentication(JabberStream *js) enc_out = purple_base64_encode((guchar *)response->str, response->len); - xmlnode_set_attrib(auth, "mechanism", "PLAIN"); - xmlnode_insert_data(auth, enc_out, -1); + purple_xmlnode_set_attrib(auth, "mechanism", "PLAIN"); + purple_xmlnode_insert_data(auth, enc_out, -1); g_free(enc_out); g_string_free(response, TRUE); @@ -64,13 +64,13 @@ static void allow_plaintext_auth(PurpleAccount *account) { PurpleConnection *gc = purple_account_get_connection(account); JabberStream *js = purple_connection_get_protocol_data(gc); - xmlnode *response; + PurpleXmlNode *response; purple_account_set_bool(account, "auth_plain_in_clear", TRUE); response = finish_plaintext_authentication(js); jabber_send(js, response); - xmlnode_free(response); + purple_xmlnode_free(response); } static void disallow_plaintext_auth(PurpleAccount *account) @@ -81,7 +81,7 @@ static void disallow_plaintext_auth(PurpleAccount *account) } static JabberSaslState -jabber_plain_start(JabberStream *js, xmlnode *packet, xmlnode **response, char **error) +jabber_plain_start(JabberStream *js, PurpleXmlNode *packet, PurpleXmlNode **response, char **error) { PurpleAccount *account = purple_connection_get_account(js->gc); char *msg; diff --git a/libpurple/protocols/jabber/auth_scram.c b/libpurple/protocols/jabber/auth_scram.c index 8c92ed5978..2eac86bd89 100644 --- a/libpurple/protocols/jabber/auth_scram.c +++ b/libpurple/protocols/jabber/auth_scram.c @@ -386,9 +386,9 @@ static gchar *escape_username(const gchar *in) } static JabberSaslState -scram_start(JabberStream *js, xmlnode *mechanisms, xmlnode **out, char **error) +scram_start(JabberStream *js, PurpleXmlNode *mechanisms, PurpleXmlNode **out, char **error) { - xmlnode *reply; + PurpleXmlNode *reply; JabberScramData *data; guint64 cnonce; #ifdef CHANNEL_BINDING @@ -433,16 +433,16 @@ scram_start(JabberStream *js, xmlnode *mechanisms, xmlnode **out, char **error) data->step = 1; - reply = xmlnode_new("auth"); - xmlnode_set_namespace(reply, NS_XMPP_SASL); - xmlnode_set_attrib(reply, "mechanism", js->auth_mech->name); + reply = purple_xmlnode_new("auth"); + purple_xmlnode_set_namespace(reply, NS_XMPP_SASL); + purple_xmlnode_set_attrib(reply, "mechanism", js->auth_mech->name); /* TODO: Channel binding */ dec_out = g_strdup_printf("%c,,%s", 'n', data->auth_message->str); enc_out = purple_base64_encode((guchar *)dec_out, strlen(dec_out)); purple_debug_misc("jabber", "initial SCRAM message '%s'\n", dec_out); - xmlnode_insert_data(reply, enc_out, -1); + purple_xmlnode_insert_data(reply, enc_out, -1); g_free(enc_out); g_free(dec_out); @@ -452,19 +452,19 @@ scram_start(JabberStream *js, xmlnode *mechanisms, xmlnode **out, char **error) } static JabberSaslState -scram_handle_challenge(JabberStream *js, xmlnode *challenge, xmlnode **out, char **error) +scram_handle_challenge(JabberStream *js, PurpleXmlNode *challenge, PurpleXmlNode **out, char **error) { JabberScramData *data = js->auth_mech_data; - xmlnode *reply; + PurpleXmlNode *reply; gchar *enc_in, *dec_in = NULL; gchar *enc_out = NULL, *dec_out = NULL; gsize len; JabberSaslState state = JABBER_SASL_STATE_FAIL; - enc_in = xmlnode_get_data(challenge); + enc_in = purple_xmlnode_get_data(challenge); if (!enc_in || *enc_in == '\0') { - reply = xmlnode_new("abort"); - xmlnode_set_namespace(reply, NS_XMPP_SASL); + reply = purple_xmlnode_new("abort"); + purple_xmlnode_set_namespace(reply, NS_XMPP_SASL); data->step = -1; *error = g_strdup(_("Invalid challenge from server")); goto out; @@ -473,8 +473,8 @@ scram_handle_challenge(JabberStream *js, xmlnode *challenge, xmlnode **out, char dec_in = (gchar *)purple_base64_decode(enc_in, &len); if (!dec_in || len != strlen(dec_in)) { /* Danger afoot; SCRAM shouldn't contain NUL bytes */ - reply = xmlnode_new("abort"); - xmlnode_set_namespace(reply, NS_XMPP_SASL); + reply = purple_xmlnode_new("abort"); + purple_xmlnode_set_namespace(reply, NS_XMPP_SASL); data->step = -1; *error = g_strdup(_("Malicious challenge from server")); goto out; @@ -483,8 +483,8 @@ scram_handle_challenge(JabberStream *js, xmlnode *challenge, xmlnode **out, char purple_debug_misc("jabber", "decoded challenge: %s\n", dec_in); if (!jabber_scram_feed_parser(data, dec_in, &dec_out)) { - reply = xmlnode_new("abort"); - xmlnode_set_namespace(reply, NS_XMPP_SASL); + reply = purple_xmlnode_new("abort"); + purple_xmlnode_set_namespace(reply, NS_XMPP_SASL); data->step = -1; *error = g_strdup(_("Invalid challenge from server")); goto out; @@ -492,13 +492,13 @@ scram_handle_challenge(JabberStream *js, xmlnode *challenge, xmlnode **out, char data->step += 1; - reply = xmlnode_new("response"); - xmlnode_set_namespace(reply, NS_XMPP_SASL); + reply = purple_xmlnode_new("response"); + purple_xmlnode_set_namespace(reply, NS_XMPP_SASL); purple_debug_misc("jabber", "decoded response: %s\n", dec_out ? dec_out : "(null)"); if (dec_out) { enc_out = purple_base64_encode((guchar *)dec_out, strlen(dec_out)); - xmlnode_insert_data(reply, enc_out, -1); + purple_xmlnode_insert_data(reply, enc_out, -1); } state = JABBER_SASL_STATE_CONTINUE; @@ -514,14 +514,14 @@ out: } static JabberSaslState -scram_handle_success(JabberStream *js, xmlnode *packet, char **error) +scram_handle_success(JabberStream *js, PurpleXmlNode *packet, char **error) { JabberScramData *data = js->auth_mech_data; char *enc_in, *dec_in; char *dec_out = NULL; gsize len; - enc_in = xmlnode_get_data(packet); + enc_in = purple_xmlnode_get_data(packet); if (data->step != 3 && (!enc_in || *enc_in == '\0')) { *error = g_strdup(_("Invalid challenge from server")); g_free(enc_in); diff --git a/libpurple/protocols/jabber/bosh.c b/libpurple/protocols/jabber/bosh.c index 0ab8e4460b..5dd0b81eb0 100644 --- a/libpurple/protocols/jabber/bosh.c +++ b/libpurple/protocols/jabber/bosh.c @@ -174,11 +174,11 @@ jabber_bosh_connection_is_ssl(const PurpleJabberBOSHConnection *conn) return conn->is_ssl; } -static xmlnode * +static PurpleXmlNode * jabber_bosh_connection_parse(PurpleJabberBOSHConnection *conn, PurpleHttpResponse *response) { - xmlnode *root; + PurpleXmlNode *root; const gchar *data; size_t data_len; const gchar *type; @@ -200,14 +200,14 @@ jabber_bosh_connection_parse(PurpleJabberBOSHConnection *conn, } data = purple_http_response_get_data(response, &data_len); - root = xmlnode_from_str(data, data_len); + root = purple_xmlnode_from_str(data, data_len); - type = xmlnode_get_attrib(root, "type"); + type = purple_xmlnode_get_attrib(root, "type"); if (g_strcmp0(type, "terminate") == 0) { purple_connection_error(conn->js->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("The BOSH " "connection manager terminated your session.")); - xmlnode_free(root); + purple_xmlnode_free(root); return NULL; } @@ -219,7 +219,7 @@ jabber_bosh_connection_recv(PurpleHttpConnection *http_conn, PurpleHttpResponse *response, gpointer _bosh_conn) { PurpleJabberBOSHConnection *bosh_conn = _bosh_conn; - xmlnode *node, *child; + PurpleXmlNode *node, *child; if (purple_debug_is_verbose() && purple_debug_is_unsafe()) { purple_debug_misc("jabber-bosh", "received: %s\n", @@ -233,10 +233,10 @@ jabber_bosh_connection_recv(PurpleHttpConnection *http_conn, child = node->child; while (child != NULL) { /* jabber_process_packet might free child */ - xmlnode *next = child->next; + PurpleXmlNode *next = child->next; const gchar *xmlns; - if (child->type != XMLNODE_TYPE_TAG) { + if (child->type != PURPLE_XMLNODE_TYPE_TAG) { child = next; continue; } @@ -244,13 +244,13 @@ jabber_bosh_connection_recv(PurpleHttpConnection *http_conn, /* Workaround for non-compliant servers that don't stamp * the right xmlns on these packets. See #11315. */ - xmlns = xmlnode_get_namespace(child); + xmlns = purple_xmlnode_get_namespace(child); if ((xmlns == NULL || g_strcmp0(xmlns, NS_BOSH) == 0) && (g_strcmp0(child->name, "iq") == 0 || g_strcmp0(child->name, "message") == 0 || g_strcmp0(child->name, "presence") == 0)) { - xmlnode_set_namespace(child, NS_XMPP_CLIENT); + purple_xmlnode_set_namespace(child, NS_XMPP_CLIENT); } jabber_process_packet(bosh_conn->js, &child); @@ -380,7 +380,7 @@ jabber_bosh_connection_session_created(PurpleHttpConnection *http_conn, PurpleHttpResponse *response, gpointer _bosh_conn) { PurpleJabberBOSHConnection *bosh_conn = _bosh_conn; - xmlnode *node, *features; + PurpleXmlNode *node, *features; const gchar *sid, *ver, *inactivity_str; int inactivity = 0; @@ -396,16 +396,16 @@ jabber_bosh_connection_session_created(PurpleHttpConnection *http_conn, if (node == NULL) return; - sid = xmlnode_get_attrib(node, "sid"); - ver = xmlnode_get_attrib(node, "ver"); - inactivity_str = xmlnode_get_attrib(node, "inactivity"); - /* requests = xmlnode_get_attrib(node, "requests"); */ + sid = purple_xmlnode_get_attrib(node, "sid"); + ver = purple_xmlnode_get_attrib(node, "ver"); + inactivity_str = purple_xmlnode_get_attrib(node, "inactivity"); + /* requests = purple_xmlnode_get_attrib(node, "requests"); */ if (!sid) { purple_connection_error(bosh_conn->js->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("No BOSH session ID given")); - xmlnode_free(node); + purple_xmlnode_free(node); return; } @@ -417,7 +417,7 @@ jabber_bosh_connection_session_created(PurpleHttpConnection *http_conn, purple_connection_error(bosh_conn->js->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unsupported version of BOSH protocol")); - xmlnode_free(node); + purple_xmlnode_free(node); return; } @@ -448,10 +448,10 @@ jabber_bosh_connection_session_created(PurpleHttpConnection *http_conn, jabber_stream_set_state(bosh_conn->js, JABBER_STREAM_AUTHENTICATING); /* FIXME: Depending on receiving features might break with some hosts */ - features = xmlnode_get_child(node, "features"); + features = purple_xmlnode_get_child(node, "features"); jabber_stream_features_parse(bosh_conn->js, features); - xmlnode_free(node); + purple_xmlnode_free(node); jabber_bosh_connection_send(bosh_conn, NULL); } diff --git a/libpurple/protocols/jabber/buddy.c b/libpurple/protocols/jabber/buddy.c index 3a37315fcc..aa6e0c4671 100644 --- a/libpurple/protocols/jabber/buddy.c +++ b/libpurple/protocols/jabber/buddy.c @@ -387,7 +387,7 @@ struct tag_attr { /* - * Insert a tag node into an xmlnode tree, recursively inserting parent tag + * Insert a tag node into an PurpleXmlNode tree, recursively inserting parent tag * nodes as necessary * * Returns pointer to inserted node @@ -395,9 +395,9 @@ struct tag_attr { * Note to hackers: this code is designed to be re-entrant (it's recursive--it * calls itself), so don't put any "static"s in here! */ -static xmlnode *insert_tag_to_parent_tag(xmlnode *start, const char *parent_tag, const char *new_tag) +static PurpleXmlNode *insert_tag_to_parent_tag(PurpleXmlNode *start, const char *parent_tag, const char *new_tag) { - xmlnode *x = NULL; + PurpleXmlNode *x = NULL; /* * If the parent tag wasn't specified, see if we can get it @@ -422,7 +422,7 @@ static xmlnode *insert_tag_to_parent_tag(xmlnode *start, const char *parent_tag, /* * Try to get the parent node for a tag */ - if((x = xmlnode_get_child(start, parent_tag)) == NULL) { + if((x = purple_xmlnode_get_child(start, parent_tag)) == NULL) { /* * Descend? */ @@ -433,7 +433,7 @@ static xmlnode *insert_tag_to_parent_tag(xmlnode *start, const char *parent_tag, *(parent++) = '\0'; x = insert_tag_to_parent_tag(start, grand_parent, parent); } else { - x = xmlnode_new_child(start, grand_parent); + x = purple_xmlnode_new_child(start, grand_parent); } g_free(grand_parent); } else { @@ -441,8 +441,8 @@ static xmlnode *insert_tag_to_parent_tag(xmlnode *start, const char *parent_tag, * We found *something* to be the parent node. * Note: may be the "root" node! */ - xmlnode *y; - if((y = xmlnode_get_child(x, new_tag)) != NULL) { + PurpleXmlNode *y; + if((y = purple_xmlnode_get_child(x, new_tag)) != NULL) { return(y); } } @@ -451,7 +451,7 @@ static xmlnode *insert_tag_to_parent_tag(xmlnode *start, const char *parent_tag, /* * insert the new tag into its parent node */ - return(xmlnode_new_child((x == NULL? start : x), new_tag)); + return(purple_xmlnode_new_child((x == NULL? start : x), new_tag)); } /* @@ -462,7 +462,7 @@ void jabber_set_info(PurpleConnection *gc, const char *info) PurpleStoredImage *img; JabberIq *iq; JabberStream *js = purple_connection_get_protocol_data(gc); - xmlnode *vc_node; + PurpleXmlNode *vc_node; const struct tag_attr *tag_attr; /* if we haven't grabbed the remote vcard yet, we can't @@ -493,24 +493,24 @@ void jabber_set_info(PurpleConnection *gc, const char *info) /* * Send only if there's actually any *information* to send */ - vc_node = info ? xmlnode_from_str(info, -1) : NULL; + vc_node = info ? purple_xmlnode_from_str(info, -1) : NULL; if (vc_node && (!vc_node->name || g_ascii_strncasecmp(vc_node->name, "vCard", 5))) { - xmlnode_free(vc_node); + purple_xmlnode_free(vc_node); vc_node = NULL; } if ((img = purple_buddy_icons_find_account_icon(purple_connection_get_account(gc)))) { gconstpointer avatar_data; gsize avatar_len; - xmlnode *photo, *binval, *type; + PurpleXmlNode *photo, *binval, *type; gchar *enc; if(!vc_node) { - vc_node = xmlnode_new("vCard"); + vc_node = purple_xmlnode_new("vCard"); for(tag_attr = vcard_tag_attr_list; tag_attr->attr != NULL; ++tag_attr) - xmlnode_set_attrib(vc_node, tag_attr->attr, tag_attr->value); + purple_xmlnode_set_attrib(vc_node, tag_attr->attr, tag_attr->value); } avatar_data = purple_imgstore_get_data(img); @@ -519,32 +519,32 @@ void jabber_set_info(PurpleConnection *gc, const char *info) * TODO: This may want to be modified to remove all old PHOTO * children, at the moment some people have managed to get * multiple PHOTO entries in their vCard. */ - if((photo = xmlnode_get_child(vc_node, "PHOTO"))) { - xmlnode_free(photo); + if((photo = purple_xmlnode_get_child(vc_node, "PHOTO"))) { + purple_xmlnode_free(photo); } - photo = xmlnode_new_child(vc_node, "PHOTO"); - type = xmlnode_new_child(photo, "TYPE"); - xmlnode_insert_data(type, "image/png", -1); - binval = xmlnode_new_child(photo, "BINVAL"); + photo = purple_xmlnode_new_child(vc_node, "PHOTO"); + type = purple_xmlnode_new_child(photo, "TYPE"); + purple_xmlnode_insert_data(type, "image/png", -1); + binval = purple_xmlnode_new_child(photo, "BINVAL"); enc = purple_base64_encode(avatar_data, avatar_len); js->avatar_hash = jabber_calculate_data_hash(avatar_data, avatar_len, "sha1"); - xmlnode_insert_data(binval, enc, -1); + purple_xmlnode_insert_data(binval, enc, -1); g_free(enc); purple_imgstore_unref(img); } else if (vc_node) { - xmlnode *photo; + PurpleXmlNode *photo; /* TODO: Remove all PHOTO children? (see above note) */ - if ((photo = xmlnode_get_child(vc_node, "PHOTO"))) { - xmlnode_free(photo); + if ((photo = purple_xmlnode_get_child(vc_node, "PHOTO"))) { + purple_xmlnode_free(photo); } } if (vc_node != NULL) { iq = jabber_iq_new(js, JABBER_IQ_SET); - xmlnode_insert_child(iq->node, vc_node); + purple_xmlnode_insert_child(iq->node, vc_node); jabber_iq_send(iq); /* Send presence to update vcard-temp:x:update */ @@ -575,17 +575,17 @@ void jabber_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) static void jabber_format_info(PurpleConnection *gc, PurpleRequestFields *fields) { - xmlnode *vc_node; + PurpleXmlNode *vc_node; PurpleRequestField *field; const char *text; char *p; const struct vcard_template *vc_tp; const struct tag_attr *tag_attr; - vc_node = xmlnode_new("vCard"); + vc_node = purple_xmlnode_new("vCard"); for(tag_attr = vcard_tag_attr_list; tag_attr->attr != NULL; ++tag_attr) - xmlnode_set_attrib(vc_node, tag_attr->attr, tag_attr->value); + purple_xmlnode_set_attrib(vc_node, tag_attr->attr, tag_attr->value); for (vc_tp = vcard_template_data; vc_tp->label != NULL; vc_tp++) { if (*vc_tp->label == '\0') @@ -596,20 +596,20 @@ jabber_format_info(PurpleConnection *gc, PurpleRequestFields *fields) if (text != NULL && *text != '\0') { - xmlnode *xp; + PurpleXmlNode *xp; purple_debug_info("jabber", "Setting %s to '%s'\n", vc_tp->tag, text); if ((xp = insert_tag_to_parent_tag(vc_node, NULL, vc_tp->tag)) != NULL) { - xmlnode_insert_data(xp, text, -1); + purple_xmlnode_insert_data(xp, text, -1); } } } - p = xmlnode_to_str(vc_node, NULL); - xmlnode_free(vc_node); + p = purple_xmlnode_to_str(vc_node, NULL); + purple_xmlnode_free(vc_node); purple_account_set_user_info(purple_connection_get_account(gc), p); serv_set_info(gc, p); @@ -633,7 +633,7 @@ void jabber_setup_set_info(PurplePluginAction *action) const struct vcard_template *vc_tp; const char *user_info; char *cdata = NULL; - xmlnode *x_vc_data = NULL; + PurpleXmlNode *x_vc_data = NULL; fields = purple_request_fields_new(); group = purple_request_field_group_new(NULL); @@ -643,26 +643,26 @@ void jabber_setup_set_info(PurplePluginAction *action) * Get existing, XML-formatted, user info */ if((user_info = purple_account_get_user_info(purple_connection_get_account(gc))) != NULL) - x_vc_data = xmlnode_from_str(user_info, -1); + x_vc_data = purple_xmlnode_from_str(user_info, -1); /* * Set up GSLists for edit with labels from "template," data from user info */ for(vc_tp = vcard_template_data; vc_tp->label != NULL; ++vc_tp) { - xmlnode *data_node; + PurpleXmlNode *data_node; if((vc_tp->label)[0] == '\0') continue; if (x_vc_data != NULL) { if(vc_tp->ptag == NULL) { - data_node = xmlnode_get_child(x_vc_data, vc_tp->tag); + data_node = purple_xmlnode_get_child(x_vc_data, vc_tp->tag); } else { gchar *tag = g_strdup_printf("%s/%s", vc_tp->ptag, vc_tp->tag); - data_node = xmlnode_get_child(x_vc_data, tag); + data_node = purple_xmlnode_get_child(x_vc_data, tag); g_free(tag); } if(data_node) - cdata = xmlnode_get_data(data_node); + cdata = purple_xmlnode_get_data(data_node); } if(strcmp(vc_tp->tag, "DESC") == 0) { @@ -682,7 +682,7 @@ void jabber_setup_set_info(PurplePluginAction *action) } if(x_vc_data != NULL) - xmlnode_free(x_vc_data); + purple_xmlnode_free(x_vc_data); purple_request_fields(gc, _("Edit XMPP vCard"), _("Edit XMPP vCard"), @@ -921,27 +921,27 @@ set_own_vcard_cb(gpointer data) static void jabber_vcard_save_mine(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { - xmlnode *vcard, *photo, *binval; + PurpleXmlNode *vcard, *photo, *binval; char *txt, *vcard_hash = NULL; PurpleAccount *account; if (type == JABBER_IQ_ERROR) { - xmlnode *error; + PurpleXmlNode *error; purple_debug_warning("jabber", "Server returned error while retrieving vCard\n"); - error = xmlnode_get_child(packet, "error"); - if (!error || !xmlnode_get_child(error, "item-not-found")) + error = purple_xmlnode_get_child(packet, "error"); + if (!error || !purple_xmlnode_get_child(error, "item-not-found")) return; } account = purple_connection_get_account(js->gc); - if((vcard = xmlnode_get_child(packet, "vCard")) || - (vcard = xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) + if((vcard = purple_xmlnode_get_child(packet, "vCard")) || + (vcard = purple_xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) { - txt = xmlnode_to_str(vcard, NULL); + txt = purple_xmlnode_to_str(vcard, NULL); purple_account_set_user_info(account, txt); g_free(txt); } else { @@ -950,10 +950,10 @@ static void jabber_vcard_save_mine(JabberStream *js, const char *from, js->vcard_fetched = TRUE; - if (vcard && (photo = xmlnode_get_child(vcard, "PHOTO")) && - (binval = xmlnode_get_child(photo, "BINVAL"))) { + if (vcard && (photo = purple_xmlnode_get_child(vcard, "PHOTO")) && + (binval = purple_xmlnode_get_child(photo, "BINVAL"))) { gsize size; - char *bintext = xmlnode_get_data(binval); + char *bintext = purple_xmlnode_get_data(binval); if (bintext) { guchar *data = purple_base64_decode(bintext, &size); g_free(bintext); @@ -994,8 +994,8 @@ void jabber_vcard_fetch_mine(JabberStream *js) { JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET); - xmlnode *vcard = xmlnode_new_child(iq->node, "vCard"); - xmlnode_set_namespace(vcard, "vcard-temp"); + PurpleXmlNode *vcard = purple_xmlnode_new_child(iq->node, "vCard"); + purple_xmlnode_set_namespace(vcard, "vcard-temp"); jabber_iq_set_callback(iq, jabber_vcard_save_mine, NULL); jabber_iq_send(iq); @@ -1003,12 +1003,12 @@ void jabber_vcard_fetch_mine(JabberStream *js) static void jabber_vcard_parse(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { char *bare_jid; char *text; char *serverside_alias = NULL; - xmlnode *vcard; + PurpleXmlNode *vcard; PurpleAccount *account; JabberBuddyInfo *jbi = data; PurpleNotifyUserInfo *user_info; @@ -1028,17 +1028,17 @@ static void jabber_vcard_parse(JabberStream *js, const char *from, bare_jid = jabber_get_bare_jid(from ? from : purple_account_get_username(account)); /* TODO: Is the query xmlns='vcard-temp' version of this still necessary? */ - if((vcard = xmlnode_get_child(packet, "vCard")) || - (vcard = xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) { - xmlnode *child; + if((vcard = purple_xmlnode_get_child(packet, "vCard")) || + (vcard = purple_xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) { + PurpleXmlNode *child; for(child = vcard->child; child; child = child->next) { - xmlnode *child2; + PurpleXmlNode *child2; - if(child->type != XMLNODE_TYPE_TAG) + if(child->type != PURPLE_XMLNODE_TYPE_TAG) continue; - text = xmlnode_get_data(child); + text = purple_xmlnode_get_data(child); if(text && !strcmp(child->name, "FN")) { if (!serverside_alias) serverside_alias = g_strdup(text); @@ -1049,10 +1049,10 @@ static void jabber_vcard_parse(JabberStream *js, const char *from, { char *text2; - if(child2->type != XMLNODE_TYPE_TAG) + if(child2->type != PURPLE_XMLNODE_TYPE_TAG) continue; - text2 = xmlnode_get_data(child2); + text2 = purple_xmlnode_get_data(child2); if(text2 && !strcmp(child2->name, "FAMILY")) { purple_notify_user_info_add_pair_plaintext(user_info, _("Family Name"), text2); } else if(text2 && !strcmp(child2->name, "GIVEN")) { @@ -1080,10 +1080,10 @@ static void jabber_vcard_parse(JabberStream *js, const char *from, { char *text2; - if(child2->type != XMLNODE_TYPE_TAG) + if(child2->type != PURPLE_XMLNODE_TYPE_TAG) continue; - text2 = xmlnode_get_data(child2); + text2 = purple_xmlnode_get_data(child2); if (text2 == NULL) continue; @@ -1124,14 +1124,14 @@ static void jabber_vcard_parse(JabberStream *js, const char *from, } else if(!strcmp(child->name, "TEL")) { char *number; - if((child2 = xmlnode_get_child(child, "NUMBER"))) { + if((child2 = purple_xmlnode_get_child(child, "NUMBER"))) { /* show what kind of number it is */ - number = xmlnode_get_data(child2); + number = purple_xmlnode_get_data(child2); if(number) { purple_notify_user_info_add_pair_plaintext(user_info, _("Telephone"), number); g_free(number); } - } else if((number = xmlnode_get_data(child))) { + } else if((number = purple_xmlnode_get_data(child))) { /* lots of clients (including purple) do this, but it's * out of spec */ purple_notify_user_info_add_pair_plaintext(user_info, _("Telephone"), number); @@ -1139,9 +1139,9 @@ static void jabber_vcard_parse(JabberStream *js, const char *from, } } else if(!strcmp(child->name, "EMAIL")) { char *userid, *escaped; - if((child2 = xmlnode_get_child(child, "USERID"))) { + if((child2 = purple_xmlnode_get_child(child, "USERID"))) { /* show what kind of email it is */ - userid = xmlnode_get_data(child2); + userid = purple_xmlnode_get_data(child2); if(userid) { char *mailto; escaped = g_markup_escape_text(userid, -1); @@ -1152,7 +1152,7 @@ static void jabber_vcard_parse(JabberStream *js, const char *from, g_free(escaped); g_free(userid); } - } else if((userid = xmlnode_get_data(child))) { + } else if((userid = purple_xmlnode_get_data(child))) { /* lots of clients (including purple) do this, but it's * out of spec */ char *mailto; @@ -1170,10 +1170,10 @@ static void jabber_vcard_parse(JabberStream *js, const char *from, { char *text2; - if(child2->type != XMLNODE_TYPE_TAG) + if(child2->type != PURPLE_XMLNODE_TYPE_TAG) continue; - text2 = xmlnode_get_data(child2); + text2 = purple_xmlnode_get_data(child2); if(text2 && !strcmp(child2->name, "ORGNAME")) { purple_notify_user_info_add_pair_plaintext(user_info, _("Organization Name"), text2); } else if(text2 && !strcmp(child2->name, "ORGUNIT")) { @@ -1190,10 +1190,10 @@ static void jabber_vcard_parse(JabberStream *js, const char *from, } else if(!strcmp(child->name, "PHOTO") || !strcmp(child->name, "LOGO")) { char *bintext = NULL; - xmlnode *binval; + PurpleXmlNode *binval; - if ((binval = xmlnode_get_child(child, "BINVAL")) && - (bintext = xmlnode_get_data(binval))) { + if ((binval = purple_xmlnode_get_child(child, "BINVAL")) && + (bintext = purple_xmlnode_get_data(binval))) { gsize size; guchar *data; gboolean photo = (strcmp(child->name, "PHOTO") == 0); @@ -1262,10 +1262,10 @@ static gboolean jbir_equal(gconstpointer v1, gconstpointer v2) static void jabber_version_parse(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { JabberBuddyInfo *jbi = data; - xmlnode *query; + PurpleXmlNode *query; char *resource_name; g_return_if_fail(jbi != NULL); @@ -1279,18 +1279,18 @@ static void jabber_version_parse(JabberStream *js, const char *from, if(resource_name) { if (type == JABBER_IQ_RESULT) { - if((query = xmlnode_get_child(packet, "query"))) { + if((query = purple_xmlnode_get_child(packet, "query"))) { JabberBuddyResource *jbr = jabber_buddy_find_resource(jbi->jb, resource_name); if(jbr) { - xmlnode *node; - if((node = xmlnode_get_child(query, "name"))) { - jbr->client.name = xmlnode_get_data(node); + PurpleXmlNode *node; + if((node = purple_xmlnode_get_child(query, "name"))) { + jbr->client.name = purple_xmlnode_get_data(node); } - if((node = xmlnode_get_child(query, "version"))) { - jbr->client.version = xmlnode_get_data(node); + if((node = purple_xmlnode_get_child(query, "version"))) { + jbr->client.version = purple_xmlnode_get_data(node); } - if((node = xmlnode_get_child(query, "os"))) { - jbr->client.os = xmlnode_get_data(node); + if((node = purple_xmlnode_get_child(query, "os"))) { + jbr->client.os = purple_xmlnode_get_data(node); } } } @@ -1303,10 +1303,10 @@ static void jabber_version_parse(JabberStream *js, const char *from, static void jabber_last_parse(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { JabberBuddyInfo *jbi = data; - xmlnode *query; + PurpleXmlNode *query; char *resource_name; const char *seconds; @@ -1321,8 +1321,8 @@ static void jabber_last_parse(JabberStream *js, const char *from, if(resource_name) { if (type == JABBER_IQ_RESULT) { - if((query = xmlnode_get_child(packet, "query"))) { - seconds = xmlnode_get_attrib(query, "seconds"); + if((query = purple_xmlnode_get_child(packet, "query"))) { + seconds = purple_xmlnode_get_attrib(query, "seconds"); if(seconds) { char *end = NULL; long sec = strtol(seconds, &end, 10); @@ -1381,10 +1381,10 @@ static void jabber_last_parse(JabberStream *js, const char *from, static void jabber_last_offline_parse(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { JabberBuddyInfo *jbi = data; - xmlnode *query; + PurpleXmlNode *query; const char *seconds; g_return_if_fail(jbi != NULL); @@ -1392,8 +1392,8 @@ static void jabber_last_offline_parse(JabberStream *js, const char *from, jabber_buddy_info_remove_id(jbi, id); if (type == JABBER_IQ_RESULT) { - if((query = xmlnode_get_child(packet, "query"))) { - seconds = xmlnode_get_attrib(query, "seconds"); + if((query = purple_xmlnode_get_child(packet, "query"))) { + seconds = purple_xmlnode_get_attrib(query, "seconds"); if(seconds) { char *end = NULL; long sec = strtol(seconds, &end, 10); @@ -1401,7 +1401,7 @@ static void jabber_last_offline_parse(JabberStream *js, const char *from, jbi->last_seconds = sec; } } - jbi->last_message = xmlnode_get_data(query); + jbi->last_message = purple_xmlnode_get_data(query); } } @@ -1410,7 +1410,7 @@ static void jabber_last_offline_parse(JabberStream *js, const char *from, static void jabber_time_parse(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { JabberBuddyInfo *jbi = data; JabberBuddyResource *jbr; @@ -1428,9 +1428,9 @@ static void jabber_time_parse(JabberStream *js, const char *from, g_free(resource_name); if (jbr) { if (type == JABBER_IQ_RESULT) { - xmlnode *time = xmlnode_get_child(packet, "time"); - xmlnode *tzo = time ? xmlnode_get_child(time, "tzo") : NULL; - char *tzo_data = tzo ? xmlnode_get_data(tzo) : NULL; + PurpleXmlNode *time = purple_xmlnode_get_child(packet, "time"); + PurpleXmlNode *tzo = time ? purple_xmlnode_get_child(time, "tzo") : NULL; + char *tzo_data = tzo ? purple_xmlnode_get_data(tzo) : NULL; if (tzo_data) { char *c = tzo_data; int hours, minutes; @@ -1539,7 +1539,7 @@ dispatch_queries_for_resource(JabberStream *js, JabberBuddyInfo *jbi, if(!jbr->client.name) { iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:version"); - xmlnode_set_attrib(iq->node, "to", to); + purple_xmlnode_set_attrib(iq->node, "to", to); jabber_iq_set_callback(iq, jabber_version_parse, jbi); jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); jabber_iq_send(iq); @@ -1552,7 +1552,7 @@ dispatch_queries_for_resource(JabberStream *js, JabberBuddyInfo *jbi, * office. */ if(!_client_is_blacklisted(jbr, NS_LAST_ACTIVITY)) { iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_LAST_ACTIVITY); - xmlnode_set_attrib(iq->node, "to", to); + purple_xmlnode_set_attrib(iq->node, "to", to); jabber_iq_set_callback(iq, jabber_last_parse, jbi); jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); jabber_iq_send(iq); @@ -1561,11 +1561,11 @@ dispatch_queries_for_resource(JabberStream *js, JabberBuddyInfo *jbi, if (jbr->tz_off == PURPLE_NO_TZ_OFF && (!jbr->caps.info || jabber_resource_has_capability(jbr, NS_ENTITY_TIME))) { - xmlnode *child; + PurpleXmlNode *child; iq = jabber_iq_new(js, JABBER_IQ_GET); - xmlnode_set_attrib(iq->node, "to", to); - child = xmlnode_new_child(iq->node, "time"); - xmlnode_set_namespace(child, NS_ENTITY_TIME); + purple_xmlnode_set_attrib(iq->node, "to", to); + child = purple_xmlnode_new_child(iq->node, "time"); + purple_xmlnode_set_namespace(child, NS_ENTITY_TIME); jabber_iq_set_callback(iq, jabber_time_parse, jbi); jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); jabber_iq_send(iq); @@ -1577,7 +1577,7 @@ dispatch_queries_for_resource(JabberStream *js, JabberBuddyInfo *jbi, static void jabber_buddy_get_info_for_jid(JabberStream *js, const char *jid) { JabberIq *iq; - xmlnode *vcard; + PurpleXmlNode *vcard; GList *resources; JabberBuddy *jb; JabberBuddyInfo *jbi; @@ -1602,9 +1602,9 @@ static void jabber_buddy_get_info_for_jid(JabberStream *js, const char *jid) iq = jabber_iq_new(js, JABBER_IQ_GET); - xmlnode_set_attrib(iq->node, "to", jid); - vcard = xmlnode_new_child(iq->node, "vCard"); - xmlnode_set_namespace(vcard, "vcard-temp"); + purple_xmlnode_set_attrib(iq->node, "to", jid); + vcard = purple_xmlnode_new_child(iq->node, "vCard"); + purple_xmlnode_set_namespace(vcard, "vcard-temp"); jabber_iq_set_callback(iq, jabber_vcard_parse, jbi); jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); @@ -1620,7 +1620,7 @@ static void jabber_buddy_get_info_for_jid(JabberStream *js, const char *jid) } else { /* user is offline, send a jabber:iq:last to find out last time online */ iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_LAST_ACTIVITY); - xmlnode_set_attrib(iq->node, "to", jid); + purple_xmlnode_set_attrib(iq->node, "to", jid); jabber_iq_set_callback(iq, jabber_last_offline_parse, jbi); jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); jabber_iq_send(iq); @@ -1666,7 +1666,7 @@ static void jabber_buddy_set_invisibility(JabberStream *js, const char *who, PurpleAccount *account; PurpleStatus *status; JabberBuddy *jb = jabber_buddy_find(js, who, TRUE); - xmlnode *presence; + PurpleXmlNode *presence; JabberBuddyState state; char *msg; int priority; @@ -1680,16 +1680,16 @@ static void jabber_buddy_set_invisibility(JabberStream *js, const char *who, g_free(msg); - xmlnode_set_attrib(presence, "to", who); + purple_xmlnode_set_attrib(presence, "to", who); if(invisible) { - xmlnode_set_attrib(presence, "type", "invisible"); + purple_xmlnode_set_attrib(presence, "type", "invisible"); jb->invisible |= JABBER_INVIS_BUDDY; } else { jb->invisible &= ~JABBER_INVIS_BUDDY; } jabber_send(js, presence); - xmlnode_free(presence); + purple_xmlnode_free(presence); } static void jabber_buddy_make_invisible(PurpleBlistNode *node, gpointer data) @@ -1800,7 +1800,7 @@ static void jabber_buddy_login(PurpleBlistNode *node, gpointer data) { PurpleAccount *account = purple_connection_get_account(gc); PurplePresence *gpresence = purple_account_get_presence(account); PurpleStatus *status = purple_presence_get_active_status(gpresence); - xmlnode *presence; + PurpleXmlNode *presence; JabberBuddyState state; char *msg; int priority; @@ -1810,10 +1810,10 @@ static void jabber_buddy_login(PurpleBlistNode *node, gpointer data) { g_free(msg); - xmlnode_set_attrib(presence, "to", purple_buddy_get_name(buddy)); + purple_xmlnode_set_attrib(presence, "to", purple_buddy_get_name(buddy)); jabber_send(js, presence); - xmlnode_free(presence); + purple_xmlnode_free(presence); } } @@ -1823,14 +1823,14 @@ static void jabber_buddy_logout(PurpleBlistNode *node, gpointer data) { PurpleBuddy *buddy = (PurpleBuddy *) node; PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); JabberStream *js = purple_connection_get_protocol_data(gc); - xmlnode *presence; + PurpleXmlNode *presence; presence = jabber_presence_create_js(js, JABBER_BUDDY_STATE_UNAVAILABLE, NULL, 0); - xmlnode_set_attrib(presence, "to", purple_buddy_get_name(buddy)); + purple_xmlnode_set_attrib(presence, "to", purple_buddy_get_name(buddy)); jabber_send(js, presence); - xmlnode_free(presence); + purple_xmlnode_free(presence); } } @@ -1949,42 +1949,42 @@ static void user_search_result_add_buddy_cb(PurpleConnection *gc, GList *row, vo static void user_search_result_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { PurpleNotifySearchResults *results; PurpleNotifySearchColumn *column; - xmlnode *x, *query, *item, *field; + PurpleXmlNode *x, *query, *item, *field; /* XXX error checking? */ - if(!(query = xmlnode_get_child(packet, "query"))) + if(!(query = purple_xmlnode_get_child(packet, "query"))) return; results = purple_notify_searchresults_new(); - if((x = xmlnode_get_child_with_namespace(query, "x", "jabber:x:data"))) { - xmlnode *reported; + if((x = purple_xmlnode_get_child_with_namespace(query, "x", "jabber:x:data"))) { + PurpleXmlNode *reported; GSList *column_vars = NULL; purple_debug_info("jabber", "new-skool\n"); - if((reported = xmlnode_get_child(x, "reported"))) { - xmlnode *field = xmlnode_get_child(reported, "field"); + if((reported = purple_xmlnode_get_child(x, "reported"))) { + PurpleXmlNode *field = purple_xmlnode_get_child(reported, "field"); while(field) { - const char *var = xmlnode_get_attrib(field, "var"); - const char *label = xmlnode_get_attrib(field, "label"); + const char *var = purple_xmlnode_get_attrib(field, "var"); + const char *label = purple_xmlnode_get_attrib(field, "label"); if(var) { column = purple_notify_searchresults_column_new(label ? label : var); purple_notify_searchresults_column_add(results, column); column_vars = g_slist_append(column_vars, (char *)var); } - field = xmlnode_get_next_twin(field); + field = purple_xmlnode_get_next_twin(field); } } - item = xmlnode_get_child(x, "item"); + item = purple_xmlnode_get_child(x, "item"); while(item) { GList *row = NULL; GSList *l; - xmlnode *valuenode; + PurpleXmlNode *valuenode; const char *var; for (l = column_vars; l != NULL; l = l->next) { @@ -1992,15 +1992,15 @@ static void user_search_result_cb(JabberStream *js, const char *from, * Build a row containing the strings that correspond * to each column of the search results. */ - for (field = xmlnode_get_child(item, "field"); + for (field = purple_xmlnode_get_child(item, "field"); field != NULL; - field = xmlnode_get_next_twin(field)) + field = purple_xmlnode_get_next_twin(field)) { - if ((var = xmlnode_get_attrib(field, "var")) && + if ((var = purple_xmlnode_get_attrib(field, "var")) && !strcmp(var, l->data) && - (valuenode = xmlnode_get_child(field, "value"))) + (valuenode = purple_xmlnode_get_child(field, "value"))) { - char *value = xmlnode_get_data(valuenode); + char *value = purple_xmlnode_get_data(valuenode); row = g_list_append(row, value); break; } @@ -2010,7 +2010,7 @@ static void user_search_result_cb(JabberStream *js, const char *from, row = g_list_append(row, NULL); } purple_notify_searchresults_row_add(results, row); - item = xmlnode_get_next_twin(item); + item = purple_xmlnode_get_next_twin(item); } g_slist_free(column_vars); @@ -2029,23 +2029,23 @@ static void user_search_result_cb(JabberStream *js, const char *from, column = purple_notify_searchresults_column_new(_("Email")); purple_notify_searchresults_column_add(results, column); - for(item = xmlnode_get_child(query, "item"); item; item = xmlnode_get_next_twin(item)) { + for(item = purple_xmlnode_get_child(query, "item"); item; item = purple_xmlnode_get_next_twin(item)) { const char *jid; - xmlnode *node; + PurpleXmlNode *node; GList *row = NULL; - if(!(jid = xmlnode_get_attrib(item, "jid"))) + if(!(jid = purple_xmlnode_get_attrib(item, "jid"))) continue; row = g_list_append(row, g_strdup(jid)); - node = xmlnode_get_child(item, "first"); - row = g_list_append(row, node ? xmlnode_get_data(node) : NULL); - node = xmlnode_get_child(item, "last"); - row = g_list_append(row, node ? xmlnode_get_data(node) : NULL); - node = xmlnode_get_child(item, "nick"); - row = g_list_append(row, node ? xmlnode_get_data(node) : NULL); - node = xmlnode_get_child(item, "email"); - row = g_list_append(row, node ? xmlnode_get_data(node) : NULL); + node = purple_xmlnode_get_child(item, "first"); + row = g_list_append(row, node ? purple_xmlnode_get_data(node) : NULL); + node = purple_xmlnode_get_child(item, "last"); + row = g_list_append(row, node ? purple_xmlnode_get_data(node) : NULL); + node = purple_xmlnode_get_child(item, "nick"); + row = g_list_append(row, node ? purple_xmlnode_get_data(node) : NULL); + node = purple_xmlnode_get_child(item, "email"); + row = g_list_append(row, node ? purple_xmlnode_get_data(node) : NULL); purple_debug_info("jabber", "row=%p\n", row); purple_notify_searchresults_row_add(results, row); } @@ -2057,9 +2057,9 @@ static void user_search_result_cb(JabberStream *js, const char *from, purple_notify_searchresults(js->gc, NULL, NULL, _("The following are the results of your search"), results, NULL, NULL); } -static void user_search_x_data_cb(JabberStream *js, xmlnode *result, gpointer data) +static void user_search_x_data_cb(JabberStream *js, PurpleXmlNode *result, gpointer data) { - xmlnode *query; + PurpleXmlNode *query; JabberIq *iq; char *dir_server = data; const char *type; @@ -2067,19 +2067,19 @@ static void user_search_x_data_cb(JabberStream *js, xmlnode *result, gpointer da /* if they've cancelled the search, we're * just going to get an error if we send * a cancel, so skip it */ - type = xmlnode_get_attrib(result, "type"); + type = purple_xmlnode_get_attrib(result, "type"); if(type && !strcmp(type, "cancel")) { g_free(dir_server); return; } iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:search"); - query = xmlnode_get_child(iq->node, "query"); + query = purple_xmlnode_get_child(iq->node, "query"); - xmlnode_insert_child(query, result); + purple_xmlnode_insert_child(query, result); jabber_iq_set_callback(iq, user_search_result_cb, NULL); - xmlnode_set_attrib(iq->node, "to", dir_server); + purple_xmlnode_set_attrib(iq->node, "to", dir_server); jabber_iq_send(iq); g_free(dir_server); } @@ -2099,11 +2099,11 @@ static void user_search_cb(struct user_search_info *usi, PurpleRequestFields *fi { JabberStream *js = usi->js; JabberIq *iq; - xmlnode *query; + PurpleXmlNode *query; GList *groups, *flds; iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:search"); - query = xmlnode_get_child(iq->node, "query"); + query = purple_xmlnode_get_child(iq->node, "query"); for(groups = purple_request_fields_get_groups(fields); groups; groups = groups->next) { for(flds = purple_request_field_group_get_fields(groups->data); @@ -2113,14 +2113,14 @@ static void user_search_cb(struct user_search_info *usi, PurpleRequestFields *fi const char *value = purple_request_field_string_get_value(field); if(value && (!strcmp(id, "first") || !strcmp(id, "last") || !strcmp(id, "nick") || !strcmp(id, "email"))) { - xmlnode *y = xmlnode_new_child(query, id); - xmlnode_insert_data(y, value, -1); + PurpleXmlNode *y = purple_xmlnode_new_child(query, id); + purple_xmlnode_insert_data(y, value, -1); } } } jabber_iq_set_callback(iq, user_search_result_cb, NULL); - xmlnode_set_attrib(iq->node, "to", usi->directory_server); + purple_xmlnode_set_attrib(iq->node, "to", usi->directory_server); jabber_iq_send(iq); g_free(usi->directory_server); @@ -2147,9 +2147,9 @@ static const char * jabber_user_dir_comments [] = { static void user_search_fields_result_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { - xmlnode *query, *x; + PurpleXmlNode *query, *x; if (!from) return; @@ -2168,15 +2168,15 @@ static void user_search_fields_result_cb(JabberStream *js, const char *from, } - if(!(query = xmlnode_get_child(packet, "query"))) + if(!(query = purple_xmlnode_get_child(packet, "query"))) return; - if((x = xmlnode_get_child_with_namespace(query, "x", "jabber:x:data"))) { + if((x = purple_xmlnode_get_child_with_namespace(query, "x", "jabber:x:data"))) { jabber_x_data_request(js, x, user_search_x_data_cb, g_strdup(from)); return; } else { struct user_search_info *usi; - xmlnode *instnode; + PurpleXmlNode *instnode; char *instructions = NULL; PurpleRequestFields *fields; PurpleRequestFieldGroup *group; @@ -2187,9 +2187,9 @@ static void user_search_fields_result_cb(JabberStream *js, const char *from, group = purple_request_field_group_new(NULL); purple_request_fields_add_group(fields, group); - if((instnode = xmlnode_get_child(query, "instructions"))) + if((instnode = purple_xmlnode_get_child(query, "instructions"))) { - char *tmp = xmlnode_get_data(instnode); + char *tmp = purple_xmlnode_get_data(instnode); if(tmp) { @@ -2206,22 +2206,22 @@ static void user_search_fields_result_cb(JabberStream *js, const char *from, "for any matching XMPP users.")); } - if(xmlnode_get_child(query, "first")) { + if(purple_xmlnode_get_child(query, "first")) { field = purple_request_field_string_new("first", _("First Name"), NULL, FALSE); purple_request_field_group_add_field(group, field); } - if(xmlnode_get_child(query, "last")) { + if(purple_xmlnode_get_child(query, "last")) { field = purple_request_field_string_new("last", _("Last Name"), NULL, FALSE); purple_request_field_group_add_field(group, field); } - if(xmlnode_get_child(query, "nick")) { + if(purple_xmlnode_get_child(query, "nick")) { field = purple_request_field_string_new("nick", _("Nickname"), NULL, FALSE); purple_request_field_group_add_field(group, field); } - if(xmlnode_get_child(query, "email")) { + if(purple_xmlnode_get_child(query, "email")) { field = purple_request_field_string_new("email", _("Email Address"), NULL, FALSE); purple_request_field_group_add_field(group, field); @@ -2263,7 +2263,7 @@ void jabber_user_search(JabberStream *js, const char *directory) } iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:search"); - xmlnode_set_attrib(iq->node, "to", directory); + purple_xmlnode_set_attrib(iq->node, "to", directory); jabber_iq_set_callback(iq, user_search_fields_result_cb, NULL); diff --git a/libpurple/protocols/jabber/caps.c b/libpurple/protocols/jabber/caps.c index 7e084681ee..87fd10af68 100644 --- a/libpurple/protocols/jabber/caps.c +++ b/libpurple/protocols/jabber/caps.c @@ -119,7 +119,7 @@ jabber_caps_client_info_destroy(JabberCapsClientInfo *info) free_string_glist(info->features); while (info->forms) { - xmlnode_free(info->forms->data); + purple_xmlnode_free(info->forms->data); info->forms = g_list_delete_link(info->forms, info->forms); } @@ -153,49 +153,49 @@ exts_to_xmlnode(gconstpointer key, gconstpointer value, gpointer user_data) { const char *identifier = key; const GList *features = value, *node; - xmlnode *client = user_data, *ext, *feature; + PurpleXmlNode *client = user_data, *ext, *feature; - ext = xmlnode_new_child(client, "ext"); - xmlnode_set_attrib(ext, "identifier", identifier); + ext = purple_xmlnode_new_child(client, "ext"); + purple_xmlnode_set_attrib(ext, "identifier", identifier); for (node = features; node; node = node->next) { - feature = xmlnode_new_child(ext, "feature"); - xmlnode_set_attrib(feature, "var", (const gchar *)node->data); + feature = purple_xmlnode_new_child(ext, "feature"); + purple_xmlnode_set_attrib(feature, "var", (const gchar *)node->data); } } static void jabber_caps_store_client(gpointer key, gpointer value, gpointer user_data) { const JabberCapsTuple *tuple = key; const JabberCapsClientInfo *props = value; - xmlnode *root = user_data; - xmlnode *client = xmlnode_new_child(root, "client"); + PurpleXmlNode *root = user_data; + PurpleXmlNode *client = purple_xmlnode_new_child(root, "client"); GList *iter; - xmlnode_set_attrib(client, "node", tuple->node); - xmlnode_set_attrib(client, "ver", tuple->ver); + purple_xmlnode_set_attrib(client, "node", tuple->node); + purple_xmlnode_set_attrib(client, "ver", tuple->ver); if (tuple->hash) - xmlnode_set_attrib(client, "hash", tuple->hash); + purple_xmlnode_set_attrib(client, "hash", tuple->hash); for(iter = props->identities; iter; iter = g_list_next(iter)) { JabberIdentity *id = iter->data; - xmlnode *identity = xmlnode_new_child(client, "identity"); - xmlnode_set_attrib(identity, "category", id->category); - xmlnode_set_attrib(identity, "type", id->type); + PurpleXmlNode *identity = purple_xmlnode_new_child(client, "identity"); + purple_xmlnode_set_attrib(identity, "category", id->category); + purple_xmlnode_set_attrib(identity, "type", id->type); if (id->name) - xmlnode_set_attrib(identity, "name", id->name); + purple_xmlnode_set_attrib(identity, "name", id->name); if (id->lang) - xmlnode_set_attrib(identity, "lang", id->lang); + purple_xmlnode_set_attrib(identity, "lang", id->lang); } for(iter = props->features; iter; iter = g_list_next(iter)) { const char *feat = iter->data; - xmlnode *feature = xmlnode_new_child(client, "feature"); - xmlnode_set_attrib(feature, "var", feat); + PurpleXmlNode *feature = purple_xmlnode_new_child(client, "feature"); + purple_xmlnode_set_attrib(feature, "var", feat); } for(iter = props->forms; iter; iter = g_list_next(iter)) { /* FIXME: See #7814 */ - xmlnode *xdata = iter->data; - xmlnode_insert_child(client, xmlnode_copy(xdata)); + PurpleXmlNode *xdata = iter->data; + purple_xmlnode_insert_child(client, purple_xmlnode_copy(xdata)); } /* TODO: Ideally, only save this once-per-node... */ @@ -208,10 +208,10 @@ do_jabber_caps_store(gpointer data) { char *str; int length = 0; - xmlnode *root = xmlnode_new("capabilities"); + PurpleXmlNode *root = purple_xmlnode_new("capabilities"); g_hash_table_foreach(capstable, jabber_caps_store_client, root); - str = xmlnode_to_formatted_str(root, &length); - xmlnode_free(root); + str = purple_xmlnode_to_formatted_str(root, &length); + purple_xmlnode_free(root); purple_util_write_data_to_file(JABBER_CAPS_FILENAME, str, length); g_free(str); @@ -229,46 +229,46 @@ schedule_caps_save(void) static void jabber_caps_load(void) { - xmlnode *capsdata = purple_util_read_xml_from_file(JABBER_CAPS_FILENAME, "XMPP capabilities cache"); - xmlnode *client; + PurpleXmlNode *capsdata = purple_util_read_xml_from_file(JABBER_CAPS_FILENAME, "XMPP capabilities cache"); + PurpleXmlNode *client; if(!capsdata) return; if (!g_str_equal(capsdata->name, "capabilities")) { - xmlnode_free(capsdata); + purple_xmlnode_free(capsdata); return; } for (client = capsdata->child; client; client = client->next) { - if (client->type != XMLNODE_TYPE_TAG) + if (client->type != PURPLE_XMLNODE_TYPE_TAG) continue; if (g_str_equal(client->name, "client")) { JabberCapsClientInfo *value = g_new0(JabberCapsClientInfo, 1); JabberCapsTuple *key = (JabberCapsTuple*)&value->tuple; - xmlnode *child; + PurpleXmlNode *child; JabberCapsNodeExts *exts = NULL; - key->node = g_strdup(xmlnode_get_attrib(client,"node")); - key->ver = g_strdup(xmlnode_get_attrib(client,"ver")); - key->hash = g_strdup(xmlnode_get_attrib(client,"hash")); + key->node = g_strdup(purple_xmlnode_get_attrib(client,"node")); + key->ver = g_strdup(purple_xmlnode_get_attrib(client,"ver")); + key->hash = g_strdup(purple_xmlnode_get_attrib(client,"hash")); /* v1.3 capabilities */ if (key->hash == NULL) exts = jabber_caps_find_exts_by_node(key->node); for (child = client->child; child; child = child->next) { - if (child->type != XMLNODE_TYPE_TAG) + if (child->type != PURPLE_XMLNODE_TYPE_TAG) continue; if (g_str_equal(child->name, "feature")) { - const char *var = xmlnode_get_attrib(child, "var"); + const char *var = purple_xmlnode_get_attrib(child, "var"); if(!var) continue; value->features = g_list_append(value->features,g_strdup(var)); } else if (g_str_equal(child->name, "identity")) { - const char *category = xmlnode_get_attrib(child, "category"); - const char *type = xmlnode_get_attrib(child, "type"); - const char *name = xmlnode_get_attrib(child, "name"); - const char *lang = xmlnode_get_attrib(child, "lang"); + const char *category = purple_xmlnode_get_attrib(child, "category"); + const char *type = purple_xmlnode_get_attrib(child, "type"); + const char *name = purple_xmlnode_get_attrib(child, "name"); + const char *lang = purple_xmlnode_get_attrib(child, "lang"); JabberIdentity *id; if (!category || !type) @@ -285,25 +285,25 @@ jabber_caps_load(void) /* TODO: See #7814 -- this might cause problems if anyone * ever actually specifies forms. In fact, for this to * work properly, that bug needs to be fixed in - * xmlnode_from_str, not the output version... */ - value->forms = g_list_append(value->forms, xmlnode_copy(child)); + * purple_xmlnode_from_str, not the output version... */ + value->forms = g_list_append(value->forms, purple_xmlnode_copy(child)); } else if (g_str_equal(child->name, "ext")) { if (key->hash != NULL) purple_debug_warning("jabber", "Ignoring exts when reading new-style caps\n"); else { /* TODO: Do we care about reading in the identities listed here? */ - const char *identifier = xmlnode_get_attrib(child, "identifier"); - xmlnode *node; + const char *identifier = purple_xmlnode_get_attrib(child, "identifier"); + PurpleXmlNode *node; GList *features = NULL; if (!identifier) continue; for (node = child->child; node; node = node->next) { - if (node->type != XMLNODE_TYPE_TAG) + if (node->type != PURPLE_XMLNODE_TYPE_TAG) continue; if (g_str_equal(node->name, "feature")) { - const char *var = xmlnode_get_attrib(node, "var"); + const char *var = purple_xmlnode_get_attrib(node, "var"); if (!var) continue; features = g_list_prepend(features, g_strdup(var)); @@ -325,7 +325,7 @@ jabber_caps_load(void) } } - xmlnode_free(capsdata); + purple_xmlnode_free(capsdata); } void jabber_caps_init(void) @@ -436,9 +436,9 @@ jabber_caps_get_info_complete(jabber_caps_cbplususerdata *userdata) static void jabber_caps_client_iqcb(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *packet, gpointer data) + const char *id, PurpleXmlNode *packet, gpointer data) { - xmlnode *query = xmlnode_get_child_with_namespace(packet, "query", + PurpleXmlNode *query = purple_xmlnode_get_child_with_namespace(packet, "query", NS_DISCO_INFO); jabber_caps_cbplususerdata *userdata = data; JabberCapsClientInfo *info = NULL, *value; @@ -473,7 +473,7 @@ jabber_caps_client_iqcb(JabberStream *js, const char *from, JabberIqType type, if (!hash || !g_str_equal(hash, userdata->ver)) { purple_debug_warning("jabber", "Could not validate caps info from " "%s. Expected %s, got %s\n", - xmlnode_get_attrib(packet, "from"), + purple_xmlnode_get_attrib(packet, "from"), userdata->ver, hash ? hash : "(null)"); userdata->cb(NULL, NULL, userdata->cb_data); @@ -530,11 +530,11 @@ typedef struct { static void jabber_caps_ext_iqcb(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *packet, gpointer data) + const char *id, PurpleXmlNode *packet, gpointer data) { - xmlnode *query = xmlnode_get_child_with_namespace(packet, "query", + PurpleXmlNode *query = purple_xmlnode_get_child_with_namespace(packet, "query", NS_DISCO_INFO); - xmlnode *child; + PurpleXmlNode *child; ext_iq_data *userdata = data; GList *features = NULL; JabberCapsNodeExts *node_exts; @@ -576,9 +576,9 @@ jabber_caps_ext_iqcb(JabberStream *js, const char *from, JabberIqType type, */ --userdata->data->extOutstanding; - for (child = xmlnode_get_child(query, "feature"); child; - child = xmlnode_get_next_twin(child)) { - const char *var = xmlnode_get_attrib(child, "var"); + for (child = purple_xmlnode_get_child(query, "feature"); child; + child = purple_xmlnode_get_next_twin(child)) { + const char *var = purple_xmlnode_get_attrib(child, "var"); if (var) features = g_list_prepend(features, g_strdup(var)); } @@ -637,16 +637,16 @@ void jabber_caps_get_info(JabberStream *js, const char *who, const char *node, /* If we don't have the basic information about the client, we need * to fetch it. */ JabberIq *iq; - xmlnode *query; + PurpleXmlNode *query; char *nodever; iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO); - query = xmlnode_get_child_with_namespace(iq->node, "query", + query = purple_xmlnode_get_child_with_namespace(iq->node, "query", NS_DISCO_INFO); nodever = g_strdup_printf("%s#%s", node, ver); - xmlnode_set_attrib(query, "node", nodever); + purple_xmlnode_set_attrib(query, "node", nodever); g_free(nodever); - xmlnode_set_attrib(iq->node, "to", who); + purple_xmlnode_set_attrib(iq->node, "to", who); cbplususerdata_ref(userdata); @@ -673,7 +673,7 @@ void jabber_caps_get_info(JabberStream *js, const char *who, const char *node, /* Look it up if we don't already know what it means */ if (!g_hash_table_lookup(node_exts->exts, exts[i])) { JabberIq *iq; - xmlnode *query; + PurpleXmlNode *query; char *nodeext; ext_iq_data *cbdata = g_new(ext_iq_data, 1); @@ -681,12 +681,12 @@ void jabber_caps_get_info(JabberStream *js, const char *who, const char *node, cbdata->data = cbplususerdata_ref(userdata); iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO); - query = xmlnode_get_child_with_namespace(iq->node, "query", + query = purple_xmlnode_get_child_with_namespace(iq->node, "query", NS_DISCO_INFO); nodeext = g_strdup_printf("%s#%s", node, exts[i]); - xmlnode_set_attrib(query, "node", nodeext); + purple_xmlnode_set_attrib(query, "node", nodeext); g_free(nodeext); - xmlnode_set_attrib(iq->node, "to", who); + purple_xmlnode_set_attrib(iq->node, "to", who); jabber_iq_set_callback(iq, jabber_caps_ext_iqcb, cbdata); jabber_iq_send(iq); @@ -713,8 +713,8 @@ void jabber_caps_get_info(JabberStream *js, const char *who, const char *node, static gint jabber_xdata_compare(gconstpointer a, gconstpointer b) { - const xmlnode *aformtypefield = a; - const xmlnode *bformtypefield = b; + const PurpleXmlNode *aformtypefield = a; + const PurpleXmlNode *bformtypefield = b; char *aformtype; char *bformtype; int result; @@ -728,9 +728,9 @@ jabber_xdata_compare(gconstpointer a, gconstpointer b) return result; } -JabberCapsClientInfo *jabber_caps_parse_client_info(xmlnode *query) +JabberCapsClientInfo *jabber_caps_parse_client_info(PurpleXmlNode *query) { - xmlnode *child; + PurpleXmlNode *child; JabberCapsClientInfo *info; if (!query || !g_str_equal(query->name, "query") || @@ -740,14 +740,14 @@ JabberCapsClientInfo *jabber_caps_parse_client_info(xmlnode *query) info = g_new0(JabberCapsClientInfo, 1); for(child = query->child; child; child = child->next) { - if (child->type != XMLNODE_TYPE_TAG) + if (child->type != PURPLE_XMLNODE_TYPE_TAG) continue; if (g_str_equal(child->name, "identity")) { /* parse identity */ - const char *category = xmlnode_get_attrib(child, "category"); - const char *type = xmlnode_get_attrib(child, "type"); - const char *name = xmlnode_get_attrib(child, "name"); - const char *lang = xmlnode_get_attrib(child, "lang"); + const char *category = purple_xmlnode_get_attrib(child, "category"); + const char *type = purple_xmlnode_get_attrib(child, "type"); + const char *name = purple_xmlnode_get_attrib(child, "name"); + const char *lang = purple_xmlnode_get_attrib(child, "lang"); JabberIdentity *id; if (!category || !type) @@ -762,13 +762,13 @@ JabberCapsClientInfo *jabber_caps_parse_client_info(xmlnode *query) info->identities = g_list_append(info->identities, id); } else if (g_str_equal(child->name, "feature")) { /* parse feature */ - const char *var = xmlnode_get_attrib(child, "var"); + const char *var = purple_xmlnode_get_attrib(child, "var"); if (var) info->features = g_list_prepend(info->features, g_strdup(var)); } else if (g_str_equal(child->name, "x")) { if (purple_strequal(child->xmlns, "jabber:x:data")) { /* x-data form */ - xmlnode *dataform = xmlnode_copy(child); + PurpleXmlNode *dataform = purple_xmlnode_copy(child); info->forms = g_list_append(info->forms, dataform); } } @@ -784,21 +784,21 @@ static gint jabber_caps_xdata_field_compare(gconstpointer a, gconstpointer b) return strcmp(ac->var, bc->var); } -static GList* jabber_caps_xdata_get_fields(const xmlnode *x) +static GList* jabber_caps_xdata_get_fields(const PurpleXmlNode *x) { GList *fields = NULL; - xmlnode *field; + PurpleXmlNode *field; if (!x) return NULL; - for (field = xmlnode_get_child(x, "field"); field; field = xmlnode_get_next_twin(field)) { - xmlnode *value; + for (field = purple_xmlnode_get_child(x, "field"); field; field = purple_xmlnode_get_next_twin(field)) { + PurpleXmlNode *value; JabberDataFormField *xdatafield = g_new0(JabberDataFormField, 1); - xdatafield->var = g_strdup(xmlnode_get_attrib(field, "var")); + xdatafield->var = g_strdup(purple_xmlnode_get_attrib(field, "var")); - for (value = xmlnode_get_child(field, "value"); value; value = xmlnode_get_next_twin(value)) { - gchar *val = xmlnode_get_data(value); + for (value = purple_xmlnode_get_child(field, "value"); value; value = purple_xmlnode_get_next_twin(value)) { + gchar *val = purple_xmlnode_get_data(value); xdatafield->values = g_list_prepend(xdatafield->values, val); } @@ -876,7 +876,7 @@ gchar *jabber_caps_calculate_hash(JabberCapsClientInfo *info, PurpleHash *hash) /* concat x-data forms to the verification string */ for(node = info->forms; node; node = node->next) { - xmlnode *data = (xmlnode *)node->data; + PurpleXmlNode *data = (PurpleXmlNode *)node->data; gchar *formtype = jabber_x_data_get_formtype(data); GList *fields = jabber_caps_xdata_get_fields(data); diff --git a/libpurple/protocols/jabber/caps.h b/libpurple/protocols/jabber/caps.h index b428c577d2..2d698fa7ef 100644 --- a/libpurple/protocols/jabber/caps.h +++ b/libpurple/protocols/jabber/caps.h @@ -42,7 +42,7 @@ typedef struct _JabberCapsTuple { struct _JabberCapsClientInfo { GList *identities; /* JabberIdentity */ GList *features; /* char * */ - GList *forms; /* xmlnode * */ + GList *forms; /* PurpleXmlNode * */ JabberCapsNodeExts *exts; const JabberCapsTuple tuple; @@ -125,6 +125,6 @@ void jabber_caps_broadcast_change(void); * @param query The 'query' element from an IQ reply stanza. * @returns A JabberCapsClientInfo struct, or NULL on error */ -JabberCapsClientInfo *jabber_caps_parse_client_info(xmlnode *query); +JabberCapsClientInfo *jabber_caps_parse_client_info(PurpleXmlNode *query); #endif /* PURPLE_JABBER_CAPS_H_ */ diff --git a/libpurple/protocols/jabber/chat.c b/libpurple/protocols/jabber/chat.c index e797d0cb4b..e06d963506 100644 --- a/libpurple/protocols/jabber/chat.c +++ b/libpurple/protocols/jabber/chat.c @@ -156,29 +156,29 @@ void jabber_chat_invite(PurpleConnection *gc, int id, const char *msg, { JabberStream *js = purple_connection_get_protocol_data(gc); JabberChat *chat; - xmlnode *message, *body, *x, *invite; + PurpleXmlNode *message, *body, *x, *invite; char *room_jid; chat = jabber_chat_find_by_id(js, id); if(!chat) return; - message = xmlnode_new("message"); + message = purple_xmlnode_new("message"); room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); if(chat->muc) { - xmlnode_set_attrib(message, "to", room_jid); - x = xmlnode_new_child(message, "x"); - xmlnode_set_namespace(x, "http://jabber.org/protocol/muc#user"); - invite = xmlnode_new_child(x, "invite"); - xmlnode_set_attrib(invite, "to", name); + purple_xmlnode_set_attrib(message, "to", room_jid); + x = purple_xmlnode_new_child(message, "x"); + purple_xmlnode_set_namespace(x, "http://jabber.org/protocol/muc#user"); + invite = purple_xmlnode_new_child(x, "invite"); + purple_xmlnode_set_attrib(invite, "to", name); if (msg) { - body = xmlnode_new_child(invite, "reason"); - xmlnode_insert_data(body, msg, -1); + body = purple_xmlnode_new_child(invite, "reason"); + purple_xmlnode_insert_data(body, msg, -1); } } else { - xmlnode_set_attrib(message, "to", name); + purple_xmlnode_set_attrib(message, "to", name); /* * Putting the reason into the body was an 'undocumented protocol, * ...not part of "groupchat 1.0"'. @@ -187,21 +187,21 @@ void jabber_chat_invite(PurpleConnection *gc, int id, const char *msg, * Left here for compatibility. */ if (msg) { - body = xmlnode_new_child(message, "body"); - xmlnode_insert_data(body, msg, -1); + body = purple_xmlnode_new_child(message, "body"); + purple_xmlnode_insert_data(body, msg, -1); } - x = xmlnode_new_child(message, "x"); - xmlnode_set_attrib(x, "jid", room_jid); + x = purple_xmlnode_new_child(message, "x"); + purple_xmlnode_set_attrib(x, "jid", room_jid); /* The better place for it! XEP-0249 style. */ if (msg) - xmlnode_set_attrib(x, "reason", msg); - xmlnode_set_namespace(x, "jabber:x:conference"); + purple_xmlnode_set_attrib(x, "reason", msg); + purple_xmlnode_set_namespace(x, "jabber:x:conference"); } jabber_send(js, message); - xmlnode_free(message); + purple_xmlnode_free(message); g_free(room_jid); } @@ -274,7 +274,7 @@ JabberChat *jabber_join_chat(JabberStream *js, const char *room, PurpleAccount *account; PurpleStatus *status; - xmlnode *presence, *x; + PurpleXmlNode *presence, *x; JabberBuddyState state; char *msg; int priority; @@ -302,7 +302,7 @@ JabberChat *jabber_join_chat(JabberStream *js, const char *room, g_free(msg); jid = g_strdup_printf("%s@%s/%s", room, server, handle); - xmlnode_set_attrib(presence, "to", jid); + purple_xmlnode_set_attrib(presence, "to", jid); g_free(jid); history_maxchars = g_hash_table_lookup(data, "history_maxchars"); @@ -321,12 +321,12 @@ JabberChat *jabber_join_chat(JabberStream *js, const char *room, } } - x = xmlnode_new_child(presence, "x"); - xmlnode_set_namespace(x, "http://jabber.org/protocol/muc"); + x = purple_xmlnode_new_child(presence, "x"); + purple_xmlnode_set_namespace(x, "http://jabber.org/protocol/muc"); if (password && *password) { - xmlnode *p = xmlnode_new_child(x, "password"); - xmlnode_insert_data(p, password, -1); + PurpleXmlNode *p = purple_xmlnode_new_child(x, "password"); + purple_xmlnode_insert_data(p, password, -1); } if ((history_maxchars && *history_maxchars) @@ -334,24 +334,24 @@ JabberChat *jabber_join_chat(JabberStream *js, const char *room, || (history_seconds && *history_seconds) || (history_since_string && *history_since_string)) { - xmlnode *history = xmlnode_new_child(x, "history"); + PurpleXmlNode *history = purple_xmlnode_new_child(x, "history"); if (history_maxchars && *history_maxchars) { - xmlnode_set_attrib(history, "maxchars", history_maxchars); + purple_xmlnode_set_attrib(history, "maxchars", history_maxchars); } if (history_maxstanzas && *history_maxstanzas) { - xmlnode_set_attrib(history, "maxstanzas", history_maxstanzas); + purple_xmlnode_set_attrib(history, "maxstanzas", history_maxstanzas); } if (history_seconds && *history_seconds) { - xmlnode_set_attrib(history, "seconds", history_seconds); + purple_xmlnode_set_attrib(history, "seconds", history_seconds); } if (history_since_string && *history_since_string) { - xmlnode_set_attrib(history, "since", history_since_string); + purple_xmlnode_set_attrib(history, "since", history_since_string); } } jabber_send(js, presence); - xmlnode_free(presence); + purple_xmlnode_free(presence); return chat; } @@ -475,29 +475,29 @@ char *jabber_chat_user_real_name(PurpleConnection *gc, int id, const char *who) return g_strdup_printf("%s@%s/%s", chat->room, chat->server, who); } -static void jabber_chat_room_configure_x_data_cb(JabberStream *js, xmlnode *result, gpointer data) +static void jabber_chat_room_configure_x_data_cb(JabberStream *js, PurpleXmlNode *result, gpointer data) { JabberChat *chat = data; - xmlnode *query; + PurpleXmlNode *query; JabberIq *iq; char *to = g_strdup_printf("%s@%s", chat->room, chat->server); iq = jabber_iq_new_query(js, JABBER_IQ_SET, "http://jabber.org/protocol/muc#owner"); - xmlnode_set_attrib(iq->node, "to", to); + purple_xmlnode_set_attrib(iq->node, "to", to); g_free(to); - query = xmlnode_get_child(iq->node, "query"); + query = purple_xmlnode_get_child(iq->node, "query"); - xmlnode_insert_child(query, result); + purple_xmlnode_insert_child(query, result); jabber_iq_send(iq); } static void jabber_chat_room_configure_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { - xmlnode *query, *x; + PurpleXmlNode *query, *x; char *msg; JabberChat *chat; JabberID *jid; @@ -517,12 +517,12 @@ static void jabber_chat_room_configure_cb(JabberStream *js, const char *from, if(!chat) return; - if(!(query = xmlnode_get_child(packet, "query"))) + if(!(query = purple_xmlnode_get_child(packet, "query"))) return; - for(x = xmlnode_get_child(query, "x"); x; x = xmlnode_get_next_twin(x)) { + for(x = purple_xmlnode_get_child(query, "x"); x; x = purple_xmlnode_get_next_twin(x)) { const char *xmlns; - if(!(xmlns = xmlnode_get_namespace(x))) + if(!(xmlns = purple_xmlnode_get_namespace(x))) continue; if(!strcmp(xmlns, "jabber:x:data")) { @@ -567,7 +567,7 @@ void jabber_chat_request_room_configure(JabberChat *chat) { "http://jabber.org/protocol/muc#owner"); room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); - xmlnode_set_attrib(iq->node, "to", room_jid); + purple_xmlnode_set_attrib(iq->node, "to", room_jid); jabber_iq_set_callback(iq, jabber_chat_room_configure_cb, NULL); @@ -578,7 +578,7 @@ void jabber_chat_request_room_configure(JabberChat *chat) { void jabber_chat_create_instant_room(JabberChat *chat) { JabberIq *iq; - xmlnode *query, *x; + PurpleXmlNode *query, *x; char *room_jid; if(!chat) @@ -588,13 +588,13 @@ void jabber_chat_create_instant_room(JabberChat *chat) { iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, "http://jabber.org/protocol/muc#owner"); - query = xmlnode_get_child(iq->node, "query"); - x = xmlnode_new_child(query, "x"); + query = purple_xmlnode_get_child(iq->node, "query"); + x = purple_xmlnode_new_child(query, "x"); room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); - xmlnode_set_attrib(iq->node, "to", room_jid); - xmlnode_set_namespace(x, "jabber:x:data"); - xmlnode_set_attrib(x, "type", "submit"); + purple_xmlnode_set_attrib(iq->node, "to", room_jid); + purple_xmlnode_set_namespace(x, "jabber:x:data"); + purple_xmlnode_set_attrib(x, "type", "submit"); jabber_iq_send(iq); @@ -604,7 +604,7 @@ void jabber_chat_create_instant_room(JabberChat *chat) { static void jabber_chat_register_x_data_result_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { if (type == JABBER_IQ_ERROR) { char *msg = jabber_parse_error(js, packet, NULL); @@ -617,20 +617,20 @@ jabber_chat_register_x_data_result_cb(JabberStream *js, const char *from, } } -static void jabber_chat_register_x_data_cb(JabberStream *js, xmlnode *result, gpointer data) +static void jabber_chat_register_x_data_cb(JabberStream *js, PurpleXmlNode *result, gpointer data) { JabberChat *chat = data; - xmlnode *query; + PurpleXmlNode *query; JabberIq *iq; char *to = g_strdup_printf("%s@%s", chat->room, chat->server); iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); - xmlnode_set_attrib(iq->node, "to", to); + purple_xmlnode_set_attrib(iq->node, "to", to); g_free(to); - query = xmlnode_get_child(iq->node, "query"); + query = purple_xmlnode_get_child(iq->node, "query"); - xmlnode_insert_child(query, result); + purple_xmlnode_insert_child(query, result); jabber_iq_set_callback(iq, jabber_chat_register_x_data_result_cb, NULL); @@ -639,9 +639,9 @@ static void jabber_chat_register_x_data_cb(JabberStream *js, xmlnode *result, gp static void jabber_chat_register_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { - xmlnode *query, *x; + PurpleXmlNode *query, *x; char *msg; JabberChat *chat; JabberID *jid; @@ -661,13 +661,13 @@ static void jabber_chat_register_cb(JabberStream *js, const char *from, if(!chat) return; - if(!(query = xmlnode_get_child(packet, "query"))) + if(!(query = purple_xmlnode_get_child(packet, "query"))) return; - for(x = xmlnode_get_child(query, "x"); x; x = xmlnode_get_next_twin(x)) { + for(x = purple_xmlnode_get_child(query, "x"); x; x = purple_xmlnode_get_next_twin(x)) { const char *xmlns; - if(!(xmlns = xmlnode_get_namespace(x))) + if(!(xmlns = purple_xmlnode_get_namespace(x))) continue; if(!strcmp(xmlns, "jabber:x:data")) { @@ -703,7 +703,7 @@ void jabber_chat_register(JabberChat *chat) room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, "jabber:iq:register"); - xmlnode_set_attrib(iq->node, "to", room_jid); + purple_xmlnode_set_attrib(iq->node, "to", room_jid); g_free(room_jid); jabber_iq_set_callback(iq, jabber_chat_register_cb, NULL); @@ -744,7 +744,7 @@ void jabber_chat_set_topic(PurpleConnection *gc, int id, const char *topic) gboolean jabber_chat_change_nick(JabberChat *chat, const char *nick) { - xmlnode *presence; + PurpleXmlNode *presence; char *full_jid; PurpleAccount *account; PurpleStatus *status; @@ -766,12 +766,12 @@ gboolean jabber_chat_change_nick(JabberChat *chat, const char *nick) presence = jabber_presence_create_js(chat->js, state, msg, priority); full_jid = g_strdup_printf("%s@%s/%s", chat->room, chat->server, nick); - xmlnode_set_attrib(presence, "to", full_jid); + purple_xmlnode_set_attrib(presence, "to", full_jid); g_free(full_jid); g_free(msg); jabber_send(chat->js, presence); - xmlnode_free(presence); + purple_xmlnode_free(presence); return TRUE; } @@ -779,29 +779,29 @@ gboolean jabber_chat_change_nick(JabberChat *chat, const char *nick) void jabber_chat_part(JabberChat *chat, const char *msg) { char *room_jid; - xmlnode *presence; + PurpleXmlNode *presence; room_jid = g_strdup_printf("%s@%s/%s", chat->room, chat->server, chat->handle); - presence = xmlnode_new("presence"); - xmlnode_set_attrib(presence, "to", room_jid); - xmlnode_set_attrib(presence, "type", "unavailable"); + presence = purple_xmlnode_new("presence"); + purple_xmlnode_set_attrib(presence, "to", room_jid); + purple_xmlnode_set_attrib(presence, "type", "unavailable"); if(msg) { - xmlnode *status = xmlnode_new_child(presence, "status"); - xmlnode_insert_data(status, msg, -1); + PurpleXmlNode *status = purple_xmlnode_new_child(presence, "status"); + purple_xmlnode_insert_data(status, msg, -1); } jabber_send(chat->js, presence); - xmlnode_free(presence); + purple_xmlnode_free(presence); g_free(room_jid); } static void roomlist_disco_result_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { - xmlnode *query; - xmlnode *item; + PurpleXmlNode *query; + PurpleXmlNode *item; if(!js->roomlist) return; @@ -817,7 +817,7 @@ static void roomlist_disco_result_cb(JabberStream *js, const char *from, return; } - if(!(query = xmlnode_get_child(packet, "query"))) { + if(!(query = purple_xmlnode_get_child(packet, "query"))) { char *err = jabber_parse_error(js, packet, NULL); purple_notify_error(js->gc, _("Error"), _("Error retrieving room list"), err); @@ -828,15 +828,15 @@ static void roomlist_disco_result_cb(JabberStream *js, const char *from, return; } - for(item = xmlnode_get_child(query, "item"); item; - item = xmlnode_get_next_twin(item)) { + for(item = purple_xmlnode_get_child(query, "item"); item; + item = purple_xmlnode_get_next_twin(item)) { const char *name; PurpleRoomlistRoom *room; JabberID *jid; - if(!(jid = jabber_id_new(xmlnode_get_attrib(item, "jid")))) + if(!(jid = jabber_id_new(purple_xmlnode_get_attrib(item, "jid")))) continue; - name = xmlnode_get_attrib(item, "name"); + name = purple_xmlnode_get_attrib(item, "name"); room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, jid->node, NULL); @@ -877,7 +877,7 @@ static void roomlist_ok_cb(JabberStream *js, const char *server) iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_ITEMS); - xmlnode_set_attrib(iq->node, "to", server); + purple_xmlnode_set_attrib(iq->node, "to", server); jabber_iq_set_callback(iq, roomlist_disco_result_cb, NULL); @@ -974,7 +974,7 @@ gboolean jabber_chat_ban_user(JabberChat *chat, const char *who, const char *why const char *jid; char *to; JabberIq *iq; - xmlnode *query, *item, *reason; + PurpleXmlNode *query, *item, *reason; jcm = g_hash_table_lookup(chat->members, who); if (jcm && jcm->jid) @@ -988,16 +988,16 @@ gboolean jabber_chat_ban_user(JabberChat *chat, const char *who, const char *why "http://jabber.org/protocol/muc#admin"); to = g_strdup_printf("%s@%s", chat->room, chat->server); - xmlnode_set_attrib(iq->node, "to", to); + purple_xmlnode_set_attrib(iq->node, "to", to); g_free(to); - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); - xmlnode_set_attrib(item, "jid", jid); - xmlnode_set_attrib(item, "affiliation", "outcast"); + query = purple_xmlnode_get_child(iq->node, "query"); + item = purple_xmlnode_new_child(query, "item"); + purple_xmlnode_set_attrib(item, "jid", jid); + purple_xmlnode_set_attrib(item, "affiliation", "outcast"); if(why) { - reason = xmlnode_new_child(item, "reason"); - xmlnode_insert_data(reason, why, -1); + reason = purple_xmlnode_new_child(item, "reason"); + purple_xmlnode_insert_data(reason, why, -1); } jabber_iq_send(iq); @@ -1011,7 +1011,7 @@ gboolean jabber_chat_affiliate_user(JabberChat *chat, const char *who, const cha const char *jid; char *to; JabberIq *iq; - xmlnode *query, *item; + PurpleXmlNode *query, *item; jcm = g_hash_table_lookup(chat->members, who); if (jcm && jcm->jid) @@ -1025,13 +1025,13 @@ gboolean jabber_chat_affiliate_user(JabberChat *chat, const char *who, const cha "http://jabber.org/protocol/muc#admin"); to = g_strdup_printf("%s@%s", chat->room, chat->server); - xmlnode_set_attrib(iq->node, "to", to); + purple_xmlnode_set_attrib(iq->node, "to", to); g_free(to); - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); - xmlnode_set_attrib(item, "jid", jid); - xmlnode_set_attrib(item, "affiliation", affiliation); + query = purple_xmlnode_get_child(iq->node, "query"); + item = purple_xmlnode_new_child(query, "item"); + purple_xmlnode_set_attrib(item, "jid", jid); + purple_xmlnode_set_attrib(item, "affiliation", affiliation); jabber_iq_send(iq); @@ -1041,10 +1041,10 @@ gboolean jabber_chat_affiliate_user(JabberChat *chat, const char *who, const cha static void jabber_chat_affiliation_list_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { JabberChat *chat; - xmlnode *query, *item; + PurpleXmlNode *query, *item; int chat_id = GPOINTER_TO_INT(data); GString *buf; @@ -1054,16 +1054,16 @@ jabber_chat_affiliation_list_cb(JabberStream *js, const char *from, if (type == JABBER_IQ_ERROR) return; - if(!(query = xmlnode_get_child(packet, "query"))) + if(!(query = purple_xmlnode_get_child(packet, "query"))) return; buf = g_string_new(_("Affiliations:")); - item = xmlnode_get_child(query, "item"); + item = purple_xmlnode_get_child(query, "item"); if (item) { - for( ; item; item = xmlnode_get_next_twin(item)) { - const char *jid = xmlnode_get_attrib(item, "jid"); - const char *affiliation = xmlnode_get_attrib(item, "affiliation"); + for( ; item; item = purple_xmlnode_get_next_twin(item)) { + const char *jid = purple_xmlnode_get_attrib(item, "jid"); + const char *affiliation = purple_xmlnode_get_attrib(item, "affiliation"); if (jid && affiliation) g_string_append_printf(buf, "\n%s %s", jid, affiliation); } @@ -1082,17 +1082,17 @@ gboolean jabber_chat_affiliation_list(JabberChat *chat, const char *affiliation) { JabberIq *iq; char *room_jid; - xmlnode *query, *item; + PurpleXmlNode *query, *item; iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, "http://jabber.org/protocol/muc#admin"); room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); - xmlnode_set_attrib(iq->node, "to", room_jid); + purple_xmlnode_set_attrib(iq->node, "to", room_jid); - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); - xmlnode_set_attrib(item, "affiliation", affiliation); + query = purple_xmlnode_get_child(iq->node, "query"); + item = purple_xmlnode_new_child(query, "item"); + purple_xmlnode_set_attrib(item, "affiliation", affiliation); jabber_iq_set_callback(iq, jabber_chat_affiliation_list_cb, GINT_TO_POINTER(chat->id)); jabber_iq_send(iq); @@ -1105,7 +1105,7 @@ gboolean jabber_chat_role_user(JabberChat *chat, const char *who, { char *to; JabberIq *iq; - xmlnode *query, *item; + PurpleXmlNode *query, *item; JabberChatMember *jcm; jcm = g_hash_table_lookup(chat->members, who); @@ -1117,16 +1117,16 @@ gboolean jabber_chat_role_user(JabberChat *chat, const char *who, "http://jabber.org/protocol/muc#admin"); to = g_strdup_printf("%s@%s", chat->room, chat->server); - xmlnode_set_attrib(iq->node, "to", to); + purple_xmlnode_set_attrib(iq->node, "to", to); g_free(to); - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); - xmlnode_set_attrib(item, "nick", jcm->handle); - xmlnode_set_attrib(item, "role", role); + query = purple_xmlnode_get_child(iq->node, "query"); + item = purple_xmlnode_new_child(query, "item"); + purple_xmlnode_set_attrib(item, "nick", jcm->handle); + purple_xmlnode_set_attrib(item, "role", role); if (why) { - xmlnode *reason = xmlnode_new_child(item, "reason"); - xmlnode_insert_data(reason, why, -1); + PurpleXmlNode *reason = purple_xmlnode_new_child(item, "reason"); + purple_xmlnode_insert_data(reason, why, -1); } jabber_iq_send(iq); @@ -1136,10 +1136,10 @@ gboolean jabber_chat_role_user(JabberChat *chat, const char *who, static void jabber_chat_role_list_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { JabberChat *chat; - xmlnode *query, *item; + PurpleXmlNode *query, *item; int chat_id = GPOINTER_TO_INT(data); GString *buf; @@ -1149,16 +1149,16 @@ static void jabber_chat_role_list_cb(JabberStream *js, const char *from, if (type == JABBER_IQ_ERROR) return; - if(!(query = xmlnode_get_child(packet, "query"))) + if(!(query = purple_xmlnode_get_child(packet, "query"))) return; buf = g_string_new(_("Roles:")); - item = xmlnode_get_child(query, "item"); + item = purple_xmlnode_get_child(query, "item"); if (item) { - for( ; item; item = xmlnode_get_next_twin(item)) { - const char *jid = xmlnode_get_attrib(item, "jid"); - const char *role = xmlnode_get_attrib(item, "role"); + for( ; item; item = purple_xmlnode_get_next_twin(item)) { + const char *jid = purple_xmlnode_get_attrib(item, "jid"); + const char *role = purple_xmlnode_get_attrib(item, "role"); if (jid && role) g_string_append_printf(buf, "\n%s %s", jid, role); } @@ -1177,17 +1177,17 @@ gboolean jabber_chat_role_list(JabberChat *chat, const char *role) { JabberIq *iq; char *room_jid; - xmlnode *query, *item; + PurpleXmlNode *query, *item; iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, "http://jabber.org/protocol/muc#admin"); room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); - xmlnode_set_attrib(iq->node, "to", room_jid); + purple_xmlnode_set_attrib(iq->node, "to", room_jid); - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); - xmlnode_set_attrib(item, "role", role); + query = purple_xmlnode_get_child(iq->node, "query"); + item = purple_xmlnode_new_child(query, "item"); + purple_xmlnode_set_attrib(item, "role", role); jabber_iq_set_callback(iq, jabber_chat_role_list_cb, GINT_TO_POINTER(chat->id)); jabber_iq_send(iq); @@ -1197,11 +1197,11 @@ gboolean jabber_chat_role_list(JabberChat *chat, const char *role) static void jabber_chat_disco_traffic_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { JabberChat *chat; #if 0 - xmlnode *query, *x; + PurpleXmlNode *query, *x; #endif int chat_id = GPOINTER_TO_INT(data); @@ -1219,13 +1219,13 @@ static void jabber_chat_disco_traffic_cb(JabberStream *js, const char *from, return; } - if(!(query = xmlnode_get_child(packet, "query"))) + if(!(query = purple_xmlnode_get_child(packet, "query"))) return; chat->xhtml = FALSE; - for(x = xmlnode_get_child(query, "feature"); x; x = xmlnode_get_next_twin(x)) { - const char *var = xmlnode_get_attrib(x, "var"); + for(x = purple_xmlnode_get_child(query, "feature"); x; x = purple_xmlnode_get_next_twin(x)) { + const char *var = purple_xmlnode_get_attrib(x, "var"); if(var && !strcmp(var, NS_XHTML_IM)) { chat->xhtml = TRUE; @@ -1237,18 +1237,18 @@ static void jabber_chat_disco_traffic_cb(JabberStream *js, const char *from, void jabber_chat_disco_traffic(JabberChat *chat) { JabberIq *iq; - xmlnode *query; + PurpleXmlNode *query; char *room_jid; room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, NS_DISCO_INFO); - xmlnode_set_attrib(iq->node, "to", room_jid); + purple_xmlnode_set_attrib(iq->node, "to", room_jid); - query = xmlnode_get_child(iq->node, "query"); + query = purple_xmlnode_get_child(iq->node, "query"); - xmlnode_set_attrib(query, "node", "http://jabber.org/protocol/muc#traffic"); + purple_xmlnode_set_attrib(query, "node", "http://jabber.org/protocol/muc#traffic"); jabber_iq_set_callback(iq, jabber_chat_disco_traffic_cb, GINT_TO_POINTER(chat->id)); diff --git a/libpurple/protocols/jabber/data.c b/libpurple/protocols/jabber/data.c index 9de1017b46..67d2828476 100644 --- a/libpurple/protocols/jabber/data.c +++ b/libpurple/protocols/jabber/data.c @@ -78,7 +78,7 @@ jabber_data_delete(gpointer cbdata) JabberData * -jabber_data_create_from_xml(xmlnode *tag) +jabber_data_create_from_xml(PurpleXmlNode *tag) { JabberData *data; gchar *raw_data = NULL; @@ -92,15 +92,15 @@ jabber_data_create_from_xml(xmlnode *tag) return NULL; } - cid = xmlnode_get_attrib(tag, "cid"); - type = xmlnode_get_attrib(tag, "type"); + cid = purple_xmlnode_get_attrib(tag, "cid"); + type = purple_xmlnode_get_attrib(tag, "type"); if (!cid || !type) { purple_debug_error("jabber", "cid or type missing\n"); return NULL; } - raw_data = xmlnode_get_data(tag); + raw_data = purple_xmlnode_get_data(tag); if (raw_data == NULL || *raw_data == '\0') { purple_debug_error("jabber", "data element was empty"); @@ -165,54 +165,54 @@ jabber_data_get_data(const JabberData *data) return data->data; } -xmlnode * +PurpleXmlNode * jabber_data_get_xml_definition(const JabberData *data) { - xmlnode *tag; + PurpleXmlNode *tag; char *base64data; g_return_val_if_fail(data != NULL, NULL); - tag = xmlnode_new("data"); + tag = purple_xmlnode_new("data"); base64data = purple_base64_encode(data->data, data->size); - xmlnode_set_namespace(tag, NS_BOB); - xmlnode_set_attrib(tag, "cid", data->cid); - xmlnode_set_attrib(tag, "type", data->type); + purple_xmlnode_set_namespace(tag, NS_BOB); + purple_xmlnode_set_attrib(tag, "cid", data->cid); + purple_xmlnode_set_attrib(tag, "type", data->type); - xmlnode_insert_data(tag, base64data, -1); + purple_xmlnode_insert_data(tag, base64data, -1); g_free(base64data); return tag; } -xmlnode * +PurpleXmlNode * jabber_data_get_xhtml_im(const JabberData *data, const gchar *alt) { - xmlnode *img; + PurpleXmlNode *img; char *src; g_return_val_if_fail(data != NULL, NULL); g_return_val_if_fail(alt != NULL, NULL); - img = xmlnode_new("img"); - xmlnode_set_attrib(img, "alt", alt); + img = purple_xmlnode_new("img"); + purple_xmlnode_set_attrib(img, "alt", alt); src = g_strconcat("cid:", data->cid, NULL); - xmlnode_set_attrib(img, "src", src); + purple_xmlnode_set_attrib(img, "src", src); g_free(src); return img; } -static xmlnode * +static PurpleXmlNode * jabber_data_get_xml_request(const gchar *cid) { - xmlnode *tag = xmlnode_new("data"); + PurpleXmlNode *tag = purple_xmlnode_new("data"); - xmlnode_set_namespace(tag, NS_BOB); - xmlnode_set_attrib(tag, "cid", cid); + purple_xmlnode_set_namespace(tag, NS_BOB); + purple_xmlnode_set_attrib(tag, "cid", cid); return tag; } @@ -276,7 +276,7 @@ typedef struct { static void jabber_data_request_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *packet, gpointer data) + JabberIqType type, const char *id, PurpleXmlNode *packet, gpointer data) { JabberDataRequestData *request_data = (JabberDataRequestData *) data; gpointer userdata = request_data->userdata; @@ -284,8 +284,8 @@ jabber_data_request_cb(JabberStream *js, const char *from, gboolean ephemeral = request_data->ephemeral; JabberDataRequestCallback *cb = request_data->cb; - xmlnode *data_element = xmlnode_get_child(packet, "data"); - xmlnode *item_not_found = xmlnode_get_child(packet, "item-not-found"); + PurpleXmlNode *data_element = purple_xmlnode_get_child(packet, "data"); + PurpleXmlNode *item_not_found = purple_xmlnode_get_child(packet, "item-not-found"); /* did we get a data element as result? */ if (data_element && type == JABBER_IQ_RESULT) { @@ -313,7 +313,7 @@ jabber_data_request(JabberStream *js, const gchar *cid, const gchar *who, gpointer userdata) { JabberIq *request; - xmlnode *data_request; + PurpleXmlNode *data_request; JabberDataRequestData *data; g_return_if_fail(cid != NULL); @@ -329,9 +329,9 @@ jabber_data_request(JabberStream *js, const gchar *cid, const gchar *who, data->ephemeral = ephemeral; data->cb = cb; - xmlnode_set_attrib(request->node, "to", who); + purple_xmlnode_set_attrib(request->node, "to", who); jabber_iq_set_callback(request, jabber_data_request_cb, data); - xmlnode_insert_child(request->node, data_request); + purple_xmlnode_insert_child(request->node, data_request); jabber_iq_send(request); } @@ -404,26 +404,26 @@ jabber_data_associate_remote(JabberStream *js, const gchar *who, JabberData *dat void jabber_data_parse(JabberStream *js, const char *who, JabberIqType type, - const char *id, xmlnode *data_node) + const char *id, PurpleXmlNode *data_node) { JabberIq *result = NULL; - const char *cid = xmlnode_get_attrib(data_node, "cid"); + const char *cid = purple_xmlnode_get_attrib(data_node, "cid"); const JabberData *data = cid ? jabber_data_find_local_by_cid(cid) : NULL; if (!data) { - xmlnode *item_not_found = xmlnode_new("item-not-found"); + PurpleXmlNode *item_not_found = purple_xmlnode_new("item-not-found"); result = jabber_iq_new(js, JABBER_IQ_ERROR); if (who) - xmlnode_set_attrib(result->node, "to", who); - xmlnode_set_attrib(result->node, "id", id); - xmlnode_insert_child(result->node, item_not_found); + purple_xmlnode_set_attrib(result->node, "to", who); + purple_xmlnode_set_attrib(result->node, "id", id); + purple_xmlnode_insert_child(result->node, item_not_found); } else { result = jabber_iq_new(js, JABBER_IQ_RESULT); if (who) - xmlnode_set_attrib(result->node, "to", who); - xmlnode_set_attrib(result->node, "id", id); - xmlnode_insert_child(result->node, + purple_xmlnode_set_attrib(result->node, "to", who); + purple_xmlnode_set_attrib(result->node, "id", id); + purple_xmlnode_insert_child(result->node, jabber_data_get_xml_definition(data)); /* if the data object is temporary, destroy it and remove the references to it */ diff --git a/libpurple/protocols/jabber/data.h b/libpurple/protocols/jabber/data.h index 84c200f633..960fa27c58 100644 --- a/libpurple/protocols/jabber/data.h +++ b/libpurple/protocols/jabber/data.h @@ -50,7 +50,7 @@ JabberData *jabber_data_create_from_data(gconstpointer data, gsize size, /* create a JabberData instance from an XML "data" element (as defined by XEP 0231 */ -JabberData *jabber_data_create_from_xml(xmlnode *tag); +JabberData *jabber_data_create_from_xml(PurpleXmlNode *tag); /* destroy a JabberData instance, NOT to be used on data that has been associated, since they get "owned" */ @@ -63,10 +63,10 @@ gsize jabber_data_get_size(const JabberData *data); gpointer jabber_data_get_data(const JabberData *data); /* returns the XML definition for the data element */ -xmlnode *jabber_data_get_xml_definition(const JabberData *data); +PurpleXmlNode *jabber_data_get_xml_definition(const JabberData *data); /* returns an XHTML-IM "img" tag given a data instance */ -xmlnode *jabber_data_get_xhtml_im(const JabberData *data, const gchar *alt); +PurpleXmlNode *jabber_data_get_xhtml_im(const JabberData *data, const gchar *alt); void jabber_data_request(JabberStream *js, const gchar *cid, const gchar *who, gchar *alt, gboolean ephemeral, JabberDataRequestCallback cb, @@ -85,7 +85,7 @@ void jabber_data_associate_remote(JabberStream *js, const gchar *who, /* handles iq requests */ void jabber_data_parse(JabberStream *js, const char *who, JabberIqType type, - const char *id, xmlnode *data_node); + const char *id, PurpleXmlNode *data_node); void jabber_data_init(void); void jabber_data_uninit(void); diff --git a/libpurple/protocols/jabber/disco.c b/libpurple/protocols/jabber/disco.c index 82f0f03fa8..c39fcec96b 100644 --- a/libpurple/protocols/jabber/disco.c +++ b/libpurple/protocols/jabber/disco.c @@ -52,32 +52,32 @@ struct _jabber_disco_items_cb_data { }; #define SUPPORT_FEATURE(x) { \ - feature = xmlnode_new_child(query, "feature"); \ - xmlnode_set_attrib(feature, "var", x); \ + feature = purple_xmlnode_new_child(query, "feature"); \ + purple_xmlnode_set_attrib(feature, "var", x); \ } static void jabber_disco_bytestream_server_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { JabberBytestreamsStreamhost *sh = data; - xmlnode *query = xmlnode_get_child_with_namespace(packet, "query", + PurpleXmlNode *query = purple_xmlnode_get_child_with_namespace(packet, "query", NS_BYTESTREAMS); if (from && !strcmp(from, sh->jid) && query != NULL) { - xmlnode *sh_node = xmlnode_get_child(query, "streamhost"); + PurpleXmlNode *sh_node = purple_xmlnode_get_child(query, "streamhost"); if (sh_node) { - const char *jid = xmlnode_get_attrib(sh_node, "jid"); - const char *port = xmlnode_get_attrib(sh_node, "port"); + const char *jid = purple_xmlnode_get_attrib(sh_node, "jid"); + const char *port = purple_xmlnode_get_attrib(sh_node, "port"); if (jid == NULL || strcmp(jid, from) != 0) purple_debug_error("jabber", "Invalid jid(%s) for bytestream.\n", jid ? jid : "(null)"); - sh->host = g_strdup(xmlnode_get_attrib(sh_node, "host")); - sh->zeroconf = g_strdup(xmlnode_get_attrib(sh_node, "zeroconf")); + sh->host = g_strdup(purple_xmlnode_get_attrib(sh_node, "host")); + sh->zeroconf = g_strdup(purple_xmlnode_get_attrib(sh_node, "zeroconf")); if (port != NULL) sh->port = atoi(port); } @@ -101,12 +101,12 @@ jabber_disco_bytestream_server_cb(JabberStream *js, const char *from, void jabber_disco_info_parse(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *in_query) + PurpleXmlNode *in_query) { if(type == JABBER_IQ_GET) { - xmlnode *query, *identity, *feature; + PurpleXmlNode *query, *identity, *feature; JabberIq *iq; - const char *node = xmlnode_get_attrib(in_query, "node"); + const char *node = purple_xmlnode_get_attrib(in_query, "node"); char *node_uri = NULL; /* create custom caps node URI */ @@ -117,29 +117,29 @@ void jabber_disco_info_parse(JabberStream *js, const char *from, jabber_iq_set_id(iq, id); if (from) - xmlnode_set_attrib(iq->node, "to", from); - query = xmlnode_get_child(iq->node, "query"); + purple_xmlnode_set_attrib(iq->node, "to", from); + query = purple_xmlnode_get_child(iq->node, "query"); if(node) - xmlnode_set_attrib(query, "node", node); + purple_xmlnode_set_attrib(query, "node", node); if(!node || g_str_equal(node, node_uri)) { GList *features, *identities; for(identities = jabber_identities; identities; identities = identities->next) { JabberIdentity *ident = (JabberIdentity*)identities->data; - identity = xmlnode_new_child(query, "identity"); - xmlnode_set_attrib(identity, "category", ident->category); - xmlnode_set_attrib(identity, "type", ident->type); + identity = purple_xmlnode_new_child(query, "identity"); + purple_xmlnode_set_attrib(identity, "category", ident->category); + purple_xmlnode_set_attrib(identity, "type", ident->type); if (ident->lang) - xmlnode_set_attrib(identity, "xml:lang", ident->lang); + purple_xmlnode_set_attrib(identity, "xml:lang", ident->lang); if (ident->name) - xmlnode_set_attrib(identity, "name", ident->name); + purple_xmlnode_set_attrib(identity, "name", ident->name); } for(features = jabber_features; features; features = features->next) { JabberFeature *feat = (JabberFeature*)features->data; if (!feat->is_enabled || feat->is_enabled(js, feat->namespace)) { - feature = xmlnode_new_child(query, "feature"); - xmlnode_set_attrib(feature, "var", feat->namespace); + feature = purple_xmlnode_new_child(query, "feature"); + purple_xmlnode_set_attrib(feature, "var", feat->namespace); } } #ifdef USE_VV @@ -153,8 +153,8 @@ void jabber_disco_info_parse(JabberStream *js, const char *from, * node='http://mail.google.com/xmpp/client/caps', ver='1.1' * advertises as 'voice-v1'. */ - xmlnode *feature = xmlnode_new_child(query, "feature"); - xmlnode_set_attrib(feature, "var", NS_GOOGLE_VOICE); + PurpleXmlNode *feature = purple_xmlnode_new_child(query, "feature"); + purple_xmlnode_set_attrib(feature, "var", NS_GOOGLE_VOICE); } else if (g_str_equal(node, CAPS0115_NODE "#" "video-v1")) { /* * HUGE HACK! We advertise this ext (see jabber_presence_create_js @@ -165,8 +165,8 @@ void jabber_disco_info_parse(JabberStream *js, const char *from, * node='http://mail.google.com/xmpp/client/caps', ver='1.1' * advertises as 'video-v1'. */ - xmlnode *feature = xmlnode_new_child(query, "feature"); - xmlnode_set_attrib(feature, "var", NS_GOOGLE_VIDEO); + PurpleXmlNode *feature = purple_xmlnode_new_child(query, "feature"); + purple_xmlnode_set_attrib(feature, "var", NS_GOOGLE_VIDEO); } else if (g_str_equal(node, CAPS0115_NODE "#" "camera-v1")) { /* * HUGE HACK! We advertise this ext (see jabber_presence_create_js @@ -177,40 +177,40 @@ void jabber_disco_info_parse(JabberStream *js, const char *from, * node='http://mail.google.com/xmpp/client/caps', ver='1.1' * advertises as 'camera-v1'. */ - xmlnode *feature = xmlnode_new_child(query, "feature"); - xmlnode_set_attrib(feature, "var", NS_GOOGLE_CAMERA); + PurpleXmlNode *feature = purple_xmlnode_new_child(query, "feature"); + purple_xmlnode_set_attrib(feature, "var", NS_GOOGLE_CAMERA); #endif } else { - xmlnode *error, *inf; + PurpleXmlNode *error, *inf; /* XXX: gross hack, implement jabber_iq_set_type or something */ - xmlnode_set_attrib(iq->node, "type", "error"); + purple_xmlnode_set_attrib(iq->node, "type", "error"); iq->type = JABBER_IQ_ERROR; - error = xmlnode_new_child(query, "error"); - xmlnode_set_attrib(error, "code", "404"); - xmlnode_set_attrib(error, "type", "cancel"); - inf = xmlnode_new_child(error, "item-not-found"); - xmlnode_set_namespace(inf, NS_XMPP_STANZAS); + error = purple_xmlnode_new_child(query, "error"); + purple_xmlnode_set_attrib(error, "code", "404"); + purple_xmlnode_set_attrib(error, "type", "cancel"); + inf = purple_xmlnode_new_child(error, "item-not-found"); + purple_xmlnode_set_namespace(inf, NS_XMPP_STANZAS); } g_free(node_uri); jabber_iq_send(iq); } else if (type == JABBER_IQ_SET) { /* wtf? seriously. wtf‽ */ JabberIq *iq = jabber_iq_new(js, JABBER_IQ_ERROR); - xmlnode *error, *bad_request; + PurpleXmlNode *error, *bad_request; /* Free the <query/> */ - xmlnode_free(xmlnode_get_child(iq->node, "query")); + purple_xmlnode_free(purple_xmlnode_get_child(iq->node, "query")); /* Add an error */ - error = xmlnode_new_child(iq->node, "error"); - xmlnode_set_attrib(error, "type", "modify"); - bad_request = xmlnode_new_child(error, "bad-request"); - xmlnode_set_namespace(bad_request, NS_XMPP_STANZAS); + error = purple_xmlnode_new_child(iq->node, "error"); + purple_xmlnode_set_attrib(error, "type", "modify"); + bad_request = purple_xmlnode_new_child(error, "bad-request"); + purple_xmlnode_set_namespace(bad_request, NS_XMPP_STANZAS); jabber_iq_set_id(iq, id); if (from) - xmlnode_set_attrib(iq->node, "to", from); + purple_xmlnode_set_attrib(iq->node, "to", from); jabber_iq_send(iq); } @@ -218,15 +218,15 @@ void jabber_disco_info_parse(JabberStream *js, const char *from, static void jabber_disco_info_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { struct _jabber_disco_info_cb_data *jdicd = data; - xmlnode *query; + PurpleXmlNode *query; - query = xmlnode_get_child_with_namespace(packet, "query", NS_DISCO_INFO); + query = purple_xmlnode_get_child_with_namespace(packet, "query", NS_DISCO_INFO); if (type == JABBER_IQ_RESULT && query) { - xmlnode *child; + PurpleXmlNode *child; JabberID *jid; JabberBuddy *jb; JabberBuddyResource *jbr = NULL; @@ -242,12 +242,12 @@ static void jabber_disco_info_cb(JabberStream *js, const char *from, capabilities = jbr->capabilities; for(child = query->child; child; child = child->next) { - if(child->type != XMLNODE_TYPE_TAG) + if(child->type != PURPLE_XMLNODE_TYPE_TAG) continue; if(!strcmp(child->name, "identity")) { - const char *category = xmlnode_get_attrib(child, "category"); - const char *type = xmlnode_get_attrib(child, "type"); + const char *category = purple_xmlnode_get_attrib(child, "category"); + const char *type = purple_xmlnode_get_attrib(child, "type"); if(!category || !type) continue; @@ -271,13 +271,13 @@ static void jabber_disco_info_cb(JabberStream *js, const char *from, iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_BYTESTREAMS); - xmlnode_set_attrib(iq->node, "to", sh->jid); + purple_xmlnode_set_attrib(iq->node, "to", sh->jid); jabber_iq_set_callback(iq, jabber_disco_bytestream_server_cb, sh); jabber_iq_send(iq); } } else if(!strcmp(child->name, "feature")) { - const char *var = xmlnode_get_attrib(child, "var"); + const char *var = purple_xmlnode_get_attrib(child, "var"); if(!var) continue; @@ -338,22 +338,22 @@ static void jabber_disco_info_cb(JabberStream *js, const char *from, void jabber_disco_items_parse(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *query) + PurpleXmlNode *query) { if(type == JABBER_IQ_GET) { JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, NS_DISCO_ITEMS); /* preserve node */ - xmlnode *iq_query = xmlnode_get_child(iq->node, "query"); - const char *node = xmlnode_get_attrib(query, "node"); + PurpleXmlNode *iq_query = purple_xmlnode_get_child(iq->node, "query"); + const char *node = purple_xmlnode_get_attrib(query, "node"); if(node) - xmlnode_set_attrib(iq_query,"node",node); + purple_xmlnode_set_attrib(iq_query,"node",node); jabber_iq_set_id(iq, id); if (from) - xmlnode_set_attrib(iq->node, "to", from); + purple_xmlnode_set_attrib(iq->node, "to", from); jabber_iq_send(iq); } } @@ -409,7 +409,7 @@ jabber_disco_finish_server_info_result_cb(JabberStream *js) js->bs_proxies = g_list_prepend(js->bs_proxies, sh); iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_BYTESTREAMS); - xmlnode_set_attrib(iq->node, "to", sh->jid); + purple_xmlnode_set_attrib(iq->node, "to", sh->jid); jabber_iq_set_callback(iq, jabber_disco_bytestream_server_cb, sh); jabber_iq_send(iq); } @@ -494,9 +494,9 @@ jabber_disco_stun_srv_resolve_cb(PurpleSrvResponse *resp, int results, gpointer static void jabber_disco_server_info_result_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { - xmlnode *query, *child; + PurpleXmlNode *query, *child; if (!from || strcmp(from, js->user->domain)) { jabber_disco_finish_server_info_result_cb(js); @@ -509,18 +509,18 @@ jabber_disco_server_info_result_cb(JabberStream *js, const char *from, return; } - query = xmlnode_get_child(packet, "query"); + query = purple_xmlnode_get_child(packet, "query"); if (!query) { jabber_disco_finish_server_info_result_cb(js); return; } - for (child = xmlnode_get_child(query, "identity"); child; - child = xmlnode_get_next_twin(child)) { + for (child = purple_xmlnode_get_child(query, "identity"); child; + child = purple_xmlnode_get_next_twin(child)) { const char *category, *type, *name; - category = xmlnode_get_attrib(child, "category"); - type = xmlnode_get_attrib(child, "type"); + category = purple_xmlnode_get_attrib(child, "category"); + type = purple_xmlnode_get_attrib(child, "type"); if(category && type && !strcmp(category, "pubsub") && !strcmp(type,"pep")) { PurpleConnection *gc = js->gc; js->pep = TRUE; @@ -534,7 +534,7 @@ jabber_disco_server_info_result_cb(JabberStream *js, const char *from, if (!type || strcmp(type, "im")) continue; - name = xmlnode_get_attrib(child, "name"); + name = purple_xmlnode_get_attrib(child, "name"); if (!name) continue; @@ -560,10 +560,10 @@ jabber_disco_server_info_result_cb(JabberStream *js, const char *from, } } - for (child = xmlnode_get_child(query, "feature"); child; - child = xmlnode_get_next_twin(child)) { + for (child = purple_xmlnode_get_child(query, "feature"); child; + child = purple_xmlnode_get_next_twin(child)) { const char *var; - var = xmlnode_get_attrib(child, "var"); + var = purple_xmlnode_get_attrib(child, "var"); if (!var) continue; @@ -585,9 +585,9 @@ jabber_disco_server_info_result_cb(JabberStream *js, const char *from, static void jabber_disco_server_items_result_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { - xmlnode *query, *child; + PurpleXmlNode *query, *child; if (!from || strcmp(from, js->user->domain) != 0) return; @@ -600,23 +600,23 @@ jabber_disco_server_items_result_cb(JabberStream *js, const char *from, js->chat_servers = g_list_delete_link(js->chat_servers, js->chat_servers); } - query = xmlnode_get_child(packet, "query"); + query = purple_xmlnode_get_child(packet, "query"); - for(child = xmlnode_get_child(query, "item"); child; - child = xmlnode_get_next_twin(child)) { + for(child = purple_xmlnode_get_child(query, "item"); child; + child = purple_xmlnode_get_next_twin(child)) { JabberIq *iq; const char *jid; - if(!(jid = xmlnode_get_attrib(child, "jid"))) + if(!(jid = purple_xmlnode_get_attrib(child, "jid"))) continue; /* we don't actually care about the specific nodes, * so we won't query them */ - if(xmlnode_get_attrib(child, "node") != NULL) + if(purple_xmlnode_get_attrib(child, "node") != NULL) continue; iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO); - xmlnode_set_attrib(iq->node, "to", jid); + purple_xmlnode_set_attrib(iq->node, "to", jid); jabber_iq_set_callback(iq, jabber_disco_info_cb, NULL); jabber_iq_send(iq); } @@ -626,13 +626,13 @@ void jabber_disco_items_server(JabberStream *js) { JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_ITEMS); - xmlnode_set_attrib(iq->node, "to", js->user->domain); + purple_xmlnode_set_attrib(iq->node, "to", js->user->domain); jabber_iq_set_callback(iq, jabber_disco_server_items_result_cb, NULL); jabber_iq_send(iq); iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO); - xmlnode_set_attrib(iq->node, "to", js->user->domain); + purple_xmlnode_set_attrib(iq->node, "to", js->user->domain); jabber_iq_set_callback(iq, jabber_disco_server_info_result_cb, NULL); jabber_iq_send(iq); } @@ -661,7 +661,7 @@ void jabber_disco_info_do(JabberStream *js, const char *who, JabberDiscoInfoCall jdicd->callback = callback; iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO); - xmlnode_set_attrib(iq->node, "to", who); + purple_xmlnode_set_attrib(iq->node, "to", who); jabber_iq_set_callback(iq, jabber_disco_info_cb, jdicd); jabber_iq_send(iq); diff --git a/libpurple/protocols/jabber/disco.h b/libpurple/protocols/jabber/disco.h index 588c62fd8b..02e0577c78 100644 --- a/libpurple/protocols/jabber/disco.h +++ b/libpurple/protocols/jabber/disco.h @@ -39,9 +39,9 @@ typedef void (JabberDiscoItemsCallback)(JabberStream *js, const char *jid, const char *node, GSList *items, gpointer data); void jabber_disco_info_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *in_query); + JabberIqType type, const char *id, PurpleXmlNode *in_query); void jabber_disco_items_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *query); + JabberIqType type, const char *id, PurpleXmlNode *query); void jabber_disco_items_server(JabberStream *js); diff --git a/libpurple/protocols/jabber/google/gmail.c b/libpurple/protocols/jabber/google/gmail.c index 8d09209fdf..3d857642e4 100644 --- a/libpurple/protocols/jabber/google/gmail.c +++ b/libpurple/protocols/jabber/google/gmail.c @@ -26,10 +26,10 @@ static void jabber_gmail_parse(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer nul) + PurpleXmlNode *packet, gpointer nul) { - xmlnode *child; - xmlnode *message; + PurpleXmlNode *child; + PurpleXmlNode *message; const char *to, *url; const char *in_str; char *to_name; @@ -42,18 +42,18 @@ jabber_gmail_parse(JabberStream *js, const char *from, if (type == JABBER_IQ_ERROR) return; - child = xmlnode_get_child(packet, "mailbox"); + child = purple_xmlnode_get_child(packet, "mailbox"); if (!child) return; - in_str = xmlnode_get_attrib(child, "total-matched"); + in_str = purple_xmlnode_get_attrib(child, "total-matched"); if (in_str && *in_str) count = atoi(in_str); /* If Gmail doesn't tell us who the mail is to, let's use our JID */ - to = xmlnode_get_attrib(packet, "to"); + to = purple_xmlnode_get_attrib(packet, "to"); - message = xmlnode_get_child(child, "mail-thread-info"); + message = purple_xmlnode_get_child(child, "mail-thread-info"); if (count == 0 || !message) { if (count > 0) { @@ -71,51 +71,51 @@ jabber_gmail_parse(JabberStream *js, const char *from, /* Loop once to see how many messages were returned so we can allocate arrays * accordingly */ - for (returned_count = 0; message; returned_count++, message=xmlnode_get_next_twin(message)); + for (returned_count = 0; message; returned_count++, message=purple_xmlnode_get_next_twin(message)); froms = g_new0(const char* , returned_count + 1); tos = g_new0(const char* , returned_count + 1); subjects = g_new0(char* , returned_count + 1); urls = g_new0(const char* , returned_count + 1); - to = xmlnode_get_attrib(packet, "to"); + to = purple_xmlnode_get_attrib(packet, "to"); to_name = jabber_get_bare_jid(to); - url = xmlnode_get_attrib(child, "url"); + url = purple_xmlnode_get_attrib(child, "url"); if (!url || !*url) url = "http://www.gmail.com"; - message= xmlnode_get_child(child, "mail-thread-info"); - for (i=0; message; message = xmlnode_get_next_twin(message), i++) { - xmlnode *sender_node, *subject_node; + message= purple_xmlnode_get_child(child, "mail-thread-info"); + for (i=0; message; message = purple_xmlnode_get_next_twin(message), i++) { + PurpleXmlNode *sender_node, *subject_node; const char *from, *tid; char *subject; - subject_node = xmlnode_get_child(message, "subject"); - sender_node = xmlnode_get_child(message, "senders"); - sender_node = xmlnode_get_child(sender_node, "sender"); + subject_node = purple_xmlnode_get_child(message, "subject"); + sender_node = purple_xmlnode_get_child(message, "senders"); + sender_node = purple_xmlnode_get_child(sender_node, "sender"); - while (sender_node && (!xmlnode_get_attrib(sender_node, "unread") || - !strcmp(xmlnode_get_attrib(sender_node, "unread"),"0"))) - sender_node = xmlnode_get_next_twin(sender_node); + while (sender_node && (!purple_xmlnode_get_attrib(sender_node, "unread") || + !strcmp(purple_xmlnode_get_attrib(sender_node, "unread"),"0"))) + sender_node = purple_xmlnode_get_next_twin(sender_node); if (!sender_node) { i--; continue; } - from = xmlnode_get_attrib(sender_node, "name"); + from = purple_xmlnode_get_attrib(sender_node, "name"); if (!from || !*from) - from = xmlnode_get_attrib(sender_node, "address"); - subject = xmlnode_get_data(subject_node); + from = purple_xmlnode_get_attrib(sender_node, "address"); + subject = purple_xmlnode_get_data(subject_node); /* - * url = xmlnode_get_attrib(message, "url"); + * url = purple_xmlnode_get_attrib(message, "url"); */ tos[i] = (to_name != NULL ? to_name : ""); froms[i] = (from != NULL ? from : ""); subjects[i] = (subject != NULL ? subject : g_strdup("")); urls[i] = url; - tid = xmlnode_get_attrib(message, "tid"); + tid = purple_xmlnode_get_attrib(message, "tid"); if (tid && (js->gmail_last_tid == NULL || strcmp(tid, js->gmail_last_tid) > 0)) { g_free(js->gmail_last_tid); @@ -135,7 +135,7 @@ jabber_gmail_parse(JabberStream *js, const char *from, g_free(subjects); g_free(urls); - in_str = xmlnode_get_attrib(child, "result-time"); + in_str = purple_xmlnode_get_attrib(child, "result-time"); if (in_str && *in_str) { g_free(js->gmail_last_time); js->gmail_last_time = g_strdup(in_str); @@ -144,9 +144,9 @@ jabber_gmail_parse(JabberStream *js, const char *from, void jabber_gmail_poke(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *new_mail) + const char *id, PurpleXmlNode *new_mail) { - xmlnode *query; + PurpleXmlNode *query; JabberIq *iq; /* bail if the user isn't interested */ @@ -160,8 +160,8 @@ jabber_gmail_poke(JabberStream *js, const char *from, JabberIqType type, /* Acknowledge the notification */ iq = jabber_iq_new(js, JABBER_IQ_RESULT); if (from) - xmlnode_set_attrib(iq->node, "to", from); - xmlnode_set_attrib(iq->node, "id", id); + purple_xmlnode_set_attrib(iq->node, "to", from); + purple_xmlnode_set_attrib(iq->node, "id", id); jabber_iq_send(iq); purple_debug_misc("jabber", @@ -169,12 +169,12 @@ jabber_gmail_poke(JabberStream *js, const char *from, JabberIqType type, iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_GOOGLE_MAIL_NOTIFY); jabber_iq_set_callback(iq, jabber_gmail_parse, NULL); - query = xmlnode_get_child(iq->node, "query"); + query = purple_xmlnode_get_child(iq->node, "query"); if (js->gmail_last_time) - xmlnode_set_attrib(query, "newer-than-time", js->gmail_last_time); + purple_xmlnode_set_attrib(query, "newer-than-time", js->gmail_last_time); if (js->gmail_last_tid) - xmlnode_set_attrib(query, "newer-than-tid", js->gmail_last_tid); + purple_xmlnode_set_attrib(query, "newer-than-tid", js->gmail_last_tid); jabber_iq_send(iq); return; @@ -182,7 +182,7 @@ jabber_gmail_poke(JabberStream *js, const char *from, JabberIqType type, void jabber_gmail_init(JabberStream *js) { JabberIq *iq; - xmlnode *usersetting, *mailnotifications; + PurpleXmlNode *usersetting, *mailnotifications; if (!purple_account_get_check_mail(purple_connection_get_account(js->gc))) return; @@ -195,10 +195,10 @@ void jabber_gmail_init(JabberStream *js) { * email notifications itself. */ iq = jabber_iq_new(js, JABBER_IQ_SET); - usersetting = xmlnode_new_child(iq->node, "usersetting"); - xmlnode_set_namespace(usersetting, "google:setting"); - mailnotifications = xmlnode_new_child(usersetting, "mailnotifications"); - xmlnode_set_attrib(mailnotifications, "value", "true"); + usersetting = purple_xmlnode_new_child(iq->node, "usersetting"); + purple_xmlnode_set_namespace(usersetting, "google:setting"); + mailnotifications = purple_xmlnode_new_child(usersetting, "mailnotifications"); + purple_xmlnode_set_attrib(mailnotifications, "value", "true"); jabber_iq_send(iq); iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_GOOGLE_MAIL_NOTIFY); diff --git a/libpurple/protocols/jabber/google/gmail.h b/libpurple/protocols/jabber/google/gmail.h index 2058802ea2..713e5e573e 100644 --- a/libpurple/protocols/jabber/google/gmail.h +++ b/libpurple/protocols/jabber/google/gmail.h @@ -25,6 +25,6 @@ void jabber_gmail_init(JabberStream *js); void jabber_gmail_poke(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *new_mail); + const char *id, PurpleXmlNode *new_mail); #endif /* PURPLE_JABBER_GOOGLE_GMAIL_H_ */ diff --git a/libpurple/protocols/jabber/google/google_p2p.c b/libpurple/protocols/jabber/google/google_p2p.c index 8dce1bbc46..69528c20ab 100644 --- a/libpurple/protocols/jabber/google/google_p2p.c +++ b/libpurple/protocols/jabber/google/google_p2p.c @@ -43,8 +43,8 @@ static void jingle_google_p2p_init (JingleGoogleP2P *google_p2p); static void jingle_google_p2p_finalize (GObject *object); static void jingle_google_p2p_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); static void jingle_google_p2p_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static JingleTransport *jingle_google_p2p_parse_internal(xmlnode *google_p2p); -static xmlnode *jingle_google_p2p_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action); +static JingleTransport *jingle_google_p2p_parse_internal(PurpleXmlNode *google_p2p); +static PurpleXmlNode *jingle_google_p2p_to_xml_internal(JingleTransport *transport, PurpleXmlNode *content, JingleActionType action); static void jingle_google_p2p_add_local_candidate(JingleTransport *transport, const gchar *id, guint generation, PurpleMediaCandidate *candidate); static GList *jingle_google_p2p_get_remote_candidates(JingleTransport *transport); @@ -354,22 +354,22 @@ jingle_google_p2p_add_remote_candidate(JingleGoogleP2P *google_p2p, JingleGoogle } static JingleTransport * -jingle_google_p2p_parse_internal(xmlnode *google_p2p) +jingle_google_p2p_parse_internal(PurpleXmlNode *google_p2p) { JingleTransport *transport = parent_class->parse(google_p2p); - xmlnode *candidate = xmlnode_get_child(google_p2p, "candidate"); + PurpleXmlNode *candidate = purple_xmlnode_get_child(google_p2p, "candidate"); JingleGoogleP2PCandidate *google_p2p_candidate = NULL; - for (; candidate; candidate = xmlnode_get_next_twin(candidate)) { - const gchar *generation = xmlnode_get_attrib(candidate, "generation"); - const gchar *id = xmlnode_get_attrib(candidate, "name"); - const gchar *address = xmlnode_get_attrib(candidate, "address"); - const gchar *port = xmlnode_get_attrib(candidate, "port"); - const gchar *preference = xmlnode_get_attrib(candidate, "preference"); - const gchar *type = xmlnode_get_attrib(candidate, "type"); - const gchar *protocol = xmlnode_get_attrib(candidate, "protocol"); - const gchar *username = xmlnode_get_attrib(candidate, "username"); - const gchar *password = xmlnode_get_attrib(candidate, "password"); + for (; candidate; candidate = purple_xmlnode_get_next_twin(candidate)) { + const gchar *generation = purple_xmlnode_get_attrib(candidate, "generation"); + const gchar *id = purple_xmlnode_get_attrib(candidate, "name"); + const gchar *address = purple_xmlnode_get_attrib(candidate, "address"); + const gchar *port = purple_xmlnode_get_attrib(candidate, "port"); + const gchar *preference = purple_xmlnode_get_attrib(candidate, "preference"); + const gchar *type = purple_xmlnode_get_attrib(candidate, "type"); + const gchar *protocol = purple_xmlnode_get_attrib(candidate, "protocol"); + const gchar *username = purple_xmlnode_get_attrib(candidate, "username"); + const gchar *password = purple_xmlnode_get_attrib(candidate, "password"); if (!generation || !id || !address || !port || !preference || !type || !protocol || !username || !password) @@ -390,10 +390,10 @@ jingle_google_p2p_parse_internal(xmlnode *google_p2p) return transport; } -static xmlnode * -jingle_google_p2p_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action) +static PurpleXmlNode * +jingle_google_p2p_to_xml_internal(JingleTransport *transport, PurpleXmlNode *content, JingleActionType action) { - xmlnode *node = parent_class->to_xml(transport, content, action); + PurpleXmlNode *node = parent_class->to_xml(transport, content, action); if (action == JINGLE_SESSION_INITIATE || action == JINGLE_SESSION_ACCEPT || @@ -405,7 +405,7 @@ jingle_google_p2p_to_xml_internal(JingleTransport *transport, xmlnode *content, for (; iter; iter = g_list_next(iter)) { JingleGoogleP2PCandidate *candidate = iter->data; - xmlnode *xmltransport; + PurpleXmlNode *xmltransport; gchar *generation, *network, *port, *preference; if (candidate->rem_known == TRUE) @@ -413,22 +413,22 @@ jingle_google_p2p_to_xml_internal(JingleTransport *transport, xmlnode *content, candidate->rem_known = TRUE; - xmltransport = xmlnode_new_child(node, "candidate"); + xmltransport = purple_xmlnode_new_child(node, "candidate"); generation = g_strdup_printf("%d", candidate->generation); network = g_strdup_printf("%d", candidate->network); port = g_strdup_printf("%d", candidate->port); preference = g_strdup_printf("%d", candidate->preference); - xmlnode_set_attrib(xmltransport, "generation", generation); - xmlnode_set_attrib(xmltransport, "name", candidate->id); - xmlnode_set_attrib(xmltransport, "address", candidate->address); - xmlnode_set_attrib(xmltransport, "network", network); - xmlnode_set_attrib(xmltransport, "port", port); - xmlnode_set_attrib(xmltransport, "preference", preference); - xmlnode_set_attrib(xmltransport, "protocol", candidate->protocol); - xmlnode_set_attrib(xmltransport, "type", candidate->type); - xmlnode_set_attrib(xmltransport, "username", candidate->username); - xmlnode_set_attrib(xmltransport, "password", candidate->password); + purple_xmlnode_set_attrib(xmltransport, "generation", generation); + purple_xmlnode_set_attrib(xmltransport, "name", candidate->id); + purple_xmlnode_set_attrib(xmltransport, "address", candidate->address); + purple_xmlnode_set_attrib(xmltransport, "network", network); + purple_xmlnode_set_attrib(xmltransport, "port", port); + purple_xmlnode_set_attrib(xmltransport, "preference", preference); + purple_xmlnode_set_attrib(xmltransport, "protocol", candidate->protocol); + purple_xmlnode_set_attrib(xmltransport, "type", candidate->type); + purple_xmlnode_set_attrib(xmltransport, "username", candidate->username); + purple_xmlnode_set_attrib(xmltransport, "password", candidate->password); g_free(generation); g_free(network); diff --git a/libpurple/protocols/jabber/google/google_p2p.h b/libpurple/protocols/jabber/google/google_p2p.h index b141c74639..dcf22ff283 100644 --- a/libpurple/protocols/jabber/google/google_p2p.h +++ b/libpurple/protocols/jabber/google/google_p2p.h @@ -54,8 +54,8 @@ struct _JingleGoogleP2PClass { JingleTransportClass parent_class; /**< The parent class. */ - xmlnode *(*to_xml) (JingleTransport *transport, xmlnode *content, JingleActionType action); - JingleTransport *(*parse) (xmlnode *transport); + PurpleXmlNode *(*to_xml) (JingleTransport *transport, PurpleXmlNode *content, JingleActionType action); + JingleTransport *(*parse) (PurpleXmlNode *transport); }; /** The Google P2P class's private data */ diff --git a/libpurple/protocols/jabber/google/google_roster.c b/libpurple/protocols/jabber/google/google_roster.c index dcab1a1e2c..bb674c33a6 100644 --- a/libpurple/protocols/jabber/google/google_roster.c +++ b/libpurple/protocols/jabber/google/google_roster.c @@ -25,35 +25,35 @@ #include "debug.h" #include "xmlnode.h" -void jabber_google_roster_outgoing(JabberStream *js, xmlnode *query, xmlnode *item) +void jabber_google_roster_outgoing(JabberStream *js, PurpleXmlNode *query, PurpleXmlNode *item) { PurpleAccount *account = purple_connection_get_account(js->gc); GSList *list = purple_account_privacy_get_denied(account); - const char *jid = xmlnode_get_attrib(item, "jid"); + const char *jid = purple_xmlnode_get_attrib(item, "jid"); char *jid_norm = (char *)jabber_normalize(account, jid); while (list) { if (!strcmp(jid_norm, (char*)list->data)) { - xmlnode_set_attrib(query, "xmlns:gr", NS_GOOGLE_ROSTER); - xmlnode_set_attrib(query, "gr:ext", "2"); - xmlnode_set_attrib(item, "gr:t", "B"); + purple_xmlnode_set_attrib(query, "xmlns:gr", NS_GOOGLE_ROSTER); + purple_xmlnode_set_attrib(query, "gr:ext", "2"); + purple_xmlnode_set_attrib(item, "gr:t", "B"); return; } list = list->next; } } -gboolean jabber_google_roster_incoming(JabberStream *js, xmlnode *item) +gboolean jabber_google_roster_incoming(JabberStream *js, PurpleXmlNode *item) { PurpleAccount *account = purple_connection_get_account(js->gc); - const char *jid = xmlnode_get_attrib(item, "jid"); + const char *jid = purple_xmlnode_get_attrib(item, "jid"); gboolean on_block_list = FALSE; char *jid_norm; - const char *grt = xmlnode_get_attrib_with_namespace(item, "t", NS_GOOGLE_ROSTER); - const char *subscription = xmlnode_get_attrib(item, "subscription"); - const char *ask = xmlnode_get_attrib(item, "ask"); + const char *grt = purple_xmlnode_get_attrib_with_namespace(item, "t", NS_GOOGLE_ROSTER); + const char *subscription = purple_xmlnode_get_attrib(item, "subscription"); + const char *ask = purple_xmlnode_get_attrib(item, "ask"); if ((!subscription || !strcmp(subscription, "none")) && !ask) { /* The Google Talk servers will automatically add people from your Gmail address book @@ -101,9 +101,9 @@ void jabber_google_roster_add_deny(JabberStream *js, const char *who) PurpleAccount *account; GSList *buddies; JabberIq *iq; - xmlnode *query; - xmlnode *item; - xmlnode *group; + PurpleXmlNode *query; + PurpleXmlNode *item; + PurpleXmlNode *group; PurpleBuddy *b; JabberBuddy *jb; const char *balias; @@ -117,8 +117,8 @@ void jabber_google_roster_add_deny(JabberStream *js, const char *who) iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:roster"); - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); + query = purple_xmlnode_get_child(iq->node, "query"); + item = purple_xmlnode_new_child(query, "item"); do { PurpleGroup *g; @@ -126,18 +126,18 @@ void jabber_google_roster_add_deny(JabberStream *js, const char *who) b = buddies->data; g = purple_buddy_get_group(b); - group = xmlnode_new_child(item, "group"); - xmlnode_insert_data(group, purple_group_get_name(g), -1); + group = purple_xmlnode_new_child(item, "group"); + purple_xmlnode_insert_data(group, purple_group_get_name(g), -1); buddies = g_slist_delete_link(buddies, buddies); } while (buddies); balias = purple_buddy_get_local_alias(b); - xmlnode_set_attrib(item, "jid", who); - xmlnode_set_attrib(item, "name", balias ? balias : ""); - xmlnode_set_attrib(item, "gr:t", "B"); - xmlnode_set_attrib(query, "xmlns:gr", NS_GOOGLE_ROSTER); - xmlnode_set_attrib(query, "gr:ext", "2"); + purple_xmlnode_set_attrib(item, "jid", who); + purple_xmlnode_set_attrib(item, "name", balias ? balias : ""); + purple_xmlnode_set_attrib(item, "gr:t", "B"); + purple_xmlnode_set_attrib(query, "xmlns:gr", NS_GOOGLE_ROSTER); + purple_xmlnode_set_attrib(query, "gr:ext", "2"); jabber_iq_send(iq); @@ -163,9 +163,9 @@ void jabber_google_roster_rem_deny(JabberStream *js, const char *who) { GSList *buddies; JabberIq *iq; - xmlnode *query; - xmlnode *item; - xmlnode *group; + PurpleXmlNode *query; + PurpleXmlNode *item; + PurpleXmlNode *group; PurpleBuddy *b; const char *balias; @@ -175,8 +175,8 @@ void jabber_google_roster_rem_deny(JabberStream *js, const char *who) iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:roster"); - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); + query = purple_xmlnode_get_child(iq->node, "query"); + item = purple_xmlnode_new_child(query, "item"); do { PurpleGroup *g; @@ -184,17 +184,17 @@ void jabber_google_roster_rem_deny(JabberStream *js, const char *who) b = buddies->data; g = purple_buddy_get_group(b); - group = xmlnode_new_child(item, "group"); - xmlnode_insert_data(group, purple_group_get_name(g), -1); + group = purple_xmlnode_new_child(item, "group"); + purple_xmlnode_insert_data(group, purple_group_get_name(g), -1); buddies = g_slist_delete_link(buddies, buddies); } while (buddies); balias = purple_buddy_get_local_alias(b); - xmlnode_set_attrib(item, "jid", who); - xmlnode_set_attrib(item, "name", balias ? balias : ""); - xmlnode_set_attrib(query, "xmlns:gr", NS_GOOGLE_ROSTER); - xmlnode_set_attrib(query, "gr:ext", "2"); + purple_xmlnode_set_attrib(item, "jid", who); + purple_xmlnode_set_attrib(item, "name", balias ? balias : ""); + purple_xmlnode_set_attrib(query, "xmlns:gr", NS_GOOGLE_ROSTER); + purple_xmlnode_set_attrib(query, "gr:ext", "2"); jabber_iq_send(iq); diff --git a/libpurple/protocols/jabber/google/google_roster.h b/libpurple/protocols/jabber/google/google_roster.h index 34f6fa5d8c..4ba0265447 100644 --- a/libpurple/protocols/jabber/google/google_roster.h +++ b/libpurple/protocols/jabber/google/google_roster.h @@ -23,12 +23,12 @@ #include "jabber.h" -void jabber_google_roster_outgoing(JabberStream *js, xmlnode *query, xmlnode *item); +void jabber_google_roster_outgoing(JabberStream *js, PurpleXmlNode *query, PurpleXmlNode *item); /* Returns FALSE if this should short-circuit processing of this roster item, or TRUE * if this roster item should continue to be processed */ -gboolean jabber_google_roster_incoming(JabberStream *js, xmlnode *item); +gboolean jabber_google_roster_incoming(JabberStream *js, PurpleXmlNode *item); void jabber_google_roster_add_deny(JabberStream *js, const char *who); void jabber_google_roster_rem_deny(JabberStream *js, const char *who); diff --git a/libpurple/protocols/jabber/google/google_session.c b/libpurple/protocols/jabber/google/google_session.c index 05665aa9b7..f4f2a91f46 100644 --- a/libpurple/protocols/jabber/google/google_session.c +++ b/libpurple/protocols/jabber/google/google_session.c @@ -61,20 +61,20 @@ google_session_destroy(GoogleSession *session) purple_media_candidate_list_free(session_data->remote_video_candidates); if (session->description) - xmlnode_free(session->description); + purple_xmlnode_free(session->description); g_free(session->session_data); g_free(session); } -static xmlnode * +static PurpleXmlNode * google_session_create_xmlnode(GoogleSession *session, const char *type) { - xmlnode *node = xmlnode_new("session"); - xmlnode_set_namespace(node, NS_GOOGLE_SESSION); - xmlnode_set_attrib(node, "id", session->id.id); - xmlnode_set_attrib(node, "initiator", session->id.initiator); - xmlnode_set_attrib(node, "type", type); + PurpleXmlNode *node = purple_xmlnode_new("session"); + purple_xmlnode_set_namespace(node, NS_GOOGLE_SESSION); + purple_xmlnode_set_attrib(node, "id", session->id.id); + purple_xmlnode_set_attrib(node, "initiator", session->id.initiator); + purple_xmlnode_set_attrib(node, "type", type); return node; } @@ -99,8 +99,8 @@ google_session_send_candidates(PurpleMedia *media, gchar *session_id, gchar *ip, *port, *username, *password; gchar pref[16]; PurpleMediaCandidateType type; - xmlnode *sess; - xmlnode *candidate; + PurpleXmlNode *sess; + PurpleXmlNode *candidate; guint component_id; transport = PURPLE_MEDIA_CANDIDATE(iter->data); component_id = purple_media_candidate_get_component_id( @@ -108,10 +108,10 @@ google_session_send_candidates(PurpleMedia *media, gchar *session_id, iq = jabber_iq_new(session->js, JABBER_IQ_SET); sess = google_session_create_xmlnode(session, "candidates"); - xmlnode_insert_child(iq->node, sess); - xmlnode_set_attrib(iq->node, "to", session->remote_jid); + purple_xmlnode_insert_child(iq->node, sess); + purple_xmlnode_set_attrib(iq->node, "to", session->remote_jid); - candidate = xmlnode_new("candidate"); + candidate = purple_xmlnode_new("candidate"); ip = purple_media_candidate_get_ip(transport); port = g_strdup_printf("%d", @@ -122,36 +122,36 @@ google_session_send_candidates(PurpleMedia *media, gchar *session_id, password = purple_media_candidate_get_password(transport); type = purple_media_candidate_get_candidate_type(transport); - xmlnode_set_attrib(candidate, "address", ip); - xmlnode_set_attrib(candidate, "port", port); - xmlnode_set_attrib(candidate, "name", + purple_xmlnode_set_attrib(candidate, "address", ip); + purple_xmlnode_set_attrib(candidate, "port", port); + purple_xmlnode_set_attrib(candidate, "name", component_id == PURPLE_MEDIA_COMPONENT_RTP ? video ? "video_rtp" : "rtp" : component_id == PURPLE_MEDIA_COMPONENT_RTCP ? video ? "video_rtcp" : "rtcp" : "none"); - xmlnode_set_attrib(candidate, "username", username); + purple_xmlnode_set_attrib(candidate, "username", username); /* * As of this writing, Farsight 2 in Google compatibility * mode doesn't provide a password. The Gmail client * requires this to be set. */ - xmlnode_set_attrib(candidate, "password", + purple_xmlnode_set_attrib(candidate, "password", password != NULL ? password : ""); - xmlnode_set_attrib(candidate, "preference", pref); - xmlnode_set_attrib(candidate, "protocol", + purple_xmlnode_set_attrib(candidate, "preference", pref); + purple_xmlnode_set_attrib(candidate, "protocol", purple_media_candidate_get_protocol(transport) == PURPLE_MEDIA_NETWORK_PROTOCOL_UDP ? "udp" : "tcp"); - xmlnode_set_attrib(candidate, "type", type == + purple_xmlnode_set_attrib(candidate, "type", type == PURPLE_MEDIA_CANDIDATE_TYPE_HOST ? "local" : type == PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX ? "stun" : type == PURPLE_MEDIA_CANDIDATE_TYPE_RELAY ? "relay" : NULL); - xmlnode_set_attrib(candidate, "generation", "0"); - xmlnode_set_attrib(candidate, "network", "0"); - xmlnode_insert_child(sess, candidate); + purple_xmlnode_set_attrib(candidate, "generation", "0"); + purple_xmlnode_set_attrib(candidate, "network", "0"); + purple_xmlnode_insert_child(sess, candidate); g_free(ip); g_free(port); @@ -177,7 +177,7 @@ google_session_ready(GoogleSession *session) session->js->user->domain, session->js->user->resource); JabberIq *iq; - xmlnode *sess, *desc, *payload; + PurpleXmlNode *sess, *desc, *payload; GList *codecs, *iter; gboolean is_initiator = !strcmp(session->id.initiator, me); @@ -190,8 +190,8 @@ google_session_ready(GoogleSession *session) iq = jabber_iq_new(session->js, JABBER_IQ_SET); if (is_initiator) { - xmlnode_set_attrib(iq->node, "to", session->remote_jid); - xmlnode_set_attrib(iq->node, "from", session->id.initiator); + purple_xmlnode_set_attrib(iq->node, "to", session->remote_jid); + purple_xmlnode_set_attrib(iq->node, "from", session->id.initiator); sess = google_session_create_xmlnode(session, "initiate"); } else { google_session_send_candidates(media, @@ -200,16 +200,16 @@ google_session_ready(GoogleSession *session) google_session_send_candidates(media, "google-video", session->remote_jid, session); - xmlnode_set_attrib(iq->node, "to", session->remote_jid); - xmlnode_set_attrib(iq->node, "from", me); + purple_xmlnode_set_attrib(iq->node, "to", session->remote_jid); + purple_xmlnode_set_attrib(iq->node, "from", me); sess = google_session_create_xmlnode(session, "accept"); } - xmlnode_insert_child(iq->node, sess); - desc = xmlnode_new_child(sess, "description"); + purple_xmlnode_insert_child(iq->node, sess); + desc = purple_xmlnode_new_child(sess, "description"); if (video) - xmlnode_set_namespace(desc, NS_GOOGLE_SESSION_VIDEO); + purple_xmlnode_set_namespace(desc, NS_GOOGLE_SESSION_VIDEO); else - xmlnode_set_namespace(desc, NS_GOOGLE_SESSION_PHONE); + purple_xmlnode_set_namespace(desc, NS_GOOGLE_SESSION_PHONE); codecs = purple_media_get_codecs(media, "google-video"); @@ -219,12 +219,12 @@ google_session_ready(GoogleSession *session) purple_media_codec_get_id(codec)); gchar *encoding_name = purple_media_codec_get_encoding_name(codec); - payload = xmlnode_new_child(desc, "payload-type"); - xmlnode_set_attrib(payload, "id", id); - xmlnode_set_attrib(payload, "name", encoding_name); - xmlnode_set_attrib(payload, "width", "320"); - xmlnode_set_attrib(payload, "height", "200"); - xmlnode_set_attrib(payload, "framerate", "30"); + payload = purple_xmlnode_new_child(desc, "payload-type"); + purple_xmlnode_set_attrib(payload, "id", id); + purple_xmlnode_set_attrib(payload, "name", encoding_name); + purple_xmlnode_set_attrib(payload, "width", "320"); + purple_xmlnode_set_attrib(payload, "height", "200"); + purple_xmlnode_set_attrib(payload, "framerate", "30"); g_free(encoding_name); g_free(id); } @@ -240,19 +240,19 @@ google_session_ready(GoogleSession *session) purple_media_codec_get_encoding_name(codec); gchar *clock_rate = g_strdup_printf("%d", purple_media_codec_get_clock_rate(codec)); - payload = xmlnode_new_child(desc, "payload-type"); + payload = purple_xmlnode_new_child(desc, "payload-type"); if (video) - xmlnode_set_namespace(payload, NS_GOOGLE_SESSION_PHONE); - xmlnode_set_attrib(payload, "id", id); + purple_xmlnode_set_namespace(payload, NS_GOOGLE_SESSION_PHONE); + purple_xmlnode_set_attrib(payload, "id", id); /* * Hack to make Gmail accept speex as the codec. * It shouldn't have to be case sensitive. */ if (purple_strequal(encoding_name, "SPEEX")) - xmlnode_set_attrib(payload, "name", "speex"); + purple_xmlnode_set_attrib(payload, "name", "speex"); else - xmlnode_set_attrib(payload, "name", encoding_name); - xmlnode_set_attrib(payload, "clockrate", clock_rate); + purple_xmlnode_set_attrib(payload, "name", encoding_name); + purple_xmlnode_set_attrib(payload, "clockrate", clock_rate); g_free(clock_rate); g_free(encoding_name); g_free(id); @@ -295,21 +295,21 @@ google_session_stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type, return; if (type == PURPLE_MEDIA_INFO_HANGUP) { - xmlnode *sess; + PurpleXmlNode *sess; JabberIq *iq = jabber_iq_new(session->js, JABBER_IQ_SET); - xmlnode_set_attrib(iq->node, "to", session->remote_jid); + purple_xmlnode_set_attrib(iq->node, "to", session->remote_jid); sess = google_session_create_xmlnode(session, "terminate"); - xmlnode_insert_child(iq->node, sess); + purple_xmlnode_insert_child(iq->node, sess); jabber_iq_send(iq); } else if (type == PURPLE_MEDIA_INFO_REJECT) { - xmlnode *sess; + PurpleXmlNode *sess; JabberIq *iq = jabber_iq_new(session->js, JABBER_IQ_SET); - xmlnode_set_attrib(iq->node, "to", session->remote_jid); + purple_xmlnode_set_attrib(iq->node, "to", session->remote_jid); sess = google_session_create_xmlnode(session, "reject"); - xmlnode_insert_child(iq->node, sess); + purple_xmlnode_insert_child(iq->node, sess); jabber_iq_send(iq); } else if (type == PURPLE_MEDIA_INFO_ACCEPT && local == TRUE) { @@ -454,7 +454,7 @@ jabber_google_relay_response_session_handle_initiate_cb(GoogleSession *session, GParameter *params; guint num_params; JabberStream *js = session->js; - xmlnode *codec_element; + PurpleXmlNode *codec_element; const gchar *xmlns; PurpleMediaCodec *codec; GList *video_codecs = NULL; @@ -499,7 +499,7 @@ jabber_google_relay_response_session_handle_initiate_cb(GoogleSession *session, g_free(params); - for (codec_element = xmlnode_get_child(session->description, "payload-type"); + for (codec_element = purple_xmlnode_get_child(session->description, "payload-type"); codec_element; codec_element = codec_element->next) { const char *id, *encoding_name, *clock_rate; gboolean video; @@ -507,19 +507,19 @@ jabber_google_relay_response_session_handle_initiate_cb(GoogleSession *session, strcmp(codec_element->name, "payload-type")) continue; - xmlns = xmlnode_get_namespace(codec_element); - encoding_name = xmlnode_get_attrib(codec_element, "name"); - id = xmlnode_get_attrib(codec_element, "id"); + xmlns = purple_xmlnode_get_namespace(codec_element); + encoding_name = purple_xmlnode_get_attrib(codec_element, "name"); + id = purple_xmlnode_get_attrib(codec_element, "id"); if (!session_data->video || (xmlns && !strcmp(xmlns, NS_GOOGLE_SESSION_PHONE))) { - clock_rate = xmlnode_get_attrib( + clock_rate = purple_xmlnode_get_attrib( codec_element, "clockrate"); video = FALSE; } else { - /*width = xmlnode_get_attrib(codec_element, "width"); - height = xmlnode_get_attrib(codec_element, "height"); - framerate = xmlnode_get_attrib( + /*width = purple_xmlnode_get_attrib(codec_element, "width"); + height = purple_xmlnode_get_attrib(codec_element, "height"); + framerate = purple_xmlnode_get_attrib( codec_element, "framerate");*/ clock_rate = "90000"; video = TRUE; @@ -550,12 +550,12 @@ jabber_google_relay_response_session_handle_initiate_cb(GoogleSession *session, result = jabber_iq_new(js, JABBER_IQ_RESULT); jabber_iq_set_id(result, session->iq_id); - xmlnode_set_attrib(result->node, "to", session->remote_jid); + purple_xmlnode_set_attrib(result->node, "to", session->remote_jid); jabber_iq_send(result); } static gboolean -google_session_handle_initiate(JabberStream *js, GoogleSession *session, xmlnode *sess, const char *iq_id) +google_session_handle_initiate(JabberStream *js, GoogleSession *session, PurpleXmlNode *sess, const char *iq_id) { const gchar *xmlns; GoogleAVSessionData *session_data = @@ -566,8 +566,8 @@ google_session_handle_initiate(JabberStream *js, GoogleSession *session, xmlnode return FALSE; } - session->description = xmlnode_copy(xmlnode_get_child(sess, "description")); - xmlns = xmlnode_get_namespace(session->description); + session->description = purple_xmlnode_copy(purple_xmlnode_get_child(sess, "description")); + xmlns = purple_xmlnode_get_namespace(session->description); if (purple_strequal(xmlns, NS_GOOGLE_SESSION_PHONE)) session_data->video = FALSE; @@ -611,25 +611,25 @@ google_session_handle_initiate(JabberStream *js, GoogleSession *session, xmlnode static void -google_session_handle_candidates(JabberStream *js, GoogleSession *session, xmlnode *sess, const char *iq_id) +google_session_handle_candidates(JabberStream *js, GoogleSession *session, PurpleXmlNode *sess, const char *iq_id) { JabberIq *result; GList *list = NULL, *video_list = NULL; - xmlnode *cand; + PurpleXmlNode *cand; static int name = 0; char n[4]; GoogleAVSessionData *session_data = (GoogleAVSessionData *) session->session_data; - for (cand = xmlnode_get_child(sess, "candidate"); cand; - cand = xmlnode_get_next_twin(cand)) { + for (cand = purple_xmlnode_get_child(sess, "candidate"); cand; + cand = purple_xmlnode_get_next_twin(cand)) { PurpleMediaCandidate *info; - const gchar *cname = xmlnode_get_attrib(cand, "name"); - const gchar *type = xmlnode_get_attrib(cand, "type"); - const gchar *protocol = xmlnode_get_attrib(cand, "protocol"); - const gchar *address = xmlnode_get_attrib(cand, "address"); - const gchar *port = xmlnode_get_attrib(cand, "port"); - const gchar *preference = xmlnode_get_attrib(cand, "preference"); + const gchar *cname = purple_xmlnode_get_attrib(cand, "name"); + const gchar *type = purple_xmlnode_get_attrib(cand, "type"); + const gchar *protocol = purple_xmlnode_get_attrib(cand, "protocol"); + const gchar *address = purple_xmlnode_get_attrib(cand, "address"); + const gchar *port = purple_xmlnode_get_attrib(cand, "port"); + const gchar *preference = purple_xmlnode_get_attrib(cand, "preference"); guint component_id; if (cname && type && address && port) { @@ -660,8 +660,8 @@ google_session_handle_candidates(JabberStream *js, GoogleSession *session, xmln PURPLE_MEDIA_NETWORK_PROTOCOL_TCP, address, atoi(port)); - g_object_set(info, "username", xmlnode_get_attrib(cand, "username"), - "password", xmlnode_get_attrib(cand, "password"), + g_object_set(info, "username", purple_xmlnode_get_attrib(cand, "username"), + "password", purple_xmlnode_get_attrib(cand, "password"), "priority", prio, NULL); if (!strncmp(cname, "video_", 6)) { if (session_data->added_streams) { @@ -696,19 +696,19 @@ google_session_handle_candidates(JabberStream *js, GoogleSession *session, xmln result = jabber_iq_new(js, JABBER_IQ_RESULT); jabber_iq_set_id(result, iq_id); - xmlnode_set_attrib(result->node, "to", session->remote_jid); + purple_xmlnode_set_attrib(result->node, "to", session->remote_jid); jabber_iq_send(result); } static void -google_session_handle_accept(JabberStream *js, GoogleSession *session, xmlnode *sess, const char *iq_id) +google_session_handle_accept(JabberStream *js, GoogleSession *session, PurpleXmlNode *sess, const char *iq_id) { - xmlnode *desc_element = xmlnode_get_child(sess, "description"); - xmlnode *codec_element = xmlnode_get_child( + PurpleXmlNode *desc_element = purple_xmlnode_get_child(sess, "description"); + PurpleXmlNode *codec_element = purple_xmlnode_get_child( desc_element, "payload-type"); GList *codecs = NULL, *video_codecs = NULL; JabberIq *result = NULL; - const gchar *xmlns = xmlnode_get_namespace(desc_element); + const gchar *xmlns = purple_xmlnode_get_namespace(desc_element); gboolean video = (xmlns && !strcmp(xmlns, NS_GOOGLE_SESSION_VIDEO)); GoogleAVSessionData *session_data = (GoogleAVSessionData *) session->session_data; @@ -721,18 +721,18 @@ google_session_handle_accept(JabberStream *js, GoogleSession *session, xmlnode * if (!purple_strequal(codec_element->name, "payload-type")) continue; - xmlns = xmlnode_get_namespace(codec_element); - encoding_name = xmlnode_get_attrib(codec_element, "name"); - id = xmlnode_get_attrib(codec_element, "id"); + xmlns = purple_xmlnode_get_namespace(codec_element); + encoding_name = purple_xmlnode_get_attrib(codec_element, "name"); + id = purple_xmlnode_get_attrib(codec_element, "id"); if (!video || purple_strequal(xmlns, NS_GOOGLE_SESSION_PHONE)) - clock_rate = xmlnode_get_attrib( + clock_rate = purple_xmlnode_get_attrib( codec_element, "clockrate"); else { clock_rate = "90000"; - /*width = xmlnode_get_attrib(codec_element, "width"); - height = xmlnode_get_attrib(codec_element, "height"); - framerate = xmlnode_get_attrib( + /*width = purple_xmlnode_get_attrib(codec_element, "width"); + height = purple_xmlnode_get_attrib(codec_element, "height"); + framerate = purple_xmlnode_get_attrib( codec_element, "framerate");*/ video_codec = TRUE; } @@ -763,12 +763,12 @@ google_session_handle_accept(JabberStream *js, GoogleSession *session, xmlnode * result = jabber_iq_new(js, JABBER_IQ_RESULT); jabber_iq_set_id(result, iq_id); - xmlnode_set_attrib(result->node, "to", session->remote_jid); + purple_xmlnode_set_attrib(result->node, "to", session->remote_jid); jabber_iq_send(result); } static void -google_session_handle_reject(JabberStream *js, GoogleSession *session, xmlnode *sess) +google_session_handle_reject(JabberStream *js, GoogleSession *session, PurpleXmlNode *sess) { GoogleAVSessionData *session_data = (GoogleAVSessionData *) session->session_data; @@ -776,7 +776,7 @@ google_session_handle_reject(JabberStream *js, GoogleSession *session, xmlnode * } static void -google_session_handle_terminate(JabberStream *js, GoogleSession *session, xmlnode *sess) +google_session_handle_terminate(JabberStream *js, GoogleSession *session, PurpleXmlNode *sess) { GoogleAVSessionData *session_data = (GoogleAVSessionData *) session->session_data; @@ -784,9 +784,9 @@ google_session_handle_terminate(JabberStream *js, GoogleSession *session, xmlnod } static void -google_session_parse_iq(JabberStream *js, GoogleSession *session, xmlnode *sess, const char *iq_id) +google_session_parse_iq(JabberStream *js, GoogleSession *session, PurpleXmlNode *sess, const char *iq_id) { - const char *type = xmlnode_get_attrib(sess, "type"); + const char *type = purple_xmlnode_get_attrib(sess, "type"); if (!strcmp(type, "initiate")) { google_session_handle_initiate(js, session, sess, iq_id); @@ -804,23 +804,23 @@ google_session_parse_iq(JabberStream *js, GoogleSession *session, xmlnode *sess, void jabber_google_session_parse(JabberStream *js, const char *from, JabberIqType type, const char *iq_id, - xmlnode *session_node) + PurpleXmlNode *session_node) { GoogleSession *session = NULL; GoogleSessionId id; - xmlnode *desc_node; + PurpleXmlNode *desc_node; GList *iter = NULL; if (type != JABBER_IQ_SET) return; - id.id = (gchar*)xmlnode_get_attrib(session_node, "id"); + id.id = (gchar*)purple_xmlnode_get_attrib(session_node, "id"); if (!id.id) return; - id.initiator = (gchar*)xmlnode_get_attrib(session_node, "initiator"); + id.initiator = (gchar*)purple_xmlnode_get_attrib(session_node, "initiator"); if (!id.initiator) return; @@ -845,9 +845,9 @@ jabber_google_session_parse(JabberStream *js, const char *from, } /* If the session doesn't exist, this has to be an initiate message */ - if (strcmp(xmlnode_get_attrib(session_node, "type"), "initiate")) + if (strcmp(purple_xmlnode_get_attrib(session_node, "type"), "initiate")) return; - desc_node = xmlnode_get_child(session_node, "description"); + desc_node = purple_xmlnode_get_child(session_node, "description"); if (!desc_node) return; session = g_new0(GoogleSession, 1); diff --git a/libpurple/protocols/jabber/google/google_session.h b/libpurple/protocols/jabber/google/google_session.h index 756ddf2fd3..ad5155c32c 100644 --- a/libpurple/protocols/jabber/google/google_session.h +++ b/libpurple/protocols/jabber/google/google_session.h @@ -42,7 +42,7 @@ typedef struct { JabberStream *js; char *remote_jid; char *iq_id; - xmlnode *description; /* store incoming description through + PurpleXmlNode *description; /* store incoming description through relay credential fetching */ gpointer session_data; } GoogleSession; @@ -51,6 +51,6 @@ gboolean jabber_google_session_initiate(JabberStream *js, const gchar *who, PurpleMediaSessionType type); void jabber_google_session_parse(JabberStream *js, const char *from, - JabberIqType type, const char *iq, xmlnode *session); + JabberIqType type, const char *iq, PurpleXmlNode *session); #endif /* PURPLE_JABBER_GOOGLE_SESSION_H_ */
\ No newline at end of file diff --git a/libpurple/protocols/jabber/google/jingleinfo.c b/libpurple/protocols/jabber/google/jingleinfo.c index bde149e000..23bda53ff9 100644 --- a/libpurple/protocols/jabber/google/jingleinfo.c +++ b/libpurple/protocols/jabber/google/jingleinfo.c @@ -73,10 +73,10 @@ jabber_google_stun_lookup_cb(GSList *hosts, gpointer data, static void jabber_google_jingle_info_common(JabberStream *js, const char *from, - JabberIqType type, xmlnode *query) + JabberIqType type, PurpleXmlNode *query) { - const xmlnode *stun = xmlnode_get_child(query, "stun"); - const xmlnode *relay = xmlnode_get_child(query, "relay"); + const PurpleXmlNode *stun = purple_xmlnode_get_child(query, "stun"); + const PurpleXmlNode *relay = purple_xmlnode_get_child(query, "relay"); gchar *my_bare_jid; /* @@ -102,11 +102,11 @@ jabber_google_jingle_info_common(JabberStream *js, const char *from, purple_debug_info("jabber", "got google:jingleinfo\n"); if (stun) { - xmlnode *server = xmlnode_get_child(stun, "server"); + PurpleXmlNode *server = purple_xmlnode_get_child(stun, "server"); if (server) { - const gchar *host = xmlnode_get_attrib(server, "host"); - const gchar *udp = xmlnode_get_attrib(server, "udp"); + const gchar *host = purple_xmlnode_get_attrib(server, "host"); + const gchar *udp = purple_xmlnode_get_attrib(server, "udp"); if (host && udp) { PurpleAccount *account; @@ -124,19 +124,19 @@ jabber_google_jingle_info_common(JabberStream *js, const char *from, } if (relay) { - xmlnode *token = xmlnode_get_child(relay, "token"); - xmlnode *server = xmlnode_get_child(relay, "server"); + PurpleXmlNode *token = purple_xmlnode_get_child(relay, "token"); + PurpleXmlNode *server = purple_xmlnode_get_child(relay, "server"); if (token) { - gchar *relay_token = xmlnode_get_data(token); + gchar *relay_token = purple_xmlnode_get_data(token); - /* we let js own the string returned from xmlnode_get_data */ + /* we let js own the string returned from purple_xmlnode_get_data */ js->google_relay_token = relay_token; } if (server) { js->google_relay_host = - g_strdup(xmlnode_get_attrib(server, "host")); + g_strdup(purple_xmlnode_get_attrib(server, "host")); } } } @@ -144,9 +144,9 @@ jabber_google_jingle_info_common(JabberStream *js, const char *from, static void jabber_google_jingle_info_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { - xmlnode *query = xmlnode_get_child_with_namespace(packet, "query", + PurpleXmlNode *query = purple_xmlnode_get_child_with_namespace(packet, "query", NS_GOOGLE_JINGLE_INFO); if (query) @@ -158,7 +158,7 @@ jabber_google_jingle_info_cb(JabberStream *js, const char *from, void jabber_google_handle_jingle_info(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *child) + PurpleXmlNode *child) { jabber_google_jingle_info_common(js, from, type, child); } diff --git a/libpurple/protocols/jabber/google/jingleinfo.h b/libpurple/protocols/jabber/google/jingleinfo.h index e5f4da232b..929ab4b18d 100644 --- a/libpurple/protocols/jabber/google/jingleinfo.h +++ b/libpurple/protocols/jabber/google/jingleinfo.h @@ -25,7 +25,7 @@ void jabber_google_handle_jingle_info(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *child); + PurpleXmlNode *child); void jabber_google_send_jingle_info(JabberStream *js); diff --git a/libpurple/protocols/jabber/ibb.c b/libpurple/protocols/jabber/ibb.c index bfece07087..b619ce6a1e 100644 --- a/libpurple/protocols/jabber/ibb.c +++ b/libpurple/protocols/jabber/ibb.c @@ -54,11 +54,11 @@ jabber_ibb_session_create(JabberStream *js, const gchar *sid, const gchar *who, JabberIBBSession * jabber_ibb_session_create_from_xmlnode(JabberStream *js, const char *from, - const char *id, xmlnode *open, gpointer user_data) + const char *id, PurpleXmlNode *open, gpointer user_data) { JabberIBBSession *sess = NULL; - const gchar *sid = xmlnode_get_attrib(open, "sid"); - const gchar *block_size = xmlnode_get_attrib(open, "block-size"); + const gchar *sid = purple_xmlnode_get_attrib(open, "sid"); + const gchar *block_size = purple_xmlnode_get_attrib(open, "block-size"); if (!open) { return NULL; @@ -210,7 +210,7 @@ jabber_ibb_session_set_error_callback(JabberIBBSession *sess, static void jabber_ibb_session_opened_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { JabberIBBSession *sess = (JabberIBBSession *) data; @@ -233,16 +233,16 @@ jabber_ibb_session_open(JabberIBBSession *sess) "jabber_ibb_session called on an already open stream\n"); } else { JabberIq *set = jabber_iq_new(sess->js, JABBER_IQ_SET); - xmlnode *open = xmlnode_new("open"); + PurpleXmlNode *open = purple_xmlnode_new("open"); gchar block_size[10]; - xmlnode_set_attrib(set->node, "to", jabber_ibb_session_get_who(sess)); - xmlnode_set_namespace(open, NS_IBB); - xmlnode_set_attrib(open, "sid", jabber_ibb_session_get_sid(sess)); + purple_xmlnode_set_attrib(set->node, "to", jabber_ibb_session_get_who(sess)); + purple_xmlnode_set_namespace(open, NS_IBB); + purple_xmlnode_set_attrib(open, "sid", jabber_ibb_session_get_sid(sess)); g_snprintf(block_size, sizeof(block_size), "%" G_GSIZE_FORMAT, jabber_ibb_session_get_block_size(sess)); - xmlnode_set_attrib(open, "block-size", block_size); - xmlnode_insert_child(set->node, open); + purple_xmlnode_set_attrib(open, "block-size", block_size); + purple_xmlnode_insert_child(set->node, open); jabber_iq_set_callback(set, jabber_ibb_session_opened_cb, sess); @@ -262,12 +262,12 @@ jabber_ibb_session_close(JabberIBBSession *sess) } else { JabberIq *set = jabber_iq_new(jabber_ibb_session_get_js(sess), JABBER_IQ_SET); - xmlnode *close = xmlnode_new("close"); + PurpleXmlNode *close = purple_xmlnode_new("close"); - xmlnode_set_attrib(set->node, "to", jabber_ibb_session_get_who(sess)); - xmlnode_set_namespace(close, NS_IBB); - xmlnode_set_attrib(close, "sid", jabber_ibb_session_get_sid(sess)); - xmlnode_insert_child(set->node, close); + purple_xmlnode_set_attrib(set->node, "to", jabber_ibb_session_get_who(sess)); + purple_xmlnode_set_namespace(close, NS_IBB); + purple_xmlnode_set_attrib(close, "sid", jabber_ibb_session_get_sid(sess)); + purple_xmlnode_insert_child(set->node, close); jabber_iq_send(set); sess->state = JABBER_IBB_SESSION_CLOSED; } @@ -279,7 +279,7 @@ jabber_ibb_session_accept(JabberIBBSession *sess) JabberIq *result = jabber_iq_new(jabber_ibb_session_get_js(sess), JABBER_IQ_RESULT); - xmlnode_set_attrib(result->node, "to", jabber_ibb_session_get_who(sess)); + purple_xmlnode_set_attrib(result->node, "to", jabber_ibb_session_get_who(sess)); jabber_iq_set_id(result, sess->id); jabber_iq_send(result); sess->state = JABBER_IBB_SESSION_OPENED; @@ -288,7 +288,7 @@ jabber_ibb_session_accept(JabberIBBSession *sess) static void jabber_ibb_session_send_acknowledge_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { JabberIBBSession *sess = (JabberIBBSession *) data; @@ -336,24 +336,24 @@ jabber_ibb_session_send_data(JabberIBBSession *sess, gconstpointer data, } else { JabberIq *set = jabber_iq_new(jabber_ibb_session_get_js(sess), JABBER_IQ_SET); - xmlnode *data_element = xmlnode_new("data"); + PurpleXmlNode *data_element = purple_xmlnode_new("data"); char *base64 = purple_base64_encode(data, size); char seq[10]; g_snprintf(seq, sizeof(seq), "%u", jabber_ibb_session_get_send_seq(sess)); - xmlnode_set_attrib(set->node, "to", jabber_ibb_session_get_who(sess)); - xmlnode_set_namespace(data_element, NS_IBB); - xmlnode_set_attrib(data_element, "sid", jabber_ibb_session_get_sid(sess)); - xmlnode_set_attrib(data_element, "seq", seq); - xmlnode_insert_data(data_element, base64, -1); + purple_xmlnode_set_attrib(set->node, "to", jabber_ibb_session_get_who(sess)); + purple_xmlnode_set_namespace(data_element, NS_IBB); + purple_xmlnode_set_attrib(data_element, "sid", jabber_ibb_session_get_sid(sess)); + purple_xmlnode_set_attrib(data_element, "seq", seq); + purple_xmlnode_insert_data(data_element, base64, -1); - xmlnode_insert_child(set->node, data_element); + purple_xmlnode_insert_child(set->node, data_element); purple_debug_info("jabber", "IBB: setting send <iq/> callback for session %p %s\n", sess, sess->sid); jabber_iq_set_callback(set, jabber_ibb_session_send_acknowledge_cb, sess); - sess->last_iq_id = g_strdup(xmlnode_get_attrib(set->node, "id")); + sess->last_iq_id = g_strdup(purple_xmlnode_get_attrib(set->node, "id")); purple_debug_info("jabber", "IBB: set sess->last_iq_id: %s\n", sess->last_iq_id); jabber_iq_send(set); @@ -367,30 +367,30 @@ static void jabber_ibb_send_error_response(JabberStream *js, const char *to, const char *id) { JabberIq *result = jabber_iq_new(js, JABBER_IQ_ERROR); - xmlnode *error = xmlnode_new("error"); - xmlnode *item_not_found = xmlnode_new("item-not-found"); + PurpleXmlNode *error = purple_xmlnode_new("error"); + PurpleXmlNode *item_not_found = purple_xmlnode_new("item-not-found"); - xmlnode_set_namespace(item_not_found, NS_XMPP_STANZAS); - xmlnode_set_attrib(error, "code", "440"); - xmlnode_set_attrib(error, "type", "cancel"); + purple_xmlnode_set_namespace(item_not_found, NS_XMPP_STANZAS); + purple_xmlnode_set_attrib(error, "code", "440"); + purple_xmlnode_set_attrib(error, "type", "cancel"); jabber_iq_set_id(result, id); - xmlnode_set_attrib(result->node, "to", to); - xmlnode_insert_child(error, item_not_found); - xmlnode_insert_child(result->node, error); + purple_xmlnode_set_attrib(result->node, "to", to); + purple_xmlnode_insert_child(error, item_not_found); + purple_xmlnode_insert_child(result->node, error); jabber_iq_send(result); } void jabber_ibb_parse(JabberStream *js, const char *who, JabberIqType type, - const char *id, xmlnode *child) + const char *id, PurpleXmlNode *child) { const char *name = child->name; gboolean data = g_str_equal(name, "data"); gboolean close = g_str_equal(name, "close"); gboolean open = g_str_equal(name, "open"); const gchar *sid = (data || close) ? - xmlnode_get_attrib(child, "sid") : NULL; + purple_xmlnode_get_attrib(child, "sid") : NULL; JabberIBBSession *sess = sid ? g_hash_table_lookup(jabber_ibb_sessions, sid) : NULL; @@ -402,7 +402,7 @@ jabber_ibb_parse(JabberStream *js, const char *who, JabberIqType type, purple_debug_error("jabber", "Got IBB iq from wrong JID, ignoring\n"); } else if (data) { - const gchar *seq_attr = xmlnode_get_attrib(child, "seq"); + const gchar *seq_attr = purple_xmlnode_get_attrib(child, "seq"); guint16 seq = (seq_attr ? atoi(seq_attr) : 0); /* reject the data, and set the session in error if we get an @@ -412,10 +412,10 @@ jabber_ibb_parse(JabberStream *js, const char *who, JabberIqType type, JabberIq *result = jabber_iq_new(js, JABBER_IQ_RESULT); jabber_iq_set_id(result, id); - xmlnode_set_attrib(result->node, "to", who); + purple_xmlnode_set_attrib(result->node, "to", who); if (sess->data_received_cb) { - gchar *base64 = xmlnode_get_data(child); + gchar *base64 = purple_xmlnode_get_data(child); gsize size; gpointer rawdata = purple_base64_decode(base64, &size); @@ -484,7 +484,7 @@ jabber_ibb_parse(JabberStream *js, const char *who, JabberIqType type, if (handler(js, who, id, child)) { result = jabber_iq_new(js, JABBER_IQ_RESULT); - xmlnode_set_attrib(result->node, "to", who); + purple_xmlnode_set_attrib(result->node, "to", who); jabber_iq_set_id(result, id); jabber_iq_send(result); return; diff --git a/libpurple/protocols/jabber/ibb.h b/libpurple/protocols/jabber/ibb.h index 4b2e711f68..5a3c630be0 100644 --- a/libpurple/protocols/jabber/ibb.h +++ b/libpurple/protocols/jabber/ibb.h @@ -38,7 +38,7 @@ typedef void (JabberIBBErrorCallback)(JabberIBBSession *); typedef void (JabberIBBSentCallback)(JabberIBBSession *); typedef gboolean (JabberIBBOpenHandler)(JabberStream *js, const char *from, - const char *id, xmlnode *open); + const char *id, PurpleXmlNode *open); typedef enum { JABBER_IBB_SESSION_NOT_OPENED, @@ -77,7 +77,7 @@ struct _JabberIBBSession { JabberIBBSession *jabber_ibb_session_create(JabberStream *js, const gchar *sid, const gchar *who, gpointer user_data); JabberIBBSession *jabber_ibb_session_create_from_xmlnode(JabberStream *js, - const gchar *from, const gchar *id, xmlnode *open, gpointer user_data); + const gchar *from, const gchar *id, PurpleXmlNode *open, gpointer user_data); void jabber_ibb_session_destroy(JabberIBBSession *sess); @@ -118,7 +118,7 @@ gpointer jabber_ibb_session_get_user_data(JabberIBBSession *sess); /* handle incoming packet */ void jabber_ibb_parse(JabberStream *js, const char *who, JabberIqType type, - const char *id, xmlnode *child); + const char *id, PurpleXmlNode *child); /* add a handler for open session */ void jabber_ibb_register_open_handler(JabberIBBOpenHandler *cb); diff --git a/libpurple/protocols/jabber/iq.c b/libpurple/protocols/jabber/iq.c index 6cd591b1d4..6740973b6a 100644 --- a/libpurple/protocols/jabber/iq.c +++ b/libpurple/protocols/jabber/iq.c @@ -57,19 +57,19 @@ JabberIq *jabber_iq_new(JabberStream *js, JabberIqType type) iq->type = type; - iq->node = xmlnode_new("iq"); + iq->node = purple_xmlnode_new("iq"); switch(iq->type) { case JABBER_IQ_SET: - xmlnode_set_attrib(iq->node, "type", "set"); + purple_xmlnode_set_attrib(iq->node, "type", "set"); break; case JABBER_IQ_GET: - xmlnode_set_attrib(iq->node, "type", "get"); + purple_xmlnode_set_attrib(iq->node, "type", "get"); break; case JABBER_IQ_ERROR: - xmlnode_set_attrib(iq->node, "type", "error"); + purple_xmlnode_set_attrib(iq->node, "type", "error"); break; case JABBER_IQ_RESULT: - xmlnode_set_attrib(iq->node, "type", "result"); + purple_xmlnode_set_attrib(iq->node, "type", "result"); break; case JABBER_IQ_NONE: /* this shouldn't ever happen */ @@ -80,7 +80,7 @@ JabberIq *jabber_iq_new(JabberStream *js, JabberIqType type) if(type == JABBER_IQ_GET || type == JABBER_IQ_SET) { iq->id = jabber_get_next_id(js); - xmlnode_set_attrib(iq->node, "id", iq->id); + purple_xmlnode_set_attrib(iq->node, "id", iq->id); } return iq; @@ -90,10 +90,10 @@ JabberIq *jabber_iq_new_query(JabberStream *js, JabberIqType type, const char *xmlns) { JabberIq *iq = jabber_iq_new(js, type); - xmlnode *query; + PurpleXmlNode *query; - query = xmlnode_new_child(iq->node, "query"); - xmlnode_set_namespace(query, xmlns); + query = purple_xmlnode_new_child(iq->node, "query"); + purple_xmlnode_set_namespace(query, xmlns); return iq; } @@ -115,10 +115,10 @@ void jabber_iq_set_id(JabberIq *iq, const char *id) g_free(iq->id); if(id) { - xmlnode_set_attrib(iq->node, "id", id); + purple_xmlnode_set_attrib(iq->node, "id", id); iq->id = g_strdup(id); } else { - xmlnode_remove_attrib(iq->node, "id"); + purple_xmlnode_remove_attrib(iq->node, "id"); iq->id = NULL; } } @@ -145,28 +145,28 @@ void jabber_iq_free(JabberIq *iq) g_return_if_fail(iq != NULL); g_free(iq->id); - xmlnode_free(iq->node); + purple_xmlnode_free(iq->node); g_free(iq); } static void jabber_iq_last_parse(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet) + PurpleXmlNode *packet) { JabberIq *iq; - xmlnode *query; + PurpleXmlNode *query; char *idle_time; if(type == JABBER_IQ_GET) { iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, NS_LAST_ACTIVITY); jabber_iq_set_id(iq, id); if (from) - xmlnode_set_attrib(iq->node, "to", from); + purple_xmlnode_set_attrib(iq->node, "to", from); - query = xmlnode_get_child(iq->node, "query"); + query = purple_xmlnode_get_child(iq->node, "query"); idle_time = g_strdup_printf("%ld", js->idle ? time(NULL) - js->idle : 0); - xmlnode_set_attrib(query, "seconds", idle_time); + purple_xmlnode_set_attrib(query, "seconds", idle_time); g_free(idle_time); jabber_iq_send(iq); @@ -175,7 +175,7 @@ static void jabber_iq_last_parse(JabberStream *js, const char *from, static void jabber_time_parse(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *child) + PurpleXmlNode *child) { JabberIq *iq; time_t now_t; @@ -184,28 +184,28 @@ static void jabber_time_parse(JabberStream *js, const char *from, time(&now_t); if(type == JABBER_IQ_GET) { - xmlnode *tzo, *utc; + PurpleXmlNode *tzo, *utc; const char *date, *tz; iq = jabber_iq_new(js, JABBER_IQ_RESULT); jabber_iq_set_id(iq, id); if (from) - xmlnode_set_attrib(iq->node, "to", from); + purple_xmlnode_set_attrib(iq->node, "to", from); - child = xmlnode_new_child(iq->node, child->name); - xmlnode_set_namespace(child, NS_ENTITY_TIME); + child = purple_xmlnode_new_child(iq->node, child->name); + purple_xmlnode_set_namespace(child, NS_ENTITY_TIME); /* <tzo>-06:00</tzo> */ tm = localtime(&now_t); tz = purple_get_tzoff_str(tm, TRUE); - tzo = xmlnode_new_child(child, "tzo"); - xmlnode_insert_data(tzo, tz, -1); + tzo = purple_xmlnode_new_child(child, "tzo"); + purple_xmlnode_insert_data(tzo, tz, -1); /* <utc>2006-12-19T17:58:35Z</utc> */ tm = gmtime(&now_t); date = purple_utf8_strftime("%Y-%m-%dT%H:%M:%SZ", tm); - utc = xmlnode_new_child(child, "utc"); - xmlnode_insert_data(utc, date, -1); + utc = purple_xmlnode_new_child(child, "utc"); + purple_xmlnode_insert_data(utc, date, -1); jabber_iq_send(iq); } else { @@ -215,10 +215,10 @@ static void jabber_time_parse(JabberStream *js, const char *from, static void jabber_iq_version_parse(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet) + PurpleXmlNode *packet) { JabberIq *iq; - xmlnode *query; + PurpleXmlNode *query; if(type == JABBER_IQ_GET) { GHashTable *ui_info; @@ -236,10 +236,10 @@ static void jabber_iq_version_parse(JabberStream *js, const char *from, iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, "jabber:iq:version"); if (from) - xmlnode_set_attrib(iq->node, "to", from); + purple_xmlnode_set_attrib(iq->node, "to", from); jabber_iq_set_id(iq, id); - query = xmlnode_get_child(iq->node, "query"); + query = purple_xmlnode_get_child(iq->node, "query"); ui_info = purple_core_get_ui_info(); @@ -250,17 +250,17 @@ static void jabber_iq_version_parse(JabberStream *js, const char *from, if(NULL != ui_name && NULL != ui_version) { char *version_complete = g_strdup_printf("%s (libpurple " VERSION ")", ui_version); - xmlnode_insert_data(xmlnode_new_child(query, "name"), ui_name, -1); - xmlnode_insert_data(xmlnode_new_child(query, "version"), version_complete, -1); + purple_xmlnode_insert_data(purple_xmlnode_new_child(query, "name"), ui_name, -1); + purple_xmlnode_insert_data(purple_xmlnode_new_child(query, "version"), version_complete, -1); g_free(version_complete); } else { - xmlnode_insert_data(xmlnode_new_child(query, "name"), "libpurple", -1); - xmlnode_insert_data(xmlnode_new_child(query, "version"), VERSION, -1); + purple_xmlnode_insert_data(purple_xmlnode_new_child(query, "name"), "libpurple", -1); + purple_xmlnode_insert_data(purple_xmlnode_new_child(query, "version"), VERSION, -1); } #if 0 if(os) { - xmlnode_insert_data(xmlnode_new_child(query, "os"), os, -1); + purple_xmlnode_insert_data(purple_xmlnode_new_child(query, "os"), os, -1); g_free(os); } #endif @@ -274,18 +274,18 @@ void jabber_iq_remove_callback_by_id(JabberStream *js, const char *id) g_hash_table_remove(js->iq_callbacks, id); } -void jabber_iq_parse(JabberStream *js, xmlnode *packet) +void jabber_iq_parse(JabberStream *js, PurpleXmlNode *packet) { JabberCallbackData *jcd; - xmlnode *child, *error, *x; + PurpleXmlNode *child, *error, *x; const char *xmlns; const char *iq_type, *id, *from; JabberIqType type = JABBER_IQ_NONE; gboolean signal_return; - from = xmlnode_get_attrib(packet, "from"); - id = xmlnode_get_attrib(packet, "id"); - iq_type = xmlnode_get_attrib(packet, "type"); + from = purple_xmlnode_get_attrib(packet, "from"); + id = purple_xmlnode_get_attrib(packet, "id"); + iq_type = purple_xmlnode_get_attrib(packet, "type"); /* * child will be either the first tag child or NULL if there is no child. @@ -294,7 +294,7 @@ void jabber_iq_parse(JabberStream *js, xmlnode *packet) * being) sufficient. */ for (child = packet->child; child; child = child->next) { - if (child->type == XMLNODE_TYPE_TAG) + if (child->type == PURPLE_XMLNODE_TYPE_TAG) break; } @@ -321,21 +321,21 @@ void jabber_iq_parse(JabberStream *js, xmlnode *packet) if(type == JABBER_IQ_SET || type == JABBER_IQ_GET) { JabberIq *iq = jabber_iq_new(js, JABBER_IQ_ERROR); - xmlnode_free(iq->node); - iq->node = xmlnode_copy(packet); + purple_xmlnode_free(iq->node); + iq->node = purple_xmlnode_copy(packet); if (from) { - xmlnode_set_attrib(iq->node, "to", from); - xmlnode_remove_attrib(iq->node, "from"); + purple_xmlnode_set_attrib(iq->node, "to", from); + purple_xmlnode_remove_attrib(iq->node, "from"); } - xmlnode_set_attrib(iq->node, "type", "error"); + purple_xmlnode_set_attrib(iq->node, "type", "error"); /* This id is clearly not useful, but we must put something there for a valid stanza */ iq->id = jabber_get_next_id(js); - xmlnode_set_attrib(iq->node, "id", iq->id); - error = xmlnode_new_child(iq->node, "error"); - xmlnode_set_attrib(error, "type", "modify"); - x = xmlnode_new_child(error, "bad-request"); - xmlnode_set_namespace(x, NS_XMPP_STANZAS); + purple_xmlnode_set_attrib(iq->node, "id", iq->id); + error = purple_xmlnode_new_child(iq->node, "error"); + purple_xmlnode_set_attrib(error, "type", "modify"); + x = purple_xmlnode_new_child(error, "bad-request"); + purple_xmlnode_set_namespace(x, NS_XMPP_STANZAS); jabber_iq_send(iq); } else @@ -363,7 +363,7 @@ void jabber_iq_parse(JabberStream *js, xmlnode *packet) * Apparently not, so let's see if we have a pre-defined handler * or if an outside plugin is interested. */ - if(child && (xmlns = xmlnode_get_namespace(child))) { + if(child && (xmlns = purple_xmlnode_get_namespace(child))) { char *key = g_strdup_printf("%s %s", child->name, xmlns); JabberIqHandler *jih = g_hash_table_lookup(iq_handlers, key); int signal_ref = GPOINTER_TO_INT(g_hash_table_lookup(signal_iq_handlers, key)); @@ -388,19 +388,19 @@ void jabber_iq_parse(JabberStream *js, xmlnode *packet) if(type == JABBER_IQ_SET || type == JABBER_IQ_GET) { JabberIq *iq = jabber_iq_new(js, JABBER_IQ_ERROR); - xmlnode_free(iq->node); - iq->node = xmlnode_copy(packet); + purple_xmlnode_free(iq->node); + iq->node = purple_xmlnode_copy(packet); if (from) { - xmlnode_set_attrib(iq->node, "to", from); - xmlnode_remove_attrib(iq->node, "from"); + purple_xmlnode_set_attrib(iq->node, "to", from); + purple_xmlnode_remove_attrib(iq->node, "from"); } - xmlnode_set_attrib(iq->node, "type", "error"); - error = xmlnode_new_child(iq->node, "error"); - xmlnode_set_attrib(error, "type", "cancel"); - xmlnode_set_attrib(error, "code", "501"); - x = xmlnode_new_child(error, "feature-not-implemented"); - xmlnode_set_namespace(x, NS_XMPP_STANZAS); + purple_xmlnode_set_attrib(iq->node, "type", "error"); + error = purple_xmlnode_new_child(iq->node, "error"); + purple_xmlnode_set_attrib(error, "type", "cancel"); + purple_xmlnode_set_attrib(error, "code", "501"); + x = purple_xmlnode_new_child(error, "feature-not-implemented"); + purple_xmlnode_set_namespace(x, NS_XMPP_STANZAS); jabber_iq_send(iq); } diff --git a/libpurple/protocols/jabber/iq.h b/libpurple/protocols/jabber/iq.h index aa4123f072..6bc4995fdd 100644 --- a/libpurple/protocols/jabber/iq.h +++ b/libpurple/protocols/jabber/iq.h @@ -58,7 +58,7 @@ typedef struct _JabberIq JabberIq; */ typedef void (JabberIqHandler)(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *child); + PurpleXmlNode *child); /** * A JabberIqCallback is called to process the results of a GET or SET that @@ -77,12 +77,12 @@ typedef void (JabberIqHandler)(JabberStream *js, const char *from, */ typedef void (JabberIqCallback)(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data); + PurpleXmlNode *packet, gpointer data); struct _JabberIq { JabberIqType type; char *id; - xmlnode *node; + PurpleXmlNode *node; JabberIqCallback *callback; gpointer callback_data; @@ -94,7 +94,7 @@ JabberIq *jabber_iq_new(JabberStream *js, JabberIqType type); JabberIq *jabber_iq_new_query(JabberStream *js, JabberIqType type, const char *xmlns); -void jabber_iq_parse(JabberStream *js, xmlnode *packet); +void jabber_iq_parse(JabberStream *js, PurpleXmlNode *packet); void jabber_iq_remove_callback_by_id(JabberStream *js, const char *id); void jabber_iq_set_callback(JabberIq *iq, JabberIqCallback *cb, gpointer data); diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c index f2ca99c993..e172b0b831 100644 --- a/libpurple/protocols/jabber/jabber.c +++ b/libpurple/protocols/jabber/jabber.c @@ -112,7 +112,7 @@ static void jabber_stream_init(JabberStream *js) static void jabber_session_initialized_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { if (type == JABBER_IQ_RESULT) { jabber_disco_items_server(js); @@ -128,27 +128,27 @@ jabber_session_initialized_cb(JabberStream *js, const char *from, static void jabber_session_init(JabberStream *js) { JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET); - xmlnode *session; + PurpleXmlNode *session; jabber_iq_set_callback(iq, jabber_session_initialized_cb, NULL); - session = xmlnode_new_child(iq->node, "session"); - xmlnode_set_namespace(session, NS_XMPP_SESSION); + session = purple_xmlnode_new_child(iq->node, "session"); + purple_xmlnode_set_namespace(session, NS_XMPP_SESSION); jabber_iq_send(iq); } static void jabber_bind_result_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { - xmlnode *bind; + PurpleXmlNode *bind; if (type == JABBER_IQ_RESULT && - (bind = xmlnode_get_child_with_namespace(packet, "bind", NS_XMPP_BIND))) { - xmlnode *jid; + (bind = purple_xmlnode_get_child_with_namespace(packet, "bind", NS_XMPP_BIND))) { + PurpleXmlNode *jid; char *full_jid; - if((jid = xmlnode_get_child(bind, "jid")) && (full_jid = xmlnode_get_data(jid))) { + if((jid = purple_xmlnode_get_child(bind, "jid")) && (full_jid = purple_xmlnode_get_data(jid))) { jabber_id_free(js->user); js->user = jabber_id_new(full_jid); @@ -213,10 +213,10 @@ static char *jabber_prep_resource(char *input) { } static gboolean -jabber_process_starttls(JabberStream *js, xmlnode *packet) +jabber_process_starttls(JabberStream *js, PurpleXmlNode *packet) { PurpleAccount *account; - xmlnode *starttls; + PurpleXmlNode *starttls; account = purple_connection_get_account(js->gc); @@ -245,8 +245,8 @@ jabber_process_starttls(JabberStream *js, xmlnode *packet) } #endif - starttls = xmlnode_get_child(packet, "starttls"); - if(xmlnode_get_child(starttls, "required")) { + starttls = purple_xmlnode_get_child(packet, "starttls"); + if(purple_xmlnode_get_child(starttls, "required")) { purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("Server requires TLS/SSL, but no TLS/SSL support was found.")); @@ -263,13 +263,13 @@ jabber_process_starttls(JabberStream *js, xmlnode *packet) return FALSE; } -void jabber_stream_features_parse(JabberStream *js, xmlnode *packet) +void jabber_stream_features_parse(JabberStream *js, PurpleXmlNode *packet) { PurpleAccount *account = purple_connection_get_account(js->gc); const char *connection_security = purple_account_get_string(account, "connection_security", JABBER_DEFAULT_REQUIRE_TLS); - if (xmlnode_get_child(packet, "starttls")) { + if (purple_xmlnode_get_child(packet, "starttls")) { if (jabber_process_starttls(js, packet)) { jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING_ENCRYPTION); return; @@ -283,29 +283,29 @@ void jabber_stream_features_parse(JabberStream *js, xmlnode *packet) if(js->registration) { jabber_register_start(js); - } else if(xmlnode_get_child(packet, "mechanisms")) { + } else if(purple_xmlnode_get_child(packet, "mechanisms")) { jabber_stream_set_state(js, JABBER_STREAM_AUTHENTICATING); jabber_auth_start(js, packet); - } else if(xmlnode_get_child(packet, "bind")) { - xmlnode *bind, *resource; + } else if(purple_xmlnode_get_child(packet, "bind")) { + PurpleXmlNode *bind, *resource; char *requested_resource; JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET); - bind = xmlnode_new_child(iq->node, "bind"); - xmlnode_set_namespace(bind, NS_XMPP_BIND); + bind = purple_xmlnode_new_child(iq->node, "bind"); + purple_xmlnode_set_namespace(bind, NS_XMPP_BIND); requested_resource = jabber_prep_resource(js->user->resource); if (requested_resource != NULL) { - resource = xmlnode_new_child(bind, "resource"); - xmlnode_insert_data(resource, requested_resource, -1); + resource = purple_xmlnode_new_child(bind, "resource"); + purple_xmlnode_insert_data(resource, requested_resource, -1); g_free(requested_resource); } jabber_iq_set_callback(iq, jabber_bind_result_cb, NULL); jabber_iq_send(iq); - } else if (xmlnode_get_child_with_namespace(packet, "ver", NS_ROSTER_VERSIONING)) { + } else if (purple_xmlnode_get_child_with_namespace(packet, "ver", NS_ROSTER_VERSIONING)) { js->server_caps |= JABBER_CAP_ROSTER_VERSIONING; - } else /* if(xmlnode_get_child_with_namespace(packet, "auth")) */ { + } else /* if(purple_xmlnode_get_child_with_namespace(packet, "auth")) */ { /* If we get an empty stream:features packet, or we explicitly get * an auth feature with namespace http://jabber.org/features/iq-auth * we should revert back to iq:auth authentication, even though we're @@ -315,7 +315,7 @@ void jabber_stream_features_parse(JabberStream *js, xmlnode *packet) } } -static void jabber_stream_handle_error(JabberStream *js, xmlnode *packet) +static void jabber_stream_handle_error(JabberStream *js, PurpleXmlNode *packet) { PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; char *msg = jabber_parse_error(js, packet, &reason); @@ -327,7 +327,7 @@ static void jabber_stream_handle_error(JabberStream *js, xmlnode *packet) static void tls_init(JabberStream *js); -void jabber_process_packet(JabberStream *js, xmlnode **packet) +void jabber_process_packet(JabberStream *js, PurpleXmlNode **packet) { const char *name; const char *xmlns; @@ -339,7 +339,7 @@ void jabber_process_packet(JabberStream *js, xmlnode **packet) return; name = (*packet)->name; - xmlns = xmlnode_get_namespace(*packet); + xmlns = purple_xmlnode_get_namespace(*packet); if(!strcmp((*packet)->name, "iq")) { jabber_iq_parse(js, *packet); @@ -585,7 +585,7 @@ int jabber_prpl_send_raw(PurpleConnection *gc, const char *buf, int len) return (len < 0 ? (int)strlen(buf) : len); } -void jabber_send_signal_cb(PurpleConnection *pc, xmlnode **packet, +void jabber_send_signal_cb(PurpleConnection *pc, PurpleXmlNode **packet, gpointer unused) { JabberStream *js; @@ -606,13 +606,13 @@ void jabber_send_signal_cb(PurpleConnection *pc, xmlnode **packet, if (g_str_equal((*packet)->name, "message") || g_str_equal((*packet)->name, "iq") || g_str_equal((*packet)->name, "presence")) - xmlnode_set_namespace(*packet, NS_XMPP_CLIENT); - txt = xmlnode_to_str(*packet, &len); + purple_xmlnode_set_namespace(*packet, NS_XMPP_CLIENT); + txt = purple_xmlnode_to_str(*packet, &len); jabber_send_raw(js, txt, len); g_free(txt); } -void jabber_send(JabberStream *js, xmlnode *packet) +void jabber_send(JabberStream *js, PurpleXmlNode *packet) { purple_signal_emit(purple_connection_get_prpl(js->gc), "jabber-sending-xmlnode", js->gc, &packet); } @@ -1133,7 +1133,7 @@ jabber_connection_schedule_close(JabberStream *js) static void jabber_registration_result_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { PurpleAccount *account = purple_connection_get_account(js->gc); char *buf; @@ -1171,7 +1171,7 @@ jabber_registration_result_cb(JabberStream *js, const char *from, static void jabber_unregistration_result_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { char *buf; char *to = data; @@ -1208,14 +1208,14 @@ static void jabber_register_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields) { GList *groups, *flds; - xmlnode *query, *y; + PurpleXmlNode *query, *y; JabberIq *iq; char *username; iq = jabber_iq_new_query(cbdata->js, JABBER_IQ_SET, "jabber:iq:register"); - query = xmlnode_get_child(iq->node, "query"); + query = purple_xmlnode_get_child(iq->node, "query"); if (cbdata->who) - xmlnode_set_attrib(iq->node, "to", cbdata->who); + purple_xmlnode_set_attrib(iq->node, "to", cbdata->who); for(groups = purple_request_fields_get_groups(fields); groups; groups = groups->next) { @@ -1227,13 +1227,13 @@ jabber_register_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields) gboolean value = purple_request_field_bool_get_value(field); if(value) { /* unregister from service. this doesn't include any of the fields, so remove them from the stanza by recreating it - (there's no "remove child" function for xmlnode) */ + (there's no "remove child" function for PurpleXmlNode) */ jabber_iq_free(iq); iq = jabber_iq_new_query(cbdata->js, JABBER_IQ_SET, "jabber:iq:register"); - query = xmlnode_get_child(iq->node, "query"); + query = purple_xmlnode_get_child(iq->node, "query"); if (cbdata->who) - xmlnode_set_attrib(iq->node,"to",cbdata->who); - xmlnode_new_child(query, "remove"); + purple_xmlnode_set_attrib(iq->node,"to",cbdata->who); + purple_xmlnode_new_child(query, "remove"); jabber_iq_set_callback(iq, jabber_unregistration_result_cb, cbdata->who); @@ -1254,8 +1254,8 @@ jabber_register_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields) if (!ids[i]) continue; - y = xmlnode_new_child(query, ids[i]); - xmlnode_insert_data(y, value, -1); + y = purple_xmlnode_new_child(query, ids[i]); + purple_xmlnode_insert_data(y, value, -1); if(cbdata->js->registration && !strcmp(id, "username")) { g_free(cbdata->js->user->node); cbdata->js->user->node = g_strdup(value); @@ -1292,18 +1292,18 @@ jabber_register_cancel_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fie g_free(cbdata); } -static void jabber_register_x_data_cb(JabberStream *js, xmlnode *result, gpointer data) +static void jabber_register_x_data_cb(JabberStream *js, PurpleXmlNode *result, gpointer data) { - xmlnode *query; + PurpleXmlNode *query; JabberIq *iq; char *to = data; iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); - query = xmlnode_get_child(iq->node, "query"); + query = purple_xmlnode_get_child(iq->node, "query"); if (to) - xmlnode_set_attrib(iq->node,"to",to); + purple_xmlnode_set_attrib(iq->node,"to",to); - xmlnode_insert_child(query, result); + purple_xmlnode_insert_child(query, result); jabber_iq_set_callback(iq, jabber_registration_result_cb, to); jabber_iq_send(iq); @@ -1328,13 +1328,13 @@ static const struct { }; void jabber_register_parse(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *query) + const char *id, PurpleXmlNode *query) { PurpleAccount *account = purple_connection_get_account(js->gc); PurpleRequestFields *fields; PurpleRequestFieldGroup *group; PurpleRequestField *field; - xmlnode *x, *y, *node; + PurpleXmlNode *x, *y, *node; char *instructions; JabberRegisterCBData *cbdata; gboolean registered = FALSE; @@ -1348,7 +1348,7 @@ void jabber_register_parse(JabberStream *js, const char *from, JabberIqType type purple_connection_set_state(js->gc, PURPLE_CONNECTION_CONNECTED); } - if(xmlnode_get_child(query, "registered")) { + if(purple_xmlnode_get_child(query, "registered")) { registered = TRUE; if(js->registration) { @@ -1360,16 +1360,16 @@ void jabber_register_parse(JabberStream *js, const char *from, JabberIqType type } } - if((x = xmlnode_get_child_with_namespace(query, "x", "jabber:x:data"))) { + if((x = purple_xmlnode_get_child_with_namespace(query, "x", "jabber:x:data"))) { jabber_x_data_request(js, x, jabber_register_x_data_cb, g_strdup(from)); return; - } else if((x = xmlnode_get_child_with_namespace(query, "x", NS_OOB_X_DATA))) { - xmlnode *url; + } else if((x = purple_xmlnode_get_child_with_namespace(query, "x", NS_OOB_X_DATA))) { + PurpleXmlNode *url; - if((url = xmlnode_get_child(x, "url"))) { + if((url = purple_xmlnode_get_child(x, "url"))) { char *href; - if((href = xmlnode_get_data(url))) { + if((href = purple_xmlnode_get_data(url))) { purple_notify_uri(NULL, href); g_free(href); @@ -1391,8 +1391,8 @@ void jabber_register_parse(JabberStream *js, const char *from, JabberIqType type group = purple_request_field_group_new(NULL); purple_request_fields_add_group(fields, group); - if((node = xmlnode_get_child(query, "username"))) { - char *data = xmlnode_get_data(node); + if((node = purple_xmlnode_get_child(query, "username"))) { + char *data = purple_xmlnode_get_data(node); if(js->registration) field = purple_request_field_string_new("username", _("Username"), data ? data : js->user->node, FALSE); else @@ -1401,12 +1401,12 @@ void jabber_register_parse(JabberStream *js, const char *from, JabberIqType type purple_request_field_group_add_field(group, field); g_free(data); } - if((node = xmlnode_get_child(query, "password"))) { + if((node = purple_xmlnode_get_child(query, "password"))) { if(js->registration) field = purple_request_field_string_new("password", _("Password"), purple_connection_get_password(js->gc), FALSE); else { - char *data = xmlnode_get_data(node); + char *data = purple_xmlnode_get_data(node); field = purple_request_field_string_new("password", _("Password"), data, FALSE); g_free(data); } @@ -1415,12 +1415,12 @@ void jabber_register_parse(JabberStream *js, const char *from, JabberIqType type purple_request_field_group_add_field(group, field); } - if((node = xmlnode_get_child(query, "name"))) { + if((node = purple_xmlnode_get_child(query, "name"))) { if(js->registration) field = purple_request_field_string_new("name", _("Name"), purple_account_get_private_alias(purple_connection_get_account(js->gc)), FALSE); else { - char *data = xmlnode_get_data(node); + char *data = purple_xmlnode_get_data(node); field = purple_request_field_string_new("name", _("Name"), data, FALSE); g_free(data); } @@ -1428,8 +1428,8 @@ void jabber_register_parse(JabberStream *js, const char *from, JabberIqType type } for (i = 0; registration_fields[i].name != NULL; ++i) { - if ((node = xmlnode_get_child(query, registration_fields[i].name))) { - char *data = xmlnode_get_data(node); + if ((node = purple_xmlnode_get_child(query, registration_fields[i].name))) { + char *data = purple_xmlnode_get_data(node); field = purple_request_field_string_new(registration_fields[i].name, _(registration_fields[i].label), data, FALSE); @@ -1443,8 +1443,8 @@ void jabber_register_parse(JabberStream *js, const char *from, JabberIqType type purple_request_field_group_add_field(group, field); } - if((y = xmlnode_get_child(query, "instructions"))) - instructions = xmlnode_get_data(y); + if((y = purple_xmlnode_get_child(query, "instructions"))) + instructions = purple_xmlnode_get_data(y); else if(registered) instructions = g_strdup(_("Please fill out the information below " "to change your account registration.")); @@ -1492,7 +1492,7 @@ void jabber_register_gateway(JabberStream *js, const char *gateway) { JabberIq *iq; iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:register"); - xmlnode_set_attrib(iq->node, "to", gateway); + purple_xmlnode_set_attrib(iq->node, "to", gateway); jabber_iq_send(iq); } @@ -1511,7 +1511,7 @@ void jabber_register_account(PurpleAccount *account) static void jabber_unregister_account_iq_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { PurpleAccount *account = purple_connection_get_account(js->gc); @@ -1533,16 +1533,16 @@ jabber_unregister_account_iq_cb(JabberStream *js, const char *from, static void jabber_unregister_account_cb(JabberStream *js) { JabberIq *iq; - xmlnode *query; + PurpleXmlNode *query; g_return_if_fail(js->unregistration); iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); - query = xmlnode_get_child_with_namespace(iq->node, "query", "jabber:iq:register"); + query = purple_xmlnode_get_child_with_namespace(iq->node, "query", "jabber:iq:register"); - xmlnode_new_child(query, "remove"); - xmlnode_set_attrib(iq->node, "to", js->user->domain); + purple_xmlnode_new_child(query, "remove"); + purple_xmlnode_set_attrib(iq->node, "to", js->user->domain); jabber_iq_set_callback(iq, jabber_unregister_account_iq_cb, NULL); jabber_iq_send(iq); @@ -1773,25 +1773,25 @@ void jabber_idle_set(PurpleConnection *gc, int idle) void jabber_blocklist_parse_push(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *child) + PurpleXmlNode *child) { JabberIq *result; - xmlnode *item; + PurpleXmlNode *item; PurpleAccount *account; gboolean is_block; GSList *deny; if (!jabber_is_own_account(js, from)) { - xmlnode *error, *x; + PurpleXmlNode *error, *x; result = jabber_iq_new(js, JABBER_IQ_ERROR); - xmlnode_set_attrib(result->node, "id", id); + purple_xmlnode_set_attrib(result->node, "id", id); if (from) - xmlnode_set_attrib(result->node, "to", from); + purple_xmlnode_set_attrib(result->node, "to", from); - error = xmlnode_new_child(result->node, "error"); - xmlnode_set_attrib(error, "type", "cancel"); - x = xmlnode_new_child(error, "not-allowed"); - xmlnode_set_namespace(x, NS_XMPP_STANZAS); + error = purple_xmlnode_new_child(result->node, "error"); + purple_xmlnode_set_attrib(error, "type", "cancel"); + x = purple_xmlnode_new_child(error, "not-allowed"); + purple_xmlnode_set_namespace(x, NS_XMPP_STANZAS); jabber_iq_send(result); return; @@ -1800,7 +1800,7 @@ void jabber_blocklist_parse_push(JabberStream *js, const char *from, account = purple_connection_get_account(js->gc); is_block = g_str_equal(child->name, "block"); - item = xmlnode_get_child(child, "item"); + item = purple_xmlnode_get_child(child, "item"); if (!is_block && item == NULL) { /* Unblock everyone */ purple_debug_info("jabber", "Received unblock push. Unblocking everyone.\n"); @@ -1810,20 +1810,20 @@ void jabber_blocklist_parse_push(JabberStream *js, const char *from, } } else if (item == NULL) { /* An empty <block/> is bogus */ - xmlnode *error, *x; + PurpleXmlNode *error, *x; result = jabber_iq_new(js, JABBER_IQ_ERROR); - xmlnode_set_attrib(result->node, "id", id); + purple_xmlnode_set_attrib(result->node, "id", id); - error = xmlnode_new_child(result->node, "error"); - xmlnode_set_attrib(error, "type", "modify"); - x = xmlnode_new_child(error, "bad-request"); - xmlnode_set_namespace(x, NS_XMPP_STANZAS); + error = purple_xmlnode_new_child(result->node, "error"); + purple_xmlnode_set_attrib(error, "type", "modify"); + x = purple_xmlnode_new_child(error, "bad-request"); + purple_xmlnode_set_namespace(x, NS_XMPP_STANZAS); jabber_iq_send(result); return; } else { - for ( ; item; item = xmlnode_get_next_twin(item)) { - const char *jid = xmlnode_get_attrib(item, "jid"); + for ( ; item; item = purple_xmlnode_get_next_twin(item)) { + const char *jid = purple_xmlnode_get_attrib(item, "jid"); if (jid == NULL || *jid == '\0') continue; @@ -1835,19 +1835,19 @@ void jabber_blocklist_parse_push(JabberStream *js, const char *from, } result = jabber_iq_new(js, JABBER_IQ_RESULT); - xmlnode_set_attrib(result->node, "id", id); + purple_xmlnode_set_attrib(result->node, "id", id); jabber_iq_send(result); } static void jabber_blocklist_parse(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { - xmlnode *blocklist, *item; + PurpleXmlNode *blocklist, *item; PurpleAccount *account; GSList *deny; - blocklist = xmlnode_get_child_with_namespace(packet, + blocklist = purple_xmlnode_get_child_with_namespace(packet, "blocklist", NS_SIMPLE_BLOCKING); account = purple_connection_get_account(js->gc); @@ -1864,23 +1864,23 @@ static void jabber_blocklist_parse(JabberStream *js, const char *from, while ((deny = purple_account_privacy_get_denied(account))) purple_account_privacy_deny_remove(account, deny->data, TRUE); - item = xmlnode_get_child(blocklist, "item"); + item = purple_xmlnode_get_child(blocklist, "item"); while (item != NULL) { - const char *jid = xmlnode_get_attrib(item, "jid"); + const char *jid = purple_xmlnode_get_attrib(item, "jid"); purple_account_privacy_deny_add(account, jid, TRUE); - item = xmlnode_get_next_twin(item); + item = purple_xmlnode_get_next_twin(item); } } void jabber_request_block_list(JabberStream *js) { JabberIq *iq; - xmlnode *blocklist; + PurpleXmlNode *blocklist; iq = jabber_iq_new(js, JABBER_IQ_GET); - blocklist = xmlnode_new_child(iq->node, "blocklist"); - xmlnode_set_namespace(blocklist, NS_SIMPLE_BLOCKING); + blocklist = purple_xmlnode_new_child(iq->node, "blocklist"); + purple_xmlnode_set_namespace(blocklist, NS_SIMPLE_BLOCKING); jabber_iq_set_callback(iq, jabber_blocklist_parse, NULL); @@ -1891,7 +1891,7 @@ void jabber_add_deny(PurpleConnection *gc, const char *who) { JabberStream *js; JabberIq *iq; - xmlnode *block, *item; + PurpleXmlNode *block, *item; g_return_if_fail(who != NULL && *who != '\0'); @@ -1914,11 +1914,11 @@ void jabber_add_deny(PurpleConnection *gc, const char *who) iq = jabber_iq_new(js, JABBER_IQ_SET); - block = xmlnode_new_child(iq->node, "block"); - xmlnode_set_namespace(block, NS_SIMPLE_BLOCKING); + block = purple_xmlnode_new_child(iq->node, "block"); + purple_xmlnode_set_namespace(block, NS_SIMPLE_BLOCKING); - item = xmlnode_new_child(block, "item"); - xmlnode_set_attrib(item, "jid", who); + item = purple_xmlnode_new_child(block, "item"); + purple_xmlnode_set_attrib(item, "jid", who); jabber_iq_send(iq); } @@ -1927,7 +1927,7 @@ void jabber_rem_deny(PurpleConnection *gc, const char *who) { JabberStream *js; JabberIq *iq; - xmlnode *unblock, *item; + PurpleXmlNode *unblock, *item; g_return_if_fail(who != NULL && *who != '\0'); @@ -1946,11 +1946,11 @@ void jabber_rem_deny(PurpleConnection *gc, const char *who) iq = jabber_iq_new(js, JABBER_IQ_SET); - unblock = xmlnode_new_child(iq->node, "unblock"); - xmlnode_set_namespace(unblock, NS_SIMPLE_BLOCKING); + unblock = purple_xmlnode_new_child(iq->node, "unblock"); + purple_xmlnode_set_namespace(unblock, NS_SIMPLE_BLOCKING); - item = xmlnode_new_child(unblock, "item"); - xmlnode_set_attrib(item, "jid", who); + item = purple_xmlnode_new_child(unblock, "item"); + purple_xmlnode_set_attrib(item, "jid", who); jabber_iq_send(iq); } @@ -2464,7 +2464,7 @@ GList *jabber_status_types(PurpleAccount *account) static void jabber_password_change_result_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { if (type == JABBER_IQ_RESULT) { purple_notify_info(js->gc, _("Password Changed"), _("Password Changed"), @@ -2487,7 +2487,7 @@ static void jabber_password_change_cb(JabberStream *js, { const char *p1, *p2; JabberIq *iq; - xmlnode *query, *y; + PurpleXmlNode *query, *y; p1 = purple_request_fields_get_string(fields, "password1"); p2 = purple_request_fields_get_string(fields, "password2"); @@ -2499,14 +2499,14 @@ static void jabber_password_change_cb(JabberStream *js, iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); - xmlnode_set_attrib(iq->node, "to", js->user->domain); + purple_xmlnode_set_attrib(iq->node, "to", js->user->domain); - query = xmlnode_get_child(iq->node, "query"); + query = purple_xmlnode_get_child(iq->node, "query"); - y = xmlnode_new_child(query, "username"); - xmlnode_insert_data(y, js->user->node, -1); - y = xmlnode_new_child(query, "password"); - xmlnode_insert_data(y, p1, -1); + y = purple_xmlnode_new_child(query, "username"); + purple_xmlnode_insert_data(y, js->user->node, -1); + y = purple_xmlnode_new_child(query, "password"); + purple_xmlnode_insert_data(y, p1, -1); jabber_iq_set_callback(iq, jabber_password_change_result_cb, g_strdup(p1)); @@ -2641,94 +2641,94 @@ void jabber_convo_closed(PurpleConnection *gc, const char *who) char *jabber_parse_error(JabberStream *js, - xmlnode *packet, + PurpleXmlNode *packet, PurpleConnectionError *reason) { - xmlnode *error; + PurpleXmlNode *error; const char *code = NULL, *text = NULL; - const char *xmlns = xmlnode_get_namespace(packet); + const char *xmlns = purple_xmlnode_get_namespace(packet); char *cdata = NULL; #define SET_REASON(x) \ if(reason != NULL) { *reason = x; } - if((error = xmlnode_get_child(packet, "error"))) { - xmlnode *t = xmlnode_get_child_with_namespace(error, "text", NS_XMPP_STANZAS); + if((error = purple_xmlnode_get_child(packet, "error"))) { + PurpleXmlNode *t = purple_xmlnode_get_child_with_namespace(error, "text", NS_XMPP_STANZAS); if (t) - cdata = xmlnode_get_data(t); + cdata = purple_xmlnode_get_data(t); #if 0 - cdata = xmlnode_get_data(error); + cdata = purple_xmlnode_get_data(error); #endif - code = xmlnode_get_attrib(error, "code"); + code = purple_xmlnode_get_attrib(error, "code"); /* Stanza errors */ - if(xmlnode_get_child(error, "bad-request")) { + if(purple_xmlnode_get_child(error, "bad-request")) { text = _("Bad Request"); - } else if(xmlnode_get_child(error, "conflict")) { + } else if(purple_xmlnode_get_child(error, "conflict")) { SET_REASON(PURPLE_CONNECTION_ERROR_NAME_IN_USE); text = _("Conflict"); - } else if(xmlnode_get_child(error, "feature-not-implemented")) { + } else if(purple_xmlnode_get_child(error, "feature-not-implemented")) { text = _("Feature Not Implemented"); - } else if(xmlnode_get_child(error, "forbidden")) { + } else if(purple_xmlnode_get_child(error, "forbidden")) { text = _("Forbidden"); - } else if(xmlnode_get_child(error, "gone")) { + } else if(purple_xmlnode_get_child(error, "gone")) { text = _("Gone"); - } else if(xmlnode_get_child(error, "internal-server-error")) { + } else if(purple_xmlnode_get_child(error, "internal-server-error")) { text = _("Internal Server Error"); - } else if(xmlnode_get_child(error, "item-not-found")) { + } else if(purple_xmlnode_get_child(error, "item-not-found")) { text = _("Item Not Found"); - } else if(xmlnode_get_child(error, "jid-malformed")) { + } else if(purple_xmlnode_get_child(error, "jid-malformed")) { text = _("Malformed XMPP ID"); - } else if(xmlnode_get_child(error, "not-acceptable")) { + } else if(purple_xmlnode_get_child(error, "not-acceptable")) { text = _("Not Acceptable"); - } else if(xmlnode_get_child(error, "not-allowed")) { + } else if(purple_xmlnode_get_child(error, "not-allowed")) { text = _("Not Allowed"); - } else if(xmlnode_get_child(error, "not-authorized")) { + } else if(purple_xmlnode_get_child(error, "not-authorized")) { text = _("Not Authorized"); - } else if(xmlnode_get_child(error, "payment-required")) { + } else if(purple_xmlnode_get_child(error, "payment-required")) { text = _("Payment Required"); - } else if(xmlnode_get_child(error, "recipient-unavailable")) { + } else if(purple_xmlnode_get_child(error, "recipient-unavailable")) { text = _("Recipient Unavailable"); - } else if(xmlnode_get_child(error, "redirect")) { + } else if(purple_xmlnode_get_child(error, "redirect")) { /* XXX */ - } else if(xmlnode_get_child(error, "registration-required")) { + } else if(purple_xmlnode_get_child(error, "registration-required")) { text = _("Registration Required"); - } else if(xmlnode_get_child(error, "remote-server-not-found")) { + } else if(purple_xmlnode_get_child(error, "remote-server-not-found")) { text = _("Remote Server Not Found"); - } else if(xmlnode_get_child(error, "remote-server-timeout")) { + } else if(purple_xmlnode_get_child(error, "remote-server-timeout")) { text = _("Remote Server Timeout"); - } else if(xmlnode_get_child(error, "resource-constraint")) { + } else if(purple_xmlnode_get_child(error, "resource-constraint")) { text = _("Server Overloaded"); - } else if(xmlnode_get_child(error, "service-unavailable")) { + } else if(purple_xmlnode_get_child(error, "service-unavailable")) { text = _("Service Unavailable"); - } else if(xmlnode_get_child(error, "subscription-required")) { + } else if(purple_xmlnode_get_child(error, "subscription-required")) { text = _("Subscription Required"); - } else if(xmlnode_get_child(error, "unexpected-request")) { + } else if(purple_xmlnode_get_child(error, "unexpected-request")) { text = _("Unexpected Request"); - } else if(xmlnode_get_child(error, "undefined-condition")) { + } else if(purple_xmlnode_get_child(error, "undefined-condition")) { text = _("Unknown Error"); } } else if(xmlns && !strcmp(xmlns, NS_XMPP_SASL)) { /* Most common reason can be the default */ SET_REASON(PURPLE_CONNECTION_ERROR_NETWORK_ERROR); - if(xmlnode_get_child(packet, "aborted")) { + if(purple_xmlnode_get_child(packet, "aborted")) { text = _("Authorization Aborted"); - } else if(xmlnode_get_child(packet, "incorrect-encoding")) { + } else if(purple_xmlnode_get_child(packet, "incorrect-encoding")) { text = _("Incorrect encoding in authorization"); - } else if(xmlnode_get_child(packet, "invalid-authzid")) { + } else if(purple_xmlnode_get_child(packet, "invalid-authzid")) { text = _("Invalid authzid"); - } else if(xmlnode_get_child(packet, "invalid-mechanism")) { + } else if(purple_xmlnode_get_child(packet, "invalid-mechanism")) { text = _("Invalid Authorization Mechanism"); - } else if(xmlnode_get_child(packet, "mechanism-too-weak")) { + } else if(purple_xmlnode_get_child(packet, "mechanism-too-weak")) { SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE); text = _("Authorization mechanism too weak"); - } else if(xmlnode_get_child(packet, "not-authorized")) { + } else if(purple_xmlnode_get_child(packet, "not-authorized")) { SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED); /* Clear the pasword if it isn't being saved */ if (!purple_account_get_remember_password(purple_connection_get_account(js->gc))) purple_account_set_password(purple_connection_get_account(js->gc), NULL, NULL, NULL); text = _("Not Authorized"); - } else if(xmlnode_get_child(packet, "temporary-auth-failure")) { + } else if(purple_xmlnode_get_child(packet, "temporary-auth-failure")) { text = _("Temporary Authentication Failure"); } else { SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED); @@ -2739,54 +2739,54 @@ char *jabber_parse_error(JabberStream *js, !strcmp(xmlns, NS_XMPP_STREAMS))) { /* Most common reason as default: */ SET_REASON(PURPLE_CONNECTION_ERROR_NETWORK_ERROR); - if(xmlnode_get_child(packet, "bad-format")) { + if(purple_xmlnode_get_child(packet, "bad-format")) { text = _("Bad Format"); - } else if(xmlnode_get_child(packet, "bad-namespace-prefix")) { + } else if(purple_xmlnode_get_child(packet, "bad-namespace-prefix")) { text = _("Bad Namespace Prefix"); - } else if(xmlnode_get_child(packet, "conflict")) { + } else if(purple_xmlnode_get_child(packet, "conflict")) { SET_REASON(PURPLE_CONNECTION_ERROR_NAME_IN_USE); text = _("Resource Conflict"); - } else if(xmlnode_get_child(packet, "connection-timeout")) { + } else if(purple_xmlnode_get_child(packet, "connection-timeout")) { text = _("Connection Timeout"); - } else if(xmlnode_get_child(packet, "host-gone")) { + } else if(purple_xmlnode_get_child(packet, "host-gone")) { text = _("Host Gone"); - } else if(xmlnode_get_child(packet, "host-unknown")) { + } else if(purple_xmlnode_get_child(packet, "host-unknown")) { text = _("Host Unknown"); - } else if(xmlnode_get_child(packet, "improper-addressing")) { + } else if(purple_xmlnode_get_child(packet, "improper-addressing")) { text = _("Improper Addressing"); - } else if(xmlnode_get_child(packet, "internal-server-error")) { + } else if(purple_xmlnode_get_child(packet, "internal-server-error")) { text = _("Internal Server Error"); - } else if(xmlnode_get_child(packet, "invalid-id")) { + } else if(purple_xmlnode_get_child(packet, "invalid-id")) { text = _("Invalid ID"); - } else if(xmlnode_get_child(packet, "invalid-namespace")) { + } else if(purple_xmlnode_get_child(packet, "invalid-namespace")) { text = _("Invalid Namespace"); - } else if(xmlnode_get_child(packet, "invalid-xml")) { + } else if(purple_xmlnode_get_child(packet, "invalid-xml")) { text = _("Invalid XML"); - } else if(xmlnode_get_child(packet, "nonmatching-hosts")) { + } else if(purple_xmlnode_get_child(packet, "nonmatching-hosts")) { text = _("Non-matching Hosts"); - } else if(xmlnode_get_child(packet, "not-authorized")) { + } else if(purple_xmlnode_get_child(packet, "not-authorized")) { text = _("Not Authorized"); - } else if(xmlnode_get_child(packet, "policy-violation")) { + } else if(purple_xmlnode_get_child(packet, "policy-violation")) { text = _("Policy Violation"); - } else if(xmlnode_get_child(packet, "remote-connection-failed")) { + } else if(purple_xmlnode_get_child(packet, "remote-connection-failed")) { text = _("Remote Connection Failed"); - } else if(xmlnode_get_child(packet, "resource-constraint")) { + } else if(purple_xmlnode_get_child(packet, "resource-constraint")) { text = _("Resource Constraint"); - } else if(xmlnode_get_child(packet, "restricted-xml")) { + } else if(purple_xmlnode_get_child(packet, "restricted-xml")) { text = _("Restricted XML"); - } else if(xmlnode_get_child(packet, "see-other-host")) { + } else if(purple_xmlnode_get_child(packet, "see-other-host")) { text = _("See Other Host"); - } else if(xmlnode_get_child(packet, "system-shutdown")) { + } else if(purple_xmlnode_get_child(packet, "system-shutdown")) { text = _("System Shutdown"); - } else if(xmlnode_get_child(packet, "undefined-condition")) { + } else if(purple_xmlnode_get_child(packet, "undefined-condition")) { text = _("Undefined Condition"); - } else if(xmlnode_get_child(packet, "unsupported-encoding")) { + } else if(purple_xmlnode_get_child(packet, "unsupported-encoding")) { text = _("Unsupported Encoding"); - } else if(xmlnode_get_child(packet, "unsupported-stanza-type")) { + } else if(purple_xmlnode_get_child(packet, "unsupported-stanza-type")) { text = _("Unsupported Stanza Type"); - } else if(xmlnode_get_child(packet, "unsupported-version")) { + } else if(purple_xmlnode_get_child(packet, "unsupported-version")) { text = _("Unsupported Version"); - } else if(xmlnode_get_child(packet, "xml-not-well-formed")) { + } else if(purple_xmlnode_get_child(packet, "xml-not-well-formed")) { text = _("XML Not Well Formed"); } else { text = _("Stream Error"); @@ -3118,21 +3118,21 @@ static gboolean _jabber_send_buzz(JabberStream *js, const char *username, char * } if (jabber_resource_has_capability(jbr, NS_ATTENTION)) { - xmlnode *buzz, *msg = xmlnode_new("message"); + PurpleXmlNode *buzz, *msg = purple_xmlnode_new("message"); gchar *to; to = g_strdup_printf("%s/%s", username, jbr->name); - xmlnode_set_attrib(msg, "to", to); + purple_xmlnode_set_attrib(msg, "to", to); g_free(to); /* avoid offline storage */ - xmlnode_set_attrib(msg, "type", "headline"); + purple_xmlnode_set_attrib(msg, "type", "headline"); - buzz = xmlnode_new_child(msg, "attention"); - xmlnode_set_namespace(buzz, NS_ATTENTION); + buzz = purple_xmlnode_new_child(msg, "attention"); + purple_xmlnode_set_namespace(buzz, NS_ATTENTION); jabber_send(js, msg); - xmlnode_free(msg); + purple_xmlnode_free(msg); return TRUE; } else { @@ -3985,12 +3985,12 @@ void jabber_plugin_init(PurplePlugin *plugin) purple_signal_register(plugin, "jabber-receiving-xmlnode", purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2, PURPLE_TYPE_CONNECTION, - G_TYPE_POINTER); /* modifiable xmlnode */ + G_TYPE_POINTER); /* modifiable PurpleXmlNode */ purple_signal_register(plugin, "jabber-sending-xmlnode", purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2, PURPLE_TYPE_CONNECTION, - G_TYPE_POINTER); /* modifiable xmlnode */ + G_TYPE_POINTER); /* modifiable PurpleXmlNode */ /* * Do not remove this or the plugin will fail. Completely. You have been diff --git a/libpurple/protocols/jabber/jabber.h b/libpurple/protocols/jabber/jabber.h index fac856e920..f62df00c2e 100644 --- a/libpurple/protocols/jabber/jabber.h +++ b/libpurple/protocols/jabber/jabber.h @@ -105,7 +105,7 @@ struct _JabberStream PurpleSrvTxtQueryData *srv_query_data; xmlParserCtxt *context; - xmlnode *current; + PurpleXmlNode *current; struct { guint8 major; @@ -309,17 +309,17 @@ extern GList *jabber_features; */ extern GList *jabber_identities; -void jabber_stream_features_parse(JabberStream *js, xmlnode *packet); -void jabber_process_packet(JabberStream *js, xmlnode **packet); -void jabber_send(JabberStream *js, xmlnode *data); +void jabber_stream_features_parse(JabberStream *js, PurpleXmlNode *packet); +void jabber_process_packet(JabberStream *js, PurpleXmlNode **packet); +void jabber_send(JabberStream *js, PurpleXmlNode *data); void jabber_send_raw(JabberStream *js, const char *data, int len); -void jabber_send_signal_cb(PurpleConnection *pc, xmlnode **packet, +void jabber_send_signal_cb(PurpleConnection *pc, PurpleXmlNode **packet, gpointer unused); void jabber_stream_set_state(JabberStream *js, JabberStreamState state); void jabber_register_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *query); + JabberIqType type, const char *id, PurpleXmlNode *query); void jabber_register_start(JabberStream *js); char *jabber_get_next_id(JabberStream *js); @@ -331,7 +331,7 @@ char *jabber_get_next_id(JabberStream *js); * @param reason where to store the disconnection reason, or @c NULL if you * don't care or you don't intend to close the connection. */ -char *jabber_parse_error(JabberStream *js, xmlnode *packet, PurpleConnectionError *reason); +char *jabber_parse_error(JabberStream *js, PurpleXmlNode *packet, PurpleConnectionError *reason); /** * Add a feature to the list of features advertised via disco#info. If you @@ -389,7 +389,7 @@ void jabber_close(PurpleConnection *gc); void jabber_idle_set(PurpleConnection *gc, int idle); void jabber_blocklist_parse_push(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *child); + PurpleXmlNode *child); void jabber_request_block_list(JabberStream *js); void jabber_add_deny(PurpleConnection *gc, const char *who); void jabber_rem_deny(PurpleConnection *gc, const char *who); diff --git a/libpurple/protocols/jabber/jingle/content.c b/libpurple/protocols/jabber/jingle/content.c index f19d186cb4..d1cf2d33d2 100644 --- a/libpurple/protocols/jabber/jingle/content.c +++ b/libpurple/protocols/jabber/jingle/content.c @@ -49,8 +49,8 @@ static void jingle_content_init (JingleContent *content); static void jingle_content_finalize (GObject *object); static void jingle_content_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); static void jingle_content_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static xmlnode *jingle_content_to_xml_internal(JingleContent *content, xmlnode *jingle, JingleActionType action); -static JingleContent *jingle_content_parse_internal(xmlnode *content); +static PurpleXmlNode *jingle_content_to_xml_internal(JingleContent *content, PurpleXmlNode *jingle, JingleActionType action); +static JingleContent *jingle_content_parse_internal(PurpleXmlNode *content); static GObjectClass *parent_class = NULL; @@ -378,16 +378,16 @@ jingle_content_modify(JingleContent *content, const gchar *senders) } static JingleContent * -jingle_content_parse_internal(xmlnode *content) +jingle_content_parse_internal(PurpleXmlNode *content) { - xmlnode *description = xmlnode_get_child(content, "description"); - const gchar *type = xmlnode_get_namespace(description); - const gchar *creator = xmlnode_get_attrib(content, "creator"); - const gchar *disposition = xmlnode_get_attrib(content, "disposition"); - const gchar *senders = xmlnode_get_attrib(content, "senders"); - const gchar *name = xmlnode_get_attrib(content, "name"); + PurpleXmlNode *description = purple_xmlnode_get_child(content, "description"); + const gchar *type = purple_xmlnode_get_namespace(description); + const gchar *creator = purple_xmlnode_get_attrib(content, "creator"); + const gchar *disposition = purple_xmlnode_get_attrib(content, "disposition"); + const gchar *senders = purple_xmlnode_get_attrib(content, "senders"); + const gchar *name = purple_xmlnode_get_attrib(content, "name"); JingleTransport *transport = - jingle_transport_parse(xmlnode_get_child(content, "transport")); + jingle_transport_parse(purple_xmlnode_get_child(content, "transport")); if (transport == NULL) return NULL; @@ -398,9 +398,9 @@ jingle_content_parse_internal(xmlnode *content) } JingleContent * -jingle_content_parse(xmlnode *content) +jingle_content_parse(PurpleXmlNode *content) { - const gchar *type = xmlnode_get_namespace(xmlnode_get_child(content, "description")); + const gchar *type = purple_xmlnode_get_namespace(purple_xmlnode_get_child(content, "description")); GType jingle_type = jingle_get_type(type); if (jingle_type != G_TYPE_NONE) { @@ -410,20 +410,20 @@ jingle_content_parse(xmlnode *content) } } -static xmlnode * -jingle_content_to_xml_internal(JingleContent *content, xmlnode *jingle, JingleActionType action) +static PurpleXmlNode * +jingle_content_to_xml_internal(JingleContent *content, PurpleXmlNode *jingle, JingleActionType action) { - xmlnode *node = xmlnode_new_child(jingle, "content"); + PurpleXmlNode *node = purple_xmlnode_new_child(jingle, "content"); gchar *creator = jingle_content_get_creator(content); gchar *name = jingle_content_get_name(content); gchar *senders = jingle_content_get_senders(content); gchar *disposition = jingle_content_get_disposition(content); - xmlnode_set_attrib(node, "creator", creator); - xmlnode_set_attrib(node, "name", name); - xmlnode_set_attrib(node, "senders", senders); + purple_xmlnode_set_attrib(node, "creator", creator); + purple_xmlnode_set_attrib(node, "name", name); + purple_xmlnode_set_attrib(node, "senders", senders); if (strcmp("session", disposition)) - xmlnode_set_attrib(node, "disposition", disposition); + purple_xmlnode_set_attrib(node, "disposition", disposition); g_free(disposition); g_free(senders); @@ -437,9 +437,9 @@ jingle_content_to_xml_internal(JingleContent *content, xmlnode *jingle, JingleAc action != JINGLE_TRANSPORT_INFO && action != JINGLE_TRANSPORT_REJECT && action != JINGLE_TRANSPORT_REPLACE) { - xmlnode *description = xmlnode_new_child(node, "description"); + PurpleXmlNode *description = purple_xmlnode_new_child(node, "description"); - xmlnode_set_namespace(description, + purple_xmlnode_set_namespace(description, jingle_content_get_description_type(content)); } @@ -455,8 +455,8 @@ jingle_content_to_xml_internal(JingleContent *content, xmlnode *jingle, JingleAc return node; } -xmlnode * -jingle_content_to_xml(JingleContent *content, xmlnode *jingle, JingleActionType action) +PurpleXmlNode * +jingle_content_to_xml(JingleContent *content, PurpleXmlNode *jingle, JingleActionType action) { g_return_val_if_fail(content != NULL, NULL); g_return_val_if_fail(JINGLE_IS_CONTENT(content), NULL); @@ -464,7 +464,7 @@ jingle_content_to_xml(JingleContent *content, xmlnode *jingle, JingleActionType } void -jingle_content_handle_action(JingleContent *content, xmlnode *xmlcontent, JingleActionType action) +jingle_content_handle_action(JingleContent *content, PurpleXmlNode *xmlcontent, JingleActionType action) { g_return_if_fail(content != NULL); g_return_if_fail(JINGLE_IS_CONTENT(content)); diff --git a/libpurple/protocols/jabber/jingle/content.h b/libpurple/protocols/jabber/jingle/content.h index b9fbd77f12..bbefb2751e 100644 --- a/libpurple/protocols/jabber/jingle/content.h +++ b/libpurple/protocols/jabber/jingle/content.h @@ -55,9 +55,9 @@ struct _JingleContentClass { GObjectClass parent_class; /**< The parent class. */ - xmlnode *(*to_xml) (JingleContent *content, xmlnode *jingle, JingleActionType action); - JingleContent *(*parse) (xmlnode *content); - void (*handle_action) (JingleContent *content, xmlnode *xmlcontent, JingleActionType action); + PurpleXmlNode *(*to_xml) (JingleContent *content, PurpleXmlNode *jingle, JingleActionType action); + JingleContent *(*parse) (PurpleXmlNode *content); + void (*handle_action) (JingleContent *content, PurpleXmlNode *xmlcontent, JingleActionType action); const gchar *description_type; }; @@ -103,9 +103,9 @@ void jingle_content_modify(JingleContent *content, const gchar *senders); #define jingle_content_create_content_remove(session) \ jingle_session_to_packet(session, JINGLE_CONTENT_REMOVE) -JingleContent *jingle_content_parse(xmlnode *content); -xmlnode *jingle_content_to_xml(JingleContent *content, xmlnode *jingle, JingleActionType action); -void jingle_content_handle_action(JingleContent *content, xmlnode *xmlcontent, JingleActionType action); +JingleContent *jingle_content_parse(PurpleXmlNode *content); +PurpleXmlNode *jingle_content_to_xml(JingleContent *content, PurpleXmlNode *jingle, JingleActionType action); +void jingle_content_handle_action(JingleContent *content, PurpleXmlNode *xmlcontent, JingleActionType action); G_END_DECLS diff --git a/libpurple/protocols/jabber/jingle/iceudp.c b/libpurple/protocols/jabber/jingle/iceudp.c index 02574225e1..74de63f196 100644 --- a/libpurple/protocols/jabber/jingle/iceudp.c +++ b/libpurple/protocols/jabber/jingle/iceudp.c @@ -43,8 +43,8 @@ static void jingle_iceudp_init (JingleIceUdp *iceudp); static void jingle_iceudp_finalize (GObject *object); static void jingle_iceudp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); static void jingle_iceudp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static JingleTransport *jingle_iceudp_parse_internal(xmlnode *iceudp); -static xmlnode *jingle_iceudp_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action); +static JingleTransport *jingle_iceudp_parse_internal(PurpleXmlNode *iceudp); +static PurpleXmlNode *jingle_iceudp_to_xml_internal(JingleTransport *transport, PurpleXmlNode *content, JingleActionType action); static void jingle_iceudp_add_local_candidate(JingleTransport *transport, const gchar *id, guint generation, PurpleMediaCandidate *candidate); static GList *jingle_iceudp_get_remote_candidates(JingleTransport *transport); @@ -370,27 +370,27 @@ jingle_iceudp_add_remote_candidate(JingleIceUdp *iceudp, JingleIceUdpCandidate * } static JingleTransport * -jingle_iceudp_parse_internal(xmlnode *iceudp) +jingle_iceudp_parse_internal(PurpleXmlNode *iceudp) { JingleTransport *transport = parent_class->parse(iceudp); - xmlnode *candidate = xmlnode_get_child(iceudp, "candidate"); + PurpleXmlNode *candidate = purple_xmlnode_get_child(iceudp, "candidate"); JingleIceUdpCandidate *iceudp_candidate = NULL; - const gchar *username = xmlnode_get_attrib(iceudp, "ufrag"); - const gchar *password = xmlnode_get_attrib(iceudp, "pwd"); - - for (; candidate; candidate = xmlnode_get_next_twin(candidate)) { - const gchar *relport = xmlnode_get_attrib(candidate, "rel-port"); - const gchar *component = xmlnode_get_attrib(candidate, "component"); - const gchar *foundation = xmlnode_get_attrib(candidate, "foundation"); - const gchar *generation = xmlnode_get_attrib(candidate, "generation"); - const gchar *id = xmlnode_get_attrib(candidate, "id"); - const gchar *ip = xmlnode_get_attrib(candidate, "ip"); - const gchar *network = xmlnode_get_attrib(candidate, "network"); - const gchar *port = xmlnode_get_attrib(candidate, "port"); - const gchar *priority = xmlnode_get_attrib(candidate, "priority"); - const gchar *protocol = xmlnode_get_attrib(candidate, "protocol"); - const gchar *type = xmlnode_get_attrib(candidate, "type"); + const gchar *username = purple_xmlnode_get_attrib(iceudp, "ufrag"); + const gchar *password = purple_xmlnode_get_attrib(iceudp, "pwd"); + + for (; candidate; candidate = purple_xmlnode_get_next_twin(candidate)) { + const gchar *relport = purple_xmlnode_get_attrib(candidate, "rel-port"); + const gchar *component = purple_xmlnode_get_attrib(candidate, "component"); + const gchar *foundation = purple_xmlnode_get_attrib(candidate, "foundation"); + const gchar *generation = purple_xmlnode_get_attrib(candidate, "generation"); + const gchar *id = purple_xmlnode_get_attrib(candidate, "id"); + const gchar *ip = purple_xmlnode_get_attrib(candidate, "ip"); + const gchar *network = purple_xmlnode_get_attrib(candidate, "network"); + const gchar *port = purple_xmlnode_get_attrib(candidate, "port"); + const gchar *priority = purple_xmlnode_get_attrib(candidate, "priority"); + const gchar *protocol = purple_xmlnode_get_attrib(candidate, "protocol"); + const gchar *type = purple_xmlnode_get_attrib(candidate, "type"); if (!component || !foundation || !generation || !id || !ip || !network || !port || !priority || !protocol || !type) @@ -409,7 +409,7 @@ jingle_iceudp_parse_internal(xmlnode *iceudp) type, username, password); iceudp_candidate->reladdr = g_strdup( - xmlnode_get_attrib(candidate, "rel-addr")); + purple_xmlnode_get_attrib(candidate, "rel-addr")); iceudp_candidate->relport = relport != NULL ? atoi(relport) : 0; iceudp_candidate->rem_known = TRUE; @@ -419,10 +419,10 @@ jingle_iceudp_parse_internal(xmlnode *iceudp) return transport; } -static xmlnode * -jingle_iceudp_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action) +static PurpleXmlNode * +jingle_iceudp_to_xml_internal(JingleTransport *transport, PurpleXmlNode *content, JingleActionType action) { - xmlnode *node = parent_class->to_xml(transport, content, action); + PurpleXmlNode *node = parent_class->to_xml(transport, content, action); if (action == JINGLE_SESSION_INITIATE || action == JINGLE_SESSION_ACCEPT || @@ -435,7 +435,7 @@ jingle_iceudp_to_xml_internal(JingleTransport *transport, xmlnode *content, Jing for (; iter; iter = g_list_next(iter)) { JingleIceUdpCandidate *candidate = iter->data; - xmlnode *xmltransport; + PurpleXmlNode *xmltransport; gchar *component, *generation, *network, *port, *priority; @@ -445,7 +445,7 @@ jingle_iceudp_to_xml_internal(JingleTransport *transport, xmlnode *content, Jing used_candidate = TRUE; candidate->rem_known = TRUE; - xmltransport = xmlnode_new_child(node, "candidate"); + xmltransport = purple_xmlnode_new_child(node, "candidate"); component = g_strdup_printf("%d", candidate->component); generation = g_strdup_printf("%d", candidate->generation); @@ -453,29 +453,29 @@ jingle_iceudp_to_xml_internal(JingleTransport *transport, xmlnode *content, Jing port = g_strdup_printf("%d", candidate->port); priority = g_strdup_printf("%d", candidate->priority); - xmlnode_set_attrib(xmltransport, "component", component); - xmlnode_set_attrib(xmltransport, "foundation", candidate->foundation); - xmlnode_set_attrib(xmltransport, "generation", generation); - xmlnode_set_attrib(xmltransport, "id", candidate->id); - xmlnode_set_attrib(xmltransport, "ip", candidate->ip); - xmlnode_set_attrib(xmltransport, "network", network); - xmlnode_set_attrib(xmltransport, "port", port); - xmlnode_set_attrib(xmltransport, "priority", priority); - xmlnode_set_attrib(xmltransport, "protocol", candidate->protocol); + purple_xmlnode_set_attrib(xmltransport, "component", component); + purple_xmlnode_set_attrib(xmltransport, "foundation", candidate->foundation); + purple_xmlnode_set_attrib(xmltransport, "generation", generation); + purple_xmlnode_set_attrib(xmltransport, "id", candidate->id); + purple_xmlnode_set_attrib(xmltransport, "ip", candidate->ip); + purple_xmlnode_set_attrib(xmltransport, "network", network); + purple_xmlnode_set_attrib(xmltransport, "port", port); + purple_xmlnode_set_attrib(xmltransport, "priority", priority); + purple_xmlnode_set_attrib(xmltransport, "protocol", candidate->protocol); if (candidate->reladdr != NULL && (strcmp(candidate->ip, candidate->reladdr) || (candidate->port != candidate->relport))) { gchar *relport = g_strdup_printf("%d", candidate->relport); - xmlnode_set_attrib(xmltransport, "rel-addr", + purple_xmlnode_set_attrib(xmltransport, "rel-addr", candidate->reladdr); - xmlnode_set_attrib(xmltransport, "rel-port", + purple_xmlnode_set_attrib(xmltransport, "rel-port", relport); g_free(relport); } - xmlnode_set_attrib(xmltransport, "type", candidate->type); + purple_xmlnode_set_attrib(xmltransport, "type", candidate->type); g_free(component); g_free(generation); @@ -487,8 +487,8 @@ jingle_iceudp_to_xml_internal(JingleTransport *transport, xmlnode *content, Jing if (used_candidate == TRUE) { JingleIceUdpCandidate *candidate = priv->local_candidates->data; - xmlnode_set_attrib(node, "pwd", candidate->password); - xmlnode_set_attrib(node, "ufrag", candidate->username); + purple_xmlnode_set_attrib(node, "pwd", candidate->password); + purple_xmlnode_set_attrib(node, "ufrag", candidate->username); } } diff --git a/libpurple/protocols/jabber/jingle/iceudp.h b/libpurple/protocols/jabber/jingle/iceudp.h index b783c6e037..8bcf8c3869 100644 --- a/libpurple/protocols/jabber/jingle/iceudp.h +++ b/libpurple/protocols/jabber/jingle/iceudp.h @@ -54,8 +54,8 @@ struct _JingleIceUdpClass { JingleTransportClass parent_class; /**< The parent class. */ - xmlnode *(*to_xml) (JingleTransport *transport, xmlnode *content, JingleActionType action); - JingleTransport *(*parse) (xmlnode *transport); + PurpleXmlNode *(*to_xml) (JingleTransport *transport, PurpleXmlNode *content, JingleActionType action); + JingleTransport *(*parse) (PurpleXmlNode *transport); }; /** The iceudp class's private data */ diff --git a/libpurple/protocols/jabber/jingle/jingle.c b/libpurple/protocols/jabber/jingle/jingle.c index 2ee71c54e6..0b697ec8e3 100644 --- a/libpurple/protocols/jabber/jingle/jingle.c +++ b/libpurple/protocols/jabber/jingle/jingle.c @@ -74,32 +74,32 @@ jingle_get_type(const gchar *type) } static void -jingle_handle_unknown_type(JingleSession *session, xmlnode *jingle) +jingle_handle_unknown_type(JingleSession *session, PurpleXmlNode *jingle) { /* Send error */ } static void -jingle_handle_content_accept(JingleSession *session, xmlnode *jingle) +jingle_handle_content_accept(JingleSession *session, PurpleXmlNode *jingle) { - xmlnode *content = xmlnode_get_child(jingle, "content"); + PurpleXmlNode *content = purple_xmlnode_get_child(jingle, "content"); jabber_iq_send(jingle_session_create_ack(session, jingle)); - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); + for (; content; content = purple_xmlnode_get_next_twin(content)) { + const gchar *name = purple_xmlnode_get_attrib(content, "name"); + const gchar *creator = purple_xmlnode_get_attrib(content, "creator"); jingle_session_accept_content(session, name, creator); /* signal here */ } } static void -jingle_handle_content_add(JingleSession *session, xmlnode *jingle) +jingle_handle_content_add(JingleSession *session, PurpleXmlNode *jingle) { - xmlnode *content = xmlnode_get_child(jingle, "content"); + PurpleXmlNode *content = purple_xmlnode_get_child(jingle, "content"); jabber_iq_send(jingle_session_create_ack(session, jingle)); - for (; content; content = xmlnode_get_next_twin(content)) { + for (; content; content = purple_xmlnode_get_next_twin(content)) { JingleContent *pending_content = jingle_content_parse(content); if (pending_content == NULL) { @@ -117,18 +117,18 @@ jingle_handle_content_add(JingleSession *session, xmlnode *jingle) } static void -jingle_handle_content_modify(JingleSession *session, xmlnode *jingle) +jingle_handle_content_modify(JingleSession *session, PurpleXmlNode *jingle) { - xmlnode *content = xmlnode_get_child(jingle, "content"); + PurpleXmlNode *content = purple_xmlnode_get_child(jingle, "content"); jabber_iq_send(jingle_session_create_ack(session, jingle)); - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); + for (; content; content = purple_xmlnode_get_next_twin(content)) { + const gchar *name = purple_xmlnode_get_attrib(content, "name"); + const gchar *creator = purple_xmlnode_get_attrib(content, "creator"); JingleContent *local_content = jingle_session_find_content(session, name, creator); if (local_content != NULL) { - const gchar *senders = xmlnode_get_attrib(content, "senders"); + const gchar *senders = purple_xmlnode_get_attrib(content, "senders"); gchar *local_senders = jingle_content_get_senders(local_content); if (!purple_strequal(senders, local_senders)) jingle_content_modify(local_content, senders); @@ -142,45 +142,45 @@ jingle_handle_content_modify(JingleSession *session, xmlnode *jingle) } static void -jingle_handle_content_reject(JingleSession *session, xmlnode *jingle) +jingle_handle_content_reject(JingleSession *session, PurpleXmlNode *jingle) { - xmlnode *content = xmlnode_get_child(jingle, "content"); + PurpleXmlNode *content = purple_xmlnode_get_child(jingle, "content"); jabber_iq_send(jingle_session_create_ack(session, jingle)); - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); + for (; content; content = purple_xmlnode_get_next_twin(content)) { + const gchar *name = purple_xmlnode_get_attrib(content, "name"); + const gchar *creator = purple_xmlnode_get_attrib(content, "creator"); jingle_session_remove_pending_content(session, name, creator); /* signal here */ } } static void -jingle_handle_content_remove(JingleSession *session, xmlnode *jingle) +jingle_handle_content_remove(JingleSession *session, PurpleXmlNode *jingle) { - xmlnode *content = xmlnode_get_child(jingle, "content"); + PurpleXmlNode *content = purple_xmlnode_get_child(jingle, "content"); jabber_iq_send(jingle_session_create_ack(session, jingle)); - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); + for (; content; content = purple_xmlnode_get_next_twin(content)) { + const gchar *name = purple_xmlnode_get_attrib(content, "name"); + const gchar *creator = purple_xmlnode_get_attrib(content, "creator"); jingle_session_remove_content(session, name, creator); } } static void -jingle_handle_description_info(JingleSession *session, xmlnode *jingle) +jingle_handle_description_info(JingleSession *session, PurpleXmlNode *jingle) { - xmlnode *content = xmlnode_get_child(jingle, "content"); + PurpleXmlNode *content = purple_xmlnode_get_child(jingle, "content"); jabber_iq_send(jingle_session_create_ack(session, jingle)); jingle_session_accept_session(session); - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); + for (; content; content = purple_xmlnode_get_next_twin(content)) { + const gchar *name = purple_xmlnode_get_attrib(content, "name"); + const gchar *creator = purple_xmlnode_get_attrib(content, "creator"); JingleContent *parsed_content = jingle_session_find_content(session, name, creator); if (parsed_content == NULL) { @@ -195,23 +195,23 @@ jingle_handle_description_info(JingleSession *session, xmlnode *jingle) } static void -jingle_handle_security_info(JingleSession *session, xmlnode *jingle) +jingle_handle_security_info(JingleSession *session, PurpleXmlNode *jingle) { jabber_iq_send(jingle_session_create_ack(session, jingle)); } static void -jingle_handle_session_accept(JingleSession *session, xmlnode *jingle) +jingle_handle_session_accept(JingleSession *session, PurpleXmlNode *jingle) { - xmlnode *content = xmlnode_get_child(jingle, "content"); + PurpleXmlNode *content = purple_xmlnode_get_child(jingle, "content"); jabber_iq_send(jingle_session_create_ack(session, jingle)); jingle_session_accept_session(session); - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); + for (; content; content = purple_xmlnode_get_next_twin(content)) { + const gchar *name = purple_xmlnode_get_attrib(content, "name"); + const gchar *creator = purple_xmlnode_get_attrib(content, "creator"); JingleContent *parsed_content = jingle_session_find_content(session, name, creator); if (parsed_content == NULL) { @@ -226,18 +226,18 @@ jingle_handle_session_accept(JingleSession *session, xmlnode *jingle) } static void -jingle_handle_session_info(JingleSession *session, xmlnode *jingle) +jingle_handle_session_info(JingleSession *session, PurpleXmlNode *jingle) { jabber_iq_send(jingle_session_create_ack(session, jingle)); /* XXX: call signal */ } static void -jingle_handle_session_initiate(JingleSession *session, xmlnode *jingle) +jingle_handle_session_initiate(JingleSession *session, PurpleXmlNode *jingle) { - xmlnode *content = xmlnode_get_child(jingle, "content"); + PurpleXmlNode *content = purple_xmlnode_get_child(jingle, "content"); - for (; content; content = xmlnode_get_next_twin(content)) { + for (; content; content = purple_xmlnode_get_next_twin(content)) { JingleContent *parsed_content = jingle_content_parse(content); if (parsed_content == NULL) { purple_debug_error("jingle", "Error parsing content\n"); @@ -254,7 +254,7 @@ jingle_handle_session_initiate(JingleSession *session, xmlnode *jingle) } static void -jingle_handle_session_terminate(JingleSession *session, xmlnode *jingle) +jingle_handle_session_terminate(JingleSession *session, PurpleXmlNode *jingle) { jabber_iq_send(jingle_session_create_ack(session, jingle)); @@ -265,30 +265,30 @@ jingle_handle_session_terminate(JingleSession *session, xmlnode *jingle) } static void -jingle_handle_transport_accept(JingleSession *session, xmlnode *jingle) +jingle_handle_transport_accept(JingleSession *session, PurpleXmlNode *jingle) { - xmlnode *content = xmlnode_get_child(jingle, "content"); + PurpleXmlNode *content = purple_xmlnode_get_child(jingle, "content"); jabber_iq_send(jingle_session_create_ack(session, jingle)); - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); + for (; content; content = purple_xmlnode_get_next_twin(content)) { + const gchar *name = purple_xmlnode_get_attrib(content, "name"); + const gchar *creator = purple_xmlnode_get_attrib(content, "creator"); JingleContent *content = jingle_session_find_content(session, name, creator); jingle_content_accept_transport(content); } } static void -jingle_handle_transport_info(JingleSession *session, xmlnode *jingle) +jingle_handle_transport_info(JingleSession *session, PurpleXmlNode *jingle) { - xmlnode *content = xmlnode_get_child(jingle, "content"); + PurpleXmlNode *content = purple_xmlnode_get_child(jingle, "content"); jabber_iq_send(jingle_session_create_ack(session, jingle)); - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); + for (; content; content = purple_xmlnode_get_next_twin(content)) { + const gchar *name = purple_xmlnode_get_attrib(content, "name"); + const gchar *creator = purple_xmlnode_get_attrib(content, "creator"); JingleContent *parsed_content = jingle_session_find_content(session, name, creator); if (parsed_content == NULL) { @@ -303,31 +303,31 @@ jingle_handle_transport_info(JingleSession *session, xmlnode *jingle) } static void -jingle_handle_transport_reject(JingleSession *session, xmlnode *jingle) +jingle_handle_transport_reject(JingleSession *session, PurpleXmlNode *jingle) { - xmlnode *content = xmlnode_get_child(jingle, "content"); + PurpleXmlNode *content = purple_xmlnode_get_child(jingle, "content"); jabber_iq_send(jingle_session_create_ack(session, jingle)); - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); + for (; content; content = purple_xmlnode_get_next_twin(content)) { + const gchar *name = purple_xmlnode_get_attrib(content, "name"); + const gchar *creator = purple_xmlnode_get_attrib(content, "creator"); JingleContent *content = jingle_session_find_content(session, name, creator); jingle_content_remove_pending_transport(content); } } static void -jingle_handle_transport_replace(JingleSession *session, xmlnode *jingle) +jingle_handle_transport_replace(JingleSession *session, PurpleXmlNode *jingle) { - xmlnode *content = xmlnode_get_child(jingle, "content"); + PurpleXmlNode *content = purple_xmlnode_get_child(jingle, "content"); jabber_iq_send(jingle_session_create_ack(session, jingle)); - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); - xmlnode *xmltransport = xmlnode_get_child(content, "transport"); + for (; content; content = purple_xmlnode_get_next_twin(content)) { + const gchar *name = purple_xmlnode_get_attrib(content, "name"); + const gchar *creator = purple_xmlnode_get_attrib(content, "creator"); + PurpleXmlNode *xmltransport = purple_xmlnode_get_child(content, "transport"); JingleTransport *transport = jingle_transport_parse(xmltransport); JingleContent *content = jingle_session_find_content(session, name, creator); @@ -337,7 +337,7 @@ jingle_handle_transport_replace(JingleSession *session, xmlnode *jingle) typedef struct { const char *name; - void (*handler)(JingleSession*, xmlnode*); + void (*handler)(JingleSession*, PurpleXmlNode*); } JingleAction; static const JingleAction jingle_actions[] = { @@ -381,7 +381,7 @@ jingle_get_action_type(const gchar *action) void jingle_parse(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *jingle) + const char *id, PurpleXmlNode *jingle) { const gchar *action; const gchar *sid; @@ -393,7 +393,7 @@ jingle_parse(JabberStream *js, const char *from, JabberIqType type, return; } - if (!(action = xmlnode_get_attrib(jingle, "action"))) { + if (!(action = purple_xmlnode_get_attrib(jingle, "action"))) { /* TODO: send iq error here */ return; } @@ -403,7 +403,7 @@ jingle_parse(JabberStream *js, const char *from, JabberIqType type, purple_debug_info("jabber", "got Jingle package action = %s\n", action); - if (!(sid = xmlnode_get_attrib(jingle, "sid"))) { + if (!(sid = purple_xmlnode_get_attrib(jingle, "sid"))) { /* send iq error here */ return; } diff --git a/libpurple/protocols/jabber/jingle/jingle.h b/libpurple/protocols/jabber/jingle/jingle.h index 1b36481ae0..9d82f191f6 100644 --- a/libpurple/protocols/jabber/jingle/jingle.h +++ b/libpurple/protocols/jabber/jingle/jingle.h @@ -70,7 +70,7 @@ JingleActionType jingle_get_action_type(const gchar *action); GType jingle_get_type(const gchar *type); void jingle_parse(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *child); + const char *id, PurpleXmlNode *child); void jingle_terminate_sessions(JabberStream *js); diff --git a/libpurple/protocols/jabber/jingle/rawudp.c b/libpurple/protocols/jabber/jingle/rawudp.c index fcef18b423..4900c4dc20 100644 --- a/libpurple/protocols/jabber/jingle/rawudp.c +++ b/libpurple/protocols/jabber/jingle/rawudp.c @@ -43,8 +43,8 @@ static void jingle_rawudp_init (JingleRawUdp *rawudp); static void jingle_rawudp_finalize (GObject *object); static void jingle_rawudp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); static void jingle_rawudp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static JingleTransport *jingle_rawudp_parse_internal(xmlnode *rawudp); -static xmlnode *jingle_rawudp_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action); +static JingleTransport *jingle_rawudp_parse_internal(PurpleXmlNode *rawudp); +static PurpleXmlNode *jingle_rawudp_to_xml_internal(JingleTransport *transport, PurpleXmlNode *content, JingleActionType action); static void jingle_rawudp_add_local_candidate(JingleTransport *transport, const gchar *id, guint generation, PurpleMediaCandidate *candidate); static GList *jingle_rawudp_get_remote_candidates(JingleTransport *transport); @@ -304,19 +304,19 @@ jingle_rawudp_add_remote_candidate(JingleRawUdp *rawudp, JingleRawUdpCandidate * } static JingleTransport * -jingle_rawudp_parse_internal(xmlnode *rawudp) +jingle_rawudp_parse_internal(PurpleXmlNode *rawudp) { JingleTransport *transport = parent_class->parse(rawudp); JingleRawUdpPrivate *priv = JINGLE_RAWUDP_GET_PRIVATE(transport); - xmlnode *candidate = xmlnode_get_child(rawudp, "candidate"); + PurpleXmlNode *candidate = purple_xmlnode_get_child(rawudp, "candidate"); JingleRawUdpCandidate *rawudp_candidate = NULL; - for (; candidate; candidate = xmlnode_get_next_twin(candidate)) { - const gchar *id = xmlnode_get_attrib(candidate, "id"); - const gchar *generation = xmlnode_get_attrib(candidate, "generation"); - const gchar *component = xmlnode_get_attrib(candidate, "component"); - const gchar *ip = xmlnode_get_attrib(candidate, "ip"); - const gchar *port = xmlnode_get_attrib(candidate, "port"); + for (; candidate; candidate = purple_xmlnode_get_next_twin(candidate)) { + const gchar *id = purple_xmlnode_get_attrib(candidate, "id"); + const gchar *generation = purple_xmlnode_get_attrib(candidate, "generation"); + const gchar *component = purple_xmlnode_get_attrib(candidate, "component"); + const gchar *ip = purple_xmlnode_get_attrib(candidate, "ip"); + const gchar *port = purple_xmlnode_get_attrib(candidate, "port"); if (!id || !generation || !component || !ip || !port) continue; @@ -344,10 +344,10 @@ jingle_rawudp_parse_internal(xmlnode *rawudp) return transport; } -static xmlnode * -jingle_rawudp_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action) +static PurpleXmlNode * +jingle_rawudp_to_xml_internal(JingleTransport *transport, PurpleXmlNode *content, JingleActionType action) { - xmlnode *node = parent_class->to_xml(transport, content, action); + PurpleXmlNode *node = parent_class->to_xml(transport, content, action); if (action == JINGLE_SESSION_INITIATE || action == JINGLE_TRANSPORT_INFO || @@ -357,23 +357,23 @@ jingle_rawudp_to_xml_internal(JingleTransport *transport, xmlnode *content, Jing for (; iter; iter = g_list_next(iter)) { JingleRawUdpCandidate *candidate = iter->data; - xmlnode *xmltransport; + PurpleXmlNode *xmltransport; gchar *generation, *component, *port; if (candidate->rem_known == TRUE) continue; candidate->rem_known = TRUE; - xmltransport = xmlnode_new_child(node, "candidate"); + xmltransport = purple_xmlnode_new_child(node, "candidate"); generation = g_strdup_printf("%d", candidate->generation); component = g_strdup_printf("%d", candidate->component); port = g_strdup_printf("%d", candidate->port); - xmlnode_set_attrib(xmltransport, "generation", generation); - xmlnode_set_attrib(xmltransport, "component", component); - xmlnode_set_attrib(xmltransport, "id", candidate->id); - xmlnode_set_attrib(xmltransport, "ip", candidate->ip); - xmlnode_set_attrib(xmltransport, "port", port); + purple_xmlnode_set_attrib(xmltransport, "generation", generation); + purple_xmlnode_set_attrib(xmltransport, "component", component); + purple_xmlnode_set_attrib(xmltransport, "id", candidate->id); + purple_xmlnode_set_attrib(xmltransport, "ip", candidate->ip); + purple_xmlnode_set_attrib(xmltransport, "port", port); g_free(port); g_free(generation); diff --git a/libpurple/protocols/jabber/jingle/rawudp.h b/libpurple/protocols/jabber/jingle/rawudp.h index ba7ae06e2c..9db1bc816c 100644 --- a/libpurple/protocols/jabber/jingle/rawudp.h +++ b/libpurple/protocols/jabber/jingle/rawudp.h @@ -54,8 +54,8 @@ struct _JingleRawUdpClass { JingleTransportClass parent_class; /**< The parent class. */ - xmlnode *(*to_xml) (JingleTransport *transport, xmlnode *content, JingleActionType action); - JingleTransport *(*parse) (xmlnode *transport); + PurpleXmlNode *(*to_xml) (JingleTransport *transport, PurpleXmlNode *content, JingleActionType action); + JingleTransport *(*parse) (PurpleXmlNode *transport); }; /** The rawudp class's private data */ diff --git a/libpurple/protocols/jabber/jingle/rtp.c b/libpurple/protocols/jabber/jingle/rtp.c index 5c7fcbddb6..3862716dea 100644 --- a/libpurple/protocols/jabber/jingle/rtp.c +++ b/libpurple/protocols/jabber/jingle/rtp.c @@ -52,9 +52,9 @@ static void jingle_rtp_init (JingleRtp *rtp); static void jingle_rtp_finalize (GObject *object); static void jingle_rtp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); static void jingle_rtp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static JingleContent *jingle_rtp_parse_internal(xmlnode *rtp); -static xmlnode *jingle_rtp_to_xml_internal(JingleContent *rtp, xmlnode *content, JingleActionType action); -static void jingle_rtp_handle_action_internal(JingleContent *content, xmlnode *jingle, JingleActionType action); +static JingleContent *jingle_rtp_parse_internal(PurpleXmlNode *rtp); +static PurpleXmlNode *jingle_rtp_to_xml_internal(JingleContent *rtp, PurpleXmlNode *content, JingleActionType action); +static void jingle_rtp_handle_action_internal(JingleContent *content, PurpleXmlNode *jingle, JingleActionType action); static PurpleMedia *jingle_rtp_get_media(JingleSession *session); @@ -320,11 +320,11 @@ jingle_rtp_new_candidate_cb(PurpleMedia *media, gchar *sid, gchar *name, PurpleM static void jingle_rtp_initiate_ack_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { JingleSession *session = data; - if (type == JABBER_IQ_ERROR || xmlnode_get_child(packet, "error")) { + if (type == JABBER_IQ_ERROR || purple_xmlnode_get_child(packet, "error")) { purple_media_end(jingle_rtp_get_media(session), NULL, NULL); g_object_unref(session); return; @@ -546,13 +546,13 @@ jingle_rtp_init_media(JingleContent *content) } static GList * -jingle_rtp_parse_codecs(xmlnode *description) +jingle_rtp_parse_codecs(PurpleXmlNode *description) { GList *codecs = NULL; - xmlnode *codec_element = NULL; + PurpleXmlNode *codec_element = NULL; const char *encoding_name,*id, *clock_rate; PurpleMediaCodec *codec; - const gchar *media = xmlnode_get_attrib(description, "media"); + const gchar *media = purple_xmlnode_get_attrib(description, "media"); PurpleMediaSessionType type; if (media == NULL) { @@ -570,25 +570,25 @@ jingle_rtp_parse_codecs(xmlnode *description) return NULL; } - for (codec_element = xmlnode_get_child(description, "payload-type") ; + for (codec_element = purple_xmlnode_get_child(description, "payload-type") ; codec_element ; - codec_element = xmlnode_get_next_twin(codec_element)) { - xmlnode *param; + codec_element = purple_xmlnode_get_next_twin(codec_element)) { + PurpleXmlNode *param; gchar *codec_str; - encoding_name = xmlnode_get_attrib(codec_element, "name"); + encoding_name = purple_xmlnode_get_attrib(codec_element, "name"); - id = xmlnode_get_attrib(codec_element, "id"); - clock_rate = xmlnode_get_attrib(codec_element, "clockrate"); + id = purple_xmlnode_get_attrib(codec_element, "id"); + clock_rate = purple_xmlnode_get_attrib(codec_element, "clockrate"); codec = purple_media_codec_new(atoi(id), encoding_name, type, clock_rate ? atoi(clock_rate) : 0); - for (param = xmlnode_get_child(codec_element, "parameter"); - param; param = xmlnode_get_next_twin(param)) { + for (param = purple_xmlnode_get_child(codec_element, "parameter"); + param; param = purple_xmlnode_get_next_twin(param)) { purple_media_codec_add_optional_parameter(codec, - xmlnode_get_attrib(param, "name"), - xmlnode_get_attrib(param, "value")); + purple_xmlnode_get_attrib(param, "name"), + purple_xmlnode_get_attrib(param, "value")); } codec_str = purple_media_codec_to_string(codec); @@ -601,12 +601,12 @@ jingle_rtp_parse_codecs(xmlnode *description) } static JingleContent * -jingle_rtp_parse_internal(xmlnode *rtp) +jingle_rtp_parse_internal(PurpleXmlNode *rtp) { JingleContent *content = parent_class->parse(rtp); - xmlnode *description = xmlnode_get_child(rtp, "description"); - const gchar *media_type = xmlnode_get_attrib(description, "media"); - const gchar *ssrc = xmlnode_get_attrib(description, "ssrc"); + PurpleXmlNode *description = purple_xmlnode_get_child(rtp, "description"); + const gchar *media_type = purple_xmlnode_get_attrib(description, "media"); + const gchar *ssrc = purple_xmlnode_get_attrib(description, "ssrc"); purple_debug_info("jingle-rtp", "rtp parse\n"); g_object_set(content, "media-type", media_type, NULL); if (ssrc != NULL) @@ -615,14 +615,14 @@ jingle_rtp_parse_internal(xmlnode *rtp) } static void -jingle_rtp_add_payloads(xmlnode *description, GList *codecs) +jingle_rtp_add_payloads(PurpleXmlNode *description, GList *codecs) { for (; codecs ; codecs = codecs->next) { PurpleMediaCodec *codec = (PurpleMediaCodec*)codecs->data; GList *iter = purple_media_codec_get_optional_parameters(codec); gchar *id, *name, *clockrate, *channels; gchar *codec_str; - xmlnode *payload = xmlnode_new_child(description, "payload-type"); + PurpleXmlNode *payload = purple_xmlnode_new_child(description, "payload-type"); id = g_strdup_printf("%d", purple_media_codec_get_id(codec)); @@ -632,10 +632,10 @@ jingle_rtp_add_payloads(xmlnode *description, GList *codecs) channels = g_strdup_printf("%d", purple_media_codec_get_channels(codec)); - xmlnode_set_attrib(payload, "name", name); - xmlnode_set_attrib(payload, "id", id); - xmlnode_set_attrib(payload, "clockrate", clockrate); - xmlnode_set_attrib(payload, "channels", channels); + purple_xmlnode_set_attrib(payload, "name", name); + purple_xmlnode_set_attrib(payload, "id", id); + purple_xmlnode_set_attrib(payload, "clockrate", clockrate); + purple_xmlnode_set_attrib(payload, "channels", channels); g_free(channels); g_free(clockrate); @@ -644,9 +644,9 @@ jingle_rtp_add_payloads(xmlnode *description, GList *codecs) for (; iter; iter = g_list_next(iter)) { PurpleKeyValuePair *mparam = iter->data; - xmlnode *param = xmlnode_new_child(payload, "parameter"); - xmlnode_set_attrib(param, "name", mparam->key); - xmlnode_set_attrib(param, "value", mparam->value); + PurpleXmlNode *param = purple_xmlnode_new_child(payload, "parameter"); + purple_xmlnode_set_attrib(param, "name", mparam->key); + purple_xmlnode_set_attrib(param, "value", mparam->value); } codec_str = purple_media_codec_to_string(codec); @@ -655,11 +655,11 @@ jingle_rtp_add_payloads(xmlnode *description, GList *codecs) } } -static xmlnode * -jingle_rtp_to_xml_internal(JingleContent *rtp, xmlnode *content, JingleActionType action) +static PurpleXmlNode * +jingle_rtp_to_xml_internal(JingleContent *rtp, PurpleXmlNode *content, JingleActionType action) { - xmlnode *node = parent_class->to_xml(rtp, content, action); - xmlnode *description = xmlnode_get_child(node, "description"); + PurpleXmlNode *node = parent_class->to_xml(rtp, content, action); + PurpleXmlNode *description = purple_xmlnode_get_child(node, "description"); if (description != NULL) { JingleSession *session = jingle_content_get_session(rtp); PurpleMedia *media = jingle_rtp_get_media(session); @@ -668,10 +668,10 @@ jingle_rtp_to_xml_internal(JingleContent *rtp, xmlnode *content, JingleActionTyp gchar *name = jingle_content_get_name(rtp); GList *codecs = purple_media_get_codecs(media, name); - xmlnode_set_attrib(description, "media", media_type); + purple_xmlnode_set_attrib(description, "media", media_type); if (ssrc != NULL) - xmlnode_set_attrib(description, "ssrc", ssrc); + purple_xmlnode_set_attrib(description, "ssrc", ssrc); g_free(media_type); g_free(name); @@ -684,14 +684,14 @@ jingle_rtp_to_xml_internal(JingleContent *rtp, xmlnode *content, JingleActionTyp } static void -jingle_rtp_handle_action_internal(JingleContent *content, xmlnode *xmlcontent, JingleActionType action) +jingle_rtp_handle_action_internal(JingleContent *content, PurpleXmlNode *xmlcontent, JingleActionType action) { switch (action) { case JINGLE_SESSION_ACCEPT: case JINGLE_SESSION_INITIATE: { JingleSession *session; JingleTransport *transport; - xmlnode *description; + PurpleXmlNode *description; GList *candidates; GList *codecs; gchar *name; @@ -710,8 +710,8 @@ jingle_rtp_handle_action_internal(JingleContent *content, xmlnode *xmlcontent, J } transport = jingle_transport_parse( - xmlnode_get_child(xmlcontent, "transport")); - description = xmlnode_get_child(xmlcontent, "description"); + purple_xmlnode_get_child(xmlcontent, "transport")); + description = purple_xmlnode_get_child(xmlcontent, "description"); candidates = jingle_transport_get_remote_candidates(transport); codecs = jingle_rtp_parse_codecs(description); name = jingle_content_get_name(content); @@ -747,7 +747,7 @@ jingle_rtp_handle_action_internal(JingleContent *content, xmlnode *xmlcontent, J case JINGLE_TRANSPORT_INFO: { JingleSession *session = jingle_content_get_session(content); JingleTransport *transport = jingle_transport_parse( - xmlnode_get_child(xmlcontent, "transport")); + purple_xmlnode_get_child(xmlcontent, "transport")); GList *candidates = jingle_transport_get_remote_candidates(transport); gchar *name = jingle_content_get_name(content); gchar *remote_jid = @@ -765,7 +765,7 @@ jingle_rtp_handle_action_internal(JingleContent *content, xmlnode *xmlcontent, J case JINGLE_DESCRIPTION_INFO: { JingleSession *session = jingle_content_get_session(content); - xmlnode *description = xmlnode_get_child( + PurpleXmlNode *description = purple_xmlnode_get_child( xmlcontent, "description"); GList *codecs, *iter, *iter2, *remote_codecs = jingle_rtp_parse_codecs(description); diff --git a/libpurple/protocols/jabber/jingle/session.c b/libpurple/protocols/jabber/jingle/session.c index 5d612aa476..6518e36a8e 100644 --- a/libpurple/protocols/jabber/jingle/session.c +++ b/libpurple/protocols/jabber/jingle/session.c @@ -402,29 +402,29 @@ jingle_session_find_by_jid(JabberStream *js, const gchar *jid) find_by_jid_ghr, (gpointer)jid) : NULL; } -static xmlnode * +static PurpleXmlNode * jingle_add_jingle_packet(JingleSession *session, JabberIq *iq, JingleActionType action) { - xmlnode *jingle = iq ? - xmlnode_new_child(iq->node, "jingle") : - xmlnode_new("jingle"); + PurpleXmlNode *jingle = iq ? + purple_xmlnode_new_child(iq->node, "jingle") : + purple_xmlnode_new("jingle"); gchar *local_jid = jingle_session_get_local_jid(session); gchar *remote_jid = jingle_session_get_remote_jid(session); gchar *sid = jingle_session_get_sid(session); - xmlnode_set_namespace(jingle, JINGLE); - xmlnode_set_attrib(jingle, "action", jingle_get_action_name(action)); + purple_xmlnode_set_namespace(jingle, JINGLE); + purple_xmlnode_set_attrib(jingle, "action", jingle_get_action_name(action)); if (jingle_session_is_initiator(session)) { - xmlnode_set_attrib(jingle, "initiator", local_jid); - xmlnode_set_attrib(jingle, "responder", remote_jid); + purple_xmlnode_set_attrib(jingle, "initiator", local_jid); + purple_xmlnode_set_attrib(jingle, "responder", remote_jid); } else { - xmlnode_set_attrib(jingle, "initiator", remote_jid); - xmlnode_set_attrib(jingle, "responder", local_jid); + purple_xmlnode_set_attrib(jingle, "initiator", remote_jid); + purple_xmlnode_set_attrib(jingle, "responder", local_jid); } - xmlnode_set_attrib(jingle, "sid", sid); + purple_xmlnode_set_attrib(jingle, "sid", sid); g_free(local_jid); g_free(remote_jid); @@ -434,15 +434,15 @@ jingle_add_jingle_packet(JingleSession *session, } JabberIq * -jingle_session_create_ack(JingleSession *session, const xmlnode *jingle) +jingle_session_create_ack(JingleSession *session, const PurpleXmlNode *jingle) { JabberIq *result = jabber_iq_new( jingle_session_get_js(session), JABBER_IQ_RESULT); - xmlnode *packet = xmlnode_get_parent(jingle); - jabber_iq_set_id(result, xmlnode_get_attrib(packet, "id")); - xmlnode_set_attrib(result->node, "from", xmlnode_get_attrib(packet, "to")); - xmlnode_set_attrib(result->node, "to", xmlnode_get_attrib(packet, "from")); + PurpleXmlNode *packet = purple_xmlnode_get_parent(jingle); + jabber_iq_set_id(result, purple_xmlnode_get_attrib(packet, "id")); + purple_xmlnode_set_attrib(result->node, "from", purple_xmlnode_get_attrib(packet, "to")); + purple_xmlnode_set_attrib(result->node, "to", purple_xmlnode_get_attrib(packet, "from")); return result; } @@ -454,16 +454,16 @@ jingle_create_iq(JingleSession *session) gchar *from = jingle_session_get_local_jid(session); gchar *to = jingle_session_get_remote_jid(session); - xmlnode_set_attrib(result->node, "from", from); - xmlnode_set_attrib(result->node, "to", to); + purple_xmlnode_set_attrib(result->node, "from", from); + purple_xmlnode_set_attrib(result->node, "to", to); g_free(from); g_free(to); return result; } -xmlnode * -jingle_session_to_xml(JingleSession *session, xmlnode *jingle, JingleActionType action) +PurpleXmlNode * +jingle_session_to_xml(JingleSession *session, PurpleXmlNode *jingle, JingleActionType action) { if (action != JINGLE_SESSION_INFO && action != JINGLE_SESSION_TERMINATE) { GList *iter; @@ -485,12 +485,12 @@ JabberIq * jingle_session_to_packet(JingleSession *session, JingleActionType action) { JabberIq *iq = jingle_create_iq(session); - xmlnode *jingle = jingle_add_jingle_packet(session, iq, action); + PurpleXmlNode *jingle = jingle_add_jingle_packet(session, iq, action); jingle_session_to_xml(session, jingle, action); return iq; } -void jingle_session_handle_action(JingleSession *session, xmlnode *jingle, JingleActionType action) +void jingle_session_handle_action(JingleSession *session, PurpleXmlNode *jingle, JingleActionType action) { GList *iter; if (action == JINGLE_CONTENT_ADD || action == JINGLE_CONTENT_REMOVE) @@ -621,12 +621,12 @@ jingle_session_terminate_packet(JingleSession *session, const gchar *reason) { JabberIq *iq = jingle_session_to_packet(session, JINGLE_SESSION_TERMINATE); - xmlnode *jingle = xmlnode_get_child(iq->node, "jingle"); + PurpleXmlNode *jingle = purple_xmlnode_get_child(iq->node, "jingle"); if (reason != NULL) { - xmlnode *reason_node; - reason_node = xmlnode_new_child(jingle, "reason"); - xmlnode_new_child(reason_node, reason); + PurpleXmlNode *reason_node; + reason_node = purple_xmlnode_new_child(jingle, "reason"); + purple_xmlnode_new_child(reason_node, reason); } return iq; } @@ -636,17 +636,17 @@ jingle_session_redirect_packet(JingleSession *session, const gchar *sid) { JabberIq *iq = jingle_session_terminate_packet(session, "alternative-session"); - xmlnode *alt_session; + PurpleXmlNode *alt_session; if (sid == NULL) return iq; - alt_session = xmlnode_get_child(iq->node, + alt_session = purple_xmlnode_get_child(iq->node, "jingle/reason/alternative-session"); if (alt_session != NULL) { - xmlnode *sid_node = xmlnode_new_child(alt_session, "sid"); - xmlnode_insert_data(sid_node, sid, -1); + PurpleXmlNode *sid_node = purple_xmlnode_new_child(alt_session, "sid"); + purple_xmlnode_insert_data(sid_node, sid, -1); } return iq; } diff --git a/libpurple/protocols/jabber/jingle/session.h b/libpurple/protocols/jabber/jingle/session.h index 0885fd2f30..c5cb0c7c31 100644 --- a/libpurple/protocols/jabber/jingle/session.h +++ b/libpurple/protocols/jabber/jingle/session.h @@ -85,11 +85,11 @@ GList *jingle_session_get_pending_contents(JingleSession *session); JingleSession *jingle_session_find_by_sid(JabberStream *js, const gchar *sid); JingleSession *jingle_session_find_by_jid(JabberStream *js, const gchar *jid); -JabberIq *jingle_session_create_ack(JingleSession *session, const xmlnode *jingle); -xmlnode *jingle_session_to_xml(JingleSession *session, xmlnode *parent, JingleActionType action); +JabberIq *jingle_session_create_ack(JingleSession *session, const PurpleXmlNode *jingle); +PurpleXmlNode *jingle_session_to_xml(JingleSession *session, PurpleXmlNode *parent, JingleActionType action); JabberIq *jingle_session_to_packet(JingleSession *session, JingleActionType action); -void jingle_session_handle_action(JingleSession *session, xmlnode *jingle, JingleActionType action); +void jingle_session_handle_action(JingleSession *session, PurpleXmlNode *jingle, JingleActionType action); struct _JingleContent *jingle_session_find_content(JingleSession *session, const gchar *name, const gchar *creator); diff --git a/libpurple/protocols/jabber/jingle/transport.c b/libpurple/protocols/jabber/jingle/transport.c index 272a61da20..eb24b0ef46 100644 --- a/libpurple/protocols/jabber/jingle/transport.c +++ b/libpurple/protocols/jabber/jingle/transport.c @@ -42,8 +42,8 @@ static void jingle_transport_init (JingleTransport *transport); static void jingle_transport_finalize (GObject *object); static void jingle_transport_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); static void jingle_transport_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -JingleTransport *jingle_transport_parse_internal(xmlnode *transport); -xmlnode *jingle_transport_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action); +JingleTransport *jingle_transport_parse_internal(PurpleXmlNode *transport); +PurpleXmlNode *jingle_transport_to_xml_internal(JingleTransport *transport, PurpleXmlNode *content, JingleActionType action); static void jingle_transport_add_local_candidate_internal(JingleTransport *transport, const gchar *id, guint generation, PurpleMediaCandidate *candidate); static GList *jingle_transport_get_remote_candidates_internal(JingleTransport *transport); @@ -174,24 +174,24 @@ jingle_transport_get_remote_candidates_internal(JingleTransport *transport) } JingleTransport * -jingle_transport_parse_internal(xmlnode *transport) +jingle_transport_parse_internal(PurpleXmlNode *transport) { - const gchar *type = xmlnode_get_namespace(transport); + const gchar *type = purple_xmlnode_get_namespace(transport); return jingle_transport_create(type); } -xmlnode * -jingle_transport_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action) +PurpleXmlNode * +jingle_transport_to_xml_internal(JingleTransport *transport, PurpleXmlNode *content, JingleActionType action) { - xmlnode *node = xmlnode_new_child(content, "transport"); - xmlnode_set_namespace(node, jingle_transport_get_transport_type(transport)); + PurpleXmlNode *node = purple_xmlnode_new_child(content, "transport"); + purple_xmlnode_set_namespace(node, jingle_transport_get_transport_type(transport)); return node; } JingleTransport * -jingle_transport_parse(xmlnode *transport) +jingle_transport_parse(PurpleXmlNode *transport) { - const gchar *type_name = xmlnode_get_namespace(transport); + const gchar *type_name = purple_xmlnode_get_namespace(transport); GType type = jingle_get_type(type_name); if (type == G_TYPE_NONE) return NULL; @@ -199,8 +199,8 @@ jingle_transport_parse(xmlnode *transport) return JINGLE_TRANSPORT_CLASS(g_type_class_ref(type))->parse(transport); } -xmlnode * -jingle_transport_to_xml(JingleTransport *transport, xmlnode *content, JingleActionType action) +PurpleXmlNode * +jingle_transport_to_xml(JingleTransport *transport, PurpleXmlNode *content, JingleActionType action) { g_return_val_if_fail(transport != NULL, NULL); g_return_val_if_fail(JINGLE_IS_TRANSPORT(transport), NULL); diff --git a/libpurple/protocols/jabber/jingle/transport.h b/libpurple/protocols/jabber/jingle/transport.h index 22bbb4aaac..aec1cda6d9 100644 --- a/libpurple/protocols/jabber/jingle/transport.h +++ b/libpurple/protocols/jabber/jingle/transport.h @@ -53,8 +53,8 @@ struct _JingleTransportClass GObjectClass parent_class; /**< The parent class. */ const gchar *transport_type; - xmlnode *(*to_xml) (JingleTransport *transport, xmlnode *content, JingleActionType action); - JingleTransport *(*parse) (xmlnode *transport); + PurpleXmlNode *(*to_xml) (JingleTransport *transport, PurpleXmlNode *content, JingleActionType action); + JingleTransport *(*parse) (PurpleXmlNode *transport); void (*add_local_candidate) (JingleTransport *transport, const gchar *id, guint generation, PurpleMediaCandidate *candidate); GList *(*get_remote_candidates) (JingleTransport *transport); }; @@ -79,8 +79,8 @@ const gchar *jingle_transport_get_transport_type(JingleTransport *transport); void jingle_transport_add_local_candidate(JingleTransport *transport, const gchar *id, guint generation, PurpleMediaCandidate *candidate); GList *jingle_transport_get_remote_candidates(JingleTransport *transport); -JingleTransport *jingle_transport_parse(xmlnode *transport); -xmlnode *jingle_transport_to_xml(JingleTransport *transport, xmlnode *content, JingleActionType action); +JingleTransport *jingle_transport_parse(PurpleXmlNode *transport); +PurpleXmlNode *jingle_transport_to_xml(JingleTransport *transport, PurpleXmlNode *content, JingleActionType action); G_END_DECLS diff --git a/libpurple/protocols/jabber/message.c b/libpurple/protocols/jabber/message.c index 8c5ee0eb98..129e342671 100644 --- a/libpurple/protocols/jabber/message.c +++ b/libpurple/protocols/jabber/message.c @@ -179,20 +179,20 @@ static void handle_headline(JabberMessage *jm) g_string_append(body, jm->body); for(etc = jm->etc; etc; etc = etc->next) { - xmlnode *x = etc->data; - const char *xmlns = xmlnode_get_namespace(x); + PurpleXmlNode *x = etc->data; + const char *xmlns = purple_xmlnode_get_namespace(x); if(xmlns && !strcmp(xmlns, NS_OOB_X_DATA)) { - xmlnode *url, *desc; + PurpleXmlNode *url, *desc; char *urltxt, *desctxt; - url = xmlnode_get_child(x, "url"); - desc = xmlnode_get_child(x, "desc"); + url = purple_xmlnode_get_child(x, "url"); + desc = purple_xmlnode_get_child(x, "desc"); if(!url || !desc) continue; - urltxt = xmlnode_get_data(url); - desctxt = xmlnode_get_data(desc); + urltxt = purple_xmlnode_get_data(url); + desctxt = purple_xmlnode_get_data(desc); /* I'm all about ugly hacks */ if(body->len && jm->body && !strcmp(body->str, jm->body)) @@ -324,14 +324,14 @@ typedef struct { static void -jabber_message_get_refs_from_xmlnode_internal(const xmlnode *message, +jabber_message_get_refs_from_xmlnode_internal(const PurpleXmlNode *message, GHashTable *table) { - xmlnode *child; + PurpleXmlNode *child; - for (child = xmlnode_get_child(message, "img") ; child ; - child = xmlnode_get_next_twin(child)) { - const gchar *src = xmlnode_get_attrib(child, "src"); + for (child = purple_xmlnode_get_child(message, "img") ; child ; + child = purple_xmlnode_get_next_twin(child)) { + const gchar *src = purple_xmlnode_get_attrib(child, "src"); if (g_str_has_prefix(src, "cid:")) { const gchar *cid = src + 4; @@ -341,7 +341,7 @@ jabber_message_get_refs_from_xmlnode_internal(const xmlnode *message, /* take a copy of the cid and let the SmileyRef own it... */ gchar *temp_cid = g_strdup(cid); JabberSmileyRef *ref = g_new0(JabberSmileyRef, 1); - const gchar *alt = xmlnode_get_attrib(child, "alt"); + const gchar *alt = purple_xmlnode_get_attrib(child, "alt"); ref->cid = temp_cid; /* if there is no "alt" string, use the cid... include the entire src, eg. "cid:.." to avoid linkification */ @@ -379,7 +379,7 @@ jabber_message_get_refs_steal(gpointer key, gpointer value, gpointer user_data) } static GList * -jabber_message_get_refs_from_xmlnode(const xmlnode *message) +jabber_message_get_refs_from_xmlnode(const PurpleXmlNode *message) { GList *refs = NULL; GHashTable *unique_refs = g_hash_table_new(g_str_hash, g_str_equal); @@ -392,9 +392,9 @@ jabber_message_get_refs_from_xmlnode(const xmlnode *message) } static gchar * -jabber_message_xml_to_string_strip_img_smileys(xmlnode *xhtml) +jabber_message_xml_to_string_strip_img_smileys(PurpleXmlNode *xhtml) { - gchar *markup = xmlnode_to_str(xhtml, NULL); + gchar *markup = purple_xmlnode_to_str(xhtml, NULL); int len = strlen(markup); int pos = 0; GString *out = g_string_new(NULL); @@ -404,7 +404,7 @@ jabber_message_xml_to_string_strip_img_smileys(xmlnode *xhtml) we need to find all <img> tags within the XHTML and replace those tags with the value of their "alt" attributes */ if (g_str_has_prefix(&(markup[pos]), "<img")) { - xmlnode *img = NULL; + PurpleXmlNode *img = NULL; int pos2 = pos; const gchar *src; @@ -420,14 +420,14 @@ jabber_message_xml_to_string_strip_img_smileys(xmlnode *xhtml) /* note, if the above loop didn't find the end of the <img> tag, it the parsed string will be until the end of the input string, - in which case xmlnode_from_str will bail out and return NULL, + in which case purple_xmlnode_from_str will bail out and return NULL, in this case the "if" statement below doesn't trigger and the text is copied unchanged */ - img = xmlnode_from_str(&(markup[pos]), pos2 - pos); - src = xmlnode_get_attrib(img, "src"); + img = purple_xmlnode_from_str(&(markup[pos]), pos2 - pos); + src = purple_xmlnode_get_attrib(img, "src"); if (g_str_has_prefix(src, "cid:")) { - const gchar *alt = xmlnode_get_attrib(img, "alt"); + const gchar *alt = purple_xmlnode_get_attrib(img, "alt"); /* if the "alt" attribute is empty, put the cid as smiley string */ if (alt && alt[0] != '\0') { /* if the "alt" is the same as the CID, as Jabbim does, @@ -448,7 +448,7 @@ jabber_message_xml_to_string_strip_img_smileys(xmlnode *xhtml) pos++; } - xmlnode_free(img); + purple_xmlnode_free(img); } else { out = g_string_append_c(out, markup[pos]); @@ -462,13 +462,13 @@ jabber_message_xml_to_string_strip_img_smileys(xmlnode *xhtml) static void jabber_message_add_remote_smileys(JabberStream *js, const gchar *who, - const xmlnode *message) + const PurpleXmlNode *message) { - xmlnode *data_tag; - for (data_tag = xmlnode_get_child_with_namespace(message, "data", NS_BOB) ; + PurpleXmlNode *data_tag; + for (data_tag = purple_xmlnode_get_child_with_namespace(message, "data", NS_BOB) ; data_tag ; - data_tag = xmlnode_get_next_twin(data_tag)) { - const gchar *cid = xmlnode_get_attrib(data_tag, "cid"); + data_tag = purple_xmlnode_get_next_twin(data_tag)) { + const gchar *cid = purple_xmlnode_get_attrib(data_tag, "cid"); const JabberData *data = jabber_data_find_remote_by_cid(js, who, cid); if (!data && cid != NULL) { @@ -498,17 +498,17 @@ jabber_message_request_data_cb(JabberData *data, gchar *alt, g_free(alt); } -void jabber_message_parse(JabberStream *js, xmlnode *packet) +void jabber_message_parse(JabberStream *js, PurpleXmlNode *packet) { JabberMessage *jm; const char *id, *from, *to, *type; - xmlnode *child; + PurpleXmlNode *child; gboolean signal_return; - from = xmlnode_get_attrib(packet, "from"); - id = xmlnode_get_attrib(packet, "id"); - to = xmlnode_get_attrib(packet, "to"); - type = xmlnode_get_attrib(packet, "type"); + from = purple_xmlnode_get_attrib(packet, "from"); + id = purple_xmlnode_get_attrib(packet, "id"); + to = purple_xmlnode_get_attrib(packet, "to"); + type = purple_xmlnode_get_attrib(packet, "type"); signal_return = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_connection_get_prpl(js->gc), "jabber-receiving-message", js->gc, type, id, from, to, packet)); @@ -543,19 +543,19 @@ void jabber_message_parse(JabberStream *js, xmlnode *packet) jm->id = g_strdup(id); for(child = packet->child; child; child = child->next) { - const char *xmlns = xmlnode_get_namespace(child); - if(child->type != XMLNODE_TYPE_TAG) + const char *xmlns = purple_xmlnode_get_namespace(child); + if(child->type != PURPLE_XMLNODE_TYPE_TAG) continue; if(!strcmp(child->name, "error")) { - const char *code = xmlnode_get_attrib(child, "code"); + const char *code = purple_xmlnode_get_attrib(child, "code"); char *code_txt = NULL; - char *text = xmlnode_get_data(child); + char *text = purple_xmlnode_get_data(child); if (!text) { - xmlnode *enclosed_text_node; + PurpleXmlNode *enclosed_text_node; - if ((enclosed_text_node = xmlnode_get_child(child, "text"))) - text = xmlnode_get_data(enclosed_text_node); + if ((enclosed_text_node = purple_xmlnode_get_child(child, "text"))) + text = purple_xmlnode_get_data(enclosed_text_node); } if(code) @@ -578,23 +578,23 @@ void jabber_message_parse(JabberStream *js, xmlnode *packet) continue; } else if(!strcmp(child->name, "subject") && !strcmp(xmlns, NS_XMPP_CLIENT)) { if(!jm->subject) { - jm->subject = xmlnode_get_data(child); + jm->subject = purple_xmlnode_get_data(child); if(!jm->subject) jm->subject = g_strdup(""); } } else if(!strcmp(child->name, "thread") && !strcmp(xmlns, NS_XMPP_CLIENT)) { if(!jm->thread_id) - jm->thread_id = xmlnode_get_data(child); + jm->thread_id = purple_xmlnode_get_data(child); } else if(!strcmp(child->name, "body") && !strcmp(xmlns, NS_XMPP_CLIENT)) { if(!jm->body) { - char *msg = xmlnode_get_data(child); + char *msg = purple_xmlnode_get_data(child); char *escaped = purple_markup_escape_text(msg, -1); jm->body = purple_strdup_withhtml(escaped); g_free(escaped); g_free(msg); } } else if(!strcmp(child->name, "html") && !strcmp(xmlns, NS_XHTML_IM)) { - if(!jm->xhtml && xmlnode_get_child(child, "body")) { + if(!jm->xhtml && purple_xmlnode_get_child(child, "body")) { char *c; const PurpleConnection *gc = js->gc; @@ -637,7 +637,7 @@ void jabber_message_parse(JabberStream *js, xmlnode *packet) jabber_message_add_remote_smileys(js, to, packet); } - xmlnode_strip_prefixes(child); + purple_xmlnode_strip_prefixes(child); /* reformat xhtml so that img tags with a "cid:" src gets translated to the bare text of the emoticon (the "alt" attrib) */ @@ -703,30 +703,30 @@ void jabber_message_parse(JabberStream *js, xmlnode *packet) } else if(!strcmp(child->name, "gone") && !strcmp(xmlns,"http://jabber.org/protocol/chatstates")) { jm->chat_state = JM_STATE_GONE; } else if(!strcmp(child->name, "event") && !strcmp(xmlns,"http://jabber.org/protocol/pubsub#event")) { - xmlnode *items; + PurpleXmlNode *items; jm->type = JABBER_MESSAGE_EVENT; - for(items = xmlnode_get_child(child,"items"); items; items = items->next) + for(items = purple_xmlnode_get_child(child,"items"); items; items = items->next) jm->eventitems = g_list_append(jm->eventitems, items); } else if(!strcmp(child->name, "attention") && !strcmp(xmlns, NS_ATTENTION)) { jm->hasBuzz = TRUE; } else if(!strcmp(child->name, "delay") && !strcmp(xmlns, NS_DELAYED_DELIVERY)) { - const char *timestamp = xmlnode_get_attrib(child, "stamp"); + const char *timestamp = purple_xmlnode_get_attrib(child, "stamp"); jm->delayed = TRUE; if(timestamp) jm->sent = purple_str_to_time(timestamp, TRUE, NULL, NULL, NULL); } else if(!strcmp(child->name, "x")) { if(!strcmp(xmlns, NS_DELAYED_DELIVERY_LEGACY)) { - const char *timestamp = xmlnode_get_attrib(child, "stamp"); + const char *timestamp = purple_xmlnode_get_attrib(child, "stamp"); jm->delayed = TRUE; if(timestamp) jm->sent = purple_str_to_time(timestamp, TRUE, NULL, NULL, NULL); } else if(!strcmp(xmlns, "jabber:x:conference") && jm->type != JABBER_MESSAGE_GROUPCHAT_INVITE && jm->type != JABBER_MESSAGE_ERROR) { - const char *jid = xmlnode_get_attrib(child, "jid"); + const char *jid = purple_xmlnode_get_attrib(child, "jid"); if(jid) { - const char *reason = xmlnode_get_attrib(child, "reason"); - const char *password = xmlnode_get_attrib(child, "password"); + const char *reason = purple_xmlnode_get_attrib(child, "reason"); + const char *password = purple_xmlnode_get_attrib(child, "password"); jm->type = JABBER_MESSAGE_GROUPCHAT_INVITE; g_free(jm->to); @@ -744,20 +744,20 @@ void jabber_message_parse(JabberStream *js, xmlnode *packet) } } else if(!strcmp(xmlns, "http://jabber.org/protocol/muc#user") && jm->type != JABBER_MESSAGE_ERROR) { - xmlnode *invite = xmlnode_get_child(child, "invite"); + PurpleXmlNode *invite = purple_xmlnode_get_child(child, "invite"); if(invite) { - xmlnode *reason, *password; - const char *jid = xmlnode_get_attrib(invite, "from"); + PurpleXmlNode *reason, *password; + const char *jid = purple_xmlnode_get_attrib(invite, "from"); g_free(jm->to); jm->to = jm->from; jm->from = g_strdup(jid); - if((reason = xmlnode_get_child(invite, "reason"))) { + if((reason = purple_xmlnode_get_child(invite, "reason"))) { g_free(jm->body); - jm->body = xmlnode_get_data(reason); + jm->body = purple_xmlnode_get_data(reason); } - if((password = xmlnode_get_child(child, "password"))) { + if((password = purple_xmlnode_get_child(child, "password"))) { g_free(jm->password); - jm->password = xmlnode_get_data(password); + jm->password = purple_xmlnode_get_data(password); } jm->type = JABBER_MESSAGE_GROUPCHAT_INVITE; @@ -766,7 +766,7 @@ void jabber_message_parse(JabberStream *js, xmlnode *packet) jm->etc = g_list_append(jm->etc, child); } } else if (g_str_equal(child->name, "query")) { - const char *node = xmlnode_get_attrib(child, "node"); + const char *node = purple_xmlnode_get_attrib(child, "node"); if (purple_strequal(xmlns, NS_DISCO_ITEMS) && purple_strequal(node, "http://jabber.org/protocol/commands")) { jabber_adhoc_got_list(js, jm->from, child); @@ -869,16 +869,16 @@ jabber_message_get_smileyfied_xhtml(const gchar *xhtml, const GList *smileys) /* we found the current smiley at this position */ const JabberData *data = jabber_data_find_local_by_alt(shortcut); - xmlnode *img = jabber_data_get_xhtml_im(data, shortcut); + PurpleXmlNode *img = jabber_data_get_xhtml_im(data, shortcut); int len; - gchar *img_text = xmlnode_to_str(img, &len); + gchar *img_text = purple_xmlnode_to_str(img, &len); found_smiley = TRUE; result = g_string_append(result, img_text); g_free(img_text); pos += strlen(escaped); g_free(escaped); - xmlnode_free(img); + purple_xmlnode_free(img); break; } else { /* cleanup from the before the next round... */ @@ -994,10 +994,10 @@ jabber_message_smileyfy_xhtml(JabberMessage *jm, const char *xhtml) void jabber_message_send(JabberMessage *jm) { - xmlnode *message, *child; + PurpleXmlNode *message, *child; const char *type = NULL; - message = xmlnode_new("message"); + message = purple_xmlnode_new("message"); switch(jm->type) { case JABBER_MESSAGE_NORMAL: @@ -1023,56 +1023,56 @@ void jabber_message_send(JabberMessage *jm) } if(type) - xmlnode_set_attrib(message, "type", type); + purple_xmlnode_set_attrib(message, "type", type); if (jm->id) - xmlnode_set_attrib(message, "id", jm->id); + purple_xmlnode_set_attrib(message, "id", jm->id); - xmlnode_set_attrib(message, "to", jm->to); + purple_xmlnode_set_attrib(message, "to", jm->to); if(jm->thread_id) { - child = xmlnode_new_child(message, "thread"); - xmlnode_insert_data(child, jm->thread_id, -1); + child = purple_xmlnode_new_child(message, "thread"); + purple_xmlnode_insert_data(child, jm->thread_id, -1); } child = NULL; switch(jm->chat_state) { case JM_STATE_ACTIVE: - child = xmlnode_new_child(message, "active"); + child = purple_xmlnode_new_child(message, "active"); break; case JM_STATE_COMPOSING: - child = xmlnode_new_child(message, "composing"); + child = purple_xmlnode_new_child(message, "composing"); break; case JM_STATE_PAUSED: - child = xmlnode_new_child(message, "paused"); + child = purple_xmlnode_new_child(message, "paused"); break; case JM_STATE_INACTIVE: - child = xmlnode_new_child(message, "inactive"); + child = purple_xmlnode_new_child(message, "inactive"); break; case JM_STATE_GONE: - child = xmlnode_new_child(message, "gone"); + child = purple_xmlnode_new_child(message, "gone"); break; case JM_STATE_NONE: /* yep, nothing */ break; } if(child) - xmlnode_set_namespace(child, "http://jabber.org/protocol/chatstates"); + purple_xmlnode_set_namespace(child, "http://jabber.org/protocol/chatstates"); if(jm->subject) { - child = xmlnode_new_child(message, "subject"); - xmlnode_insert_data(child, jm->subject, -1); + child = purple_xmlnode_new_child(message, "subject"); + purple_xmlnode_insert_data(child, jm->subject, -1); } if(jm->body) { - child = xmlnode_new_child(message, "body"); - xmlnode_insert_data(child, jm->body, -1); + child = purple_xmlnode_new_child(message, "body"); + purple_xmlnode_insert_data(child, jm->body, -1); } if(jm->xhtml) { - if ((child = xmlnode_from_str(jm->xhtml, -1))) { - xmlnode_insert_child(message, child); + if ((child = purple_xmlnode_from_str(jm->xhtml, -1))) { + purple_xmlnode_insert_child(message, child); } else { purple_debug_error("jabber", "XHTML translation/validation failed, returning: %s\n", @@ -1082,7 +1082,7 @@ void jabber_message_send(JabberMessage *jm) jabber_send(jm->js, message); - xmlnode_free(message); + purple_xmlnode_free(message); } /* diff --git a/libpurple/protocols/jabber/message.h b/libpurple/protocols/jabber/message.h index ee943f0117..d78fcc2528 100644 --- a/libpurple/protocols/jabber/message.h +++ b/libpurple/protocols/jabber/message.h @@ -68,7 +68,7 @@ void jabber_message_free(JabberMessage *jm); void jabber_message_send(JabberMessage *jm); -void jabber_message_parse(JabberStream *js, xmlnode *packet); +void jabber_message_parse(JabberStream *js, PurpleXmlNode *packet); int jabber_message_send_im(PurpleConnection *gc, const char *who, const char *msg, PurpleMessageFlags flags); int jabber_message_send_chat(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags); diff --git a/libpurple/protocols/jabber/oob.c b/libpurple/protocols/jabber/oob.c index 018fcfb1a7..f77797ce84 100644 --- a/libpurple/protocols/jabber/oob.c +++ b/libpurple/protocols/jabber/oob.c @@ -61,7 +61,7 @@ static void jabber_oob_xfer_end(PurpleXfer *xfer) JabberIq *iq; iq = jabber_iq_new(jox->js, JABBER_IQ_RESULT); - xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); + purple_xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); jabber_iq_set_id(iq, jox->iq_id); jabber_iq_send(iq); @@ -136,21 +136,21 @@ static void jabber_oob_xfer_start(PurpleXfer *xfer) static void jabber_oob_xfer_recv_error(PurpleXfer *xfer, const char *code) { JabberOOBXfer *jox = purple_xfer_get_protocol_data(xfer); JabberIq *iq; - xmlnode *y, *z; + PurpleXmlNode *y, *z; iq = jabber_iq_new(jox->js, JABBER_IQ_ERROR); - xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); + purple_xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); jabber_iq_set_id(iq, jox->iq_id); - y = xmlnode_new_child(iq->node, "error"); - xmlnode_set_attrib(y, "code", code); + y = purple_xmlnode_new_child(iq->node, "error"); + purple_xmlnode_set_attrib(y, "code", code); if(!strcmp(code, "406")) { - z = xmlnode_new_child(y, "not-acceptable"); - xmlnode_set_attrib(y, "type", "modify"); - xmlnode_set_namespace(z, NS_XMPP_STANZAS); + z = purple_xmlnode_new_child(y, "not-acceptable"); + purple_xmlnode_set_attrib(y, "type", "modify"); + purple_xmlnode_set_namespace(z, NS_XMPP_STANZAS); } else if(!strcmp(code, "404")) { - z = xmlnode_new_child(y, "not-found"); - xmlnode_set_attrib(y, "type", "cancel"); - xmlnode_set_namespace(z, NS_XMPP_STANZAS); + z = purple_xmlnode_new_child(y, "not-found"); + purple_xmlnode_set_attrib(y, "type", "cancel"); + purple_xmlnode_set_namespace(z, NS_XMPP_STANZAS); } jabber_iq_send(iq); @@ -169,12 +169,12 @@ static void jabber_oob_xfer_recv_cancelled(PurpleXfer *xfer) { } void jabber_oob_parse(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *querynode) { + const char *id, PurpleXmlNode *querynode) { JabberOOBXfer *jox; PurpleXfer *xfer; const gchar *filename, *slash; gchar *url; - xmlnode *urlnode; + PurpleXmlNode *urlnode; if(type != JABBER_IQ_SET) return; @@ -182,10 +182,10 @@ void jabber_oob_parse(JabberStream *js, const char *from, JabberIqType type, if(!from) return; - if(!(urlnode = xmlnode_get_child(querynode, "url"))) + if(!(urlnode = purple_xmlnode_get_child(querynode, "url"))) return; - url = xmlnode_get_data(urlnode); + url = purple_xmlnode_get_data(urlnode); if (!url) return; diff --git a/libpurple/protocols/jabber/oob.h b/libpurple/protocols/jabber/oob.h index 89724232da..7d25898891 100644 --- a/libpurple/protocols/jabber/oob.h +++ b/libpurple/protocols/jabber/oob.h @@ -27,6 +27,6 @@ #include "jabber.h" void jabber_oob_parse(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *querynode); + const char *id, PurpleXmlNode *querynode); #endif /* PURPLE_JABBER_OOB_H_ */ diff --git a/libpurple/protocols/jabber/parser.c b/libpurple/protocols/jabber/parser.c index 8141df13c6..21c0c70b69 100644 --- a/libpurple/protocols/jabber/parser.c +++ b/libpurple/protocols/jabber/parser.c @@ -38,7 +38,7 @@ jabber_parser_element_start_libxml(void *user_data, int nb_attributes, int nb_defaulted, const xmlChar **attributes) { JabberStream *js = user_data; - xmlnode *node; + PurpleXmlNode *node; int i, j; if(!element_name) { @@ -115,11 +115,11 @@ jabber_parser_element_start_libxml(void *user_data, } else { if(js->current) - node = xmlnode_new_child(js->current, (const char*) element_name); + node = purple_xmlnode_new_child(js->current, (const char*) element_name); else - node = xmlnode_new((const char*) element_name); - xmlnode_set_namespace(node, (const char*) namespace); - xmlnode_set_prefix(node, (const char *)prefix); + node = purple_xmlnode_new((const char*) element_name); + purple_xmlnode_set_namespace(node, (const char*) namespace); + purple_xmlnode_set_prefix(node, (const char *)prefix); if (nb_namespaces != 0) { node->namespace_map = g_hash_table_new_full( @@ -143,7 +143,7 @@ jabber_parser_element_start_libxml(void *user_data, txt = attrib; attrib = purple_unescape_text(txt); g_free(txt); - xmlnode_set_attrib_full(node, name, attrib_ns, prefix, attrib); + purple_xmlnode_set_attrib_full(node, name, attrib_ns, prefix, attrib); g_free(attrib); } @@ -164,11 +164,11 @@ jabber_parser_element_end_libxml(void *user_data, const xmlChar *element_name, if(!xmlStrcmp((xmlChar*) js->current->name, element_name)) js->current = js->current->parent; } else { - xmlnode *packet = js->current; + PurpleXmlNode *packet = js->current; js->current = NULL; jabber_process_packet(js, &packet); if (packet != NULL) - xmlnode_free(packet); + purple_xmlnode_free(packet); } } @@ -183,7 +183,7 @@ jabber_parser_element_text_libxml(void *user_data, const xmlChar *text, int text if(!text || !text_len) return; - xmlnode_insert_data(js->current, (const char*) text, text_len); + purple_xmlnode_insert_data(js->current, (const char*) text, text_len); } static void diff --git a/libpurple/protocols/jabber/pep.c b/libpurple/protocols/jabber/pep.c index 0063f9e611..b974aa68d1 100644 --- a/libpurple/protocols/jabber/pep.c +++ b/libpurple/protocols/jabber/pep.c @@ -69,16 +69,16 @@ void jabber_pep_register_handler(const char *xmlns, JabberPEPHandler handlerfunc static void do_pep_iq_request_item_callback(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { - xmlnode *pubsub; - xmlnode *items = NULL; + PurpleXmlNode *pubsub; + PurpleXmlNode *items = NULL; JabberPEPHandler *cb = data; if (type == JABBER_IQ_RESULT) { - pubsub = xmlnode_get_child_with_namespace(packet, "pubsub", "http://jabber.org/protocol/pubsub"); + pubsub = purple_xmlnode_get_child_with_namespace(packet, "pubsub", "http://jabber.org/protocol/pubsub"); if(pubsub) - items = xmlnode_get_child(pubsub, "items"); + items = purple_xmlnode_get_child(pubsub, "items"); } cb(js, from, items); @@ -86,23 +86,23 @@ do_pep_iq_request_item_callback(JabberStream *js, const char *from, void jabber_pep_request_item(JabberStream *js, const char *to, const char *node, const char *id, JabberPEPHandler cb) { JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET); - xmlnode *pubsub, *items; + PurpleXmlNode *pubsub, *items; if (to) - xmlnode_set_attrib(iq->node, "to", to); + purple_xmlnode_set_attrib(iq->node, "to", to); - pubsub = xmlnode_new_child(iq->node,"pubsub"); - xmlnode_set_namespace(pubsub, "http://jabber.org/protocol/pubsub"); + pubsub = purple_xmlnode_new_child(iq->node,"pubsub"); + purple_xmlnode_set_namespace(pubsub, "http://jabber.org/protocol/pubsub"); - items = xmlnode_new_child(pubsub, "items"); - xmlnode_set_attrib(items,"node",node); + items = purple_xmlnode_new_child(pubsub, "items"); + purple_xmlnode_set_attrib(items,"node",node); if (id) { - xmlnode *item = xmlnode_new_child(items, "item"); - xmlnode_set_attrib(item, "id", id); + PurpleXmlNode *item = purple_xmlnode_new_child(items, "item"); + purple_xmlnode_set_attrib(item, "id", id); } else /* Most recent item */ - xmlnode_set_attrib(items, "max_items", "1"); + purple_xmlnode_set_attrib(items, "max_items", "1"); jabber_iq_set_callback(iq,do_pep_iq_request_item_callback,(gpointer)cb); @@ -125,8 +125,8 @@ void jabber_handle_event(JabberMessage *jm) { jid = jabber_get_bare_jid(jm->from); for(itemslist = jm->eventitems; itemslist; itemslist = itemslist->next) { - xmlnode *items = (xmlnode*)itemslist->data; - const char *nodename = xmlnode_get_attrib(items,"node"); + PurpleXmlNode *items = (PurpleXmlNode*)itemslist->data; + const char *nodename = purple_xmlnode_get_attrib(items,"node"); if(nodename && (jph = g_hash_table_lookup(pep_handlers, nodename))) jph(jm->js, jid, items); @@ -139,40 +139,40 @@ void jabber_handle_event(JabberMessage *jm) { void jabber_pep_delete_node(JabberStream *js, const gchar *node) { JabberIq *iq; - xmlnode *pubsub, *del; + PurpleXmlNode *pubsub, *del; g_return_if_fail(node != NULL); g_return_if_fail(js->pep); iq = jabber_iq_new(js, JABBER_IQ_SET); - pubsub = xmlnode_new_child(iq->node, "pubsub"); - xmlnode_set_namespace(pubsub, "http://jabber.org/protocol/pubsub#owner"); + pubsub = purple_xmlnode_new_child(iq->node, "pubsub"); + purple_xmlnode_set_namespace(pubsub, "http://jabber.org/protocol/pubsub#owner"); - del = xmlnode_new_child(pubsub, "delete"); - xmlnode_set_attrib(del, "node", node); + del = purple_xmlnode_new_child(pubsub, "delete"); + purple_xmlnode_set_attrib(del, "node", node); jabber_iq_send(iq); } -void jabber_pep_publish(JabberStream *js, xmlnode *publish) { +void jabber_pep_publish(JabberStream *js, PurpleXmlNode *publish) { JabberIq *iq; - xmlnode *pubsub; + PurpleXmlNode *pubsub; if(js->pep != TRUE) { /* ignore when there's no PEP support on the server */ - xmlnode_free(publish); + purple_xmlnode_free(publish); return; } iq = jabber_iq_new(js, JABBER_IQ_SET); - pubsub = xmlnode_new("pubsub"); - xmlnode_set_namespace(pubsub, "http://jabber.org/protocol/pubsub"); + pubsub = purple_xmlnode_new("pubsub"); + purple_xmlnode_set_namespace(pubsub, "http://jabber.org/protocol/pubsub"); - xmlnode_insert_child(pubsub, publish); + purple_xmlnode_insert_child(pubsub, publish); - xmlnode_insert_child(iq->node, pubsub); + purple_xmlnode_insert_child(iq->node, pubsub); jabber_iq_send(iq); } diff --git a/libpurple/protocols/jabber/pep.h b/libpurple/protocols/jabber/pep.h index 30b5529ece..0a2ada7345 100644 --- a/libpurple/protocols/jabber/pep.h +++ b/libpurple/protocols/jabber/pep.h @@ -39,7 +39,7 @@ void jabber_pep_init_actions(GList **m); * @parameter js The JabberStream this item was received on * @parameter items The <items/>-tag with the <item/>-children */ -typedef void (JabberPEPHandler)(JabberStream *js, const char *from, xmlnode *items); +typedef void (JabberPEPHandler)(JabberStream *js, const char *from, PurpleXmlNode *items); /* * Registers a callback for PEP events. Also automatically announces this receiving capability via disco#info. @@ -86,6 +86,6 @@ void jabber_pep_delete_node(JabberStream *js, const gchar *node); * @parameter js The JabberStream associated with the connection this event should be published * @parameter publish The publish node. This could be for example <publish node='http://jabber.org/protocol/tune'/> with an <item/> as subnode */ -void jabber_pep_publish(JabberStream *js, xmlnode *publish); +void jabber_pep_publish(JabberStream *js, PurpleXmlNode *publish); #endif /* PURPLE_JABBER_PEP_H_ */ diff --git a/libpurple/protocols/jabber/ping.c b/libpurple/protocols/jabber/ping.c index e271a39f15..8f1251cf45 100644 --- a/libpurple/protocols/jabber/ping.c +++ b/libpurple/protocols/jabber/ping.c @@ -32,7 +32,7 @@ static void jabber_keepalive_pong_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { if (js->keepalive_timeout != 0) { purple_timeout_remove(js->keepalive_timeout); @@ -42,14 +42,14 @@ static void jabber_keepalive_pong_cb(JabberStream *js, const char *from, void jabber_ping_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *ping) + JabberIqType type, const char *id, PurpleXmlNode *ping) { if (type == JABBER_IQ_GET) { JabberIq *iq = jabber_iq_new(js, JABBER_IQ_RESULT); if (from) - xmlnode_set_attrib(iq->node, "to", from); - xmlnode_set_attrib(iq->node, "id", id); + purple_xmlnode_set_attrib(iq->node, "to", from); + purple_xmlnode_set_attrib(iq->node, "id", id); jabber_iq_send(iq); } else if (type == JABBER_IQ_SET) { @@ -59,7 +59,7 @@ jabber_ping_parse(JabberStream *js, const char *from, static void jabber_ping_result_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { if (type == JABBER_IQ_RESULT) purple_debug_info("jabber", "PONG!\n"); @@ -70,11 +70,11 @@ static void jabber_ping_result_cb(JabberStream *js, const char *from, void jabber_keepalive_ping(JabberStream *js) { JabberIq *iq; - xmlnode *ping; + PurpleXmlNode *ping; iq = jabber_iq_new(js, JABBER_IQ_GET); - ping = xmlnode_new_child(iq->node, "ping"); - xmlnode_set_namespace(ping, NS_PING); + ping = purple_xmlnode_new_child(iq->node, "ping"); + purple_xmlnode_set_namespace(ping, NS_PING); jabber_iq_set_callback(iq, jabber_keepalive_pong_cb, NULL); jabber_iq_send(iq); @@ -83,14 +83,14 @@ void jabber_keepalive_ping(JabberStream *js) gboolean jabber_ping_jid(JabberStream *js, const char *jid) { JabberIq *iq; - xmlnode *ping; + PurpleXmlNode *ping; iq = jabber_iq_new(js, JABBER_IQ_GET); if (jid) - xmlnode_set_attrib(iq->node, "to", jid); + purple_xmlnode_set_attrib(iq->node, "to", jid); - ping = xmlnode_new_child(iq->node, "ping"); - xmlnode_set_namespace(ping, NS_PING); + ping = purple_xmlnode_new_child(iq->node, "ping"); + purple_xmlnode_set_namespace(ping, NS_PING); jabber_iq_set_callback(iq, jabber_ping_result_cb, NULL); jabber_iq_send(iq); diff --git a/libpurple/protocols/jabber/ping.h b/libpurple/protocols/jabber/ping.h index 5420ea531c..a7175cf632 100644 --- a/libpurple/protocols/jabber/ping.h +++ b/libpurple/protocols/jabber/ping.h @@ -29,7 +29,7 @@ #include "xmlnode.h" void jabber_ping_parse(JabberStream *js, const char *from, - JabberIqType, const char *id, xmlnode *child); + JabberIqType, const char *id, PurpleXmlNode *child); gboolean jabber_ping_jid(JabberStream *js, const char *jid); void jabber_keepalive_ping(JabberStream *js); diff --git a/libpurple/protocols/jabber/presence.c b/libpurple/protocols/jabber/presence.c index 5cc6633176..13f8b65bd0 100644 --- a/libpurple/protocols/jabber/presence.c +++ b/libpurple/protocols/jabber/presence.c @@ -80,7 +80,7 @@ static void chats_send_presence_foreach(gpointer key, gpointer val, gpointer user_data) { JabberChat *chat = val; - xmlnode *presence = user_data; + PurpleXmlNode *presence = user_data; char *chat_full_jid; if(!chat->conv || chat->left) @@ -89,7 +89,7 @@ static void chats_send_presence_foreach(gpointer key, gpointer val, chat_full_jid = g_strdup_printf("%s@%s/%s", chat->room, chat->server, chat->handle); - xmlnode_set_attrib(presence, "to", chat_full_jid); + purple_xmlnode_set_attrib(presence, "to", chat_full_jid); jabber_send(chat->js, presence); g_free(chat_full_jid); } @@ -181,7 +181,7 @@ void jabber_set_status(PurpleAccount *account, PurpleStatus *status) void jabber_presence_send(JabberStream *js, gboolean force) { PurpleAccount *account; - xmlnode *presence, *x, *photo; + PurpleXmlNode *presence, *x, *photo; char *stripped = NULL; JabberBuddyState state; int priority; @@ -224,8 +224,8 @@ void jabber_presence_send(JabberStream *js, gboolean force) presence = jabber_presence_create_js(js, state, stripped, priority); /* Per XEP-0153 4.1, we must always send the <x> */ - x = xmlnode_new_child(presence, "x"); - xmlnode_set_namespace(x, "vcard-temp:x:update"); + x = purple_xmlnode_new_child(presence, "x"); + purple_xmlnode_set_namespace(x, "vcard-temp:x:update"); /* * FIXME: Per XEP-0153 4.3.2 bullet 2, we must not publish our * image hash if another resource has logged in and updated the @@ -233,15 +233,15 @@ void jabber_presence_send(JabberStream *js, gboolean force) */ if (js->vcard_fetched) { /* Always publish a <photo>; it's empty if we have no image. */ - photo = xmlnode_new_child(x, "photo"); + photo = purple_xmlnode_new_child(x, "photo"); if (js->avatar_hash) - xmlnode_insert_data(photo, js->avatar_hash, -1); + purple_xmlnode_insert_data(photo, js->avatar_hash, -1); } jabber_send(js, presence); g_hash_table_foreach(js->chats, chats_send_presence_foreach, presence); - xmlnode_free(presence); + purple_xmlnode_free(presence); /* update old values */ @@ -299,59 +299,59 @@ void jabber_presence_send(JabberStream *js, gboolean force) jabber_presence_fake_to_self(js, status); } -xmlnode *jabber_presence_create_js(JabberStream *js, JabberBuddyState state, const char *msg, int priority) +PurpleXmlNode *jabber_presence_create_js(JabberStream *js, JabberBuddyState state, const char *msg, int priority) { - xmlnode *show, *status, *presence, *pri, *c; + PurpleXmlNode *show, *status, *presence, *pri, *c; const char *show_string = NULL; #ifdef USE_VV gboolean audio_enabled, video_enabled; #endif - presence = xmlnode_new("presence"); + presence = purple_xmlnode_new("presence"); if(state == JABBER_BUDDY_STATE_UNAVAILABLE) - xmlnode_set_attrib(presence, "type", "unavailable"); + purple_xmlnode_set_attrib(presence, "type", "unavailable"); else if(state != JABBER_BUDDY_STATE_ONLINE && state != JABBER_BUDDY_STATE_UNKNOWN && state != JABBER_BUDDY_STATE_ERROR) show_string = jabber_buddy_state_get_show(state); if(show_string) { - show = xmlnode_new_child(presence, "show"); - xmlnode_insert_data(show, show_string, -1); + show = purple_xmlnode_new_child(presence, "show"); + purple_xmlnode_insert_data(show, show_string, -1); } if(msg) { - status = xmlnode_new_child(presence, "status"); - xmlnode_insert_data(status, msg, -1); + status = purple_xmlnode_new_child(presence, "status"); + purple_xmlnode_insert_data(status, msg, -1); } if(priority) { char *pstr = g_strdup_printf("%d", priority); - pri = xmlnode_new_child(presence, "priority"); - xmlnode_insert_data(pri, pstr, -1); + pri = purple_xmlnode_new_child(presence, "priority"); + purple_xmlnode_insert_data(pri, pstr, -1); g_free(pstr); } /* if we are idle and not offline, include idle */ if (js->idle && state != JABBER_BUDDY_STATE_UNAVAILABLE) { - xmlnode *query = xmlnode_new_child(presence, "query"); + PurpleXmlNode *query = purple_xmlnode_new_child(presence, "query"); gchar seconds[10]; g_snprintf(seconds, 10, "%d", (int) (time(NULL) - js->idle)); - xmlnode_set_namespace(query, NS_LAST_ACTIVITY); - xmlnode_set_attrib(query, "seconds", seconds); + purple_xmlnode_set_namespace(query, NS_LAST_ACTIVITY); + purple_xmlnode_set_attrib(query, "seconds", seconds); } /* JEP-0115 */ /* calculate hash */ jabber_caps_calculate_own_hash(js); /* create xml */ - c = xmlnode_new_child(presence, "c"); - xmlnode_set_namespace(c, "http://jabber.org/protocol/caps"); - xmlnode_set_attrib(c, "node", CAPS0115_NODE); - xmlnode_set_attrib(c, "hash", "sha-1"); - xmlnode_set_attrib(c, "ver", jabber_caps_get_own_hash(js)); + c = purple_xmlnode_new_child(presence, "c"); + purple_xmlnode_set_namespace(c, "http://jabber.org/protocol/caps"); + purple_xmlnode_set_attrib(c, "node", CAPS0115_NODE); + purple_xmlnode_set_attrib(c, "hash", "sha-1"); + purple_xmlnode_set_attrib(c, "ver", jabber_caps_get_own_hash(js)); #ifdef USE_VV /* @@ -368,11 +368,11 @@ xmlnode *jabber_presence_create_js(JabberStream *js, JabberBuddyState state, con video_enabled = jabber_video_enabled(js, NULL /* unused */); if (audio_enabled && video_enabled) - xmlnode_set_attrib(c, "ext", "voice-v1 camera-v1 video-v1"); + purple_xmlnode_set_attrib(c, "ext", "voice-v1 camera-v1 video-v1"); else if (audio_enabled) - xmlnode_set_attrib(c, "ext", "voice-v1"); + purple_xmlnode_set_attrib(c, "ext", "voice-v1"); else if (video_enabled) - xmlnode_set_attrib(c, "ext", "camera-v1 video-v1"); + purple_xmlnode_set_attrib(c, "ext", "camera-v1 video-v1"); #endif return presence; @@ -407,10 +407,10 @@ static void deny_add_cb(const char *message, gpointer data) static void jabber_vcard_parse_avatar(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer blah) + PurpleXmlNode *packet, gpointer blah) { JabberBuddy *jb = NULL; - xmlnode *vcard, *photo, *binval, *fn, *nick; + PurpleXmlNode *vcard, *photo, *binval, *fn, *nick; char *text; if(!from) @@ -420,16 +420,16 @@ jabber_vcard_parse_avatar(JabberStream *js, const char *from, js->pending_avatar_requests = g_slist_remove(js->pending_avatar_requests, jb); - if((vcard = xmlnode_get_child(packet, "vCard")) || - (vcard = xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) { + if((vcard = purple_xmlnode_get_child(packet, "vCard")) || + (vcard = purple_xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) { /* The logic here regarding the nickname and full name is copied from * buddy.c:jabber_vcard_parse. */ gchar *nickname = NULL; - if ((fn = xmlnode_get_child(vcard, "FN"))) - nickname = xmlnode_get_data(fn); + if ((fn = purple_xmlnode_get_child(vcard, "FN"))) + nickname = purple_xmlnode_get_data(fn); - if ((nick = xmlnode_get_child(vcard, "NICKNAME"))) { - char *tmp = xmlnode_get_data(nick); + if ((nick = purple_xmlnode_get_child(vcard, "NICKNAME"))) { + char *tmp = purple_xmlnode_get_data(nick); char *bare_jid = jabber_get_bare_jid(from); if (tmp && strstr(bare_jid, tmp) == NULL) { g_free(nickname); @@ -445,13 +445,13 @@ jabber_vcard_parse_avatar(JabberStream *js, const char *from, g_free(nickname); } - if ((photo = xmlnode_get_child(vcard, "PHOTO"))) { + if ((photo = purple_xmlnode_get_child(vcard, "PHOTO"))) { guchar *data = NULL; gchar *hash = NULL; gsize size = 0; - if ((binval = xmlnode_get_child(photo, "BINVAL")) && - (text = xmlnode_get_data(binval))) { + if ((binval = purple_xmlnode_get_child(photo, "BINVAL")) && + (text = purple_xmlnode_get_data(binval))) { data = purple_base64_decode(text, &size); g_free(text); @@ -510,9 +510,9 @@ jabber_presence_set_capabilities(JabberCapsClientInfo *info, GList *exts, if (!jbr->commands_fetched && jabber_resource_has_capability(jbr, "http://jabber.org/protocol/commands")) { JabberIq *iq = jabber_iq_new_query(userdata->js, JABBER_IQ_GET, NS_DISCO_ITEMS); - xmlnode *query = xmlnode_get_child_with_namespace(iq->node, "query", NS_DISCO_ITEMS); - xmlnode_set_attrib(iq->node, "to", userdata->from); - xmlnode_set_attrib(query, "node", "http://jabber.org/protocol/commands"); + PurpleXmlNode *query = purple_xmlnode_get_child_with_namespace(iq->node, "query", NS_DISCO_ITEMS); + purple_xmlnode_set_attrib(iq->node, "to", userdata->from); + purple_xmlnode_set_attrib(query, "node", "http://jabber.org/protocol/commands"); jabber_iq_set_callback(iq, jabber_adhoc_disco_result_cb, NULL); jabber_iq_send(iq); @@ -537,7 +537,7 @@ out: } static gboolean -handle_presence_chat(JabberStream *js, JabberPresence *presence, xmlnode *packet) +handle_presence_chat(JabberStream *js, JabberPresence *presence, PurpleXmlNode *packet) { static int i = 1; PurpleChatUserFlags flags = PURPLE_CHAT_USER_NONE; @@ -580,9 +580,9 @@ handle_presence_chat(JabberStream *js, JabberPresence *presence, xmlnode *packet return FALSE; if (presence->chat_info.item) { - jid = xmlnode_get_attrib(presence->chat_info.item, "jid"); - affiliation = xmlnode_get_attrib(presence->chat_info.item, "affiliation"); - role = xmlnode_get_attrib(presence->chat_info.item, "role"); + jid = purple_xmlnode_get_attrib(presence->chat_info.item, "jid"); + affiliation = purple_xmlnode_get_attrib(presence->chat_info.item, "affiliation"); + role = purple_xmlnode_get_attrib(presence->chat_info.item, "role"); } if (g_slist_find(presence->chat_info.codes, GINT_TO_POINTER(110)) || @@ -669,7 +669,7 @@ handle_presence_chat(JabberStream *js, JabberPresence *presence, xmlnode *packet jabber_buddy_remove_resource(presence->jb, presence->jid_from->resource); if (presence->chat_info.item) - jid = xmlnode_get_attrib(presence->chat_info.item, "jid"); + jid = purple_xmlnode_get_attrib(presence->chat_info.item, "jid"); if (chat->muc) { if (g_slist_find(presence->chat_info.codes, GINT_TO_POINTER(110))) { @@ -685,7 +685,7 @@ handle_presence_chat(JabberStream *js, JabberPresence *presence, xmlnode *packet if (g_slist_find(presence->chat_info.codes, GINT_TO_POINTER(303))) { const char *nick = NULL; if (presence->chat_info.item) - nick = xmlnode_get_attrib(presence->chat_info.item, "nick"); + nick = purple_xmlnode_get_attrib(presence->chat_info.item, "nick"); /* nick change */ if (!nick) { @@ -717,14 +717,14 @@ handle_presence_chat(JabberStream *js, JabberPresence *presence, xmlnode *packet kick = TRUE; if (presence->chat_info.item) { - xmlnode *node; + PurpleXmlNode *node; - node = xmlnode_get_child(presence->chat_info.item, "actor"); + node = purple_xmlnode_get_child(presence->chat_info.item, "actor"); if (node) - actor = xmlnode_get_attrib(node, "jid"); - node = xmlnode_get_child(presence->chat_info.item, "reason"); + actor = purple_xmlnode_get_attrib(node, "jid"); + node = purple_xmlnode_get_child(presence->chat_info.item, "reason"); if (node) - reason = xmlnode_get_data(node); + reason = purple_xmlnode_get_data(node); } if (reason == NULL) @@ -848,15 +848,15 @@ handle_presence_contact(JabberStream *js, JabberPresence *presence) * but i'm too tired to write that right now */ if(!g_slist_find(js->pending_avatar_requests, presence->jb)) { JabberIq *iq; - xmlnode *vcard; + PurpleXmlNode *vcard; js->pending_avatar_requests = g_slist_prepend(js->pending_avatar_requests, presence->jb); iq = jabber_iq_new(js, JABBER_IQ_GET); - xmlnode_set_attrib(iq->node, "to", buddy_name); - vcard = xmlnode_new_child(iq->node, "vCard"); - xmlnode_set_namespace(vcard, "vcard-temp"); + purple_xmlnode_set_attrib(iq->node, "to", buddy_name); + vcard = purple_xmlnode_new_child(iq->node, "vCard"); + purple_xmlnode_set_namespace(vcard, "vcard-temp"); jabber_iq_set_callback(iq, jabber_vcard_parse_avatar, NULL); jabber_iq_send(iq); @@ -898,22 +898,22 @@ handle_presence_contact(JabberStream *js, JabberPresence *presence) return TRUE; } -void jabber_presence_parse(JabberStream *js, xmlnode *packet) +void jabber_presence_parse(JabberStream *js, PurpleXmlNode *packet) { const char *type; JabberBuddyResource *jbr = NULL; gboolean signal_return, ret; JabberPresence presence; - xmlnode *child; + PurpleXmlNode *child; memset(&presence, 0, sizeof(presence)); /* defaults */ presence.state = JABBER_BUDDY_STATE_UNKNOWN; presence.sent = time(NULL); /* interesting values */ - presence.from = xmlnode_get_attrib(packet, "from"); - presence.to = xmlnode_get_attrib(packet, "to"); - type = xmlnode_get_attrib(packet, "type"); + presence.from = purple_xmlnode_get_attrib(packet, "from"); + presence.to = purple_xmlnode_get_attrib(packet, "to"); + type = purple_xmlnode_get_attrib(packet, "type"); presence.type = str_to_presence_type(type); presence.jb = jabber_buddy_find(js, presence.from, TRUE); @@ -954,13 +954,13 @@ void jabber_presence_parse(JabberStream *js, xmlnode *packet) gboolean onlist = FALSE; PurpleAccount *account; PurpleBuddy *buddy; - xmlnode *nick; + PurpleXmlNode *nick; account = purple_connection_get_account(js->gc); buddy = purple_blist_find_buddy(account, presence.from); - nick = xmlnode_get_child_with_namespace(packet, "nick", "http://jabber.org/protocol/nick"); + nick = purple_xmlnode_get_child_with_namespace(packet, "nick", "http://jabber.org/protocol/nick"); if (nick) - presence.nickname = xmlnode_get_data(nick); + presence.nickname = purple_xmlnode_get_data(nick); if (buddy) { if ((presence.jb->subscription & (JABBER_SUB_TO | JABBER_SUB_PENDING))) @@ -1005,10 +1005,10 @@ void jabber_presence_parse(JabberStream *js, xmlnode *packet) const char *xmlns; char *key; JabberPresenceHandler *pih; - if (child->type != XMLNODE_TYPE_TAG) + if (child->type != PURPLE_XMLNODE_TYPE_TAG) continue; - xmlns = xmlnode_get_namespace(child); + xmlns = purple_xmlnode_get_namespace(child); key = g_strdup_printf("%s %s", child->name, xmlns ? xmlns : ""); pih = g_hash_table_lookup(presence_handlers, key); g_free(key); @@ -1032,10 +1032,10 @@ void jabber_presence_parse(JabberStream *js, xmlnode *packet) if (presence.caps && presence.type == JABBER_PRESENCE_AVAILABLE) { /* handle Entity Capabilities (XEP-0115) */ - const char *node = xmlnode_get_attrib(presence.caps, "node"); - const char *ver = xmlnode_get_attrib(presence.caps, "ver"); - const char *hash = xmlnode_get_attrib(presence.caps, "hash"); - const char *ext = xmlnode_get_attrib(presence.caps, "ext"); + const char *node = purple_xmlnode_get_attrib(presence.caps, "node"); + const char *ver = purple_xmlnode_get_attrib(presence.caps, "ver"); + const char *hash = purple_xmlnode_get_attrib(presence.caps, "hash"); + const char *ext = purple_xmlnode_get_attrib(presence.caps, "ext"); /* v1.3 uses: node, ver, and optionally ext. * v1.5 uses: node, ver, and hash. */ @@ -1077,13 +1077,13 @@ out: void jabber_presence_subscription_set(JabberStream *js, const char *who, const char *type) { - xmlnode *presence = xmlnode_new("presence"); + PurpleXmlNode *presence = purple_xmlnode_new("presence"); - xmlnode_set_attrib(presence, "to", who); - xmlnode_set_attrib(presence, "type", type); + purple_xmlnode_set_attrib(presence, "to", who); + purple_xmlnode_set_attrib(presence, "type", type); jabber_send(js, presence); - xmlnode_free(presence); + purple_xmlnode_free(presence); } void purple_status_to_jabber(const PurpleStatus *status, JabberBuddyState *state, char **msg, int *priority) @@ -1118,9 +1118,9 @@ void purple_status_to_jabber(const PurpleStatus *status, JabberBuddyState *state /* Incoming presence handlers */ static void -parse_priority(JabberStream *js, JabberPresence *presence, xmlnode *priority) +parse_priority(JabberStream *js, JabberPresence *presence, PurpleXmlNode *priority) { - char *p = xmlnode_get_data(priority); + char *p = purple_xmlnode_get_data(priority); if (presence->priority != 0) purple_debug_warning("jabber", "presence stanza received with multiple " @@ -1134,7 +1134,7 @@ parse_priority(JabberStream *js, JabberPresence *presence, xmlnode *priority) } static void -parse_show(JabberStream *js, JabberPresence *presence, xmlnode *show) +parse_show(JabberStream *js, JabberPresence *presence, PurpleXmlNode *show) { char *cdata; @@ -1144,7 +1144,7 @@ parse_show(JabberStream *js, JabberPresence *presence, xmlnode *show) return; } - cdata = xmlnode_get_data(show); + cdata = purple_xmlnode_get_data(show); if (cdata) { presence->state = jabber_buddy_show_get_state(cdata); g_free(cdata); @@ -1154,28 +1154,28 @@ parse_show(JabberStream *js, JabberPresence *presence, xmlnode *show) } static void -parse_status(JabberStream *js, JabberPresence *presence, xmlnode *status) +parse_status(JabberStream *js, JabberPresence *presence, PurpleXmlNode *status) { /* TODO: Check/track language attribute? */ g_free(presence->status); - presence->status = xmlnode_get_data(status); + presence->status = purple_xmlnode_get_data(status); } static void -parse_delay(JabberStream *js, JabberPresence *presence, xmlnode *delay) +parse_delay(JabberStream *js, JabberPresence *presence, PurpleXmlNode *delay) { - const char *stamp = xmlnode_get_attrib(delay, "stamp"); + const char *stamp = purple_xmlnode_get_attrib(delay, "stamp"); presence->delayed = TRUE; presence->sent = purple_str_to_time(stamp, TRUE, NULL, NULL, NULL); } static void -parse_apple_idle(JabberStream *js, JabberPresence *presence, xmlnode *x) +parse_apple_idle(JabberStream *js, JabberPresence *presence, PurpleXmlNode *x) { - xmlnode *since = xmlnode_get_child(x, "idle-since"); + PurpleXmlNode *since = purple_xmlnode_get_child(x, "idle-since"); if (since) { - char *stamp = xmlnode_get_data_unescaped(since); + char *stamp = purple_xmlnode_get_data_unescaped(since); if (stamp) { time_t tstamp = purple_str_to_time(stamp, TRUE, NULL, NULL, NULL); if (tstamp != 0) { @@ -1192,9 +1192,9 @@ parse_apple_idle(JabberStream *js, JabberPresence *presence, xmlnode *x) } static void -parse_idle(JabberStream *js, JabberPresence *presence, xmlnode *query) +parse_idle(JabberStream *js, JabberPresence *presence, PurpleXmlNode *query) { - const gchar *seconds = xmlnode_get_attrib(query, "seconds"); + const gchar *seconds = purple_xmlnode_get_attrib(query, "seconds"); if (seconds) { presence->idle = atoi(seconds); presence->adjust_idle_for_delay = TRUE; @@ -1206,7 +1206,7 @@ parse_idle(JabberStream *js, JabberPresence *presence, xmlnode *query) } static void -parse_caps(JabberStream *js, JabberPresence *presence, xmlnode *c) +parse_caps(JabberStream *js, JabberPresence *presence, PurpleXmlNode *c) { /* TODO: Move the rest of the caps handling in here, after changing the * the "do we have details about this (node, ver) and exts" to not @@ -1216,19 +1216,19 @@ parse_caps(JabberStream *js, JabberPresence *presence, xmlnode *c) } static void -parse_nickname(JabberStream *js, JabberPresence *presence, xmlnode *nick) +parse_nickname(JabberStream *js, JabberPresence *presence, PurpleXmlNode *nick) { g_free(presence->nickname); - presence->nickname = xmlnode_get_data(nick); + presence->nickname = purple_xmlnode_get_data(nick); } static void -parse_vcard_avatar(JabberStream *js, JabberPresence *presence, xmlnode *x) +parse_vcard_avatar(JabberStream *js, JabberPresence *presence, PurpleXmlNode *x) { - xmlnode *photo = xmlnode_get_child(x, "photo"); + PurpleXmlNode *photo = purple_xmlnode_get_child(x, "photo"); if (photo) { - char *hash_tmp = xmlnode_get_data(photo); + char *hash_tmp = purple_xmlnode_get_data(photo); g_free(presence->vcard_avatar_hash); presence->vcard_avatar_hash = hash_tmp ? hash_tmp : g_strdup(""); @@ -1236,9 +1236,9 @@ parse_vcard_avatar(JabberStream *js, JabberPresence *presence, xmlnode *x) } static void -parse_muc_user(JabberStream *js, JabberPresence *presence, xmlnode *x) +parse_muc_user(JabberStream *js, JabberPresence *presence, PurpleXmlNode *x) { - xmlnode *status; + PurpleXmlNode *status; if (presence->chat == NULL) { purple_debug_warning("jabber", "Ignoring MUC gloop on non-MUC presence\n"); @@ -1248,9 +1248,9 @@ parse_muc_user(JabberStream *js, JabberPresence *presence, xmlnode *x) if (presence->chat->conv == NULL) presence->chat->muc = TRUE; - for (status = xmlnode_get_child(x, "status"); status; - status = xmlnode_get_next_twin(status)) { - const char *code = xmlnode_get_attrib(status, "code"); + for (status = purple_xmlnode_get_child(x, "status"); status; + status = purple_xmlnode_get_next_twin(status)) { + const char *code = purple_xmlnode_get_attrib(status, "code"); int val; if (!code) continue; @@ -1265,7 +1265,7 @@ parse_muc_user(JabberStream *js, JabberPresence *presence, xmlnode *x) presence->chat_info.codes = g_slist_prepend(presence->chat_info.codes, GINT_TO_POINTER(val)); } - presence->chat_info.item = xmlnode_get_child(x, "item"); + presence->chat_info.item = purple_xmlnode_get_child(x, "item"); } void jabber_presence_register_handler(const char *node, const char *xmlns, diff --git a/libpurple/protocols/jabber/presence.h b/libpurple/protocols/jabber/presence.h index a95b64f429..9318fff0ca 100644 --- a/libpurple/protocols/jabber/presence.h +++ b/libpurple/protocols/jabber/presence.h @@ -46,7 +46,7 @@ typedef struct _JabberPresence JabberPresence; struct _JabberPresenceChatInfo { GSList *codes; - xmlnode *item; + PurpleXmlNode *item; }; struct _JabberPresence { @@ -59,7 +59,7 @@ struct _JabberPresence { JabberBuddy *jb; JabberChat *chat; JabberPresenceChatInfo chat_info; - xmlnode *caps; /* TODO: Temporary, see presence.c:parse_caps */ + PurpleXmlNode *caps; /* TODO: Temporary, see presence.c:parse_caps */ JabberBuddyState state; gchar *status; @@ -75,7 +75,7 @@ struct _JabberPresence { }; typedef void (JabberPresenceHandler)(JabberStream *js, JabberPresence *presence, - xmlnode *child); + PurpleXmlNode *child); void jabber_presence_register_handler(const char *node, const char *xmlns, JabberPresenceHandler *handler); @@ -93,8 +93,8 @@ void jabber_set_status(PurpleAccount *account, PurpleStatus *status); */ void jabber_presence_send(JabberStream *js, gboolean force); -xmlnode *jabber_presence_create_js(JabberStream *js, JabberBuddyState state, const char *msg, int priority); -void jabber_presence_parse(JabberStream *js, xmlnode *packet); +PurpleXmlNode *jabber_presence_create_js(JabberStream *js, JabberBuddyState state, const char *msg, int priority); +void jabber_presence_parse(JabberStream *js, PurpleXmlNode *packet); void jabber_presence_subscription_set(JabberStream *js, const char *who, const char *type); void jabber_presence_fake_to_self(JabberStream *js, PurpleStatus *status); diff --git a/libpurple/protocols/jabber/roster.c b/libpurple/protocols/jabber/roster.c index 8a4f4ccce9..71d17acb59 100644 --- a/libpurple/protocols/jabber/roster.c +++ b/libpurple/protocols/jabber/roster.c @@ -50,9 +50,9 @@ static gchar *roster_groups_join(GSList *list) static void roster_request_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { - xmlnode *query; + PurpleXmlNode *query; if (type == JABBER_IQ_ERROR) { /* @@ -65,7 +65,7 @@ static void roster_request_cb(JabberStream *js, const char *from, return; } - query = xmlnode_get_child(packet, "query"); + query = purple_xmlnode_get_child(packet, "query"); if (query == NULL) { jabber_stream_set_state(js, JABBER_STREAM_CONNECTED); return; @@ -78,14 +78,14 @@ static void roster_request_cb(JabberStream *js, const char *from, void jabber_roster_request(JabberStream *js) { JabberIq *iq; - xmlnode *query; + PurpleXmlNode *query; iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:roster"); - query = xmlnode_get_child(iq->node, "query"); + query = purple_xmlnode_get_child(iq->node, "query"); if (js->server_caps & JABBER_CAP_GOOGLE_ROSTER) { - xmlnode_set_attrib(query, "xmlns:gr", NS_GOOGLE_ROSTER); - xmlnode_set_attrib(query, "gr:ext", "2"); + purple_xmlnode_set_attrib(query, "xmlns:gr", NS_GOOGLE_ROSTER); + purple_xmlnode_set_attrib(query, "gr:ext", "2"); } jabber_iq_set_callback(iq, roster_request_cb, NULL); @@ -188,9 +188,9 @@ static void add_purple_buddy_to_groups(JabberStream *js, const char *jid, } void jabber_roster_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *query) + JabberIqType type, const char *id, PurpleXmlNode *query) { - xmlnode *item, *group; + PurpleXmlNode *item, *group; #if 0 const char *ver; #endif @@ -203,15 +203,15 @@ void jabber_roster_parse(JabberStream *js, const char *from, js->currently_parsing_roster_push = TRUE; - for(item = xmlnode_get_child(query, "item"); item; item = xmlnode_get_next_twin(item)) + for(item = purple_xmlnode_get_child(query, "item"); item; item = purple_xmlnode_get_next_twin(item)) { const char *jid, *name, *subscription, *ask; JabberBuddy *jb; - subscription = xmlnode_get_attrib(item, "subscription"); - jid = xmlnode_get_attrib(item, "jid"); - name = xmlnode_get_attrib(item, "name"); - ask = xmlnode_get_attrib(item, "ask"); + subscription = purple_xmlnode_get_attrib(item, "subscription"); + jid = purple_xmlnode_get_attrib(item, "jid"); + name = purple_xmlnode_get_attrib(item, "name"); + ask = purple_xmlnode_get_attrib(item, "ask"); if(!jid) continue; @@ -248,8 +248,8 @@ void jabber_roster_parse(JabberStream *js, const char *from, if (!jabber_google_roster_incoming(js, item)) continue; - for(group = xmlnode_get_child(item, "group"); group; group = xmlnode_get_next_twin(group)) { - char *group_name = xmlnode_get_data(group); + for(group = purple_xmlnode_get_child(item, "group"); group; group = purple_xmlnode_get_next_twin(group)) { + char *group_name = purple_xmlnode_get_data(group); if (group_name == NULL || *group_name == '\0') /* Changing this string? Look in add_purple_buddy_to_groups */ @@ -274,7 +274,7 @@ void jabber_roster_parse(JabberStream *js, const char *from, } #if 0 - ver = xmlnode_get_attrib(query, "ver"); + ver = purple_xmlnode_get_attrib(query, "ver"); if (ver) { PurpleAccount *account = purple_connection_get_account(js->gc); purple_account_set_string(account, "roster_ver", ver); @@ -298,7 +298,7 @@ static void jabber_roster_update(JabberStream *js, const char *name, PurpleGroup *g; GSList *l; JabberIq *iq; - xmlnode *query, *item, *group; + PurpleXmlNode *query, *item, *group; const char *balias; if (js->currently_parsing_roster_push) @@ -334,25 +334,25 @@ static void jabber_roster_update(JabberStream *js, const char *name, iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:roster"); - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); + query = purple_xmlnode_get_child(iq->node, "query"); + item = purple_xmlnode_new_child(query, "item"); - xmlnode_set_attrib(item, "jid", name); + purple_xmlnode_set_attrib(item, "jid", name); balias = purple_buddy_get_local_alias(b); - xmlnode_set_attrib(item, "name", balias ? balias : ""); + purple_xmlnode_set_attrib(item, "name", balias ? balias : ""); for(l = groups; l; l = l->next) { - group = xmlnode_new_child(item, "group"); - xmlnode_insert_data(group, l->data, -1); + group = purple_xmlnode_new_child(item, "group"); + purple_xmlnode_insert_data(group, l->data, -1); } g_slist_free(groups); if (js->server_caps & JABBER_CAP_GOOGLE_ROSTER) { jabber_google_roster_outgoing(js, query, item); - xmlnode_set_attrib(query, "xmlns:gr", NS_GOOGLE_ROSTER); - xmlnode_set_attrib(query, "gr:ext", "2"); + purple_xmlnode_set_attrib(query, "xmlns:gr", NS_GOOGLE_ROSTER); + purple_xmlnode_set_attrib(query, "gr:ext", "2"); } jabber_iq_send(iq); } @@ -500,11 +500,11 @@ void jabber_roster_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, } else { JabberIq *iq = jabber_iq_new_query(purple_connection_get_protocol_data(gc), JABBER_IQ_SET, "jabber:iq:roster"); - xmlnode *query = xmlnode_get_child(iq->node, "query"); - xmlnode *item = xmlnode_new_child(query, "item"); + PurpleXmlNode *query = purple_xmlnode_get_child(iq->node, "query"); + PurpleXmlNode *item = purple_xmlnode_new_child(query, "item"); - xmlnode_set_attrib(item, "jid", name); - xmlnode_set_attrib(item, "subscription", "remove"); + purple_xmlnode_set_attrib(item, "jid", name); + purple_xmlnode_set_attrib(item, "subscription", "remove"); purple_debug_info("jabber", "jabber_roster_remove_buddy(): Removing %s\n", purple_buddy_get_name(buddy)); diff --git a/libpurple/protocols/jabber/roster.h b/libpurple/protocols/jabber/roster.h index 367fd05d7f..22fefbf4de 100644 --- a/libpurple/protocols/jabber/roster.h +++ b/libpurple/protocols/jabber/roster.h @@ -29,7 +29,7 @@ void jabber_roster_request(JabberStream *js); void jabber_roster_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *query); + JabberIqType type, const char *id, PurpleXmlNode *query); void jabber_roster_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group, const char *message); diff --git a/libpurple/protocols/jabber/si.c b/libpurple/protocols/jabber/si.c index b7ce8eb724..25f50b423c 100644 --- a/libpurple/protocols/jabber/si.c +++ b/libpurple/protocols/jabber/si.c @@ -120,7 +120,7 @@ jabber_si_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_ PurpleXfer *xfer = data; JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); JabberIq *iq; - xmlnode *query, *su; + PurpleXmlNode *query, *su; JabberBytestreamsStreamhost *streamhost = jsx->streamhosts->data; purple_proxy_info_destroy(jsx->gpi); @@ -145,24 +145,24 @@ jabber_si_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_ /* unknown file transfer type is assumed to be RECEIVE */ if(purple_xfer_get_xfer_type(xfer) == PURPLE_XFER_TYPE_SEND) { - xmlnode *activate; + PurpleXmlNode *activate; iq = jabber_iq_new_query(jsx->js, JABBER_IQ_SET, NS_BYTESTREAMS); - xmlnode_set_attrib(iq->node, "to", streamhost->jid); - query = xmlnode_get_child(iq->node, "query"); - xmlnode_set_attrib(query, "sid", jsx->stream_id); - activate = xmlnode_new_child(query, "activate"); - xmlnode_insert_data(activate, purple_xfer_get_remote_user(xfer), -1); + purple_xmlnode_set_attrib(iq->node, "to", streamhost->jid); + query = purple_xmlnode_get_child(iq->node, "query"); + purple_xmlnode_set_attrib(query, "sid", jsx->stream_id); + activate = purple_xmlnode_new_child(query, "activate"); + purple_xmlnode_insert_data(activate, purple_xfer_get_remote_user(xfer), -1); /* TODO: We need to wait for an activation result before starting */ } else { iq = jabber_iq_new_query(jsx->js, JABBER_IQ_RESULT, NS_BYTESTREAMS); - xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); + purple_xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); jabber_iq_set_id(iq, jsx->iq_id); - query = xmlnode_get_child(iq->node, "query"); - su = xmlnode_new_child(query, "streamhost-used"); - xmlnode_set_attrib(su, "jid", streamhost->jid); + query = purple_xmlnode_get_child(iq->node, "query"); + su = purple_xmlnode_new_child(query, "streamhost-used"); + purple_xmlnode_set_attrib(su, "jid", streamhost->jid); } jabber_iq_send(iq); @@ -224,17 +224,17 @@ static void jabber_si_bytestreams_attempt_connect(PurpleXfer *xfer) if(!jsx->streamhosts) { JabberIq *iq = jabber_iq_new(jsx->js, JABBER_IQ_ERROR); - xmlnode *error, *inf; + PurpleXmlNode *error, *inf; if(jsx->iq_id) jabber_iq_set_id(iq, jsx->iq_id); - xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); - error = xmlnode_new_child(iq->node, "error"); - xmlnode_set_attrib(error, "code", "404"); - xmlnode_set_attrib(error, "type", "cancel"); - inf = xmlnode_new_child(error, "item-not-found"); - xmlnode_set_namespace(inf, NS_XMPP_STANZAS); + purple_xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); + error = purple_xmlnode_new_child(iq->node, "error"); + purple_xmlnode_set_attrib(error, "code", "404"); + purple_xmlnode_set_attrib(error, "type", "cancel"); + inf = purple_xmlnode_new_child(error, "item-not-found"); + purple_xmlnode_set_namespace(inf, NS_XMPP_STANZAS); jabber_iq_send(iq); @@ -327,11 +327,11 @@ static void jabber_si_bytestreams_attempt_connect(PurpleXfer *xfer) } void jabber_bytestreams_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *query) + JabberIqType type, const char *id, PurpleXmlNode *query) { PurpleXfer *xfer; JabberSIXfer *jsx; - xmlnode *streamhost; + PurpleXmlNode *streamhost; const char *sid; if(type != JABBER_IQ_SET) @@ -340,7 +340,7 @@ void jabber_bytestreams_parse(JabberStream *js, const char *from, if(!from) return; - if(!(sid = xmlnode_get_attrib(query, "sid"))) + if(!(sid = purple_xmlnode_get_attrib(query, "sid"))) return; if(!(xfer = jabber_si_xfer_find(js, sid, from))) @@ -355,15 +355,15 @@ void jabber_bytestreams_parse(JabberStream *js, const char *from, g_free(jsx->iq_id); jsx->iq_id = g_strdup(id); - for(streamhost = xmlnode_get_child(query, "streamhost"); streamhost; - streamhost = xmlnode_get_next_twin(streamhost)) { + for(streamhost = purple_xmlnode_get_child(query, "streamhost"); streamhost; + streamhost = purple_xmlnode_get_next_twin(streamhost)) { const char *jid, *host = NULL, *port, *zeroconf; int portnum = 0; - if((jid = xmlnode_get_attrib(streamhost, "jid")) && - ((zeroconf = xmlnode_get_attrib(streamhost, "zeroconf")) || - ((host = xmlnode_get_attrib(streamhost, "host")) && - (port = xmlnode_get_attrib(streamhost, "port")) && + if((jid = purple_xmlnode_get_attrib(streamhost, "jid")) && + ((zeroconf = purple_xmlnode_get_attrib(streamhost, "zeroconf")) || + ((host = purple_xmlnode_get_attrib(streamhost, "host")) && + (port = purple_xmlnode_get_attrib(streamhost, "port")) && (portnum = atoi(port))))) { JabberBytestreamsStreamhost *sh = g_new0(JabberBytestreamsStreamhost, 1); sh->jid = g_strdup(jid); @@ -700,11 +700,11 @@ jabber_si_xfer_bytestreams_send_connected_cb(gpointer data, gint source, static void jabber_si_connect_proxy_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { PurpleXfer *xfer = data; JabberSIXfer *jsx; - xmlnode *query, *streamhost_used; + PurpleXmlNode *query, *streamhost_used; const char *jid; GList *matched; @@ -752,13 +752,13 @@ jabber_si_connect_proxy_cb(JabberStream *js, const char *from, if (!from) return; - if(!(query = xmlnode_get_child(packet, "query"))) + if(!(query = purple_xmlnode_get_child(packet, "query"))) return; - if(!(streamhost_used = xmlnode_get_child(query, "streamhost-used"))) + if(!(streamhost_used = purple_xmlnode_get_child(query, "streamhost-used"))) return; - if(!(jid = xmlnode_get_attrib(streamhost_used, "jid"))) + if(!(jid = purple_xmlnode_get_attrib(streamhost_used, "jid"))) return; purple_debug_info("jabber", "jabber_si_connect_proxy_cb() will be looking at jsx %p: jsx->streamhosts is %p and jid is %s\n", @@ -818,7 +818,7 @@ jabber_si_xfer_bytestreams_listen_cb(int sock, gpointer data) PurpleXfer *xfer = data; JabberSIXfer *jsx; JabberIq *iq; - xmlnode *query, *streamhost; + PurpleXmlNode *query, *streamhost; char port[6]; GList *tmp; JabberBytestreamsStreamhost *sh, *sh2; @@ -837,10 +837,10 @@ jabber_si_xfer_bytestreams_listen_cb(int sock, gpointer data) g_object_unref(xfer); iq = jabber_iq_new_query(jsx->js, JABBER_IQ_SET, NS_BYTESTREAMS); - xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); - query = xmlnode_get_child(iq->node, "query"); + purple_xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); + query = purple_xmlnode_get_child(iq->node, "query"); - xmlnode_set_attrib(query, "sid", jsx->stream_id); + purple_xmlnode_set_attrib(query, "sid", jsx->stream_id); /* If we successfully started listening locally */ if (sock >= 0) { @@ -863,10 +863,10 @@ jabber_si_xfer_bytestreams_listen_cb(int sock, gpointer data) while (local_ips) { gchar *local_ip = local_ips->data; streamhost_count++; - streamhost = xmlnode_new_child(query, "streamhost"); - xmlnode_set_attrib(streamhost, "jid", jid); - xmlnode_set_attrib(streamhost, "host", local_ip); - xmlnode_set_attrib(streamhost, "port", port); + streamhost = purple_xmlnode_new_child(query, "streamhost"); + purple_xmlnode_set_attrib(streamhost, "jid", jid); + purple_xmlnode_set_attrib(streamhost, "host", local_ip); + purple_xmlnode_set_attrib(streamhost, "port", port); if (purple_strequal(local_ip, public_ip)) has_public_ip = TRUE; g_free(local_ip); @@ -876,10 +876,10 @@ jabber_si_xfer_bytestreams_listen_cb(int sock, gpointer data) /* Include the public IP (assuming that there is a port mapped somehow) */ if (!has_public_ip && strcmp(public_ip, "0.0.0.0") != 0) { streamhost_count++; - streamhost = xmlnode_new_child(query, "streamhost"); - xmlnode_set_attrib(streamhost, "jid", jid); - xmlnode_set_attrib(streamhost, "host", public_ip); - xmlnode_set_attrib(streamhost, "port", port); + streamhost = purple_xmlnode_new_child(query, "streamhost"); + purple_xmlnode_set_attrib(streamhost, "jid", jid); + purple_xmlnode_set_attrib(streamhost, "host", public_ip); + purple_xmlnode_set_attrib(streamhost, "port", port); } g_free(jid); @@ -903,11 +903,11 @@ jabber_si_xfer_bytestreams_listen_cb(int sock, gpointer data) continue; streamhost_count++; - streamhost = xmlnode_new_child(query, "streamhost"); - xmlnode_set_attrib(streamhost, "jid", sh->jid); - xmlnode_set_attrib(streamhost, "host", sh->host); + streamhost = purple_xmlnode_new_child(query, "streamhost"); + purple_xmlnode_set_attrib(streamhost, "jid", sh->jid); + purple_xmlnode_set_attrib(streamhost, "host", sh->host); g_snprintf(port, sizeof(port), "%hu", sh->port); - xmlnode_set_attrib(streamhost, "port", port); + purple_xmlnode_set_attrib(streamhost, "port", port); sh2 = g_new0(JabberBytestreamsStreamhost, 1); sh2->jid = g_strdup(sh->jid); @@ -1044,9 +1044,9 @@ jabber_si_xfer_ibb_read(guchar **out_buffer, PurpleXfer *xfer) static gboolean jabber_si_xfer_ibb_open_cb(JabberStream *js, const char *who, const char *id, - xmlnode *open) + PurpleXmlNode *open) { - const gchar *sid = xmlnode_get_attrib(open, "sid"); + const gchar *sid = purple_xmlnode_get_attrib(open, "sid"); PurpleXfer *xfer = jabber_si_xfer_find(js, sid, who); if (xfer) { JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); @@ -1172,34 +1172,34 @@ jabber_si_xfer_ibb_send_init(JabberStream *js, PurpleXfer *xfer) static void jabber_si_xfer_send_method_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, - xmlnode *packet, gpointer data) + PurpleXmlNode *packet, gpointer data) { PurpleXfer *xfer = data; - xmlnode *si, *feature, *x, *field, *value; + PurpleXmlNode *si, *feature, *x, *field, *value; gboolean found_method = FALSE; - if(!(si = xmlnode_get_child_with_namespace(packet, "si", "http://jabber.org/protocol/si"))) { + if(!(si = purple_xmlnode_get_child_with_namespace(packet, "si", "http://jabber.org/protocol/si"))) { purple_xfer_cancel_remote(xfer); return; } - if(!(feature = xmlnode_get_child_with_namespace(si, "feature", "http://jabber.org/protocol/feature-neg"))) { + if(!(feature = purple_xmlnode_get_child_with_namespace(si, "feature", "http://jabber.org/protocol/feature-neg"))) { purple_xfer_cancel_remote(xfer); return; } - if(!(x = xmlnode_get_child_with_namespace(feature, "x", "jabber:x:data"))) { + if(!(x = purple_xmlnode_get_child_with_namespace(feature, "x", "jabber:x:data"))) { purple_xfer_cancel_remote(xfer); return; } - for(field = xmlnode_get_child(x, "field"); field; field = xmlnode_get_next_twin(field)) { - const char *var = xmlnode_get_attrib(field, "var"); + for(field = purple_xmlnode_get_child(x, "field"); field; field = purple_xmlnode_get_next_twin(field)) { + const char *var = purple_xmlnode_get_attrib(field, "var"); JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); if(var && !strcmp(var, "stream-method")) { - if((value = xmlnode_get_child(field, "value"))) { - char *val = xmlnode_get_data(value); + if((value = purple_xmlnode_get_child(field, "value"))) { + char *val = purple_xmlnode_get_data(value); if(val && !strcmp(val, NS_BYTESTREAMS)) { jabber_si_xfer_bytestreams_send_init(xfer); jsx->stream_method |= STREAM_METHOD_BYTESTREAMS; @@ -1228,7 +1228,7 @@ static void jabber_si_xfer_send_request(PurpleXfer *xfer) { JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); JabberIq *iq; - xmlnode *si, *file, *feature, *x, *field, *option, *value; + PurpleXmlNode *si, *file, *feature, *x, *field, *option, *value; char buf[32]; #if ENABLE_FT_THUMBNAILS gconstpointer thumb; @@ -1239,18 +1239,18 @@ static void jabber_si_xfer_send_request(PurpleXfer *xfer) purple_xfer_set_filename(xfer, g_path_get_basename(purple_xfer_get_local_filename(xfer))); iq = jabber_iq_new(jsx->js, JABBER_IQ_SET); - xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); - si = xmlnode_new_child(iq->node, "si"); - xmlnode_set_namespace(si, "http://jabber.org/protocol/si"); + purple_xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); + si = purple_xmlnode_new_child(iq->node, "si"); + purple_xmlnode_set_namespace(si, "http://jabber.org/protocol/si"); jsx->stream_id = jabber_get_next_id(jsx->js); - xmlnode_set_attrib(si, "id", jsx->stream_id); - xmlnode_set_attrib(si, "profile", NS_SI_FILE_TRANSFER); + purple_xmlnode_set_attrib(si, "id", jsx->stream_id); + purple_xmlnode_set_attrib(si, "profile", NS_SI_FILE_TRANSFER); - file = xmlnode_new_child(si, "file"); - xmlnode_set_namespace(file, NS_SI_FILE_TRANSFER); - xmlnode_set_attrib(file, "name", purple_xfer_get_filename(xfer)); + file = purple_xmlnode_new_child(si, "file"); + purple_xmlnode_set_namespace(file, NS_SI_FILE_TRANSFER); + purple_xmlnode_set_attrib(file, "name", purple_xfer_get_filename(xfer)); g_snprintf(buf, sizeof(buf), "%" G_GOFFSET_FORMAT, purple_xfer_get_size(xfer)); - xmlnode_set_attrib(file, "size", buf); + purple_xmlnode_set_attrib(file, "size", buf); /* maybe later we'll do hash and date attribs */ #if ENABLE_FT_THUMBNAILS @@ -1260,32 +1260,32 @@ static void jabber_si_xfer_send_request(PurpleXfer *xfer) JabberData *thumbnail_data = jabber_data_create_from_data(thumb, thumb_size, mimetype, TRUE, jsx->js); - xmlnode *thumbnail = xmlnode_new_child(file, "thumbnail"); - xmlnode_set_namespace(thumbnail, NS_THUMBS); - xmlnode_set_attrib(thumbnail, "cid", + PurpleXmlNode *thumbnail = purple_xmlnode_new_child(file, "thumbnail"); + purple_xmlnode_set_namespace(thumbnail, NS_THUMBS); + purple_xmlnode_set_attrib(thumbnail, "cid", jabber_data_get_cid(thumbnail_data)); - xmlnode_set_attrib(thumbnail, "mime-type", mimetype); + purple_xmlnode_set_attrib(thumbnail, "mime-type", mimetype); /* cache data */ jabber_data_associate_local(thumbnail_data, NULL); } #endif - feature = xmlnode_new_child(si, "feature"); - xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg"); - x = xmlnode_new_child(feature, "x"); - xmlnode_set_namespace(x, "jabber:x:data"); - xmlnode_set_attrib(x, "type", "form"); - field = xmlnode_new_child(x, "field"); - xmlnode_set_attrib(field, "var", "stream-method"); - xmlnode_set_attrib(field, "type", "list-single"); + feature = purple_xmlnode_new_child(si, "feature"); + purple_xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg"); + x = purple_xmlnode_new_child(feature, "x"); + purple_xmlnode_set_namespace(x, "jabber:x:data"); + purple_xmlnode_set_attrib(x, "type", "form"); + field = purple_xmlnode_new_child(x, "field"); + purple_xmlnode_set_attrib(field, "var", "stream-method"); + purple_xmlnode_set_attrib(field, "type", "list-single"); /* maybe we should add an option to always skip bytestreams for people behind troublesome firewalls */ - option = xmlnode_new_child(field, "option"); - value = xmlnode_new_child(option, "value"); - xmlnode_insert_data(value, NS_BYTESTREAMS, -1); - option = xmlnode_new_child(field, "option"); - value = xmlnode_new_child(option, "value"); - xmlnode_insert_data(value, NS_IBB, -1); + option = purple_xmlnode_new_child(field, "option"); + value = purple_xmlnode_new_child(option, "value"); + purple_xmlnode_insert_data(value, NS_BYTESTREAMS, -1); + option = purple_xmlnode_new_child(field, "option"); + value = purple_xmlnode_new_child(option, "value"); + purple_xmlnode_insert_data(value, NS_IBB, -1); jabber_iq_set_callback(iq, jabber_si_xfer_send_method_cb, xfer); @@ -1377,18 +1377,18 @@ static void jabber_si_xfer_request_denied(PurpleXfer *xfer) */ if (jsx->iq_id && !jsx->accepted) { JabberIq *iq; - xmlnode *error, *child; + PurpleXmlNode *error, *child; iq = jabber_iq_new(js, JABBER_IQ_ERROR); - xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); + purple_xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); jabber_iq_set_id(iq, jsx->iq_id); - error = xmlnode_new_child(iq->node, "error"); - xmlnode_set_attrib(error, "type", "cancel"); - child = xmlnode_new_child(error, "forbidden"); - xmlnode_set_namespace(child, NS_XMPP_STANZAS); - child = xmlnode_new_child(error, "text"); - xmlnode_set_namespace(child, NS_XMPP_STANZAS); - xmlnode_insert_data(child, "Offer Declined", -1); + error = purple_xmlnode_new_child(iq->node, "error"); + purple_xmlnode_set_attrib(error, "type", "cancel"); + child = purple_xmlnode_new_child(error, "forbidden"); + purple_xmlnode_set_namespace(child, NS_XMPP_STANZAS); + child = purple_xmlnode_new_child(error, "text"); + purple_xmlnode_set_namespace(child, NS_XMPP_STANZAS); + purple_xmlnode_insert_data(child, "Offer Declined", -1); jabber_iq_send(iq); } @@ -1579,10 +1579,10 @@ static void jabber_si_xfer_init(PurpleXfer *xfer) g_list_free(resources); } else { - xmlnode *si, *feature, *x, *field, *value; + PurpleXmlNode *si, *feature, *x, *field, *value; iq = jabber_iq_new(jsx->js, JABBER_IQ_RESULT); - xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); + purple_xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); if(jsx->iq_id) jabber_iq_set_id(iq, jsx->iq_id); else @@ -1590,17 +1590,17 @@ static void jabber_si_xfer_init(PurpleXfer *xfer) jsx->accepted = TRUE; - si = xmlnode_new_child(iq->node, "si"); - xmlnode_set_namespace(si, "http://jabber.org/protocol/si"); + si = purple_xmlnode_new_child(iq->node, "si"); + purple_xmlnode_set_namespace(si, "http://jabber.org/protocol/si"); - feature = xmlnode_new_child(si, "feature"); - xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg"); + feature = purple_xmlnode_new_child(si, "feature"); + purple_xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg"); - x = xmlnode_new_child(feature, "x"); - xmlnode_set_namespace(x, "jabber:x:data"); - xmlnode_set_attrib(x, "type", "submit"); - field = xmlnode_new_child(x, "field"); - xmlnode_set_attrib(field, "var", "stream-method"); + x = purple_xmlnode_new_child(feature, "x"); + purple_xmlnode_set_namespace(x, "jabber:x:data"); + purple_xmlnode_set_attrib(x, "type", "submit"); + field = purple_xmlnode_new_child(x, "field"); + purple_xmlnode_set_attrib(field, "var", "stream-method"); /* we should maybe "remember" if bytestreams has failed before (in the same session) with this JID, and only present IBB as an option to @@ -1608,11 +1608,11 @@ static void jabber_si_xfer_init(PurpleXfer *xfer) /* maybe we should have an account option to always just try IBB for people who know their firewalls are very restrictive */ if (jsx->stream_method & STREAM_METHOD_BYTESTREAMS) { - value = xmlnode_new_child(field, "value"); - xmlnode_insert_data(value, NS_BYTESTREAMS, -1); + value = purple_xmlnode_new_child(field, "value"); + purple_xmlnode_insert_data(value, NS_BYTESTREAMS, -1); } else if(jsx->stream_method & STREAM_METHOD_IBB) { - value = xmlnode_new_child(field, "value"); - xmlnode_insert_data(value, NS_IBB, -1); + value = purple_xmlnode_new_child(field, "value"); + purple_xmlnode_insert_data(value, NS_IBB, -1); } jabber_iq_send(iq); @@ -1678,37 +1678,37 @@ jabber_si_thumbnail_cb(JabberData *data, gchar *alt, gpointer userdata) #endif void jabber_si_parse(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *si) + const char *id, PurpleXmlNode *si) { JabberSIXfer *jsx; PurpleXfer *xfer; - xmlnode *file, *feature, *x, *field, *option, *value; + PurpleXmlNode *file, *feature, *x, *field, *option, *value; #if ENABLE_FT_THUMBNAILS - xmlnode *thumbnail; + PurpleXmlNode *thumbnail; #endif const char *stream_id, *filename, *filesize_c, *profile; goffset filesize = 0; - if(!(profile = xmlnode_get_attrib(si, "profile")) || + if(!(profile = purple_xmlnode_get_attrib(si, "profile")) || strcmp(profile, NS_SI_FILE_TRANSFER)) return; - if(!(stream_id = xmlnode_get_attrib(si, "id"))) + if(!(stream_id = purple_xmlnode_get_attrib(si, "id"))) return; - if(!(file = xmlnode_get_child(si, "file"))) + if(!(file = purple_xmlnode_get_child(si, "file"))) return; - if(!(filename = xmlnode_get_attrib(file, "name"))) + if(!(filename = purple_xmlnode_get_attrib(file, "name"))) return; - if((filesize_c = xmlnode_get_attrib(file, "size"))) + if((filesize_c = purple_xmlnode_get_attrib(file, "size"))) filesize = g_ascii_strtoull(filesize_c, NULL, 10); - if(!(feature = xmlnode_get_child(si, "feature"))) + if(!(feature = purple_xmlnode_get_child(si, "feature"))) return; - if(!(x = xmlnode_get_child_with_namespace(feature, "x", "jabber:x:data"))) + if(!(x = purple_xmlnode_get_child_with_namespace(feature, "x", "jabber:x:data"))) return; if(!from) @@ -1725,14 +1725,14 @@ void jabber_si_parse(JabberStream *js, const char *from, JabberIqType type, jsx->ibb_session = NULL; - for(field = xmlnode_get_child(x, "field"); field; field = xmlnode_get_next_twin(field)) { - const char *var = xmlnode_get_attrib(field, "var"); + for(field = purple_xmlnode_get_child(x, "field"); field; field = purple_xmlnode_get_next_twin(field)) { + const char *var = purple_xmlnode_get_attrib(field, "var"); if(var && !strcmp(var, "stream-method")) { - for(option = xmlnode_get_child(field, "option"); option; - option = xmlnode_get_next_twin(option)) { - if((value = xmlnode_get_child(option, "value"))) { + for(option = purple_xmlnode_get_child(field, "option"); option; + option = purple_xmlnode_get_next_twin(option)) { + if((value = purple_xmlnode_get_child(option, "value"))) { char *val; - if((val = xmlnode_get_data(value))) { + if((val = purple_xmlnode_get_data(value))) { if(!strcmp(val, NS_BYTESTREAMS)) { jsx->stream_method |= STREAM_METHOD_BYTESTREAMS; } else if(!strcmp(val, NS_IBB)) { @@ -1772,9 +1772,9 @@ void jabber_si_parse(JabberStream *js, const char *from, JabberIqType type, #if ENABLE_FT_THUMBNAILS /* if there is a thumbnail, we should request it... */ - if ((thumbnail = xmlnode_get_child_with_namespace(file, "thumbnail", + if ((thumbnail = purple_xmlnode_get_child_with_namespace(file, "thumbnail", NS_THUMBS))) { - const char *cid = xmlnode_get_attrib(thumbnail, "cid"); + const char *cid = purple_xmlnode_get_attrib(thumbnail, "cid"); if (cid) { jabber_data_request(js, cid, purple_xfer_get_remote_user(xfer), NULL, TRUE, jabber_si_thumbnail_cb, xfer); diff --git a/libpurple/protocols/jabber/si.h b/libpurple/protocols/jabber/si.h index 6fc7cee0ef..e8bf48e07c 100644 --- a/libpurple/protocols/jabber/si.h +++ b/libpurple/protocols/jabber/si.h @@ -29,9 +29,9 @@ #include "jabber.h" void jabber_bytestreams_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *query); + JabberIqType type, const char *id, PurpleXmlNode *query); void jabber_si_parse(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *si); + const char *id, PurpleXmlNode *si); PurpleXfer *jabber_si_new_xfer(PurpleConnection *gc, const char *who); void jabber_si_xfer_send(PurpleConnection *gc, const char *who, const char *file); void jabber_si_init(void); diff --git a/libpurple/protocols/jabber/useravatar.c b/libpurple/protocols/jabber/useravatar.c index 6f982bac13..621055bd62 100644 --- a/libpurple/protocols/jabber/useravatar.c +++ b/libpurple/protocols/jabber/useravatar.c @@ -30,7 +30,7 @@ #define MAX_HTTP_BUDDYICON_BYTES (200 * 1024) -static void update_buddy_metadata(JabberStream *js, const char *from, xmlnode *items); +static void update_buddy_metadata(JabberStream *js, const char *from, PurpleXmlNode *items); void jabber_avatar_init(void) { @@ -50,18 +50,18 @@ remove_avatar_0_12_nodes(JabberStream *js) /* See note below for why this is #if 0'd */ /* Publish an empty avatar according to the XEP-0084 v0.12 semantics */ - xmlnode *publish, *item, *metadata; + PurpleXmlNode *publish, *item, *metadata; /* publish the metadata */ - publish = xmlnode_new("publish"); - xmlnode_set_attrib(publish, "node", NS_AVATAR_0_12_METADATA); + publish = purple_xmlnode_new("publish"); + purple_xmlnode_set_attrib(publish, "node", NS_AVATAR_0_12_METADATA); - item = xmlnode_new_child(publish, "item"); - xmlnode_set_attrib(item, "id", "stop"); + item = purple_xmlnode_new_child(publish, "item"); + purple_xmlnode_set_attrib(item, "id", "stop"); - metadata = xmlnode_new_child(item, "metadata"); - xmlnode_set_namespace(metadata, NS_AVATAR_0_12_METADATA); + metadata = purple_xmlnode_new_child(item, "metadata"); + purple_xmlnode_set_namespace(metadata, NS_AVATAR_0_12_METADATA); - xmlnode_new_child(metadata, "stop"); + purple_xmlnode_new_child(metadata, "stop"); /* publish */ jabber_pep_publish(js, publish); @@ -89,7 +89,7 @@ remove_avatar_0_12_nodes(JabberStream *js) void jabber_avatar_set(JabberStream *js, PurpleStoredImage *img) { - xmlnode *publish, *metadata, *item; + PurpleXmlNode *publish, *metadata, *item; if (!js->pep) return; @@ -98,12 +98,12 @@ void jabber_avatar_set(JabberStream *js, PurpleStoredImage *img) remove_avatar_0_12_nodes(js); if (!img) { - publish = xmlnode_new("publish"); - xmlnode_set_attrib(publish, "node", NS_AVATAR_1_1_METADATA); + publish = purple_xmlnode_new("publish"); + purple_xmlnode_set_attrib(publish, "node", NS_AVATAR_1_1_METADATA); - item = xmlnode_new_child(publish, "item"); - metadata = xmlnode_new_child(item, "metadata"); - xmlnode_set_namespace(metadata, NS_AVATAR_1_1_METADATA); + item = purple_xmlnode_new_child(publish, "item"); + metadata = purple_xmlnode_new_child(item, "metadata"); + purple_xmlnode_set_namespace(metadata, NS_AVATAR_1_1_METADATA); /* publish */ jabber_pep_publish(js, publish); @@ -150,7 +150,7 @@ void jabber_avatar_set(JabberStream *js, PurpleStoredImage *img) /* parse PNG header to get the size of the image (yes, this is required) */ guint32 width = ntohl(png->ihdr.width); guint32 height = ntohl(png->ihdr.height); - xmlnode *data, *info; + PurpleXmlNode *data, *info; char *lengthstring, *widthstring, *heightstring; /* compute the sha1 hash */ @@ -160,16 +160,16 @@ void jabber_avatar_set(JabberStream *js, PurpleStoredImage *img) char *base64avatar = purple_base64_encode(purple_imgstore_get_data(img), purple_imgstore_get_size(img)); - publish = xmlnode_new("publish"); - xmlnode_set_attrib(publish, "node", NS_AVATAR_1_1_DATA); + publish = purple_xmlnode_new("publish"); + purple_xmlnode_set_attrib(publish, "node", NS_AVATAR_1_1_DATA); - item = xmlnode_new_child(publish, "item"); - xmlnode_set_attrib(item, "id", hash); + item = purple_xmlnode_new_child(publish, "item"); + purple_xmlnode_set_attrib(item, "id", hash); - data = xmlnode_new_child(item, "data"); - xmlnode_set_namespace(data, NS_AVATAR_1_1_DATA); + data = purple_xmlnode_new_child(item, "data"); + purple_xmlnode_set_namespace(data, NS_AVATAR_1_1_DATA); - xmlnode_insert_data(data, base64avatar, -1); + purple_xmlnode_insert_data(data, base64avatar, -1); /* publish the avatar itself */ jabber_pep_publish(js, publish); @@ -181,21 +181,21 @@ void jabber_avatar_set(JabberStream *js, PurpleStoredImage *img) heightstring = g_strdup_printf("%u", height); /* publish the metadata */ - publish = xmlnode_new("publish"); - xmlnode_set_attrib(publish, "node", NS_AVATAR_1_1_METADATA); + publish = purple_xmlnode_new("publish"); + purple_xmlnode_set_attrib(publish, "node", NS_AVATAR_1_1_METADATA); - item = xmlnode_new_child(publish, "item"); - xmlnode_set_attrib(item, "id", hash); + item = purple_xmlnode_new_child(publish, "item"); + purple_xmlnode_set_attrib(item, "id", hash); - metadata = xmlnode_new_child(item, "metadata"); - xmlnode_set_namespace(metadata, NS_AVATAR_1_1_METADATA); + metadata = purple_xmlnode_new_child(item, "metadata"); + purple_xmlnode_set_namespace(metadata, NS_AVATAR_1_1_METADATA); - info = xmlnode_new_child(metadata, "info"); - xmlnode_set_attrib(info, "id", hash); - xmlnode_set_attrib(info, "type", "image/png"); - xmlnode_set_attrib(info, "bytes", lengthstring); - xmlnode_set_attrib(info, "width", widthstring); - xmlnode_set_attrib(info, "height", heightstring); + info = purple_xmlnode_new_child(metadata, "info"); + purple_xmlnode_set_attrib(info, "id", hash); + purple_xmlnode_set_attrib(info, "type", "image/png"); + purple_xmlnode_set_attrib(info, "bytes", lengthstring); + purple_xmlnode_set_attrib(info, "width", widthstring); + purple_xmlnode_set_attrib(info, "height", heightstring); jabber_pep_publish(js, publish); @@ -210,7 +210,7 @@ void jabber_avatar_set(JabberStream *js, PurpleStoredImage *img) } static void -do_got_own_avatar_0_12_cb(JabberStream *js, const char *from, xmlnode *items) +do_got_own_avatar_0_12_cb(JabberStream *js, const char *from, PurpleXmlNode *items) { if (items) /* It wasn't an error (i.e. 'item-not-found') */ @@ -218,16 +218,16 @@ do_got_own_avatar_0_12_cb(JabberStream *js, const char *from, xmlnode *items) } static void -do_got_own_avatar_cb(JabberStream *js, const char *from, xmlnode *items) +do_got_own_avatar_cb(JabberStream *js, const char *from, PurpleXmlNode *items) { - xmlnode *item = NULL, *metadata = NULL, *info = NULL; + PurpleXmlNode *item = NULL, *metadata = NULL, *info = NULL; PurpleAccount *account = purple_connection_get_account(js->gc); const char *server_hash = NULL; - if (items && (item = xmlnode_get_child(items, "item")) && - (metadata = xmlnode_get_child(item, "metadata")) && - (info = xmlnode_get_child(metadata, "info"))) { - server_hash = xmlnode_get_attrib(info, "id"); + if (items && (item = purple_xmlnode_get_child(items, "item")) && + (metadata = purple_xmlnode_get_child(item, "metadata")) && + (info = purple_xmlnode_get_child(metadata, "info"))) { + server_hash = purple_xmlnode_get_attrib(info, "id"); } /* @@ -286,9 +286,9 @@ out: } static void -do_buddy_avatar_update_data(JabberStream *js, const char *from, xmlnode *items) +do_buddy_avatar_update_data(JabberStream *js, const char *from, PurpleXmlNode *items) { - xmlnode *item, *data; + PurpleXmlNode *item, *data; const char *checksum; char *b64data; void *img; @@ -296,19 +296,19 @@ do_buddy_avatar_update_data(JabberStream *js, const char *from, xmlnode *items) if(!items) return; - item = xmlnode_get_child(items, "item"); + item = purple_xmlnode_get_child(items, "item"); if(!item) return; - data = xmlnode_get_child(item, "data"); + data = purple_xmlnode_get_child(item, "data"); if(!data) return; - checksum = xmlnode_get_attrib(item,"id"); + checksum = purple_xmlnode_get_attrib(item,"id"); if(!checksum) return; - b64data = xmlnode_get_data(data); + b64data = purple_xmlnode_get_data(data); if(!b64data) return; @@ -323,41 +323,41 @@ do_buddy_avatar_update_data(JabberStream *js, const char *from, xmlnode *items) } static void -update_buddy_metadata(JabberStream *js, const char *from, xmlnode *items) +update_buddy_metadata(JabberStream *js, const char *from, PurpleXmlNode *items) { PurpleBuddy *buddy = purple_blist_find_buddy(purple_connection_get_account(js->gc), from); const char *checksum; - xmlnode *item, *metadata; + PurpleXmlNode *item, *metadata; if(!buddy) return; if (!items) return; - item = xmlnode_get_child(items,"item"); + item = purple_xmlnode_get_child(items,"item"); if (!item) return; - metadata = xmlnode_get_child(item, "metadata"); + metadata = purple_xmlnode_get_child(item, "metadata"); if(!metadata) return; checksum = purple_buddy_icons_get_checksum_for_user(buddy); /* <stop/> was the pre-v1.1 method of publishing an empty avatar */ - if(xmlnode_get_child(metadata, "stop")) { + if(purple_xmlnode_get_child(metadata, "stop")) { purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, NULL, 0, NULL); } else { - xmlnode *info, *goodinfo = NULL; + PurpleXmlNode *info, *goodinfo = NULL; gboolean has_children = FALSE; /* iterate over all info nodes to get one we can use */ for(info = metadata->child; info; info = info->next) { - if(info->type == XMLNODE_TYPE_TAG) + if(info->type == PURPLE_XMLNODE_TYPE_TAG) has_children = TRUE; - if(info->type == XMLNODE_TYPE_TAG && !strcmp(info->name,"info")) { - const char *type = xmlnode_get_attrib(info,"type"); - const char *id = xmlnode_get_attrib(info,"id"); + if(info->type == PURPLE_XMLNODE_TYPE_TAG && !strcmp(info->name,"info")) { + const char *type = purple_xmlnode_get_attrib(info,"type"); + const char *id = purple_xmlnode_get_attrib(info,"id"); if(checksum && id && !strcmp(id, checksum)) { /* we already have that avatar, so we don't have to do anything */ @@ -372,8 +372,8 @@ update_buddy_metadata(JabberStream *js, const char *from, xmlnode *items) if(has_children == FALSE) { purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, NULL, 0, NULL); } else if(goodinfo) { - const char *url = xmlnode_get_attrib(goodinfo, "url"); - const char *id = xmlnode_get_attrib(goodinfo,"id"); + const char *url = purple_xmlnode_get_attrib(goodinfo, "url"); + const char *id = purple_xmlnode_get_attrib(goodinfo,"id"); /* the avatar might either be stored in a pep node, or on a HTTP(S) URL */ if(!url) { diff --git a/libpurple/protocols/jabber/usermood.c b/libpurple/protocols/jabber/usermood.c index dd7c2fed97..5c4b196b6d 100644 --- a/libpurple/protocols/jabber/usermood.c +++ b/libpurple/protocols/jabber/usermood.c @@ -135,25 +135,25 @@ find_mood_by_name(const gchar *name) return NULL; } -static void jabber_mood_cb(JabberStream *js, const char *from, xmlnode *items) { +static void jabber_mood_cb(JabberStream *js, const char *from, PurpleXmlNode *items) { /* it doesn't make sense to have more than one item here, so let's just pick the first one */ - xmlnode *item = xmlnode_get_child(items, "item"); + PurpleXmlNode *item = purple_xmlnode_get_child(items, "item"); const char *newmood = NULL; char *moodtext = NULL; JabberBuddy *buddy = jabber_buddy_find(js, from, FALSE); - xmlnode *moodinfo, *mood; + PurpleXmlNode *moodinfo, *mood; /* ignore the mood of people not on our buddy list */ if (!buddy || !item) return; - mood = xmlnode_get_child_with_namespace(item, "mood", "http://jabber.org/protocol/mood"); + mood = purple_xmlnode_get_child_with_namespace(item, "mood", "http://jabber.org/protocol/mood"); if (!mood) return; for (moodinfo = mood->child; moodinfo; moodinfo = moodinfo->next) { - if (moodinfo->type == XMLNODE_TYPE_TAG) { + if (moodinfo->type == PURPLE_XMLNODE_TYPE_TAG) { if (!strcmp(moodinfo->name, "text")) { if (!moodtext) /* only pick the first one */ - moodtext = xmlnode_get_data(moodinfo); + moodtext = purple_xmlnode_get_data(moodinfo); } else { const PurpleMood *target_mood; @@ -186,7 +186,7 @@ gboolean jabber_mood_set(JabberStream *js, const char *mood, const char *text) { const PurpleMood *target_mood = NULL; - xmlnode *publish, *moodnode; + PurpleXmlNode *publish, *moodnode; if (mood && *mood) { target_mood = find_mood_by_name(mood); @@ -197,21 +197,21 @@ jabber_mood_set(JabberStream *js, const char *mood, const char *text) return FALSE; } - publish = xmlnode_new("publish"); - xmlnode_set_attrib(publish,"node","http://jabber.org/protocol/mood"); - moodnode = xmlnode_new_child(xmlnode_new_child(publish, "item"), "mood"); - xmlnode_set_namespace(moodnode, "http://jabber.org/protocol/mood"); + publish = purple_xmlnode_new("publish"); + purple_xmlnode_set_attrib(publish,"node","http://jabber.org/protocol/mood"); + moodnode = purple_xmlnode_new_child(purple_xmlnode_new_child(publish, "item"), "mood"); + purple_xmlnode_set_namespace(moodnode, "http://jabber.org/protocol/mood"); if (target_mood) { /* If target_mood is not NULL, then * target_mood->mood == mood, and is a valid element name. */ - xmlnode_new_child(moodnode, mood); + purple_xmlnode_new_child(moodnode, mood); /* Only set text when setting a mood */ if (text && *text) { - xmlnode *textnode = xmlnode_new_child(moodnode, "text"); - xmlnode_insert_data(textnode, text, -1); + PurpleXmlNode *textnode = purple_xmlnode_new_child(moodnode, "text"); + purple_xmlnode_insert_data(textnode, text, -1); } } diff --git a/libpurple/protocols/jabber/usernick.c b/libpurple/protocols/jabber/usernick.c index dc3e7e4e1d..068b859ad5 100644 --- a/libpurple/protocols/jabber/usernick.c +++ b/libpurple/protocols/jabber/usernick.c @@ -30,52 +30,52 @@ #include "request.h" #include "status.h" -static void jabber_nick_cb(JabberStream *js, const char *from, xmlnode *items) { +static void jabber_nick_cb(JabberStream *js, const char *from, PurpleXmlNode *items) { /* it doesn't make sense to have more than one item here, so let's just pick the first one */ - xmlnode *item = xmlnode_get_child(items, "item"); + PurpleXmlNode *item = purple_xmlnode_get_child(items, "item"); JabberBuddy *buddy = jabber_buddy_find(js, from, FALSE); - xmlnode *nick; + PurpleXmlNode *nick; char *nickname = NULL; /* ignore the nick of people not on our buddy list */ if (!buddy || !item) return; - nick = xmlnode_get_child_with_namespace(item, "nick", "http://jabber.org/protocol/nick"); + nick = purple_xmlnode_get_child_with_namespace(item, "nick", "http://jabber.org/protocol/nick"); if (!nick) return; - nickname = xmlnode_get_data(nick); + nickname = purple_xmlnode_get_data(nick); serv_got_alias(js->gc, from, nickname); g_free(nickname); } static void do_nick_set(JabberStream *js, const char *nick) { - xmlnode *publish, *nicknode; + PurpleXmlNode *publish, *nicknode; - publish = xmlnode_new("publish"); - xmlnode_set_attrib(publish,"node","http://jabber.org/protocol/nick"); - nicknode = xmlnode_new_child(xmlnode_new_child(publish, "item"), "nick"); - xmlnode_set_namespace(nicknode, "http://jabber.org/protocol/nick"); + publish = purple_xmlnode_new("publish"); + purple_xmlnode_set_attrib(publish,"node","http://jabber.org/protocol/nick"); + nicknode = purple_xmlnode_new_child(purple_xmlnode_new_child(publish, "item"), "nick"); + purple_xmlnode_set_namespace(nicknode, "http://jabber.org/protocol/nick"); if(nick && nick[0] != '\0') - xmlnode_insert_data(nicknode, nick, -1); + purple_xmlnode_insert_data(nicknode, nick, -1); jabber_pep_publish(js, publish); /* publish is freed by jabber_pep_publish -> jabber_iq_send -> jabber_iq_free (yay for well-defined memory management rules) */ } -static void do_nick_got_own_nick_cb(JabberStream *js, const char *from, xmlnode *items) { +static void do_nick_got_own_nick_cb(JabberStream *js, const char *from, PurpleXmlNode *items) { char *oldnickname = NULL; - xmlnode *item = NULL; + PurpleXmlNode *item = NULL; if (items) - item = xmlnode_get_child(items,"item"); + item = purple_xmlnode_get_child(items,"item"); if(item) { - xmlnode *nick = xmlnode_get_child_with_namespace(item,"nick","http://jabber.org/protocol/nick"); + PurpleXmlNode *nick = purple_xmlnode_get_child_with_namespace(item,"nick","http://jabber.org/protocol/nick"); if(nick) - oldnickname = xmlnode_get_data(nick); + oldnickname = purple_xmlnode_get_data(nick); } purple_request_input(js->gc, _("Set User Nickname"), _("Please specify a new nickname for you."), diff --git a/libpurple/protocols/jabber/usertune.c b/libpurple/protocols/jabber/usertune.c index 99c3ed87d9..cb3d08eb30 100644 --- a/libpurple/protocols/jabber/usertune.c +++ b/libpurple/protocols/jabber/usertune.c @@ -30,11 +30,11 @@ #include "request.h" #include "status.h" -static void jabber_tune_cb(JabberStream *js, const char *from, xmlnode *items) { +static void jabber_tune_cb(JabberStream *js, const char *from, PurpleXmlNode *items) { /* it doesn't make sense to have more than one item here, so let's just pick the first one */ - xmlnode *item = xmlnode_get_child(items, "item"); + PurpleXmlNode *item = purple_xmlnode_get_child(items, "item"); JabberBuddy *buddy = jabber_buddy_find(js, from, FALSE); - xmlnode *tuneinfo, *tune; + PurpleXmlNode *tuneinfo, *tune; PurpleJabberTuneInfo tuneinfodata; JabberBuddyResource *resource; gboolean valid = FALSE; @@ -50,21 +50,21 @@ static void jabber_tune_cb(JabberStream *js, const char *from, xmlnode *items) { tuneinfodata.time = -1; tuneinfodata.url = NULL; - tune = xmlnode_get_child_with_namespace(item, "tune", "http://jabber.org/protocol/tune"); + tune = purple_xmlnode_get_child_with_namespace(item, "tune", "http://jabber.org/protocol/tune"); if (!tune) return; resource = jabber_buddy_find_resource(buddy, NULL); if(!resource) return; /* huh? */ for (tuneinfo = tune->child; tuneinfo; tuneinfo = tuneinfo->next) { - if (tuneinfo->type == XMLNODE_TYPE_TAG) { + if (tuneinfo->type == PURPLE_XMLNODE_TYPE_TAG) { if (!strcmp(tuneinfo->name, "artist")) { if (tuneinfodata.artist == NULL) /* only pick the first one */ - tuneinfodata.artist = xmlnode_get_data(tuneinfo); + tuneinfodata.artist = purple_xmlnode_get_data(tuneinfo); valid = TRUE; } else if (!strcmp(tuneinfo->name, "length")) { if (tuneinfodata.time == -1) { - char *length = xmlnode_get_data(tuneinfo); + char *length = purple_xmlnode_get_data(tuneinfo); if (length) tuneinfodata.time = strtol(length, NULL, 10); g_free(length); @@ -73,19 +73,19 @@ static void jabber_tune_cb(JabberStream *js, const char *from, xmlnode *items) { } } else if (!strcmp(tuneinfo->name, "source")) { if (tuneinfodata.album == NULL) /* only pick the first one */ - tuneinfodata.album = xmlnode_get_data(tuneinfo); + tuneinfodata.album = purple_xmlnode_get_data(tuneinfo); valid = TRUE; } else if (!strcmp(tuneinfo->name, "title")) { if (tuneinfodata.title == NULL) /* only pick the first one */ - tuneinfodata.title = xmlnode_get_data(tuneinfo); + tuneinfodata.title = purple_xmlnode_get_data(tuneinfo); valid = TRUE; } else if (!strcmp(tuneinfo->name, "track")) { if (tuneinfodata.track == NULL) /* only pick the first one */ - tuneinfodata.track = xmlnode_get_data(tuneinfo); + tuneinfodata.track = purple_xmlnode_get_data(tuneinfo); valid = TRUE; } else if (!strcmp(tuneinfo->name, "uri")) { if (tuneinfodata.url == NULL) /* only pick the first one */ - tuneinfodata.url = xmlnode_get_data(tuneinfo); + tuneinfodata.url = purple_xmlnode_get_data(tuneinfo); valid = TRUE; } } @@ -116,30 +116,30 @@ void jabber_tune_init(void) { } void jabber_tune_set(PurpleConnection *gc, const PurpleJabberTuneInfo *tuneinfo) { - xmlnode *publish, *tunenode; + PurpleXmlNode *publish, *tunenode; JabberStream *js = purple_connection_get_protocol_data(gc); - publish = xmlnode_new("publish"); - xmlnode_set_attrib(publish,"node","http://jabber.org/protocol/tune"); - tunenode = xmlnode_new_child(xmlnode_new_child(publish, "item"), "tune"); - xmlnode_set_namespace(tunenode, "http://jabber.org/protocol/tune"); + publish = purple_xmlnode_new("publish"); + purple_xmlnode_set_attrib(publish,"node","http://jabber.org/protocol/tune"); + tunenode = purple_xmlnode_new_child(purple_xmlnode_new_child(publish, "item"), "tune"); + purple_xmlnode_set_namespace(tunenode, "http://jabber.org/protocol/tune"); if(tuneinfo) { if(tuneinfo->artist && tuneinfo->artist[0] != '\0') - xmlnode_insert_data(xmlnode_new_child(tunenode, "artist"),tuneinfo->artist,-1); + purple_xmlnode_insert_data(purple_xmlnode_new_child(tunenode, "artist"),tuneinfo->artist,-1); if(tuneinfo->title && tuneinfo->title[0] != '\0') - xmlnode_insert_data(xmlnode_new_child(tunenode, "title"),tuneinfo->title,-1); + purple_xmlnode_insert_data(purple_xmlnode_new_child(tunenode, "title"),tuneinfo->title,-1); if(tuneinfo->album && tuneinfo->album[0] != '\0') - xmlnode_insert_data(xmlnode_new_child(tunenode, "source"),tuneinfo->album,-1); + purple_xmlnode_insert_data(purple_xmlnode_new_child(tunenode, "source"),tuneinfo->album,-1); if(tuneinfo->url && tuneinfo->url[0] != '\0') - xmlnode_insert_data(xmlnode_new_child(tunenode, "uri"),tuneinfo->url,-1); + purple_xmlnode_insert_data(purple_xmlnode_new_child(tunenode, "uri"),tuneinfo->url,-1); if(tuneinfo->time > 0) { char *length = g_strdup_printf("%d", tuneinfo->time); - xmlnode_insert_data(xmlnode_new_child(tunenode, "length"),length,-1); + purple_xmlnode_insert_data(purple_xmlnode_new_child(tunenode, "length"),length,-1); g_free(length); } if(tuneinfo->track && tuneinfo->track[0] != '\0') - xmlnode_insert_data(xmlnode_new_child(tunenode, "track"),tuneinfo->track,-1); + purple_xmlnode_insert_data(purple_xmlnode_new_child(tunenode, "track"),tuneinfo->track,-1); } jabber_pep_publish(js, publish); diff --git a/libpurple/protocols/jabber/xdata.c b/libpurple/protocols/jabber/xdata.c index e681694396..e31ad1e4a3 100644 --- a/libpurple/protocols/jabber/xdata.c +++ b/libpurple/protocols/jabber/xdata.c @@ -47,7 +47,7 @@ struct jabber_x_data_data { }; static void jabber_x_data_ok_cb(struct jabber_x_data_data *data, PurpleRequestFields *fields) { - xmlnode *result = xmlnode_new("x"); + PurpleXmlNode *result = purple_xmlnode_new("x"); jabber_x_data_action_cb cb = data->cb; gpointer user_data = data->user_data; JabberStream *js = data->js; @@ -55,8 +55,8 @@ static void jabber_x_data_ok_cb(struct jabber_x_data_data *data, PurpleRequestFi char *actionhandle = NULL; gboolean hasActions = (data->actions != NULL); - xmlnode_set_namespace(result, "jabber:x:data"); - xmlnode_set_attrib(result, "type", "submit"); + purple_xmlnode_set_namespace(result, "jabber:x:data"); + purple_xmlnode_set_attrib(result, "type", "submit"); for(groups = purple_request_fields_get_groups(fields); groups; groups = groups->next) { if(groups->data == data->actiongroup) { @@ -73,7 +73,7 @@ static void jabber_x_data_ok_cb(struct jabber_x_data_data *data, PurpleRequestFi continue; } for(flds = purple_request_field_group_get_fields(groups->data); flds; flds = flds->next) { - xmlnode *fieldnode, *valuenode; + PurpleXmlNode *fieldnode, *valuenode; PurpleRequestField *field = flds->data; const char *id = purple_request_field_get_id(field); jabber_x_data_field_type type = GPOINTER_TO_INT(g_hash_table_lookup(data->fields, id)); @@ -85,11 +85,11 @@ static void jabber_x_data_ok_cb(struct jabber_x_data_data *data, PurpleRequestFi const char *value = purple_request_field_string_get_value(field); if (value == NULL) break; - fieldnode = xmlnode_new_child(result, "field"); - xmlnode_set_attrib(fieldnode, "var", id); - valuenode = xmlnode_new_child(fieldnode, "value"); + fieldnode = purple_xmlnode_new_child(result, "field"); + purple_xmlnode_set_attrib(fieldnode, "var", id); + valuenode = purple_xmlnode_new_child(fieldnode, "value"); if(value) - xmlnode_insert_data(valuenode, value, -1); + purple_xmlnode_insert_data(valuenode, value, -1); break; } case JABBER_X_DATA_TEXT_MULTI: @@ -98,13 +98,13 @@ static void jabber_x_data_ok_cb(struct jabber_x_data_data *data, PurpleRequestFi const char *value = purple_request_field_string_get_value(field); if (value == NULL) break; - fieldnode = xmlnode_new_child(result, "field"); - xmlnode_set_attrib(fieldnode, "var", id); + fieldnode = purple_xmlnode_new_child(result, "field"); + purple_xmlnode_set_attrib(fieldnode, "var", id); pieces = g_strsplit(value, "\n", -1); for(p = pieces; *p != NULL; p++) { - valuenode = xmlnode_new_child(fieldnode, "value"); - xmlnode_insert_data(valuenode, *p, -1); + valuenode = purple_xmlnode_new_child(fieldnode, "value"); + purple_xmlnode_insert_data(valuenode, *p, -1); } g_strfreev(pieces); } @@ -114,26 +114,26 @@ static void jabber_x_data_ok_cb(struct jabber_x_data_data *data, PurpleRequestFi { GList *selected = purple_request_field_list_get_selected(field); char *value; - fieldnode = xmlnode_new_child(result, "field"); - xmlnode_set_attrib(fieldnode, "var", id); + fieldnode = purple_xmlnode_new_child(result, "field"); + purple_xmlnode_set_attrib(fieldnode, "var", id); while(selected) { value = purple_request_field_list_get_data(field, selected->data); - valuenode = xmlnode_new_child(fieldnode, "value"); + valuenode = purple_xmlnode_new_child(fieldnode, "value"); if(value) - xmlnode_insert_data(valuenode, value, -1); + purple_xmlnode_insert_data(valuenode, value, -1); selected = selected->next; } } break; case JABBER_X_DATA_BOOLEAN: - fieldnode = xmlnode_new_child(result, "field"); - xmlnode_set_attrib(fieldnode, "var", id); - valuenode = xmlnode_new_child(fieldnode, "value"); + fieldnode = purple_xmlnode_new_child(result, "field"); + purple_xmlnode_set_attrib(fieldnode, "var", id); + valuenode = purple_xmlnode_new_child(fieldnode, "value"); if(purple_request_field_bool_get_value(field)) - xmlnode_insert_data(valuenode, "1", -1); + purple_xmlnode_insert_data(valuenode, "1", -1); else - xmlnode_insert_data(valuenode, "0", -1); + purple_xmlnode_insert_data(valuenode, "0", -1); break; case JABBER_X_DATA_IGNORE: break; @@ -164,7 +164,7 @@ static void jabber_x_data_ok_cb(struct jabber_x_data_data *data, PurpleRequestFi } static void jabber_x_data_cancel_cb(struct jabber_x_data_data *data, PurpleRequestFields *fields) { - xmlnode *result = xmlnode_new("x"); + PurpleXmlNode *result = purple_xmlnode_new("x"); jabber_x_data_action_cb cb = data->cb; gpointer user_data = data->user_data; JabberStream *js = data->js; @@ -184,8 +184,8 @@ static void jabber_x_data_cancel_cb(struct jabber_x_data_data *data, PurpleReque } g_free(data); - xmlnode_set_namespace(result, "jabber:x:data"); - xmlnode_set_attrib(result, "type", "cancel"); + purple_xmlnode_set_namespace(result, "jabber:x:data"); + purple_xmlnode_set_attrib(result, "type", "cancel"); if (hasActions) cb(js, result, NULL, user_data); @@ -193,15 +193,15 @@ static void jabber_x_data_cancel_cb(struct jabber_x_data_data *data, PurpleReque ((jabber_x_data_cb)cb)(js, result, user_data); } -void *jabber_x_data_request(JabberStream *js, xmlnode *packet, jabber_x_data_cb cb, gpointer user_data) +void *jabber_x_data_request(JabberStream *js, PurpleXmlNode *packet, jabber_x_data_cb cb, gpointer user_data) { return jabber_x_data_request_with_actions(js, packet, NULL, 0, (jabber_x_data_action_cb)cb, user_data); } -void *jabber_x_data_request_with_actions(JabberStream *js, xmlnode *packet, GList *actions, int defaultaction, jabber_x_data_action_cb cb, gpointer user_data) +void *jabber_x_data_request_with_actions(JabberStream *js, PurpleXmlNode *packet, GList *actions, int defaultaction, jabber_x_data_action_cb cb, gpointer user_data) { void *handle; - xmlnode *fn, *x; + PurpleXmlNode *fn, *x; PurpleRequestFields *fields; PurpleRequestFieldGroup *group; PurpleRequestField *field = NULL; @@ -220,11 +220,11 @@ void *jabber_x_data_request_with_actions(JabberStream *js, xmlnode *packet, GLis group = purple_request_field_group_new(NULL); purple_request_fields_add_group(fields, group); - for(fn = xmlnode_get_child(packet, "field"); fn; fn = xmlnode_get_next_twin(fn)) { - xmlnode *valuenode; - const char *type = xmlnode_get_attrib(fn, "type"); - const char *label = xmlnode_get_attrib(fn, "label"); - const char *var = xmlnode_get_attrib(fn, "var"); + for(fn = purple_xmlnode_get_child(packet, "field"); fn; fn = purple_xmlnode_get_next_twin(fn)) { + PurpleXmlNode *valuenode; + const char *type = purple_xmlnode_get_attrib(fn, "type"); + const char *label = purple_xmlnode_get_attrib(fn, "label"); + const char *var = purple_xmlnode_get_attrib(fn, "var"); char *value = NULL; if(!type) @@ -236,8 +236,8 @@ void *jabber_x_data_request_with_actions(JabberStream *js, xmlnode *packet, GLis label = var; if(!strcmp(type, "text-private")) { - if((valuenode = xmlnode_get_child(fn, "value"))) - value = xmlnode_get_data(valuenode); + if((valuenode = purple_xmlnode_get_child(fn, "value"))) + value = purple_xmlnode_get_data(valuenode); field = purple_request_field_string_new(var, label, value ? value : "", FALSE); @@ -250,10 +250,10 @@ void *jabber_x_data_request_with_actions(JabberStream *js, xmlnode *packet, GLis } else if(!strcmp(type, "text-multi") || !strcmp(type, "jid-multi")) { GString *str = g_string_new(""); - for(valuenode = xmlnode_get_child(fn, "value"); valuenode; - valuenode = xmlnode_get_next_twin(valuenode)) { + for(valuenode = purple_xmlnode_get_child(fn, "value"); valuenode; + valuenode = purple_xmlnode_get_next_twin(valuenode)) { - if(!(value = xmlnode_get_data(valuenode))) + if(!(value = purple_xmlnode_get_data(valuenode))) continue; g_string_append_printf(str, "%s\n", value); @@ -268,7 +268,7 @@ void *jabber_x_data_request_with_actions(JabberStream *js, xmlnode *packet, GLis g_string_free(str, TRUE); } else if(!strcmp(type, "list-single") || !strcmp(type, "list-multi")) { - xmlnode *optnode; + PurpleXmlNode *optnode; GList *selected = NULL; field = purple_request_field_list_new(var, label); @@ -282,25 +282,25 @@ void *jabber_x_data_request_with_actions(JabberStream *js, xmlnode *packet, GLis GINT_TO_POINTER(JABBER_X_DATA_LIST_SINGLE)); } - for(valuenode = xmlnode_get_child(fn, "value"); valuenode; - valuenode = xmlnode_get_next_twin(valuenode)) { - char *data = xmlnode_get_data(valuenode); + for(valuenode = purple_xmlnode_get_child(fn, "value"); valuenode; + valuenode = purple_xmlnode_get_next_twin(valuenode)) { + char *data = purple_xmlnode_get_data(valuenode); if (data != NULL) { selected = g_list_prepend(selected, data); } } - for(optnode = xmlnode_get_child(fn, "option"); optnode; - optnode = xmlnode_get_next_twin(optnode)) { + for(optnode = purple_xmlnode_get_child(fn, "option"); optnode; + optnode = purple_xmlnode_get_next_twin(optnode)) { const char *lbl; - if(!(valuenode = xmlnode_get_child(optnode, "value"))) + if(!(valuenode = purple_xmlnode_get_child(optnode, "value"))) continue; - if(!(value = xmlnode_get_data(valuenode))) + if(!(value = purple_xmlnode_get_data(valuenode))) continue; - if(!(lbl = xmlnode_get_attrib(optnode, "label"))) + if(!(lbl = purple_xmlnode_get_attrib(optnode, "label"))) lbl = value; data->values = g_slist_prepend(data->values, value); @@ -319,8 +319,8 @@ void *jabber_x_data_request_with_actions(JabberStream *js, xmlnode *packet, GLis } else if(!strcmp(type, "boolean")) { gboolean def = FALSE; - if((valuenode = xmlnode_get_child(fn, "value"))) - value = xmlnode_get_data(valuenode); + if((valuenode = purple_xmlnode_get_child(fn, "value"))) + value = purple_xmlnode_get_data(valuenode); if(value && (!g_ascii_strcasecmp(value, "yes") || !g_ascii_strcasecmp(value, "true") || !g_ascii_strcasecmp(value, "1"))) @@ -333,8 +333,8 @@ void *jabber_x_data_request_with_actions(JabberStream *js, xmlnode *packet, GLis g_free(value); } else if(!strcmp(type, "fixed")) { - if((valuenode = xmlnode_get_child(fn, "value"))) - value = xmlnode_get_data(valuenode); + if((valuenode = purple_xmlnode_get_child(fn, "value"))) + value = purple_xmlnode_get_data(valuenode); if(value != NULL) { field = purple_request_field_label_new("", value); @@ -343,8 +343,8 @@ void *jabber_x_data_request_with_actions(JabberStream *js, xmlnode *packet, GLis g_free(value); } } else if(!strcmp(type, "hidden")) { - if((valuenode = xmlnode_get_child(fn, "value"))) - value = xmlnode_get_data(valuenode); + if((valuenode = purple_xmlnode_get_child(fn, "value"))) + value = purple_xmlnode_get_data(valuenode); field = purple_request_field_string_new(var, "", value ? value : "", FALSE); @@ -355,8 +355,8 @@ void *jabber_x_data_request_with_actions(JabberStream *js, xmlnode *packet, GLis g_free(value); } else { /* text-single, jid-single, and the default */ - if((valuenode = xmlnode_get_child(fn, "value"))) - value = xmlnode_get_data(valuenode); + if((valuenode = purple_xmlnode_get_child(fn, "value"))) + value = purple_xmlnode_get_data(valuenode); field = purple_request_field_string_new(var, label, value ? value : "", FALSE); @@ -372,7 +372,7 @@ void *jabber_x_data_request_with_actions(JabberStream *js, xmlnode *packet, GLis g_free(value); } - if(field && xmlnode_get_child(fn, "required")) + if(field && purple_xmlnode_get_child(fn, "required")) purple_request_field_set_required(field,TRUE); } @@ -393,11 +393,11 @@ void *jabber_x_data_request_with_actions(JabberStream *js, xmlnode *packet, GLis purple_request_field_group_add_field(group, actionfield); } - if((x = xmlnode_get_child(packet, "title"))) - title = xmlnode_get_data(x); + if((x = purple_xmlnode_get_child(packet, "title"))) + title = purple_xmlnode_get_data(x); - if((x = xmlnode_get_child(packet, "instructions"))) - instructions = xmlnode_get_data(x); + if((x = purple_xmlnode_get_child(packet, "instructions"))) + instructions = purple_xmlnode_get_data(x); handle = purple_request_fields(js->gc, title, title, instructions, fields, _("OK"), G_CALLBACK(jabber_x_data_ok_cb), @@ -412,19 +412,19 @@ void *jabber_x_data_request_with_actions(JabberStream *js, xmlnode *packet, GLis } gchar * -jabber_x_data_get_formtype(const xmlnode *form) +jabber_x_data_get_formtype(const PurpleXmlNode *form) { - xmlnode *field; + PurpleXmlNode *field; g_return_val_if_fail(form != NULL, NULL); - for (field = xmlnode_get_child((xmlnode *)form, "field"); field; - field = xmlnode_get_next_twin(field)) { - const char *var = xmlnode_get_attrib(field, "var"); + for (field = purple_xmlnode_get_child((PurpleXmlNode *)form, "field"); field; + field = purple_xmlnode_get_next_twin(field)) { + const char *var = purple_xmlnode_get_attrib(field, "var"); if (purple_strequal(var, "FORM_TYPE")) { - xmlnode *value = xmlnode_get_child(field, "value"); + PurpleXmlNode *value = purple_xmlnode_get_child(field, "value"); if (value) - return xmlnode_get_data(value); + return purple_xmlnode_get_data(value); else /* An interesting corner case... Looking for a second * FORM_TYPE would be more considerate, but I'm in favor diff --git a/libpurple/protocols/jabber/xdata.h b/libpurple/protocols/jabber/xdata.h index 7ebc50e008..855b0460c6 100644 --- a/libpurple/protocols/jabber/xdata.h +++ b/libpurple/protocols/jabber/xdata.h @@ -32,10 +32,10 @@ typedef struct _JabberXDataAction { char *handle; } JabberXDataAction; -typedef void (*jabber_x_data_cb)(JabberStream *js, xmlnode *result, gpointer user_data); -typedef void (*jabber_x_data_action_cb)(JabberStream *js, xmlnode *result, const char *actionhandle, gpointer user_data); -void *jabber_x_data_request(JabberStream *js, xmlnode *packet, jabber_x_data_cb cb, gpointer user_data); -void *jabber_x_data_request_with_actions(JabberStream *js, xmlnode *packet, GList *actions, int defaultaction, jabber_x_data_action_cb cb, gpointer user_data); +typedef void (*jabber_x_data_cb)(JabberStream *js, PurpleXmlNode *result, gpointer user_data); +typedef void (*jabber_x_data_action_cb)(JabberStream *js, PurpleXmlNode *result, const char *actionhandle, gpointer user_data); +void *jabber_x_data_request(JabberStream *js, PurpleXmlNode *packet, jabber_x_data_cb cb, gpointer user_data); +void *jabber_x_data_request_with_actions(JabberStream *js, PurpleXmlNode *packet, GList *actions, int defaultaction, jabber_x_data_action_cb cb, gpointer user_data); /* * Return the form type (the CDATA of the value child of the FORM_TYPE @@ -47,9 +47,9 @@ void *jabber_x_data_request_with_actions(JabberStream *js, xmlnode *packet, GLis * </field> * </x> * - * @param form The xmlnode for the form (the 'x' element) + * @param form The PurpleXmlNode for the form (the 'x' element) * @returns The FORM_TYPE. Must be freed by caller. */ -gchar *jabber_x_data_get_formtype(const xmlnode *form); +gchar *jabber_x_data_get_formtype(const PurpleXmlNode *form); #endif /* PURPLE_JABBER_XDATA_H_ */ diff --git a/libpurple/protocols/msn/contact.c b/libpurple/protocols/msn/contact.c index 375b4a6855..6e9b91edbc 100644 --- a/libpurple/protocols/msn/contact.c +++ b/libpurple/protocols/msn/contact.c @@ -96,7 +96,7 @@ msn_callback_state_free(MsnCallbackState *state) g_free(state->old_group_name); g_free(state->new_group_name); g_free(state->guid); - xmlnode_free(state->body); + purple_xmlnode_free(state->body); g_free(state); } @@ -203,9 +203,9 @@ msn_contact_request_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) { MsnCallbackState *state = data; - xmlnode *fault; + PurpleXmlNode *fault; char *faultcode_str; - xmlnode *cachekey; + PurpleXmlNode *cachekey; char *changed; if (resp == NULL) { @@ -218,13 +218,13 @@ msn_contact_request_cb(MsnSoapMessage *req, MsnSoapMessage *resp, } /* Update CacheKey if necessary */ - cachekey = xmlnode_get_child(msn_soap_message_get_xml(resp), "Header/ServiceHeader/CacheKeyChanged"); + cachekey = purple_xmlnode_get_child(msn_soap_message_get_xml(resp), "Header/ServiceHeader/CacheKeyChanged"); if (cachekey != NULL) { - changed = xmlnode_get_data(cachekey); + changed = purple_xmlnode_get_data(cachekey); if (changed && !strcmp(changed, "true")) { - cachekey = xmlnode_get_child(msn_soap_message_get_xml(resp), "Header/ServiceHeader/CacheKey"); + cachekey = purple_xmlnode_get_child(msn_soap_message_get_xml(resp), "Header/ServiceHeader/CacheKey"); g_free(state->session->abch_cachekey); - state->session->abch_cachekey = xmlnode_get_data(cachekey); + state->session->abch_cachekey = purple_xmlnode_get_data(cachekey); purple_debug_info("msn", "Updated CacheKey for %s to '%s'.\n", purple_account_get_username(state->session->account), state->session->abch_cachekey); @@ -232,7 +232,7 @@ msn_contact_request_cb(MsnSoapMessage *req, MsnSoapMessage *resp, g_free(changed); } - fault = xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/Fault"); + fault = purple_xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/Fault"); if (fault == NULL) { /* No errors */ @@ -242,7 +242,7 @@ msn_contact_request_cb(MsnSoapMessage *req, MsnSoapMessage *resp, return; } - faultcode_str = xmlnode_get_data(xmlnode_get_child(fault, "faultcode")); + faultcode_str = purple_xmlnode_get_data(purple_xmlnode_get_child(fault, "faultcode")); if (faultcode_str && g_str_equal(faultcode_str, "q0:BadContextToken")) { purple_debug_info("msn", @@ -259,7 +259,7 @@ msn_contact_request_cb(MsnSoapMessage *req, MsnSoapMessage *resp, state->cb(req, resp, data); } else { /* We don't know how to respond to this faultcode, so log it */ - char *str = xmlnode_to_str(fault, NULL); + char *str = purple_xmlnode_to_str(fault, NULL); purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", msn_contact_operation_str(state->action), str); g_free(str); @@ -273,23 +273,23 @@ msn_contact_request_cb(MsnSoapMessage *req, MsnSoapMessage *resp, static gboolean msn_contact_request(MsnCallbackState *state) { - xmlnode *cachekey = xmlnode_get_child(state->body, + PurpleXmlNode *cachekey = purple_xmlnode_get_child(state->body, "Header/ABApplicationHeader/CacheKey"); if (cachekey != NULL) - xmlnode_free(cachekey); + purple_xmlnode_free(cachekey); if (state->session->abch_cachekey != NULL) { - cachekey = xmlnode_new_child(xmlnode_get_child(state->body, "Header/ABApplicationHeader"), "CacheKey"); - xmlnode_insert_data(cachekey, state->session->abch_cachekey, -1); + cachekey = purple_xmlnode_new_child(purple_xmlnode_get_child(state->body, "Header/ABApplicationHeader"), "CacheKey"); + purple_xmlnode_insert_data(cachekey, state->session->abch_cachekey, -1); } if (state->token == NULL) - state->token = xmlnode_get_child(state->body, + state->token = purple_xmlnode_get_child(state->body, "Header/ABAuthHeader/TicketToken"); /* delete old & replace with new token */ - xmlnode_free(state->token->child); - xmlnode_insert_data(state->token, + purple_xmlnode_free(state->token->child); + purple_xmlnode_insert_data(state->token, msn_nexus_get_token_str(state->session->nexus, MSN_AUTH_CONTACTS), -1); msn_soap_service_send_message(state->session->soap, - msn_soap_message_new(state->post_action, xmlnode_copy(state->body)), + msn_soap_message_new(state->post_action, purple_xmlnode_copy(state->body)), MSN_CONTACT_SERVER, state->post_url, FALSE, msn_contact_request_cb, state); return FALSE; @@ -322,7 +322,7 @@ static void msn_create_address_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) { MsnCallbackState *state = data; - if (resp && xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/Fault") == NULL) { + if (resp && purple_xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/Fault") == NULL) { purple_debug_info("msn", "Address Book successfully created!\n"); msn_get_address_book(state->session, MSN_PS_INITIAL, NULL, NULL); } else { @@ -346,7 +346,7 @@ msn_create_address_book(MsnSession *session) session->user->passport); state = msn_callback_state_new(session); - state->body = xmlnode_from_str(body, -1); + state->body = purple_xmlnode_from_str(body, -1); state->post_action = MSN_ADD_ADDRESSBOOK_SOAP_ACTION; state->post_url = MSN_ADDRESS_BOOK_POST_URL; state->cb = msn_create_address_cb; @@ -356,33 +356,33 @@ msn_create_address_book(MsnSession *session) } static void -msn_parse_each_member(MsnSession *session, xmlnode *member, const char *node, +msn_parse_each_member(MsnSession *session, PurpleXmlNode *member, const char *node, MsnListId list) { char *passport; char *type; char *member_id; MsnUser *user; - xmlnode *annotation; + PurpleXmlNode *annotation; guint nid = MSN_NETWORK_UNKNOWN; char *invite = NULL; - passport = xmlnode_get_data(xmlnode_get_child(member, node)); + passport = purple_xmlnode_get_data(purple_xmlnode_get_child(member, node)); if (!msn_email_is_valid(passport)) { g_free(passport); return; } - type = xmlnode_get_data(xmlnode_get_child(member, "Type")); - member_id = xmlnode_get_data(xmlnode_get_child(member, "MembershipId")); + type = purple_xmlnode_get_data(purple_xmlnode_get_child(member, "Type")); + member_id = purple_xmlnode_get_data(purple_xmlnode_get_child(member, "MembershipId")); user = msn_userlist_find_add_user(session->userlist, passport, NULL); - for (annotation = xmlnode_get_child(member, "Annotations/Annotation"); + for (annotation = purple_xmlnode_get_child(member, "Annotations/Annotation"); annotation; - annotation = xmlnode_get_next_twin(annotation)) { - char *name = xmlnode_get_data(xmlnode_get_child(annotation, "Name")); - char *value = xmlnode_get_data(xmlnode_get_child(annotation, "Value")); + annotation = purple_xmlnode_get_next_twin(annotation)) { + char *name = purple_xmlnode_get_data(purple_xmlnode_get_child(annotation, "Name")); + char *value = purple_xmlnode_get_data(purple_xmlnode_get_child(annotation, "Value")); if (name && value) { if (!strcmp(name, "MSN.IM.BuddyType")) { nid = strtoul(value, NULL, 10); @@ -420,39 +420,39 @@ msn_parse_each_member(MsnSession *session, xmlnode *member, const char *node, } static void -msn_parse_each_service(MsnSession *session, xmlnode *service) +msn_parse_each_service(MsnSession *session, PurpleXmlNode *service) { - xmlnode *type; + PurpleXmlNode *type; - if ((type = xmlnode_get_child(service, "Info/Handle/Type"))) { - char *type_str = xmlnode_get_data(type); + if ((type = purple_xmlnode_get_child(service, "Info/Handle/Type"))) { + char *type_str = purple_xmlnode_get_data(type); if (g_str_equal(type_str, "Profile")) { /* Process Windows Live 'Messenger Roaming Identity' */ } else if (g_str_equal(type_str, "Messenger")) { - xmlnode *lastchange = xmlnode_get_child(service, "LastChange"); - char *lastchange_str = xmlnode_get_data(lastchange); - xmlnode *membership; + PurpleXmlNode *lastchange = purple_xmlnode_get_child(service, "LastChange"); + char *lastchange_str = purple_xmlnode_get_data(lastchange); + PurpleXmlNode *membership; purple_debug_info("msn", "CL last change: %s\n", lastchange_str); purple_account_set_string(session->account, "CLLastChange", lastchange_str); - for (membership = xmlnode_get_child(service, + for (membership = purple_xmlnode_get_child(service, "Memberships/Membership"); - membership; membership = xmlnode_get_next_twin(membership)) { + membership; membership = purple_xmlnode_get_next_twin(membership)) { - xmlnode *role = xmlnode_get_child(membership, "MemberRole"); - char *role_str = xmlnode_get_data(role); + PurpleXmlNode *role = purple_xmlnode_get_child(membership, "MemberRole"); + char *role_str = purple_xmlnode_get_data(role); MsnListId list = msn_get_memberrole(role_str); - xmlnode *member; + PurpleXmlNode *member; purple_debug_info("msn", "CL MemberRole role: %s, list: %d\n", role_str, list); - for (member = xmlnode_get_child(membership, "Members/Member"); - member; member = xmlnode_get_next_twin(member)) { - const char *member_type = xmlnode_get_attrib(member, "type"); + for (member = purple_xmlnode_get_child(membership, "Members/Member"); + member; member = purple_xmlnode_get_next_twin(member)) { + const char *member_type = purple_xmlnode_get_attrib(member, "type"); if (g_str_equal(member_type, "PassportMember")) { msn_parse_each_member(session, member, "PassportName", list); @@ -475,9 +475,9 @@ msn_parse_each_service(MsnSession *session, xmlnode *service) /*parse contact list*/ static gboolean -msn_parse_contact_list(MsnSession *session, xmlnode *node) +msn_parse_contact_list(MsnSession *session, PurpleXmlNode *node) { - xmlnode *fault, *faultnode; + PurpleXmlNode *fault, *faultnode; /* we may get a response if our cache data is too old: * @@ -486,15 +486,15 @@ msn_parse_contact_list(MsnSession *session, xmlnode *node) * * this is not handled yet */ - if ((fault = xmlnode_get_child(node, "Body/Fault"))) { - if ((faultnode = xmlnode_get_child(fault, "faultstring"))) { - char *faultstring = xmlnode_get_data(faultnode); + if ((fault = purple_xmlnode_get_child(node, "Body/Fault"))) { + if ((faultnode = purple_xmlnode_get_child(fault, "faultstring"))) { + char *faultstring = purple_xmlnode_get_data(faultnode); purple_debug_info("msn", "Retrieving contact list failed: %s\n", faultstring); g_free(faultstring); } - if ((faultnode = xmlnode_get_child(fault, "detail/errorcode"))) { - char *errorcode = xmlnode_get_data(faultnode); + if ((faultnode = purple_xmlnode_get_child(fault, "detail/errorcode"))) { + char *errorcode = purple_xmlnode_get_data(faultnode); if (g_str_equal(errorcode, "ABDoesNotExist")) { msn_create_address_book(session); @@ -508,11 +508,11 @@ msn_parse_contact_list(MsnSession *session, xmlnode *node) msn_get_contact_list(session, MSN_PS_INITIAL, NULL); return FALSE; } else { - xmlnode *service; + PurpleXmlNode *service; - for (service = xmlnode_get_child(node, "Body/FindMembershipResponse/" + for (service = purple_xmlnode_get_child(node, "Body/FindMembershipResponse/" "FindMembershipResult/Services/Service"); - service; service = xmlnode_get_next_twin(service)) { + service; service = purple_xmlnode_get_next_twin(service)) { msn_parse_each_service(session, service); } return TRUE; @@ -580,7 +580,7 @@ msn_get_contact_list(MsnSession *session, state = msn_callback_state_new(session); state->partner_scenario = partner_scenario; - state->body = xmlnode_from_str(body, -1); + state->body = purple_xmlnode_from_str(body, -1); state->post_action = MSN_GET_CONTACT_SOAP_ACTION; state->post_url = MSN_GET_CONTACT_POST_URL; state->cb = msn_get_contact_list_cb; @@ -591,21 +591,21 @@ msn_get_contact_list(MsnSession *session, } static void -msn_parse_addressbook_groups(MsnSession *session, xmlnode *node) +msn_parse_addressbook_groups(MsnSession *session, PurpleXmlNode *node) { - xmlnode *group; + PurpleXmlNode *group; purple_debug_info("msn", "msn_parse_addressbook_groups()\n"); - for(group = xmlnode_get_child(node, "Group"); group; - group = xmlnode_get_next_twin(group)){ - xmlnode *groupId, *groupInfo, *groupname; + for(group = purple_xmlnode_get_child(node, "Group"); group; + group = purple_xmlnode_get_next_twin(group)){ + PurpleXmlNode *groupId, *groupInfo, *groupname; char *group_id = NULL, *group_name = NULL; - if ((groupId = xmlnode_get_child(group, "groupId"))) - group_id = xmlnode_get_data(groupId); - if ((groupInfo = xmlnode_get_child(group, "groupInfo")) && (groupname = xmlnode_get_child(groupInfo, "name"))) - group_name = xmlnode_get_data(groupname); + if ((groupId = purple_xmlnode_get_child(group, "groupId"))) + group_id = purple_xmlnode_get_data(groupId); + if ((groupInfo = purple_xmlnode_get_child(group, "groupInfo")) && (groupname = purple_xmlnode_get_child(groupInfo, "name"))) + group_name = purple_xmlnode_get_data(groupname); if (group_id == NULL) { /* Group of ungroupped buddies */ @@ -626,42 +626,42 @@ msn_parse_addressbook_groups(MsnSession *session, xmlnode *node) } static gboolean -msn_parse_addressbook_mobile(xmlnode *contactInfo, char **inout_mobile_number) +msn_parse_addressbook_mobile(PurpleXmlNode *contactInfo, char **inout_mobile_number) { - xmlnode *phones; + PurpleXmlNode *phones; char *mobile_number = NULL; gboolean mobile = FALSE; *inout_mobile_number = NULL; - if ((phones = xmlnode_get_child(contactInfo, "phones"))) { - xmlnode *contact_phone; + if ((phones = purple_xmlnode_get_child(contactInfo, "phones"))) { + PurpleXmlNode *contact_phone; char *phone_type = NULL; - for (contact_phone = xmlnode_get_child(phones, "ContactPhone"); + for (contact_phone = purple_xmlnode_get_child(phones, "ContactPhone"); contact_phone; - contact_phone = xmlnode_get_next_twin(contact_phone)) { - xmlnode *contact_phone_type; + contact_phone = purple_xmlnode_get_next_twin(contact_phone)) { + PurpleXmlNode *contact_phone_type; if (!(contact_phone_type = - xmlnode_get_child(contact_phone, "contactPhoneType"))) + purple_xmlnode_get_child(contact_phone, "contactPhoneType"))) continue; - phone_type = xmlnode_get_data(contact_phone_type); + phone_type = purple_xmlnode_get_data(contact_phone_type); if (phone_type && !strcmp(phone_type, "ContactPhoneMobile")) { - xmlnode *number; + PurpleXmlNode *number; - if ((number = xmlnode_get_child(contact_phone, "number"))) { - xmlnode *messenger_enabled; + if ((number = purple_xmlnode_get_child(contact_phone, "number"))) { + PurpleXmlNode *messenger_enabled; char *is_messenger_enabled = NULL; g_free(mobile_number); - mobile_number = xmlnode_get_data(number); + mobile_number = purple_xmlnode_get_data(number); if (mobile_number && - (messenger_enabled = xmlnode_get_child(contact_phone, "isMessengerEnabled")) - && (is_messenger_enabled = xmlnode_get_data(messenger_enabled)) + (messenger_enabled = purple_xmlnode_get_child(contact_phone, "isMessengerEnabled")) + && (is_messenger_enabled = purple_xmlnode_get_data(messenger_enabled)) && !strcmp(is_messenger_enabled, "true")) mobile = TRUE; @@ -678,17 +678,17 @@ msn_parse_addressbook_mobile(xmlnode *contactInfo, char **inout_mobile_number) } static void -msn_parse_addressbook_contacts(MsnSession *session, xmlnode *node) +msn_parse_addressbook_contacts(MsnSession *session, PurpleXmlNode *node) { - xmlnode *contactNode; + PurpleXmlNode *contactNode; char *passport = NULL, *Name = NULL, *uid = NULL, *type = NULL, *mobile_number = NULL, *alias = NULL; gboolean mobile = FALSE; PurpleConnection *pc = purple_account_get_connection(session->account); - for(contactNode = xmlnode_get_child(node, "Contact"); contactNode; - contactNode = xmlnode_get_next_twin(contactNode)) { - xmlnode *contactId, *contactInfo, *contactType, *passportName, *displayName, *guid, *groupIds; - xmlnode *annotation; + for(contactNode = purple_xmlnode_get_child(node, "Contact"); contactNode; + contactNode = purple_xmlnode_get_next_twin(contactNode)) { + PurpleXmlNode *contactId, *contactInfo, *contactType, *passportName, *displayName, *guid, *groupIds; + PurpleXmlNode *annotation; MsnUser *user; g_free(passport); @@ -700,32 +700,32 @@ msn_parse_addressbook_contacts(MsnSession *session, xmlnode *node) passport = Name = uid = type = mobile_number = alias = NULL; mobile = FALSE; - if (!(contactId = xmlnode_get_child(contactNode,"contactId")) - || !(contactInfo = xmlnode_get_child(contactNode, "contactInfo")) - || !(contactType = xmlnode_get_child(contactInfo, "contactType"))) + if (!(contactId = purple_xmlnode_get_child(contactNode,"contactId")) + || !(contactInfo = purple_xmlnode_get_child(contactNode, "contactInfo")) + || !(contactType = purple_xmlnode_get_child(contactInfo, "contactType"))) continue; - uid = xmlnode_get_data(contactId); - type = xmlnode_get_data(contactType); + uid = purple_xmlnode_get_data(contactId); + type = purple_xmlnode_get_data(contactType); /* Find out our settings */ if (type && !strcmp(type, "Me")) { /* setup the Display Name */ if (purple_connection_get_display_name(pc) == NULL) { char *friendly = NULL; - if ((displayName = xmlnode_get_child(contactInfo, "displayName"))) - friendly = xmlnode_get_data(displayName); + if ((displayName = purple_xmlnode_get_child(contactInfo, "displayName"))) + friendly = purple_xmlnode_get_data(displayName); purple_connection_set_display_name(pc, friendly ? purple_url_decode(friendly) : NULL); g_free(friendly); } - for (annotation = xmlnode_get_child(contactInfo, "annotations/Annotation"); + for (annotation = purple_xmlnode_get_child(contactInfo, "annotations/Annotation"); annotation; - annotation = xmlnode_get_next_twin(annotation)) { + annotation = purple_xmlnode_get_next_twin(annotation)) { char *name, *value; - name = xmlnode_get_data(xmlnode_get_child(annotation, "Name")); - value = xmlnode_get_data(xmlnode_get_child(annotation, "Value")); + name = purple_xmlnode_get_data(purple_xmlnode_get_child(annotation, "Name")); + value = purple_xmlnode_get_data(purple_xmlnode_get_child(annotation, "Value")); if (name && g_str_equal(name, "MSN.IM.MPOP")) { if (!value || atoi(value) != 0) session->enable_mpop = TRUE; @@ -739,12 +739,12 @@ msn_parse_addressbook_contacts(MsnSession *session, xmlnode *node) continue; /* Not adding own account as buddy to buddylist */ } - passportName = xmlnode_get_child(contactInfo, "passportName"); + passportName = purple_xmlnode_get_child(contactInfo, "passportName"); if (passportName != NULL) { - xmlnode *messenger_user; + PurpleXmlNode *messenger_user; /* ignore non-messenger contacts */ - if ((messenger_user = xmlnode_get_child(contactInfo, "isMessengerUser"))) { - char *is_messenger_user = xmlnode_get_data(messenger_user); + if ((messenger_user = purple_xmlnode_get_child(contactInfo, "isMessengerUser"))) { + char *is_messenger_user = purple_xmlnode_get_data(messenger_user); if (is_messenger_user && !strcmp(is_messenger_user, "false")) { passportName = NULL; @@ -755,27 +755,27 @@ msn_parse_addressbook_contacts(MsnSession *session, xmlnode *node) } if (passportName == NULL) { - xmlnode *emailsNode, *contactEmailNode, *emailNode; - xmlnode *messengerEnabledNode; + PurpleXmlNode *emailsNode, *contactEmailNode, *emailNode; + PurpleXmlNode *messengerEnabledNode; char *msnEnabled; /*TODO: add it to the non-instant Messenger group and recognize as email Membership*/ /* Yahoo/Federated User? */ - emailsNode = xmlnode_get_child(contactInfo, "emails"); + emailsNode = purple_xmlnode_get_child(contactInfo, "emails"); if (emailsNode == NULL) { /*TODO: need to support the Mobile type*/ continue; } - for (contactEmailNode = xmlnode_get_child(emailsNode, "ContactEmail"); + for (contactEmailNode = purple_xmlnode_get_child(emailsNode, "ContactEmail"); contactEmailNode; - contactEmailNode = xmlnode_get_next_twin(contactEmailNode)) { - if ((messengerEnabledNode = xmlnode_get_child(contactEmailNode, "isMessengerEnabled"))) { + contactEmailNode = purple_xmlnode_get_next_twin(contactEmailNode)) { + if ((messengerEnabledNode = purple_xmlnode_get_child(contactEmailNode, "isMessengerEnabled"))) { - msnEnabled = xmlnode_get_data(messengerEnabledNode); + msnEnabled = purple_xmlnode_get_data(messengerEnabledNode); if (msnEnabled && !strcmp(msnEnabled, "true")) { - if ((emailNode = xmlnode_get_child(contactEmailNode, "email"))) - passport = xmlnode_get_data(emailNode); + if ((emailNode = purple_xmlnode_get_child(contactEmailNode, "email"))) + passport = purple_xmlnode_get_data(emailNode); /* Messenger enabled, Get the Passport*/ purple_debug_info("msn", "AB Yahoo/Federated User %s\n", passport ? passport : "(null)"); @@ -787,7 +787,7 @@ msn_parse_addressbook_contacts(MsnSession *session, xmlnode *node) } } } else { - passport = xmlnode_get_data(passportName); + passport = purple_xmlnode_get_data(passportName); } /* Couldn't find anything */ @@ -797,20 +797,20 @@ msn_parse_addressbook_contacts(MsnSession *session, xmlnode *node) if (!msn_email_is_valid(passport)) continue; - if ((displayName = xmlnode_get_child(contactInfo, "displayName"))) - Name = xmlnode_get_data(displayName); + if ((displayName = purple_xmlnode_get_child(contactInfo, "displayName"))) + Name = purple_xmlnode_get_data(displayName); else Name = g_strdup(passport); - for (annotation = xmlnode_get_child(contactInfo, "annotations/Annotation"); + for (annotation = purple_xmlnode_get_child(contactInfo, "annotations/Annotation"); annotation; - annotation = xmlnode_get_next_twin(annotation)) { + annotation = purple_xmlnode_get_next_twin(annotation)) { char *name; - name = xmlnode_get_data(xmlnode_get_child(annotation, "Name")); + name = purple_xmlnode_get_data(purple_xmlnode_get_child(annotation, "Name")); if (!name) continue; if (!strcmp(name, "AB.NickName")) - alias = xmlnode_get_data(xmlnode_get_child(annotation, "Value")); + alias = purple_xmlnode_get_data(purple_xmlnode_get_child(annotation, "Value")); else if (!strcmp(name, "MSN.IM.HasSharedFolder")) ; /* Do nothing yet... */ else if (!strcmp(name, "AB.Spouse")) @@ -833,11 +833,11 @@ msn_parse_addressbook_contacts(MsnSession *session, xmlnode *node) msn_user_set_uid(user, uid); msn_user_set_mobile_phone(user, mobile_number); - groupIds = xmlnode_get_child(contactInfo, "groupIds"); + groupIds = purple_xmlnode_get_child(contactInfo, "groupIds"); if (groupIds) { - for (guid = xmlnode_get_child(groupIds, "guid"); guid; - guid = xmlnode_get_next_twin(guid)) { - char *group_id = xmlnode_get_data(guid); + for (guid = purple_xmlnode_get_child(groupIds, "guid"); guid; + guid = purple_xmlnode_get_next_twin(guid)) { + char *group_id = purple_xmlnode_get_data(guid); msn_user_add_group_id(user, group_id); purple_debug_misc("msn", "AB guid:%s\n", group_id ? group_id : "(null)"); g_free(group_id); @@ -869,41 +869,41 @@ msn_parse_addressbook_contacts(MsnSession *session, xmlnode *node) } static void -msn_parse_addressbook_circles(MsnSession *session, xmlnode *node) +msn_parse_addressbook_circles(MsnSession *session, PurpleXmlNode *node) { - xmlnode *ticket; + PurpleXmlNode *ticket; /* TODO: Parse groups */ - ticket = xmlnode_get_child(node, "CircleTicket"); + ticket = purple_xmlnode_get_child(node, "CircleTicket"); if (ticket) { - char *data = xmlnode_get_data(ticket); + char *data = purple_xmlnode_get_data(ticket); msn_notification_send_circle_auth(session, data); g_free(data); } } static gboolean -msn_parse_addressbook(MsnSession *session, xmlnode *node) +msn_parse_addressbook(MsnSession *session, PurpleXmlNode *node) { - xmlnode *result; - xmlnode *groups; - xmlnode *contacts; - xmlnode *abNode; - xmlnode *circleNode; - xmlnode *fault; - - if ((fault = xmlnode_get_child(node, "Body/Fault"))) { - xmlnode *faultnode; - - if ((faultnode = xmlnode_get_child(fault, "faultstring"))) { - gchar *faultstring = xmlnode_get_data(faultnode); + PurpleXmlNode *result; + PurpleXmlNode *groups; + PurpleXmlNode *contacts; + PurpleXmlNode *abNode; + PurpleXmlNode *circleNode; + PurpleXmlNode *fault; + + if ((fault = purple_xmlnode_get_child(node, "Body/Fault"))) { + PurpleXmlNode *faultnode; + + if ((faultnode = purple_xmlnode_get_child(fault, "faultstring"))) { + gchar *faultstring = purple_xmlnode_get_data(faultnode); purple_debug_info("msn", "AB Faultstring: %s\n", faultstring); g_free(faultstring); } - if ((faultnode = xmlnode_get_child(fault, "detail/errorcode"))) { - gchar *errorcode = xmlnode_get_data(faultnode); + if ((faultnode = purple_xmlnode_get_child(fault, "detail/errorcode"))) { + gchar *errorcode = purple_xmlnode_get_data(faultnode); purple_debug_info("msn", "AB Error Code: %s\n", errorcode); @@ -917,7 +917,7 @@ msn_parse_addressbook(MsnSession *session, xmlnode *node) return FALSE; } - result = xmlnode_get_child(node, "Body/ABFindContactsPagedResponse/ABFindContactsPagedResult"); + result = purple_xmlnode_get_child(node, "Body/ABFindContactsPagedResponse/ABFindContactsPagedResult"); if (result == NULL) { purple_debug_misc("msn", "Received no address book update\n"); return TRUE; @@ -926,7 +926,7 @@ msn_parse_addressbook(MsnSession *session, xmlnode *node) /* I don't see this "groups" tag documented on msnpiki, need to find out if they are really there, and update msnpiki */ /*Process Group List*/ - groups = xmlnode_get_child(result, "Groups"); + groups = purple_xmlnode_get_child(result, "Groups"); if (groups != NULL) { msn_parse_addressbook_groups(session, groups); } @@ -951,30 +951,30 @@ msn_parse_addressbook(MsnSession *session, xmlnode *node) /*Process contact List*/ purple_debug_info("msn", "Process contact list...\n"); - contacts = xmlnode_get_child(result, "Contacts"); + contacts = purple_xmlnode_get_child(result, "Contacts"); if (contacts != NULL) { msn_parse_addressbook_contacts(session, contacts); } - abNode = xmlnode_get_child(result, "Ab"); + abNode = purple_xmlnode_get_child(result, "Ab"); if (abNode != NULL) { - xmlnode *node2; + PurpleXmlNode *node2; char *tmp = NULL; - if ((node2 = xmlnode_get_child(abNode, "lastChange"))) - tmp = xmlnode_get_data(node2); + if ((node2 = purple_xmlnode_get_child(abNode, "lastChange"))) + tmp = purple_xmlnode_get_data(node2); purple_debug_info("msn", "AB lastchanged Time:{%s}\n", tmp ? tmp : "(null)"); purple_account_set_string(session->account, "ablastChange", tmp); g_free(tmp); tmp = NULL; - if ((node2 = xmlnode_get_child(abNode, "DynamicItemLastChanged"))) - tmp = xmlnode_get_data(node2); + if ((node2 = purple_xmlnode_get_child(abNode, "DynamicItemLastChanged"))) + tmp = purple_xmlnode_get_data(node2); purple_debug_info("msn", "AB DynamicItemLastChanged :{%s}\n", tmp ? tmp : "(null)"); purple_account_set_string(session->account, "DynamicItemLastChanged", tmp); g_free(tmp); } - circleNode = xmlnode_get_child(result, "CircleResult"); + circleNode = purple_xmlnode_get_child(result, "CircleResult"); if (circleNode != NULL) { msn_parse_addressbook_circles(session, circleNode); } @@ -1029,7 +1029,7 @@ msn_get_address_book(MsnSession *session, update_str ? update_str : ""); state = msn_callback_state_new(session); - state->body = xmlnode_from_str(body, -1); + state->body = purple_xmlnode_from_str(body, -1); state->post_action = MSN_GET_ADDRESS_SOAP_ACTION; state->post_url = MSN_ADDRESS_BOOK_POST_URL; state->cb = msn_get_address_cb; @@ -1052,16 +1052,16 @@ msn_add_contact_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, MsnUserList *userlist; MsnUser *user; - xmlnode *guid; + PurpleXmlNode *guid; - xmlnode *fault; + PurpleXmlNode *fault; g_return_if_fail(session != NULL); userlist = session->userlist; - fault = xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/Fault"); + fault = purple_xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/Fault"); if (fault != NULL) { - char *errorcode = xmlnode_get_data(xmlnode_get_child(fault, "detail/errorcode")); + char *errorcode = purple_xmlnode_get_data(purple_xmlnode_get_child(fault, "detail/errorcode")); if (errorcode && !strcmp(errorcode, "EmailDomainIsFederated")) { /* Do something special! */ purple_debug_error("msn", "Contact is from a federated domain, but don't know what to do yet!\n"); @@ -1078,7 +1078,7 @@ msn_add_contact_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, } else { /* We don't know how to respond to this faultcode, so log it */ - char *fault_str = xmlnode_to_str(fault, NULL); + char *fault_str = purple_xmlnode_to_str(fault, NULL); if (fault_str != NULL) { purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", msn_contact_operation_str(state->action), fault_str); @@ -1096,10 +1096,10 @@ msn_add_contact_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, user = msn_userlist_find_add_user(userlist, state->who, state->who); msn_user_add_group_id(user, state->guid); - guid = xmlnode_get_child(msn_soap_message_get_xml(resp), + guid = purple_xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/ABContactAddResponse/ABContactAddResult/guid"); if (guid != NULL) { - char *uid = xmlnode_get_data(guid); + char *uid = purple_xmlnode_get_data(guid); msn_user_set_uid(user, uid); purple_debug_info("msn", "Set %s guid to %s.\n", state->who, uid); g_free(uid); @@ -1133,7 +1133,7 @@ msn_add_contact(MsnSession *session, MsnCallbackState *state, const char *passpo } body = g_strdup_printf(MSN_ADD_CONTACT_TEMPLATE, contact_xml); - state->body = xmlnode_from_str(body, -1); + state->body = purple_xmlnode_from_str(body, -1); state->post_action = MSN_CONTACT_ADD_SOAP_ACTION; state->post_url = MSN_ADDRESS_BOOK_POST_URL; state->cb = msn_add_contact_read_cb; @@ -1150,14 +1150,14 @@ msn_add_contact_to_group_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, MsnCallbackState *state = data; MsnSession *session = state->session; MsnUserList *userlist; - xmlnode *fault; + PurpleXmlNode *fault; g_return_if_fail(session != NULL); userlist = session->userlist; - fault = xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/Fault"); + fault = purple_xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/Fault"); if (fault != NULL) { - char *errorcode = xmlnode_get_data(xmlnode_get_child(fault, "detail/errorcode")); + char *errorcode = purple_xmlnode_get_data(purple_xmlnode_get_child(fault, "detail/errorcode")); if (errorcode && !strcmp(errorcode, "EmailDomainIsFederated")) { /* Do something special! */ purple_debug_error("msn", "Contact is from a federated domain, but don't know what to do yet!\n"); @@ -1174,7 +1174,7 @@ msn_add_contact_to_group_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, } else { /* We don't know how to respond to this faultcode, so log it */ - char *fault_str = xmlnode_to_str(fault, NULL); + char *fault_str = purple_xmlnode_to_str(fault, NULL); if (fault_str != NULL) { purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", msn_contact_operation_str(state->action), fault_str); @@ -1193,11 +1193,11 @@ msn_add_contact_to_group_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, if (state->action & MSN_ADD_BUDDY) { MsnUser *user = msn_userlist_find_user(userlist, state->who); - xmlnode *guid = xmlnode_get_child(msn_soap_message_get_xml(resp), + PurpleXmlNode *guid = purple_xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/ABGroupContactAddResponse/ABGroupContactAddResult/guid"); if (guid != NULL) { - char *uid = xmlnode_get_data(guid); + char *uid = purple_xmlnode_get_data(guid); msn_user_set_uid(user, uid); purple_debug_info("msn", "Set %s guid to %s.\n", state->who, uid); g_free(uid); @@ -1294,7 +1294,7 @@ msn_add_contact_to_group(MsnSession *session, MsnCallbackState *state, body = g_strdup_printf(MSN_ADD_CONTACT_GROUP_TEMPLATE, groupId, contact_xml, invite); - state->body = xmlnode_from_str(body, -1); + state->body = purple_xmlnode_from_str(body, -1); state->post_action = MSN_ADD_CONTACT_GROUP_SOAP_ACTION; state->post_url = MSN_ADDRESS_BOOK_POST_URL; state->cb = msn_add_contact_to_group_read_cb; @@ -1312,12 +1312,12 @@ msn_delete_contact_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, MsnCallbackState *state = data; MsnUserList *userlist = state->session->userlist; MsnUser *user = msn_userlist_find_user_with_id(userlist, state->uid); - xmlnode *fault; + PurpleXmlNode *fault; /* We don't know how to respond to this faultcode, so log it */ - fault = xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/Fault"); + fault = purple_xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/Fault"); if (fault != NULL) { - char *fault_str = xmlnode_to_str(fault, NULL); + char *fault_str = purple_xmlnode_to_str(fault, NULL); purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", msn_contact_operation_str(state->action), fault_str); g_free(fault_str); @@ -1353,7 +1353,7 @@ msn_delete_contact(MsnSession *session, MsnUser *user) /* build SOAP request */ body = g_strdup_printf(MSN_DEL_CONTACT_TEMPLATE, contact_id_xml); - state->body = xmlnode_from_str(body, -1); + state->body = purple_xmlnode_from_str(body, -1); state->post_action = MSN_CONTACT_DEL_SOAP_ACTION; state->post_url = MSN_ADDRESS_BOOK_POST_URL; state->cb = msn_delete_contact_read_cb; @@ -1368,12 +1368,12 @@ msn_del_contact_from_group_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) { MsnCallbackState *state = data; - xmlnode *fault; + PurpleXmlNode *fault; /* We don't know how to respond to this faultcode, so log it */ - fault = xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/Fault"); + fault = purple_xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/Fault"); if (fault != NULL) { - char *fault_str = xmlnode_to_str(fault, NULL); + char *fault_str = purple_xmlnode_to_str(fault, NULL); purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", msn_contact_operation_str(state->action), fault_str); g_free(fault_str); @@ -1434,7 +1434,7 @@ msn_del_contact_from_group(MsnSession *session, const char *passport, const char contact_id_xml = g_strdup_printf(MSN_CONTACT_XML, passport); body = g_strdup_printf(MSN_CONTACT_DEL_GROUP_TEMPLATE, contact_id_xml, groupId); - state->body = xmlnode_from_str(body, -1); + state->body = purple_xmlnode_from_str(body, -1); state->post_action = MSN_CONTACT_DEL_GROUP_SOAP_ACTION; state->post_url = MSN_ADDRESS_BOOK_POST_URL; state->cb = msn_del_contact_from_group_read_cb; @@ -1450,12 +1450,12 @@ msn_update_contact_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) { MsnCallbackState *state = (MsnCallbackState *)data; - xmlnode *fault; + PurpleXmlNode *fault; /* We don't know how to respond to this faultcode, so log it */ - fault = xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/Fault"); + fault = purple_xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/Fault"); if (fault != NULL) { - char *fault_str = xmlnode_to_str(fault, NULL); + char *fault_str = purple_xmlnode_to_str(fault, NULL); purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", msn_contact_operation_str(state->action), fault_str); g_free(fault_str); @@ -1470,9 +1470,9 @@ void msn_update_contact(MsnSession *session, const char *passport, MsnContactUpdateType type, const char* value) { MsnCallbackState *state; - xmlnode *contact; - xmlnode *contact_info; - xmlnode *changes; + PurpleXmlNode *contact; + PurpleXmlNode *contact_info; + PurpleXmlNode *changes; MsnUser *user = NULL; purple_debug_info("msn", "Update contact information for %s with new %s: %s\n", @@ -1487,28 +1487,28 @@ msn_update_contact(MsnSession *session, const char *passport, MsnContactUpdateTy return; } - contact_info = xmlnode_new("contactInfo"); - changes = xmlnode_new("propertiesChanged"); + contact_info = purple_xmlnode_new("contactInfo"); + changes = purple_xmlnode_new("propertiesChanged"); switch (type) { - xmlnode *annotations; - xmlnode *display; - xmlnode *a, *n, *v; + PurpleXmlNode *annotations; + PurpleXmlNode *display; + PurpleXmlNode *a, *n, *v; case MSN_UPDATE_DISPLAY: - display = xmlnode_new_child(contact_info, "displayName"); - xmlnode_insert_data(display, value, -1); - xmlnode_insert_data(changes, "DisplayName", -1); + display = purple_xmlnode_new_child(contact_info, "displayName"); + purple_xmlnode_insert_data(display, value, -1); + purple_xmlnode_insert_data(changes, "DisplayName", -1); break; case MSN_UPDATE_ALIAS: - annotations = xmlnode_new_child(contact_info, "annotations"); - xmlnode_insert_data(changes, "Annotation ", -1); - - a = xmlnode_new_child(annotations, "Annotation"); - n = xmlnode_new_child(a, "Name"); - xmlnode_insert_data(n, "AB.NickName", -1); - v = xmlnode_new_child(a, "Value"); - xmlnode_insert_data(v, value, -1); + annotations = purple_xmlnode_new_child(contact_info, "annotations"); + purple_xmlnode_insert_data(changes, "Annotation ", -1); + + a = purple_xmlnode_new_child(annotations, "Annotation"); + n = purple_xmlnode_new_child(a, "Name"); + purple_xmlnode_insert_data(n, "AB.NickName", -1); + v = purple_xmlnode_new_child(a, "Value"); + purple_xmlnode_insert_data(v, value, -1); break; default: @@ -1517,27 +1517,27 @@ msn_update_contact(MsnSession *session, const char *passport, MsnContactUpdateTy state = msn_callback_state_new(session); - state->body = xmlnode_from_str(MSN_CONTACT_UPDATE_TEMPLATE, -1); + state->body = purple_xmlnode_from_str(MSN_CONTACT_UPDATE_TEMPLATE, -1); state->action = MSN_UPDATE_INFO; state->post_action = MSN_CONTACT_UPDATE_SOAP_ACTION; state->post_url = MSN_ADDRESS_BOOK_POST_URL; state->cb = msn_update_contact_read_cb; - contact = xmlnode_get_child(state->body, "Body/ABContactUpdate/contacts/Contact"); - xmlnode_insert_child(contact, contact_info); - xmlnode_insert_child(contact, changes); + contact = purple_xmlnode_get_child(state->body, "Body/ABContactUpdate/contacts/Contact"); + purple_xmlnode_insert_child(contact, contact_info); + purple_xmlnode_insert_child(contact, changes); - xmlnode_insert_data(xmlnode_get_child(state->body, + purple_xmlnode_insert_data(purple_xmlnode_get_child(state->body, "Header/ABApplicationHeader/PartnerScenario"), MsnSoapPartnerScenarioText[MSN_PS_SAVE_CONTACT], -1); if (user) { - xmlnode *contactId = xmlnode_new_child(contact, "contactId"); + PurpleXmlNode *contactId = purple_xmlnode_new_child(contact, "contactId"); msn_callback_state_set_uid(state, user->uid); - xmlnode_insert_data(contactId, state->uid, -1); + purple_xmlnode_insert_data(contactId, state->uid, -1); } else { - xmlnode *contactType = xmlnode_new_child(contact_info, "contactType"); - xmlnode_insert_data(contactType, "Me", -1); + PurpleXmlNode *contactType = purple_xmlnode_new_child(contact_info, "contactType"); + purple_xmlnode_insert_data(contactType, "Me", -1); } msn_contact_request(state); @@ -1548,12 +1548,12 @@ msn_annotate_contact_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) { MsnCallbackState *state = (MsnCallbackState *)data; - xmlnode *fault; + PurpleXmlNode *fault; /* We don't know how to respond to this faultcode, so log it */ - fault = xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/Fault"); + fault = purple_xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/Fault"); if (fault != NULL) { - char *fault_str = xmlnode_to_str(fault, NULL); + char *fault_str = purple_xmlnode_to_str(fault, NULL); purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", msn_contact_operation_str(state->action), fault_str); g_free(fault_str); @@ -1569,9 +1569,9 @@ msn_annotate_contact(MsnSession *session, const char *passport, ...) { va_list params; MsnCallbackState *state; - xmlnode *contact; - xmlnode *contact_info; - xmlnode *annotations; + PurpleXmlNode *contact; + PurpleXmlNode *contact_info; + PurpleXmlNode *annotations; MsnUser *user = NULL; g_return_if_fail(passport != NULL); @@ -1582,14 +1582,14 @@ msn_annotate_contact(MsnSession *session, const char *passport, ...) return; } - contact_info = xmlnode_new("contactInfo"); - annotations = xmlnode_new_child(contact_info, "annotations"); + contact_info = purple_xmlnode_new("contactInfo"); + annotations = purple_xmlnode_new_child(contact_info, "annotations"); va_start(params, passport); while (TRUE) { const char *name; const char *value; - xmlnode *a, *n, *v; + PurpleXmlNode *a, *n, *v; name = va_arg(params, const char *); if (!name) @@ -1599,36 +1599,36 @@ msn_annotate_contact(MsnSession *session, const char *passport, ...) if (!value) break; - a = xmlnode_new_child(annotations, "Annotation"); - n = xmlnode_new_child(a, "Name"); - xmlnode_insert_data(n, name, -1); - v = xmlnode_new_child(a, "Value"); - xmlnode_insert_data(v, value, -1); + a = purple_xmlnode_new_child(annotations, "Annotation"); + n = purple_xmlnode_new_child(a, "Name"); + purple_xmlnode_insert_data(n, name, -1); + v = purple_xmlnode_new_child(a, "Value"); + purple_xmlnode_insert_data(v, value, -1); } va_end(params); state = msn_callback_state_new(session); - state->body = xmlnode_from_str(MSN_CONTACT_ANNOTATE_TEMPLATE, -1); + state->body = purple_xmlnode_from_str(MSN_CONTACT_ANNOTATE_TEMPLATE, -1); state->action = MSN_ANNOTATE_USER; state->post_action = MSN_CONTACT_ANNOTATE_SOAP_ACTION; state->post_url = MSN_ADDRESS_BOOK_POST_URL; state->cb = msn_annotate_contact_read_cb; - xmlnode_insert_data(xmlnode_get_child(state->body, + purple_xmlnode_insert_data(purple_xmlnode_get_child(state->body, "Header/ABApplicationHeader/PartnerScenario"), MsnSoapPartnerScenarioText[MSN_PS_SAVE_CONTACT], -1); - contact = xmlnode_get_child(state->body, "Body/ABContactUpdate/contacts/Contact"); - xmlnode_insert_child(contact, contact_info); + contact = purple_xmlnode_get_child(state->body, "Body/ABContactUpdate/contacts/Contact"); + purple_xmlnode_insert_child(contact, contact_info); if (user) { - xmlnode *contactId = xmlnode_new_child(contact, "contactId"); + PurpleXmlNode *contactId = purple_xmlnode_new_child(contact, "contactId"); msn_callback_state_set_uid(state, user->uid); - xmlnode_insert_data(contactId, state->uid, -1); + purple_xmlnode_insert_data(contactId, state->uid, -1); } else { - xmlnode *contactType = xmlnode_new_child(contact_info, "contactType"); - xmlnode_insert_data(contactType, "Me", -1); + PurpleXmlNode *contactType = purple_xmlnode_new_child(contact_info, "contactType"); + purple_xmlnode_insert_data(contactType, "Me", -1); } msn_contact_request(state); @@ -1640,12 +1640,12 @@ msn_del_contact_from_list_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, { MsnCallbackState *state = data; MsnSession *session = state->session; - xmlnode *fault; + PurpleXmlNode *fault; /* We don't know how to respond to this faultcode, so log it */ - fault = xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/Fault"); + fault = purple_xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/Fault"); if (fault != NULL) { - char *fault_str = xmlnode_to_str(fault, NULL); + char *fault_str = purple_xmlnode_to_str(fault, NULL); purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", msn_contact_operation_str(state->action), fault_str); g_free(fault_str); @@ -1723,7 +1723,7 @@ msn_del_contact_from_list(MsnSession *session, MsnCallbackState *state, MsnSoapPartnerScenarioText[partner_scenario], MsnMemberRole[list], member); - state->body = xmlnode_from_str(body, -1); + state->body = purple_xmlnode_from_str(body, -1); state->post_action = MSN_DELETE_MEMBER_FROM_LIST_SOAP_ACTION; state->post_url = MSN_SHARE_POST_URL; state->cb = msn_del_contact_from_list_read_cb; @@ -1738,12 +1738,12 @@ msn_add_contact_to_list_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) { MsnCallbackState *state = data; - xmlnode *fault; + PurpleXmlNode *fault; /* We don't know how to respond to this faultcode, so log it */ - fault = xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/Fault"); + fault = purple_xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/Fault"); if (fault != NULL) { - char *fault_str = xmlnode_to_str(fault, NULL); + char *fault_str = purple_xmlnode_to_str(fault, NULL); purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", msn_contact_operation_str(state->action), fault_str); g_free(fault_str); @@ -1807,7 +1807,7 @@ msn_add_contact_to_list(MsnSession *session, MsnCallbackState *state, MsnSoapPartnerScenarioText[partner_scenario], MsnMemberRole[list], member); - state->body = xmlnode_from_str(body, -1); + state->body = purple_xmlnode_from_str(body, -1); state->post_action = MSN_ADD_MEMBER_TO_LIST_SOAP_ACTION; state->post_url = MSN_SHARE_POST_URL; state->cb = msn_add_contact_to_list_read_cb; @@ -1833,7 +1833,7 @@ msn_get_gleams(MsnSession *session) purple_debug_info("msn", "msn get gleams info...\n"); state = msn_callback_state_new(session); - state->body = xmlnode_from_str(MSN_GLEAMS_TEMPLATE, -1); + state->body = purple_xmlnode_from_str(MSN_GLEAMS_TEMPLATE, -1); state->post_action = MSN_GET_GLEAMS_SOAP_ACTION; state->post_url = MSN_ADDRESS_BOOK_POST_URL; state->cb = msn_gleams_read_cb; @@ -1852,12 +1852,12 @@ msn_group_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) MsnCallbackState *state = data; MsnSession *session; MsnUserList *userlist; - xmlnode *fault; + PurpleXmlNode *fault; /* We don't know how to respond to this faultcode, so log it */ - fault = xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/Fault"); + fault = purple_xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/Fault"); if (fault != NULL) { - char *fault_str = xmlnode_to_str(fault, NULL); + char *fault_str = purple_xmlnode_to_str(fault, NULL); purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", msn_contact_operation_str(state->action), fault_str); g_free(fault_str); @@ -1882,11 +1882,11 @@ msn_group_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) /* the response is taken from http://telepathy.freedesktop.org/wiki/Pymsn/MSNP/ContactListActions should copy it to msnpiki some day */ - xmlnode *guid_node = xmlnode_get_child(msn_soap_message_get_xml(resp), + PurpleXmlNode *guid_node = purple_xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/ABGroupAddResponse/ABGroupAddResult/guid"); if (guid_node) { - char *guid = xmlnode_get_data(guid_node); + char *guid = purple_xmlnode_get_data(guid_node); /* create and add the new group to the userlist */ purple_debug_info("msn", "Adding group %s with guid = %s to the userlist\n", state->new_group_name, guid); @@ -1945,7 +1945,7 @@ msn_add_group(MsnSession *session, MsnCallbackState *state, const char* group_na escaped_group_name = g_markup_escape_text(group_name, -1); body = g_strdup_printf(MSN_GROUP_ADD_TEMPLATE, escaped_group_name); - state->body = xmlnode_from_str(body, -1); + state->body = purple_xmlnode_from_str(body, -1); state->post_action = MSN_GROUP_ADD_SOAP_ACTION; state->post_url = MSN_ADDRESS_BOOK_POST_URL; state->cb = msn_group_read_cb; @@ -1989,7 +1989,7 @@ msn_del_group(MsnSession *session, const gchar *group_name) body = g_strdup_printf(MSN_GROUP_DEL_TEMPLATE, guid); - state->body = xmlnode_from_str(body, -1); + state->body = purple_xmlnode_from_str(body, -1); state->post_action = MSN_GROUP_DEL_SOAP_ACTION; state->post_url = MSN_ADDRESS_BOOK_POST_URL; state->cb = msn_group_read_cb; @@ -2033,7 +2033,7 @@ msn_contact_rename_group(MsnSession *session, const char *old_group_name, const escaped_group_name = g_markup_escape_text(new_group_name, -1); body = g_strdup_printf(MSN_GROUP_RENAME_TEMPLATE, guid, escaped_group_name); - state->body = xmlnode_from_str(body, -1); + state->body = purple_xmlnode_from_str(body, -1); state->post_action = MSN_GROUP_RENAME_SOAP_ACTION; state->post_url = MSN_ADDRESS_BOOK_POST_URL; state->cb = msn_group_read_cb; diff --git a/libpurple/protocols/msn/contact.h b/libpurple/protocols/msn/contact.h index 33985281a4..c204afd5a7 100644 --- a/libpurple/protocols/msn/contact.h +++ b/libpurple/protocols/msn/contact.h @@ -684,8 +684,8 @@ struct _MsnCallbackState MsnListId list_id; MsnCallbackAction action; MsnSession *session; - xmlnode *body; - xmlnode *token; + PurpleXmlNode *body; + PurpleXmlNode *token; const gchar *post_action; const gchar *post_url; MsnSoapCallback cb; diff --git a/libpurple/protocols/msn/nexus.c b/libpurple/protocols/msn/nexus.c index de61681fd8..9ee314ff7c 100644 --- a/libpurple/protocols/msn/nexus.c +++ b/libpurple/protocols/msn/nexus.c @@ -250,21 +250,21 @@ struct _MsnNexusUpdateCallback { }; static gboolean -nexus_parse_token(MsnNexus *nexus, int id, xmlnode *node) +nexus_parse_token(MsnNexus *nexus, int id, PurpleXmlNode *node) { char *token_str, *expiry_str; const char *id_str; char **elems, **cur, **tokens; - xmlnode *token = xmlnode_get_child(node, "RequestedSecurityToken/BinarySecurityToken"); - xmlnode *secret = xmlnode_get_child(node, "RequestedProofToken/BinarySecret"); - xmlnode *expires = xmlnode_get_child(node, "LifeTime/Expires"); + PurpleXmlNode *token = purple_xmlnode_get_child(node, "RequestedSecurityToken/BinarySecurityToken"); + PurpleXmlNode *secret = purple_xmlnode_get_child(node, "RequestedProofToken/BinarySecret"); + PurpleXmlNode *expires = purple_xmlnode_get_child(node, "LifeTime/Expires"); if (!token) return FALSE; /* Use the ID that the server sent us */ if (id == -1) { - id_str = xmlnode_get_attrib(token, "Id"); + id_str = purple_xmlnode_get_attrib(token, "Id"); if (id_str == NULL) return FALSE; @@ -273,7 +273,7 @@ nexus_parse_token(MsnNexus *nexus, int id, xmlnode *node) return FALSE; /* Where did this come from? */ } - token_str = xmlnode_get_data(token); + token_str = purple_xmlnode_get_data(token); if (token_str == NULL) return FALSE; @@ -291,12 +291,12 @@ nexus_parse_token(MsnNexus *nexus, int id, xmlnode *node) g_free(token_str); if (secret) - nexus->tokens[id].secret = xmlnode_get_data(secret); + nexus->tokens[id].secret = purple_xmlnode_get_data(secret); else nexus->tokens[id].secret = NULL; /* Yay for MS using ISO-8601 */ - expiry_str = xmlnode_get_data(expires); + expiry_str = purple_xmlnode_get_data(expires); nexus->tokens[id].expiry = purple_str_to_time(expiry_str, FALSE, NULL, NULL, NULL); g_free(expiry_str); @@ -308,30 +308,30 @@ nexus_parse_token(MsnNexus *nexus, int id, xmlnode *node) } static gboolean -nexus_parse_collection(MsnNexus *nexus, int id, xmlnode *collection) +nexus_parse_collection(MsnNexus *nexus, int id, PurpleXmlNode *collection) { - xmlnode *node; + PurpleXmlNode *node; gboolean result; - node = xmlnode_get_child(collection, "RequestSecurityTokenResponse"); + node = purple_xmlnode_get_child(collection, "RequestSecurityTokenResponse"); if (!node) return FALSE; result = TRUE; for (; node && result; node = node->next) { - xmlnode *endpoint = xmlnode_get_child(node, "AppliesTo/EndpointReference/Address"); - char *address = xmlnode_get_data(endpoint); + PurpleXmlNode *endpoint = purple_xmlnode_get_child(node, "AppliesTo/EndpointReference/Address"); + char *address = purple_xmlnode_get_data(endpoint); if (g_str_equal(address, "http://Passport.NET/tb")) { /* This node contains the stuff for updating tokens. */ char *data; - xmlnode *cipher = xmlnode_get_child(node, "RequestedSecurityToken/EncryptedData/CipherData/CipherValue"); - xmlnode *secret = xmlnode_get_child(node, "RequestedProofToken/BinarySecret"); + PurpleXmlNode *cipher = purple_xmlnode_get_child(node, "RequestedSecurityToken/EncryptedData/CipherData/CipherValue"); + PurpleXmlNode *secret = purple_xmlnode_get_child(node, "RequestedProofToken/BinarySecret"); g_free(nexus->cipher); - nexus->cipher = xmlnode_get_data(cipher); - data = xmlnode_get_data(secret); + nexus->cipher = purple_xmlnode_get_data(cipher); + data = purple_xmlnode_get_data(secret); g_free(nexus->secret); nexus->secret = (char *)purple_base64_decode(data, NULL); g_free(data); @@ -359,7 +359,7 @@ nexus_got_response_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) } if (!nexus_parse_collection(nexus, -1, - xmlnode_get_child(msn_soap_message_get_xml(resp), + purple_xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/RequestSecurityTokenResponseCollection"))) { msn_session_set_error(session, MSN_ERROR_SERVCONN, _("Windows Live ID authentication:Invalid response")); return; @@ -415,7 +415,7 @@ msn_nexus_connect(MsnNexus *nexus) g_string_free(domains, TRUE); msn_soap_service_send_message(session->soap, - msn_soap_message_new(NULL, xmlnode_from_str(request, -1)), + msn_soap_message_new(NULL, purple_xmlnode_from_str(request, -1)), MSN_SSO_SERVER, SSO_POST_URL, TRUE, nexus_got_response_cb, nexus); g_free(request); @@ -427,7 +427,7 @@ nexus_got_update_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) MsnNexusUpdateData *ud = data; MsnNexus *nexus = ud->nexus; char iv[8] = {0,0,0,0,0,0,0,0}; - xmlnode *enckey; + PurpleXmlNode *enckey; char *tmp; char *nonce; gsize len; @@ -444,18 +444,18 @@ nexus_got_update_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) purple_debug_info("msn", "Got Update Response for %s.\n", ticket_domains[ud->id][SSO_VALID_TICKET_DOMAIN]); - enckey = xmlnode_get_child(msn_soap_message_get_xml(resp), "Header/Security/DerivedKeyToken"); + enckey = purple_xmlnode_get_child(msn_soap_message_get_xml(resp), "Header/Security/DerivedKeyToken"); while (enckey) { - if (g_str_equal(xmlnode_get_attrib(enckey, "Id"), "EncKey")) + if (g_str_equal(purple_xmlnode_get_attrib(enckey, "Id"), "EncKey")) break; - enckey = xmlnode_get_next_twin(enckey); + enckey = purple_xmlnode_get_next_twin(enckey); } if (!enckey) { purple_debug_error("msn", "Invalid response in token update.\n"); return; } - tmp = xmlnode_get_data(xmlnode_get_child(enckey, "Nonce")); + tmp = purple_xmlnode_get_data(purple_xmlnode_get_child(enckey, "Nonce")); nonce = (char *)purple_base64_decode(tmp, &len); key = rps_create_key(nexus->secret, 24, nonce, len); g_free(tmp); @@ -463,7 +463,7 @@ nexus_got_update_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) #if 0 /* Don't know what this is for yet */ - tmp = xmlnode_get_data(xmlnode_get_child(resp->xml, + tmp = purple_xmlnode_get_data(purple_xmlnode_get_child(resp->xml, "Header/EncryptedPP/EncryptedData/CipherData/CipherValue")); if (tmp) { decrypted_pp = des3_cbc(key, iv, tmp, len, TRUE); @@ -473,11 +473,11 @@ nexus_got_update_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) } #endif - tmp = xmlnode_get_data(xmlnode_get_child(msn_soap_message_get_xml(resp), + tmp = purple_xmlnode_get_data(purple_xmlnode_get_child(msn_soap_message_get_xml(resp), "Body/EncryptedData/CipherData/CipherValue")); if (tmp) { char *unescaped; - xmlnode *rstresponse; + PurpleXmlNode *rstresponse; unescaped = (char *)purple_base64_decode(tmp, &len); g_free(tmp); @@ -486,7 +486,7 @@ nexus_got_update_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) g_free(unescaped); purple_debug_info("msn", "Got Response Body EncryptedData: %s\n", decrypted_data); - rstresponse = xmlnode_from_str(decrypted_data, -1); + rstresponse = purple_xmlnode_from_str(decrypted_data, -1); if (g_str_equal(rstresponse->name, "RequestSecurityTokenResponse")) nexus_parse_token(nexus, ud->id, rstresponse); else @@ -632,7 +632,7 @@ msn_nexus_update_token(MsnNexus *nexus, int id, GSourceFunc cb, gpointer data) g_free(request); msn_soap_service_send_message(session->soap, - msn_soap_message_new(NULL, xmlnode_from_str(request, -1)), + msn_soap_message_new(NULL, purple_xmlnode_from_str(request, -1)), MSN_SSO_SERVER, SSO_POST_URL, TRUE, nexus_got_update_cb, ud); } diff --git a/libpurple/protocols/msn/notification.c b/libpurple/protocols/msn/notification.c index 37c99c9373..0eb3a800a7 100644 --- a/libpurple/protocols/msn/notification.c +++ b/libpurple/protocols/msn/notification.c @@ -434,11 +434,11 @@ typedef struct MsnFqyCbData { gpointer data; } MsnFqyCbData; -/* add contact to xmlnode */ +/* add contact to PurpleXmlNode */ static void -msn_add_contact_xml(xmlnode *mlNode, const char *passport, MsnListOp list_op, MsnNetwork networkId) +msn_add_contact_xml(PurpleXmlNode *mlNode, const char *passport, MsnListOp list_op, MsnNetwork networkId) { - xmlnode *d_node,*c_node; + PurpleXmlNode *d_node,*c_node; char **tokens; const char *email,*domain; char fmt_str[3]; @@ -457,9 +457,9 @@ msn_add_contact_xml(xmlnode *mlNode, const char *passport, MsnListOp list_op, Ms } /*find a domain Node*/ - for (d_node = xmlnode_get_child(mlNode, "d"); d_node; - d_node = xmlnode_get_next_twin(d_node)) { - const char *attr = xmlnode_get_attrib(d_node,"n"); + for (d_node = purple_xmlnode_get_child(mlNode, "d"); d_node; + d_node = purple_xmlnode_get_next_twin(d_node)) { + const char *attr = purple_xmlnode_get_attrib(d_node,"n"); if (attr == NULL) continue; if (!strcmp(attr, domain)) @@ -469,29 +469,29 @@ msn_add_contact_xml(xmlnode *mlNode, const char *passport, MsnListOp list_op, Ms if (d_node == NULL) { /*domain not found, create a new domain Node*/ purple_debug_info("msn", "Didn't find existing domain node, adding one.\n"); - d_node = xmlnode_new("d"); - xmlnode_set_attrib(d_node, "n", domain); - xmlnode_insert_child(mlNode, d_node); + d_node = purple_xmlnode_new("d"); + purple_xmlnode_set_attrib(d_node, "n", domain); + purple_xmlnode_insert_child(mlNode, d_node); } /*create contact node*/ - c_node = xmlnode_new("c"); - xmlnode_set_attrib(c_node, "n", email); + c_node = purple_xmlnode_new("c"); + purple_xmlnode_set_attrib(c_node, "n", email); if (list_op != 0) { purple_debug_info("msn", "list_op: %d\n", list_op); g_snprintf(fmt_str, sizeof(fmt_str), "%d", list_op); - xmlnode_set_attrib(c_node, "l", fmt_str); + purple_xmlnode_set_attrib(c_node, "l", fmt_str); } if (networkId != MSN_NETWORK_UNKNOWN) { g_snprintf(fmt_str, sizeof(fmt_str), "%d", networkId); /*mobile*/ /*type_str = g_strdup_printf("4");*/ - xmlnode_set_attrib(c_node, "t", fmt_str); + purple_xmlnode_set_attrib(c_node, "t", fmt_str); } - xmlnode_insert_child(d_node, c_node); + purple_xmlnode_insert_child(d_node, c_node); g_strfreev(tokens); } @@ -562,20 +562,20 @@ update_contact_network(MsnSession *session, const char *passport, MsnNetwork net /* TODO: Also figure out how to update membership lists */ user = msn_userlist_find_user(session->userlist, passport); if (user) { - xmlnode *adl_node; + PurpleXmlNode *adl_node; char *payload; int payload_len; msn_user_set_network(user, network); - adl_node = xmlnode_new("ml"); - xmlnode_set_attrib(adl_node, "l", "1"); + adl_node = purple_xmlnode_new("ml"); + purple_xmlnode_set_attrib(adl_node, "l", "1"); msn_add_contact_xml(adl_node, passport, user->list_op & MSN_LIST_OP_MASK, network); - payload = xmlnode_to_str(adl_node, &payload_len); + payload = purple_xmlnode_to_str(adl_node, &payload_len); msn_notification_post_adl(session->notification->cmdproc, payload, payload_len); g_free(payload); - xmlnode_free(adl_node); + purple_xmlnode_free(adl_node); } else { purple_debug_error("msn", "Got FQY update for unknown user %s on network %d.\n", @@ -589,8 +589,8 @@ msn_notification_dump_contact(MsnSession *session) { MsnUser *user; GList *l; - xmlnode *adl_node; - xmlnode *fqy_node; + PurpleXmlNode *adl_node; + PurpleXmlNode *fqy_node; char *payload; int payload_len; int adl_count = 0; @@ -598,10 +598,10 @@ msn_notification_dump_contact(MsnSession *session) PurpleConnection *pc; const char *display_name; - adl_node = xmlnode_new("ml"); + adl_node = purple_xmlnode_new("ml"); adl_node->child = NULL; - xmlnode_set_attrib(adl_node, "l", "1"); - fqy_node = xmlnode_new("ml"); + purple_xmlnode_set_attrib(adl_node, "l", "1"); + fqy_node = purple_xmlnode_new("ml"); /*get the userlist*/ for (l = session->userlist->users; l != NULL; l = l->next) { @@ -634,7 +634,7 @@ msn_notification_dump_contact(MsnSession *session) /* each ADL command may contain up to 150 contacts */ if (++adl_count % 150 == 0) { - payload = xmlnode_to_str(adl_node, &payload_len); + payload = purple_xmlnode_to_str(adl_node, &payload_len); /* ADL's are returned all-together */ session->adl_fqy++; @@ -646,11 +646,11 @@ msn_notification_dump_contact(MsnSession *session) payload, payload_len); g_free(payload); - xmlnode_free(adl_node); + purple_xmlnode_free(adl_node); - adl_node = xmlnode_new("ml"); + adl_node = purple_xmlnode_new("ml"); adl_node->child = NULL; - xmlnode_set_attrib(adl_node, "l", "1"); + purple_xmlnode_set_attrib(adl_node, "l", "1"); } } else { /* FQY's are returned one-at-a-time */ @@ -663,21 +663,21 @@ msn_notification_dump_contact(MsnSession *session) /* each FQY command may contain up to 150 contacts, probably */ if (++fqy_count % 150 == 0) { - payload = xmlnode_to_str(fqy_node, &payload_len); + payload = purple_xmlnode_to_str(fqy_node, &payload_len); msn_notification_send_fqy(session, payload, payload_len, update_contact_network, NULL); g_free(payload); - xmlnode_free(fqy_node); - fqy_node = xmlnode_new("ml"); + purple_xmlnode_free(fqy_node); + fqy_node = purple_xmlnode_new("ml"); } } } /* Send the rest, or just an empty one to let the server set us online */ if (adl_count == 0 || adl_count % 150 != 0) { - payload = xmlnode_to_str(adl_node, &payload_len); + payload = purple_xmlnode_to_str(adl_node, &payload_len); /* ADL's are returned all-together */ session->adl_fqy++; @@ -691,7 +691,7 @@ msn_notification_dump_contact(MsnSession *session) } if (fqy_count % 150 != 0) { - payload = xmlnode_to_str(fqy_node, &payload_len); + payload = purple_xmlnode_to_str(fqy_node, &payload_len); msn_notification_send_fqy(session, payload, payload_len, update_contact_network, NULL); @@ -699,8 +699,8 @@ msn_notification_dump_contact(MsnSession *session) g_free(payload); } - xmlnode_free(adl_node); - xmlnode_free(fqy_node); + purple_xmlnode_free(adl_node); + purple_xmlnode_free(fqy_node); msn_session_activate_login_timeout(session); @@ -723,30 +723,30 @@ static void adl_cmd_parse(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) { - xmlnode *root, *domain_node; + PurpleXmlNode *root, *domain_node; purple_debug_misc("msn", "Parsing received ADL XML data\n"); g_return_if_fail(payload != NULL); - root = xmlnode_from_str(payload, (gssize) len); + root = purple_xmlnode_from_str(payload, (gssize) len); if (root == NULL) { purple_debug_info("msn", "Invalid XML in ADL!\n"); return; } - for (domain_node = xmlnode_get_child(root, "d"); + for (domain_node = purple_xmlnode_get_child(root, "d"); domain_node; - domain_node = xmlnode_get_next_twin(domain_node)) { - xmlnode *contact_node = NULL; + domain_node = purple_xmlnode_get_next_twin(domain_node)) { + PurpleXmlNode *contact_node = NULL; - for (contact_node = xmlnode_get_child(domain_node, "c"); + for (contact_node = purple_xmlnode_get_child(domain_node, "c"); contact_node; - contact_node = xmlnode_get_next_twin(contact_node)) { + contact_node = purple_xmlnode_get_next_twin(contact_node)) { const gchar *list; gint list_op = 0; - list = xmlnode_get_attrib(contact_node, "l"); + list = purple_xmlnode_get_attrib(contact_node, "l"); if (list != NULL) { list_op = atoi(list); } @@ -758,7 +758,7 @@ adl_cmd_parse(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, } } - xmlnode_free(root); + purple_xmlnode_free(root); } static void @@ -805,26 +805,26 @@ adl_error_parse(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) in the local list, but not the server list, and that we should add those buddies to the addressbook. For now I will just notify the user about the raw payload, because I am lazy */ - xmlnode *adl = xmlnode_from_str(payload, len); + PurpleXmlNode *adl = purple_xmlnode_from_str(payload, len); GString *emails = g_string_new(NULL); - xmlnode *domain = xmlnode_get_child(adl, "d"); + PurpleXmlNode *domain = purple_xmlnode_get_child(adl, "d"); while (domain) { - const char *domain_str = xmlnode_get_attrib(domain, "n"); - xmlnode *contact = xmlnode_get_child(domain, "c"); + const char *domain_str = purple_xmlnode_get_attrib(domain, "n"); + PurpleXmlNode *contact = purple_xmlnode_get_child(domain, "c"); while (contact) { g_string_append_printf(emails, "%s@%s\n", - xmlnode_get_attrib(contact, "n"), domain_str); - contact = xmlnode_get_next_twin(contact); + purple_xmlnode_get_attrib(contact, "n"), domain_str); + contact = purple_xmlnode_get_next_twin(contact); } - domain = xmlnode_get_next_twin(domain); + domain = purple_xmlnode_get_next_twin(domain); } purple_notify_error(gc, NULL, _("The following users are missing from your addressbook"), emails->str); g_string_free(emails, TRUE); - xmlnode_free(adl); + purple_xmlnode_free(adl); } else { @@ -913,7 +913,7 @@ fqy_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) { MsnSession *session; - xmlnode *ml, *d, *c; + PurpleXmlNode *ml, *d, *c; const char *domain; const char *local; const char *type; @@ -924,16 +924,16 @@ fqy_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, /* FQY response: <ml><d n="domain.com"><c n="local-node" t="network" /></d></ml> */ - ml = xmlnode_from_str(payload, len); - for (d = xmlnode_get_child(ml, "d"); + ml = purple_xmlnode_from_str(payload, len); + for (d = purple_xmlnode_get_child(ml, "d"); d != NULL; - d = xmlnode_get_next_twin(d)) { - domain = xmlnode_get_attrib(d, "n"); - for (c = xmlnode_get_child(d, "c"); + d = purple_xmlnode_get_next_twin(d)) { + domain = purple_xmlnode_get_attrib(d, "n"); + for (c = purple_xmlnode_get_child(d, "c"); c != NULL; - c = xmlnode_get_next_twin(c)) { - local = xmlnode_get_attrib(c, "n"); - type = xmlnode_get_attrib(c, "t"); + c = purple_xmlnode_get_next_twin(c)) { + local = purple_xmlnode_get_attrib(c, "n"); + type = purple_xmlnode_get_attrib(c, "t"); passport = g_strdup_printf("%s@%s", local, domain); @@ -955,7 +955,7 @@ fqy_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, } } - xmlnode_free(ml); + purple_xmlnode_free(ml); } static void @@ -1130,7 +1130,7 @@ ipg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) const char *who = NULL; char *text = NULL; const char *id = NULL; - xmlnode *payloadNode, *from, *msg, *textNode; + PurpleXmlNode *payloadNode, *from, *msg, *textNode; purple_debug_misc("msn", "Incoming Page: {%s}\n", payload); @@ -1172,21 +1172,21 @@ ipg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) </NOTIFICATION> */ - payloadNode = xmlnode_from_str(payload, len); + payloadNode = purple_xmlnode_from_str(payload, len); if (!payloadNode) return; - if (!(from = xmlnode_get_child(payloadNode, "FROM")) || - !(msg = xmlnode_get_child(payloadNode, "MSG")) || - !(textNode = xmlnode_get_child(msg, "BODY/TEXT"))) { - xmlnode_free(payloadNode); + if (!(from = purple_xmlnode_get_child(payloadNode, "FROM")) || + !(msg = purple_xmlnode_get_child(payloadNode, "MSG")) || + !(textNode = purple_xmlnode_get_child(msg, "BODY/TEXT"))) { + purple_xmlnode_free(payloadNode); return; } - who = xmlnode_get_attrib(from, "name"); + who = purple_xmlnode_get_attrib(from, "name"); if (!who) return; - text = xmlnode_get_data(textNode); + text = purple_xmlnode_get_data(textNode); /* Match number to user's mobile number, FROM is a phone number if the other side page you using your phone number */ @@ -1198,7 +1198,7 @@ ipg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) who = user->passport; } - id = xmlnode_get_attrib(msg, "id"); + id = purple_xmlnode_get_attrib(msg, "id"); if (id && strcmp(id, "1")) { PurpleConversation *conv @@ -1213,7 +1213,7 @@ ipg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) purple_conversation_write(conv, NULL, error, PURPLE_MESSAGE_ERROR, time(NULL)); - if ((id = xmlnode_get_attrib(payloadNode, "id")) != NULL) { + if ((id = purple_xmlnode_get_attrib(payloadNode, "id")) != NULL) { unsigned int trId = atol(id); MsnTransaction *trans; @@ -1241,7 +1241,7 @@ ipg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) } g_free(text); - xmlnode_free(payloadNode); + purple_xmlnode_free(payloadNode); } static void @@ -1509,12 +1509,12 @@ gcf_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, { /* QuLogic: Disabled until confirmed correct. */ #if 0 - xmlnode *root; - xmlnode *policy; + PurpleXmlNode *root; + PurpleXmlNode *policy; g_return_if_fail(cmd->payload != NULL); - if ( (root = xmlnode_from_str(cmd->payload, cmd->payload_len)) == NULL) + if ( (root = purple_xmlnode_from_str(cmd->payload, cmd->payload_len)) == NULL) { purple_debug_error("msn", "Unable to parse GCF payload into a XML tree\n"); return; @@ -1525,28 +1525,28 @@ gcf_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, cmdproc->session->blocked_text = NULL; /* We need a get_child with attrib... */ - policy = xmlnode_get_child(root, "Policy"); + policy = purple_xmlnode_get_child(root, "Policy"); while (policy) { - if (g_str_equal(xmlnode_get_attrib(policy, "type"), "SHIELDS")) + if (g_str_equal(purple_xmlnode_get_attrib(policy, "type"), "SHIELDS")) break; - policy = xmlnode_get_next_twin(policy); + policy = purple_xmlnode_get_next_twin(policy); } if (policy) { GString *blocked = g_string_new(NULL); - xmlnode *imtext = xmlnode_get_child(policy, + PurpleXmlNode *imtext = purple_xmlnode_get_child(policy, "config/block/regexp/imtext"); while (imtext) { - const char *value = xmlnode_get_attrib(imtext, "value"); + const char *value = purple_xmlnode_get_attrib(imtext, "value"); g_string_append_printf(blocked, "%s<br/>\n", purple_base64_decode(value, NULL)); - imtext = xmlnode_get_next_twin(imtext); + imtext = purple_xmlnode_get_next_twin(imtext); } cmdproc->session->blocked_text = g_string_free(blocked, FALSE); } - xmlnode_free(root); + purple_xmlnode_free(root); #endif } @@ -1567,10 +1567,10 @@ sbs_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) } static void -parse_user_endpoints(MsnUser *user, xmlnode *payloadNode) +parse_user_endpoints(MsnUser *user, PurpleXmlNode *payloadNode) { MsnSession *session; - xmlnode *epNode, *capsNode; + PurpleXmlNode *epNode, *capsNode; MsnUserEndpoint data; const char *id; char *caps, *tmp; @@ -1582,11 +1582,11 @@ parse_user_endpoints(MsnUser *user, xmlnode *payloadNode) is_me = (user == session->user); msn_user_clear_endpoints(user); - for (epNode = xmlnode_get_child(payloadNode, "EndpointData"); + for (epNode = purple_xmlnode_get_child(payloadNode, "EndpointData"); epNode; - epNode = xmlnode_get_next_twin(epNode)) { - id = xmlnode_get_attrib(epNode, "id"); - capsNode = xmlnode_get_child(epNode, "Capabilities"); + epNode = purple_xmlnode_get_next_twin(epNode)) { + id = purple_xmlnode_get_attrib(epNode, "id"); + capsNode = purple_xmlnode_get_child(epNode, "Capabilities"); /* Disconnect others, if MPOP is disabled */ if (is_me @@ -1599,7 +1599,7 @@ parse_user_endpoints(MsnUser *user, xmlnode *payloadNode) g_free(tmp); } else { if (capsNode != NULL) { - caps = xmlnode_get_data(capsNode); + caps = purple_xmlnode_get_data(capsNode); data.clientid = strtoul(caps, &tmp, 10); if (tmp && *tmp) @@ -1618,11 +1618,11 @@ parse_user_endpoints(MsnUser *user, xmlnode *payloadNode) } if (is_me && session->enable_mpop) { - for (epNode = xmlnode_get_child(payloadNode, "PrivateEndpointData"); + for (epNode = purple_xmlnode_get_child(payloadNode, "PrivateEndpointData"); epNode; - epNode = xmlnode_get_next_twin(epNode)) { + epNode = purple_xmlnode_get_next_twin(epNode)) { MsnUserEndpoint *ep; - xmlnode *nameNode, *clientNode; + PurpleXmlNode *nameNode, *clientNode; /* <PrivateEndpointData id='{GUID}'> <EpName>Endpoint Name</EpName> @@ -1631,19 +1631,19 @@ parse_user_endpoints(MsnUser *user, xmlnode *payloadNode) <State>NLN</State> </PrivateEndpointData> */ - id = xmlnode_get_attrib(epNode, "id"); + id = purple_xmlnode_get_attrib(epNode, "id"); ep = msn_user_get_endpoint_data(user, id); if (ep != NULL) { - nameNode = xmlnode_get_child(epNode, "EpName"); + nameNode = purple_xmlnode_get_child(epNode, "EpName"); if (nameNode != NULL) { g_free(ep->name); - ep->name = xmlnode_get_data(nameNode); + ep->name = purple_xmlnode_get_data(nameNode); } - clientNode = xmlnode_get_child(epNode, "ClientType"); + clientNode = purple_xmlnode_get_child(epNode, "ClientType"); if (clientNode != NULL) { - tmp = xmlnode_get_data(clientNode); + tmp = purple_xmlnode_get_data(clientNode); ep->type = strtoul(tmp, NULL, 10); g_free(tmp); } @@ -1718,7 +1718,7 @@ ubx_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, MsnUser *user; char *passport; int network; - xmlnode *payloadNode; + PurpleXmlNode *payloadNode; char *psm_str, *str; session = cmdproc->session; @@ -1749,7 +1749,7 @@ ubx_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, } if (len != 0) { - payloadNode = xmlnode_from_str(payload, len); + payloadNode = purple_xmlnode_from_str(payload, len); if (!payloadNode) { purple_debug_error("msn", "UBX XML parse Error!\n"); @@ -1769,7 +1769,7 @@ ubx_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, parse_user_endpoints(user, payloadNode); - xmlnode_free(payloadNode); + purple_xmlnode_free(payloadNode); } else { msn_user_set_statusline(user, NULL); @@ -1819,48 +1819,48 @@ msn_notification_send_uux(MsnSession *session, const char *payload) void msn_notification_send_uux_endpointdata(MsnSession *session) { - xmlnode *epDataNode; - xmlnode *capNode; + PurpleXmlNode *epDataNode; + PurpleXmlNode *capNode; char *caps; char *payload; int length; - epDataNode = xmlnode_new("EndpointData"); + epDataNode = purple_xmlnode_new("EndpointData"); - capNode = xmlnode_new_child(epDataNode, "Capabilities"); + capNode = purple_xmlnode_new_child(epDataNode, "Capabilities"); caps = g_strdup_printf("%d:%02d", MSN_CLIENT_ID_CAPABILITIES, MSN_CLIENT_ID_EXT_CAPS); - xmlnode_insert_data(capNode, caps, -1); + purple_xmlnode_insert_data(capNode, caps, -1); g_free(caps); - payload = xmlnode_to_str(epDataNode, &length); + payload = purple_xmlnode_to_str(epDataNode, &length); msn_notification_send_uux(session, payload); - xmlnode_free(epDataNode); + purple_xmlnode_free(epDataNode); g_free(payload); } void msn_notification_send_uux_private_endpointdata(MsnSession *session) { - xmlnode *private; + PurpleXmlNode *private; const char *name; - xmlnode *epname; - xmlnode *idle; + PurpleXmlNode *epname; + PurpleXmlNode *idle; GHashTable *ui_info; const gchar *ui_type; - xmlnode *client_type; - xmlnode *state; + PurpleXmlNode *client_type; + PurpleXmlNode *state; char *payload; int length; - private = xmlnode_new("PrivateEndpointData"); + private = purple_xmlnode_new("PrivateEndpointData"); name = purple_account_get_string(session->account, "endpoint-name", NULL); - epname = xmlnode_new_child(private, "EpName"); - xmlnode_insert_data(epname, name, -1); + epname = purple_xmlnode_new_child(private, "EpName"); + purple_xmlnode_insert_data(epname, name, -1); - idle = xmlnode_new_child(private, "Idle"); - xmlnode_insert_data(idle, "false", -1); + idle = purple_xmlnode_new_child(private, "Idle"); + purple_xmlnode_insert_data(idle, "false", -1); /* ClientType info (from amsn guys): 0: None @@ -1871,32 +1871,32 @@ void msn_notification_send_uux_private_endpointdata(MsnSession *session) 9: MsnGroup 32: Email member, currently Yahoo! */ - client_type = xmlnode_new_child(private, "ClientType"); + client_type = purple_xmlnode_new_child(private, "ClientType"); ui_info = purple_core_get_ui_info(); ui_type = ui_info ? g_hash_table_lookup(ui_info, "client_type") : NULL; if (ui_type) { if (strcmp(ui_type, "pc") == 0) - xmlnode_insert_data(client_type, "1", -1); + purple_xmlnode_insert_data(client_type, "1", -1); else if (strcmp(ui_type, "web") == 0) - xmlnode_insert_data(client_type, "2", -1); + purple_xmlnode_insert_data(client_type, "2", -1); else if (strcmp(ui_type, "phone") == 0) - xmlnode_insert_data(client_type, "3", -1); + purple_xmlnode_insert_data(client_type, "3", -1); else if (strcmp(ui_type, "handheld") == 0) - xmlnode_insert_data(client_type, "3", -1); + purple_xmlnode_insert_data(client_type, "3", -1); else - xmlnode_insert_data(client_type, "1", -1); + purple_xmlnode_insert_data(client_type, "1", -1); } else - xmlnode_insert_data(client_type, "1", -1); + purple_xmlnode_insert_data(client_type, "1", -1); - state = xmlnode_new_child(private, "State"); - xmlnode_insert_data(state, msn_state_get_text(msn_state_from_account(session->account)), -1); + state = purple_xmlnode_new_child(private, "State"); + purple_xmlnode_insert_data(state, msn_state_get_text(msn_state_from_account(session->account)), -1); - payload = xmlnode_to_str(private, &length); + payload = purple_xmlnode_to_str(private, &length); msn_notification_send_uux(session, payload); - xmlnode_free(private); + purple_xmlnode_free(private); g_free(payload); } @@ -2270,7 +2270,7 @@ modify_unknown_buddy_on_list(MsnSession *session, const char *passport, { MsnAddRemoveListData *addrem = data; MsnCmdProc *cmdproc; - xmlnode *node; + PurpleXmlNode *node; char *payload; int payload_len; @@ -2279,13 +2279,13 @@ modify_unknown_buddy_on_list(MsnSession *session, const char *passport, /* Update user first */ msn_user_set_network(addrem->user, network); - node = xmlnode_new("ml"); + node = purple_xmlnode_new("ml"); node->child = NULL; msn_add_contact_xml(node, passport, addrem->list_op, network); - payload = xmlnode_to_str(node, &payload_len); - xmlnode_free(node); + payload = purple_xmlnode_to_str(node, &payload_len); + purple_xmlnode_free(node); if (addrem->add) msn_notification_post_adl(cmdproc, payload, payload_len); @@ -2303,19 +2303,19 @@ msn_notification_add_buddy_to_list(MsnNotification *notification, MsnListId list MsnAddRemoveListData *addrem; MsnCmdProc *cmdproc; MsnListOp list_op = 1 << list_id; - xmlnode *adl_node; + PurpleXmlNode *adl_node; char *payload; int payload_len; cmdproc = notification->servconn->cmdproc; - adl_node = xmlnode_new("ml"); + adl_node = purple_xmlnode_new("ml"); adl_node->child = NULL; msn_add_contact_xml(adl_node, user->passport, list_op, user->networkid); - payload = xmlnode_to_str(adl_node, &payload_len); - xmlnode_free(adl_node); + payload = purple_xmlnode_to_str(adl_node, &payload_len); + purple_xmlnode_free(adl_node); if (user->networkid != MSN_NETWORK_UNKNOWN) { msn_notification_post_adl(cmdproc, payload, payload_len); @@ -2341,19 +2341,19 @@ msn_notification_rem_buddy_from_list(MsnNotification *notification, MsnListId li MsnAddRemoveListData *addrem; MsnCmdProc *cmdproc; MsnListOp list_op = 1 << list_id; - xmlnode *rml_node; + PurpleXmlNode *rml_node; char *payload; int payload_len; cmdproc = notification->servconn->cmdproc; - rml_node = xmlnode_new("ml"); + rml_node = purple_xmlnode_new("ml"); rml_node->child = NULL; msn_add_contact_xml(rml_node, user->passport, list_op, user->networkid); - payload = xmlnode_to_str(rml_node, &payload_len); - xmlnode_free(rml_node); + payload = purple_xmlnode_to_str(rml_node, &payload_len); + purple_xmlnode_free(rml_node); if (user->networkid != MSN_NETWORK_UNKNOWN) { msn_notification_post_rml(cmdproc, payload, payload_len); diff --git a/libpurple/protocols/msn/oim.c b/libpurple/protocols/msn/oim.c index 9b4101975e..2f7c2b22b5 100644 --- a/libpurple/protocols/msn/oim.c +++ b/libpurple/protocols/msn/oim.c @@ -44,7 +44,7 @@ typedef struct { } MsnOimRecvData; /*Local Function Prototype*/ -static void msn_parse_oim_xml(MsnOim *oim, xmlnode *node); +static void msn_parse_oim_xml(MsnOim *oim, PurpleXmlNode *node); static void msn_oim_free_send_req(MsnOimSendReq *req); static void msn_oim_recv_data_free(MsnOimRecvData *data); static void msn_oim_post_single_get_msg(MsnOim *oim, MsnOimRecvData *data); @@ -151,7 +151,7 @@ typedef struct _MsnOimRequestData { const char *action; const char *host; const char *url; - xmlnode *body; + PurpleXmlNode *body; MsnSoapCallback cb; gpointer cb_data; } MsnOimRequestData; @@ -163,14 +163,14 @@ msn_oim_request_cb(MsnSoapMessage *request, MsnSoapMessage *response, gpointer req_data) { MsnOimRequestData *data = (MsnOimRequestData *)req_data; - xmlnode *fault = NULL; - xmlnode *faultcode = NULL; + PurpleXmlNode *fault = NULL; + PurpleXmlNode *faultcode = NULL; if (response != NULL) - fault = xmlnode_get_child(msn_soap_message_get_xml(response), "Body/Fault"); + fault = purple_xmlnode_get_child(msn_soap_message_get_xml(response), "Body/Fault"); - if (fault && (faultcode = xmlnode_get_child(fault, "faultcode"))) { - gchar *faultcode_str = xmlnode_get_data(faultcode); + if (fault && (faultcode = purple_xmlnode_get_child(fault, "faultcode"))) { + gchar *faultcode_str = purple_xmlnode_get_data(faultcode); gboolean need_token_update = FALSE; if (faultcode_str) { @@ -179,7 +179,7 @@ msn_oim_request_cb(MsnSoapMessage *request, MsnSoapMessage *response, g_str_equal(faultcode_str, "s:AuthenticationFailed")) need_token_update = TRUE; else if (g_str_equal(faultcode_str, "q0:AuthenticationFailed") && - xmlnode_get_child(fault, "detail/RequiredAuthPolicy") != NULL) + purple_xmlnode_get_child(fault, "detail/RequiredAuthPolicy") != NULL) need_token_update = TRUE; } @@ -198,7 +198,7 @@ msn_oim_request_cb(MsnSoapMessage *request, MsnSoapMessage *response, if (data->cb) data->cb(request, response, data->cb_data); - xmlnode_free(data->body); + purple_xmlnode_free(data->body); g_free(data); } @@ -209,16 +209,16 @@ msn_oim_request_helper(MsnOimRequestData *data) if (data->send) { /* The Sending of OIM's uses a different token for some reason. */ - xmlnode *ticket; - ticket = xmlnode_get_child(data->body, "Header/Ticket"); - xmlnode_set_attrib(ticket, "passport", + PurpleXmlNode *ticket; + ticket = purple_xmlnode_get_child(data->body, "Header/Ticket"); + purple_xmlnode_set_attrib(ticket, "passport", msn_nexus_get_token_str(session->nexus, MSN_AUTH_LIVE_SECURE)); } else { - xmlnode *passport; - xmlnode *xml_t; - xmlnode *xml_p; + PurpleXmlNode *passport; + PurpleXmlNode *xml_t; + PurpleXmlNode *xml_p; GHashTable *token; const char *msn_t; const char *msn_p; @@ -232,20 +232,20 @@ msn_oim_request_helper(MsnOimRequestData *data) g_return_val_if_fail(msn_t != NULL, FALSE); g_return_val_if_fail(msn_p != NULL, FALSE); - passport = xmlnode_get_child(data->body, "Header/PassportCookie"); - xml_t = xmlnode_get_child(passport, "t"); - xml_p = xmlnode_get_child(passport, "p"); + passport = purple_xmlnode_get_child(data->body, "Header/PassportCookie"); + xml_t = purple_xmlnode_get_child(passport, "t"); + xml_p = purple_xmlnode_get_child(passport, "p"); /* frees old token text, or the 'EMPTY' text if first time */ - xmlnode_free(xml_t->child); - xmlnode_free(xml_p->child); + purple_xmlnode_free(xml_t->child); + purple_xmlnode_free(xml_p->child); - xmlnode_insert_data(xml_t, msn_t, -1); - xmlnode_insert_data(xml_p, msn_p, -1); + purple_xmlnode_insert_data(xml_t, msn_t, -1); + purple_xmlnode_insert_data(xml_p, msn_p, -1); } msn_soap_service_send_message(session->soap, - msn_soap_message_new(data->action, xmlnode_copy(data->body)), + msn_soap_message_new(data->action, purple_xmlnode_copy(data->body)), data->host, data->url, FALSE, msn_oim_request_cb, data); return FALSE; @@ -254,7 +254,7 @@ msn_oim_request_helper(MsnOimRequestData *data) static void msn_oim_make_request(MsnOim *oim, gboolean send, const char *action, - const char *host, const char *url, xmlnode *body, MsnSoapCallback cb, + const char *host, const char *url, PurpleXmlNode *body, MsnSoapCallback cb, gpointer cb_data) { MsnOimRequestData *data = g_new0(MsnOimRequestData, 1); @@ -281,7 +281,7 @@ msn_oim_get_metadata_cb(MsnSoapMessage *request, MsnSoapMessage *response, if (response) { msn_parse_oim_xml(oim, - xmlnode_get_child(msn_soap_message_get_xml(response), "Body/GetMetadataResponse/MD")); + purple_xmlnode_get_child(msn_soap_message_get_xml(response), "Body/GetMetadataResponse/MD")); } } @@ -291,7 +291,7 @@ msn_oim_get_metadata(MsnOim *oim) { msn_oim_make_request(oim, FALSE, MSN_OIM_GET_METADATA_ACTION, MSN_OIM_RETRIEVE_HOST, MSN_OIM_RETRIEVE_URL, - xmlnode_from_str(MSN_OIM_GET_METADATA_TEMPLATE, -1), + purple_xmlnode_from_str(MSN_OIM_GET_METADATA_TEMPLATE, -1), msn_oim_get_metadata_cb, oim); } @@ -350,19 +350,19 @@ msn_oim_send_read_cb(MsnSoapMessage *request, MsnSoapMessage *response, if (response == NULL) { purple_debug_info("msn", "cannot send OIM: %s\n", msg->oim_msg); } else { - xmlnode *faultNode = xmlnode_get_child(msn_soap_message_get_xml(response), "Body/Fault"); + PurpleXmlNode *faultNode = purple_xmlnode_get_child(msn_soap_message_get_xml(response), "Body/Fault"); if (faultNode == NULL) { /*Send OK! return*/ purple_debug_info("msn", "sent OIM: %s\n", msg->oim_msg); } else { - xmlnode *faultcode = xmlnode_get_child(faultNode, "faultcode"); + PurpleXmlNode *faultcode = purple_xmlnode_get_child(faultNode, "faultcode"); if (faultcode) { - char *faultcode_str = xmlnode_get_data(faultcode); + char *faultcode_str = purple_xmlnode_get_data(faultcode); if (g_str_equal(faultcode_str, "q0:AuthenticationFailed")) { - xmlnode *challengeNode = xmlnode_get_child(faultNode, + PurpleXmlNode *challengeNode = purple_xmlnode_get_child(faultNode, "detail/LockKeyChallenge"); if (challengeNode == NULL) { @@ -383,7 +383,7 @@ msn_oim_send_read_cb(MsnSoapMessage *request, MsnSoapMessage *response, } else { char buf[33]; - char *challenge = xmlnode_get_data(challengeNode); + char *challenge = purple_xmlnode_get_data(challengeNode); msn_handle_chl(challenge, buf); g_free(oim->challenge); @@ -477,7 +477,7 @@ msn_oim_send_msg(MsnOim *oim) msg_body); msn_oim_make_request(oim, TRUE, MSN_OIM_SEND_SOAP_ACTION, MSN_OIM_SEND_HOST, - MSN_OIM_SEND_URL, xmlnode_from_str(soap_body, -1), msn_oim_send_read_cb, + MSN_OIM_SEND_URL, purple_xmlnode_from_str(soap_body, -1), msn_oim_send_read_cb, oim); /*increase the offline Sequence control*/ @@ -498,7 +498,7 @@ msn_oim_delete_read_cb(MsnSoapMessage *request, MsnSoapMessage *response, { MsnOimRecvData *rdata = data; - if (response && xmlnode_get_child(msn_soap_message_get_xml(response), "Body/Fault") == NULL) + if (response && purple_xmlnode_get_child(msn_soap_message_get_xml(response), "Body/Fault") == NULL) purple_debug_info("msn", "Delete OIM success\n"); else purple_debug_info("msn", "Delete OIM failed\n"); @@ -519,7 +519,7 @@ msn_oim_post_delete_msg(MsnOimRecvData *rdata) soap_body = g_strdup_printf(MSN_OIM_DEL_TEMPLATE, msgid); msn_oim_make_request(oim, FALSE, MSN_OIM_DEL_SOAP_ACTION, MSN_OIM_RETRIEVE_HOST, - MSN_OIM_RETRIEVE_URL, xmlnode_from_str(soap_body, -1), msn_oim_delete_read_cb, rdata); + MSN_OIM_RETRIEVE_URL, purple_xmlnode_from_str(soap_body, -1), msn_oim_delete_read_cb, rdata); g_free(soap_body); } @@ -760,15 +760,15 @@ msn_oim_get_read_cb(MsnSoapMessage *request, MsnSoapMessage *response, MsnOimRecvData *rdata = data; if (response != NULL) { - xmlnode *msg_node = xmlnode_get_child(msn_soap_message_get_xml(response), + PurpleXmlNode *msg_node = purple_xmlnode_get_child(msn_soap_message_get_xml(response), "Body/GetMessageResponse/GetMessageResult"); if (msg_node) { - char *msg_str = xmlnode_get_data(msg_node); + char *msg_str = purple_xmlnode_get_data(msg_node); msn_oim_report_to_user(rdata, msg_str); g_free(msg_str); } else { - char *str = xmlnode_to_str(msn_soap_message_get_xml(response), NULL); + char *str = purple_xmlnode_to_str(msn_soap_message_get_xml(response), NULL); purple_debug_info("msn", "Unknown OIM response: %s\n", str); g_free(str); msn_oim_recv_data_free(rdata); @@ -786,7 +786,7 @@ msn_oim_get_read_cb(MsnSoapMessage *request, MsnSoapMessage *response, void msn_parse_oim_msg(MsnOim *oim,const char *xmlmsg) { - xmlnode *node; + PurpleXmlNode *node; purple_debug_info("msn", "%s\n", xmlmsg); @@ -794,33 +794,33 @@ msn_parse_oim_msg(MsnOim *oim,const char *xmlmsg) /* Too many OIM's to send via NS, so we need to request them via SOAP. */ msn_oim_get_metadata(oim); } else { - node = xmlnode_from_str(xmlmsg, -1); + node = purple_xmlnode_from_str(xmlmsg, -1); msn_parse_oim_xml(oim, node); - xmlnode_free(node); + purple_xmlnode_free(node); } } static void -msn_parse_oim_xml(MsnOim *oim, xmlnode *node) +msn_parse_oim_xml(MsnOim *oim, PurpleXmlNode *node) { - xmlnode *mNode; - xmlnode *iu_node; + PurpleXmlNode *mNode; + PurpleXmlNode *iu_node; MsnSession *session = oim->session; g_return_if_fail(node != NULL); if (strcmp(node->name, "MD") != 0) { - char *xmlmsg = xmlnode_to_str(node, NULL); + char *xmlmsg = purple_xmlnode_to_str(node, NULL); purple_debug_info("msn", "WTF is this? %s\n", xmlmsg); g_free(xmlmsg); return; } - iu_node = xmlnode_get_child(node, "E/IU"); + iu_node = purple_xmlnode_get_child(node, "E/IU"); if (iu_node != NULL && purple_account_get_check_mail(session->account)) { - char *unread = xmlnode_get_data(iu_node); + char *unread = purple_xmlnode_get_data(iu_node); const char *passports[2] = { msn_user_get_passport(session->user) }; const char *urls[2] = { session->passport_info.mail_url }; int count = atoi(unread); @@ -832,23 +832,23 @@ msn_parse_oim_xml(MsnOim *oim, xmlnode *node) g_free(unread); } - for(mNode = xmlnode_get_child(node, "M"); mNode; - mNode = xmlnode_get_next_twin(mNode)){ + for(mNode = purple_xmlnode_get_child(node, "M"); mNode; + mNode = purple_xmlnode_get_next_twin(mNode)){ char *passport, *msgid, *nickname, *rtime = NULL; - xmlnode *e_node, *i_node, *n_node, *rt_node; + PurpleXmlNode *e_node, *i_node, *n_node, *rt_node; - e_node = xmlnode_get_child(mNode, "E"); - passport = xmlnode_get_data(e_node); + e_node = purple_xmlnode_get_child(mNode, "E"); + passport = purple_xmlnode_get_data(e_node); - i_node = xmlnode_get_child(mNode, "I"); - msgid = xmlnode_get_data(i_node); + i_node = purple_xmlnode_get_child(mNode, "I"); + msgid = purple_xmlnode_get_data(i_node); - n_node = xmlnode_get_child(mNode, "N"); - nickname = xmlnode_get_data(n_node); + n_node = purple_xmlnode_get_child(mNode, "N"); + nickname = purple_xmlnode_get_data(n_node); - rt_node = xmlnode_get_child(mNode, "RT"); + rt_node = purple_xmlnode_get_child(mNode, "RT"); if (rt_node != NULL) { - rtime = xmlnode_get_data(rt_node); + rtime = purple_xmlnode_get_data(rt_node); } /* purple_debug_info("msn", "E:{%s},I:{%s},rTime:{%s}\n",passport,msgid,rTime); */ @@ -876,7 +876,7 @@ msn_oim_post_single_get_msg(MsnOim *oim, MsnOimRecvData *data) soap_body = g_strdup_printf(MSN_OIM_GET_TEMPLATE, data->msg_id); msn_oim_make_request(oim, FALSE, MSN_OIM_GET_SOAP_ACTION, MSN_OIM_RETRIEVE_HOST, - MSN_OIM_RETRIEVE_URL, xmlnode_from_str(soap_body, -1), msn_oim_get_read_cb, + MSN_OIM_RETRIEVE_URL, purple_xmlnode_from_str(soap_body, -1), msn_oim_get_read_cb, data); g_free(soap_body); diff --git a/libpurple/protocols/msn/soap.c b/libpurple/protocols/msn/soap.c index f2d75b4e3e..b9e5e98019 100644 --- a/libpurple/protocols/msn/soap.c +++ b/libpurple/protocols/msn/soap.c @@ -32,7 +32,7 @@ typedef struct _MsnSoapRequest MsnSoapRequest; struct _MsnSoapMessage { gchar *action; - xmlnode *xml; + PurpleXmlNode *xml; }; struct _MsnSoapRequest { @@ -54,7 +54,7 @@ msn_soap_service_send_message_simple(MsnSoapService *soaps, MsnSoapCallback cb, gpointer cb_data); MsnSoapMessage * -msn_soap_message_new(const gchar *action, xmlnode *xml) +msn_soap_message_new(const gchar *action, PurpleXmlNode *xml) { MsnSoapMessage *msg; @@ -75,11 +75,11 @@ msn_soap_message_free(MsnSoapMessage *msg) g_free(msg->action); if (msg->xml != NULL) - xmlnode_free(msg->xml); + purple_xmlnode_free(msg->xml); g_free(msg); } -xmlnode * +PurpleXmlNode * msn_soap_message_get_xml(MsnSoapMessage *message) { g_return_val_if_fail(message != NULL, NULL); @@ -127,7 +127,7 @@ msn_soap_service_recv(PurpleHttpConnection *http_conn, PurpleHttpResponse *response, gpointer _sreq) { MsnSoapRequest *sreq = _sreq; - xmlnode *xml_root, *xml_body, *xml_fault; + PurpleXmlNode *xml_root, *xml_body, *xml_fault; const gchar *xml_raw; size_t xml_len; @@ -154,7 +154,7 @@ msn_soap_service_recv(PurpleHttpConnection *http_conn, } xml_raw = purple_http_response_get_data(response, &xml_len); - xml_root = xmlnode_from_str(xml_raw, xml_len); + xml_root = purple_xmlnode_from_str(xml_raw, xml_len); if (purple_debug_is_verbose()) { if (sreq->secure && !purple_debug_is_unsafe()) { @@ -174,24 +174,24 @@ msn_soap_service_recv(PurpleHttpConnection *http_conn, return; } - xml_body = xmlnode_get_child(xml_root, "Body"); - xml_fault = xmlnode_get_child(xml_root, "Fault"); + xml_body = purple_xmlnode_get_child(xml_root, "Body"); + xml_fault = purple_xmlnode_get_child(xml_root, "Fault"); if (xml_fault != NULL) { - xmlnode *xml_faultcode; + PurpleXmlNode *xml_faultcode; gchar *faultdata = NULL; - xml_faultcode = xmlnode_get_child(xml_fault, "faultcode"); + xml_faultcode = purple_xmlnode_get_child(xml_fault, "faultcode"); if (xml_faultcode != NULL) - faultdata = xmlnode_get_data(xml_faultcode); + faultdata = purple_xmlnode_get_data(xml_faultcode); if (g_strcmp0(faultdata, "psf:Redirect") == 0) { - xmlnode *xml_url; + PurpleXmlNode *xml_url; gchar *url = NULL; - xml_url = xmlnode_get_child(xml_fault, "redirectUrl"); + xml_url = purple_xmlnode_get_child(xml_fault, "redirectUrl"); if (xml_url != NULL) - url = xmlnode_get_data(xml_url); + url = purple_xmlnode_get_data(xml_url); msn_soap_service_send_message_simple(sreq->soaps, sreq->message, url, sreq->secure, sreq->cb, @@ -206,9 +206,9 @@ msn_soap_service_recv(PurpleHttpConnection *http_conn, return; } if (g_strcmp0(faultdata, "wsse:FailedAuthentication") == 0) { - xmlnode *xml_reason = - xmlnode_get_child(xml_fault, "faultstring"); - gchar *reasondata = xmlnode_get_data(xml_reason); + PurpleXmlNode *xml_reason = + purple_xmlnode_get_child(xml_fault, "faultstring"); + gchar *reasondata = purple_xmlnode_get_data(xml_reason); msn_session_set_error(sreq->soaps->session, MSN_ERROR_AUTH, reasondata); @@ -261,7 +261,7 @@ msn_soap_service_send_message_simple(MsnSoapService *soaps, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"); purple_http_request_header_set(hreq, "Cache-Control", "no-cache"); - body = xmlnode_to_str(message->xml, &body_len); + body = purple_xmlnode_to_str(message->xml, &body_len); purple_http_request_set_contents(hreq, body, body_len); g_free(body); diff --git a/libpurple/protocols/msn/soap.h b/libpurple/protocols/msn/soap.h index 9222986b59..76d6d5041c 100644 --- a/libpurple/protocols/msn/soap.h +++ b/libpurple/protocols/msn/soap.h @@ -36,9 +36,9 @@ typedef void (*MsnSoapCallback)(MsnSoapMessage *request, #include "session.h" MsnSoapMessage * -msn_soap_message_new(const gchar *action, xmlnode *xml); +msn_soap_message_new(const gchar *action, PurpleXmlNode *xml); -xmlnode * +PurpleXmlNode * msn_soap_message_get_xml(MsnSoapMessage *message); MsnSoapService * diff --git a/libpurple/protocols/msn/state.c b/libpurple/protocols/msn/state.c index 7157cfcd13..6a196edf70 100644 --- a/libpurple/protocols/msn/state.c +++ b/libpurple/protocols/msn/state.c @@ -55,73 +55,73 @@ static const char *away_text[] = static char * msn_build_psm(const char *psmstr,const char *mediastr, const char *guidstr, guint protocol_ver) { - xmlnode *dataNode,*psmNode,*mediaNode,*guidNode; + PurpleXmlNode *dataNode,*psmNode,*mediaNode,*guidNode; char *result; int length; - dataNode = xmlnode_new("Data"); + dataNode = purple_xmlnode_new("Data"); - psmNode = xmlnode_new("PSM"); + psmNode = purple_xmlnode_new("PSM"); if(psmstr != NULL){ - xmlnode_insert_data(psmNode, psmstr, -1); + purple_xmlnode_insert_data(psmNode, psmstr, -1); } - xmlnode_insert_child(dataNode, psmNode); + purple_xmlnode_insert_child(dataNode, psmNode); - mediaNode = xmlnode_new("CurrentMedia"); + mediaNode = purple_xmlnode_new("CurrentMedia"); if(mediastr != NULL){ - xmlnode_insert_data(mediaNode, mediastr, -1); + purple_xmlnode_insert_data(mediaNode, mediastr, -1); } - xmlnode_insert_child(dataNode, mediaNode); + purple_xmlnode_insert_child(dataNode, mediaNode); - guidNode = xmlnode_new("MachineGuid"); + guidNode = purple_xmlnode_new("MachineGuid"); if(guidstr != NULL){ - xmlnode_insert_data(guidNode, guidstr, -1); + purple_xmlnode_insert_data(guidNode, guidstr, -1); } - xmlnode_insert_child(dataNode, guidNode); + purple_xmlnode_insert_child(dataNode, guidNode); if (protocol_ver >= 16) { /* TODO: What is this for? */ - xmlnode *ddpNode = xmlnode_new("DDP"); - xmlnode_insert_child(dataNode, ddpNode); + PurpleXmlNode *ddpNode = purple_xmlnode_new("DDP"); + purple_xmlnode_insert_child(dataNode, ddpNode); } - result = xmlnode_to_str(dataNode, &length); - xmlnode_free(dataNode); + result = purple_xmlnode_to_str(dataNode, &length); + purple_xmlnode_free(dataNode); return result; } /* get the CurrentMedia info from the XML node */ char * -msn_get_currentmedia(xmlnode *payloadNode) +msn_get_currentmedia(PurpleXmlNode *payloadNode) { - xmlnode *currentmediaNode; + PurpleXmlNode *currentmediaNode; char *currentmedia; purple_debug_info("msn", "Get CurrentMedia\n"); - currentmediaNode = xmlnode_get_child(payloadNode, "CurrentMedia"); + currentmediaNode = purple_xmlnode_get_child(payloadNode, "CurrentMedia"); if (currentmediaNode == NULL) { purple_debug_info("msn", "No CurrentMedia Node\n"); return NULL; } - currentmedia = xmlnode_get_data(currentmediaNode); + currentmedia = purple_xmlnode_get_data(currentmediaNode); return currentmedia; } /* Get the PSM info from the XML node */ char * -msn_get_psm(xmlnode *payloadNode) +msn_get_psm(PurpleXmlNode *payloadNode) { - xmlnode *psmNode; + PurpleXmlNode *psmNode; char *psm; purple_debug_info("msn", "msn get PSM\n"); - psmNode = xmlnode_get_child(payloadNode, "PSM"); + psmNode = purple_xmlnode_get_child(payloadNode, "PSM"); if (psmNode == NULL) { purple_debug_info("msn", "No PSM status Node\n"); return NULL; } - psm = xmlnode_get_data(psmNode); + psm = purple_xmlnode_get_data(psmNode); return psm; } diff --git a/libpurple/protocols/msn/state.h b/libpurple/protocols/msn/state.h index eca877729c..5ab015fe7a 100644 --- a/libpurple/protocols/msn/state.h +++ b/libpurple/protocols/msn/state.h @@ -59,10 +59,10 @@ const char *msn_away_get_text(MsnAwayType type); const char *msn_state_get_text(MsnAwayType state); /* Get the CurrentMedia info from the XML node */ -char *msn_get_currentmedia(xmlnode *payloadNode); +char *msn_get_currentmedia(PurpleXmlNode *payloadNode); /* Get the PSM info from the XML node */ -char *msn_get_psm(xmlnode *payloadNode); +char *msn_get_psm(PurpleXmlNode *payloadNode); MsnAwayType msn_state_from_account(PurpleAccount *account); diff --git a/libpurple/protocols/myspace/markup.c b/libpurple/protocols/myspace/markup.c index 05d473e130..8e7f90e6d6 100644 --- a/libpurple/protocols/myspace/markup.c +++ b/libpurple/protocols/myspace/markup.c @@ -19,7 +19,7 @@ #include "myspace.h" -typedef int (*MSIM_XMLNODE_CONVERT)(MsimSession *, xmlnode *, gchar **, gchar **); +typedef int (*MSIM_XMLNODE_CONVERT)(MsimSession *, PurpleXmlNode *, gchar **, gchar **); /* Globals */ @@ -192,15 +192,15 @@ msim_point_to_height(MsimSession *session, guint point) * Convert the msim markup <f> (font) tag into HTML. */ static void -msim_markup_f_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) +msim_markup_f_to_html(MsimSession *session, PurpleXmlNode *root, gchar **begin, gchar **end) { const gchar *face, *height_str, *decor_str; GString *gs_end, *gs_begin; guint decor, height; - face = xmlnode_get_attrib(root, "f"); - height_str = xmlnode_get_attrib(root, "h"); - decor_str = xmlnode_get_attrib(root, "s"); + face = purple_xmlnode_get_attrib(root, "f"); + height_str = purple_xmlnode_get_attrib(root, "h"); + decor_str = purple_xmlnode_get_attrib(root, "s"); /* Validate the font face, to avoid constructing invalid HTML later */ if (face != NULL && strchr(face, '\'') != NULL) @@ -283,11 +283,11 @@ msim_color_to_purple(const char *msim) * Convert the msim markup <a> (anchor) tag into HTML. */ static void -msim_markup_a_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) +msim_markup_a_to_html(MsimSession *session, PurpleXmlNode *root, gchar **begin, gchar **end) { const gchar *href; - href = xmlnode_get_attrib(root, "h"); + href = purple_xmlnode_get_attrib(root, "h"); if (!href) { href = ""; } @@ -300,7 +300,7 @@ msim_markup_a_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar * Convert the msim markup <p> (paragraph) tag into HTML. */ static void -msim_markup_p_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) +msim_markup_p_to_html(MsimSession *session, PurpleXmlNode *root, gchar **begin, gchar **end) { /* Just pass through unchanged. * @@ -313,12 +313,12 @@ msim_markup_p_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar * Convert the msim markup <c> tag (text color) into HTML. */ static void -msim_markup_c_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) +msim_markup_c_to_html(MsimSession *session, PurpleXmlNode *root, gchar **begin, gchar **end) { const gchar *color; gchar *purple_color; - color = xmlnode_get_attrib(root, "v"); + color = purple_xmlnode_get_attrib(root, "v"); if (!color) { purple_debug_info("msim", "msim_markup_c_to_html: <c> tag w/o v attr\n"); *begin = g_strdup(""); @@ -344,12 +344,12 @@ msim_markup_c_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar * Convert the msim markup <b> tag (background color) into HTML. */ static void -msim_markup_b_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) +msim_markup_b_to_html(MsimSession *session, PurpleXmlNode *root, gchar **begin, gchar **end) { const gchar *color; gchar *purple_color; - color = xmlnode_get_attrib(root, "v"); + color = purple_xmlnode_get_attrib(root, "v"); if (!color) { *begin = g_strdup(""); *end = g_strdup(""); @@ -375,13 +375,13 @@ msim_markup_b_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar * Convert the msim markup <i> tag (emoticon image) into HTML. */ static void -msim_markup_i_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) +msim_markup_i_to_html(MsimSession *session, PurpleXmlNode *root, gchar **begin, gchar **end) { const gchar *name; guint i; struct MSIM_EMOTICON *emote; - name = xmlnode_get_attrib(root, "n"); + name = purple_xmlnode_get_attrib(root, "n"); if (!name) { purple_debug_info("msim", "msim_markup_i_to_html: <i> w/o n\n"); *begin = g_strdup(""); @@ -408,7 +408,7 @@ msim_markup_i_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar * Convert an individual msim markup tag to HTML. */ static int -msim_markup_tag_to_html(MsimSession *session, xmlnode *root, gchar **begin, +msim_markup_tag_to_html(MsimSession *session, PurpleXmlNode *root, gchar **begin, gchar **end) { g_return_val_if_fail(root != NULL, 0); @@ -439,7 +439,7 @@ msim_markup_tag_to_html(MsimSession *session, xmlnode *root, gchar **begin, * Convert an individual HTML tag to msim markup. */ static int -html_tag_to_msim_markup(MsimSession *session, xmlnode *root, gchar **begin, +html_tag_to_msim_markup(MsimSession *session, PurpleXmlNode *root, gchar **begin, gchar **end) { int ret = 0; @@ -453,13 +453,13 @@ html_tag_to_msim_markup(MsimSession *session, xmlnode *root, gchar **begin, * within another one, and only the inner-most formatting will be * applied to the text. */ } else if (!purple_utf8_strcasecmp(root->name, "b")) { - if (root->child->type == XMLNODE_TYPE_DATA) { + if (root->child->type == PURPLE_XMLNODE_TYPE_DATA) { *begin = g_strdup_printf("<f s='%d'>", MSIM_TEXT_BOLD); *end = g_strdup("</f>"); } else { if (!purple_utf8_strcasecmp(root->child->name,"i")) { ret++; - if (root->child->child->type == XMLNODE_TYPE_DATA) { + if (root->child->child->type == PURPLE_XMLNODE_TYPE_DATA) { *begin = g_strdup_printf("<f s='%d'>", (MSIM_TEXT_BOLD + MSIM_TEXT_ITALIC)); *end = g_strdup("</f>"); } else { @@ -476,7 +476,7 @@ html_tag_to_msim_markup(MsimSession *session, xmlnode *root, gchar **begin, } } } else if (!purple_utf8_strcasecmp(root->name, "i")) { - if (root->child->type == XMLNODE_TYPE_DATA) { + if (root->child->type == PURPLE_XMLNODE_TYPE_DATA) { *begin = g_strdup_printf("<f s='%d'>", MSIM_TEXT_ITALIC); *end = g_strdup("</f>"); } else { @@ -493,13 +493,13 @@ html_tag_to_msim_markup(MsimSession *session, xmlnode *root, gchar **begin, const gchar *href; gchar *link_text; - href = xmlnode_get_attrib(root, "href"); + href = purple_xmlnode_get_attrib(root, "href"); if (!href) { - href = xmlnode_get_attrib(root, "HREF"); + href = purple_xmlnode_get_attrib(root, "HREF"); } - link_text = xmlnode_get_data(root); + link_text = purple_xmlnode_get_data(root); if (href) { if (g_str_equal(link_text, href)) { @@ -522,7 +522,7 @@ html_tag_to_msim_markup(MsimSession *session, xmlnode *root, gchar **begin, } /* Sorry, kid. MySpace doesn't support you within <a> tags. */ - xmlnode_free(root->child); + purple_xmlnode_free(root->child); g_free(link_text); root->child = NULL; @@ -533,9 +533,9 @@ html_tag_to_msim_markup(MsimSession *session, xmlnode *root, gchar **begin, const gchar *face; const gchar *color; - size = xmlnode_get_attrib(root, "size"); - face = xmlnode_get_attrib(root, "face"); - color = xmlnode_get_attrib(root, "color"); + size = purple_xmlnode_get_attrib(root, "size"); + face = purple_xmlnode_get_attrib(root, "face"); + color = purple_xmlnode_get_attrib(root, "color"); tmpbegin = g_string_new("<f"); tmpend = g_string_new("</f>"); @@ -562,7 +562,7 @@ html_tag_to_msim_markup(MsimSession *session, xmlnode *root, gchar **begin, } else if (!purple_utf8_strcasecmp(root->name, "body")) { const gchar *bgcolor; - bgcolor = xmlnode_get_attrib(root, "bgcolor"); + bgcolor = purple_xmlnode_get_attrib(root, "bgcolor"); if (bgcolor != NULL) { *begin = g_strdup_printf("<b v='%s'>", bgcolor); @@ -590,16 +590,16 @@ html_tag_to_msim_markup(MsimSession *session, xmlnode *root, gchar **begin, } /** - * Convert an xmlnode of msim markup or HTML to an HTML string or msim markup. + * Convert an PurpleXmlNode of msim markup or HTML to an HTML string or msim markup. * * @param f Function to convert tags. * * @return An HTML string. Caller frees. */ static void -msim_convert_xmlnode(MsimSession *session, GString *out, xmlnode *root, MSIM_XMLNODE_CONVERT f, int nodes_processed) +msim_convert_xmlnode(MsimSession *session, GString *out, PurpleXmlNode *root, MSIM_XMLNODE_CONVERT f, int nodes_processed) { - xmlnode *node; + PurpleXmlNode *node; gchar *begin, *end, *tmp; int descended = nodes_processed; @@ -620,11 +620,11 @@ msim_convert_xmlnode(MsimSession *session, GString *out, xmlnode *root, MSIM_XML /* Loop over all child nodes. */ for (node = root->child; node != NULL; node = node->next) { switch (node->type) { - case XMLNODE_TYPE_ATTRIB: + case PURPLE_XMLNODE_TYPE_ATTRIB: /* Attributes handled above. */ break; - case XMLNODE_TYPE_TAG: + case PURPLE_XMLNODE_TYPE_TAG: /* A tag or tag with attributes. Recursively descend. */ msim_convert_xmlnode(session, out, node, f, descended); @@ -632,7 +632,7 @@ msim_convert_xmlnode(MsimSession *session, GString *out, xmlnode *root, MSIM_XML node->name ? node->name : "(NULL)"); break; - case XMLNODE_TYPE_DATA: + case PURPLE_XMLNODE_TYPE_DATA: /* Literal text. */ /* * TODO: Why is it necessary to escape here? I thought @@ -663,7 +663,7 @@ msim_convert_xmlnode(MsimSession *session, GString *out, xmlnode *root, MSIM_XML static gchar * msim_convert_xml(MsimSession *session, const gchar *raw, MSIM_XMLNODE_CONVERT f) { - xmlnode *root; + PurpleXmlNode *root; GString *str; gchar *enclosed_raw; @@ -672,7 +672,7 @@ msim_convert_xml(MsimSession *session, const gchar *raw, MSIM_XMLNODE_CONVERT f) /* Enclose text in one root tag, to try to make it valid XML for parsing. */ enclosed_raw = g_strconcat("<root>", raw, "</root>", NULL); - root = xmlnode_from_str(enclosed_raw, -1); + root = purple_xmlnode_from_str(enclosed_raw, -1); if (!root) { purple_debug_warning("msim", "msim_markup_to_html: couldn't parse " @@ -686,7 +686,7 @@ msim_convert_xml(MsimSession *session, const gchar *raw, MSIM_XMLNODE_CONVERT f) str = g_string_new(NULL); msim_convert_xmlnode(session, str, root, f, 0); - xmlnode_free(root); + purple_xmlnode_free(root); purple_debug_info("msim", "msim_markup_to_html: returning %s\n", str->str); diff --git a/libpurple/protocols/oscar/clientlogin.c b/libpurple/protocols/oscar/clientlogin.c index ffdd296c54..6409dc9719 100644 --- a/libpurple/protocols/oscar/clientlogin.c +++ b/libpurple/protocols/oscar/clientlogin.c @@ -91,26 +91,26 @@ static const char *get_client_key(OscarData *od) DEFAULT_CLIENT_KEY); } -static gchar *generate_error_message(xmlnode *resp, const char *url) +static gchar *generate_error_message(PurpleXmlNode *resp, const char *url) { - xmlnode *text; - xmlnode *status_code_node; + PurpleXmlNode *text; + PurpleXmlNode *status_code_node; gchar *status_code; gboolean have_error_code = TRUE; gchar *err = NULL; gchar *details = NULL; - status_code_node = xmlnode_get_child(resp, "statusCode"); + status_code_node = purple_xmlnode_get_child(resp, "statusCode"); if (status_code_node) { /* We can get 200 OK here if the server omitted something we think it shouldn't have (see #12783). * No point in showing the "Ok" string to the user. */ - if ((status_code = xmlnode_get_data_unescaped(status_code_node)) && strcmp(status_code, "200") == 0) { + if ((status_code = purple_xmlnode_get_data_unescaped(status_code_node)) && strcmp(status_code, "200") == 0) { have_error_code = FALSE; } } - if (have_error_code && resp && (text = xmlnode_get_child(resp, "statusText"))) { - details = xmlnode_get_data(text); + if (have_error_code && resp && (text = purple_xmlnode_get_child(resp, "statusText"))) { + details = purple_xmlnode_get_data(text); } if (details && *details) { @@ -169,14 +169,14 @@ static gchar *generate_signature(const char *method, const char *url, const char static gboolean parse_start_oscar_session_response(PurpleConnection *gc, const gchar *response, gsize response_len, char **host, unsigned short *port, char **cookie, char **tls_certname) { OscarData *od = purple_connection_get_protocol_data(gc); - xmlnode *response_node, *tmp_node, *data_node; - xmlnode *host_node = NULL, *port_node = NULL, *cookie_node = NULL, *tls_node = NULL; + PurpleXmlNode *response_node, *tmp_node, *data_node; + PurpleXmlNode *host_node = NULL, *port_node = NULL, *cookie_node = NULL, *tls_node = NULL; char *tmp; guint code; const gchar *encryption_type = purple_account_get_string(purple_connection_get_account(gc), "encryption", OSCAR_DEFAULT_ENCRYPTION); /* Parse the response as XML */ - response_node = xmlnode_from_str(response, response_len); + response_node = purple_xmlnode_from_str(response, response_len); if (response_node == NULL) { char *msg; @@ -192,16 +192,16 @@ static gboolean parse_start_oscar_session_response(PurpleConnection *gc, const g } /* Grab the necessary XML nodes */ - tmp_node = xmlnode_get_child(response_node, "statusCode"); - data_node = xmlnode_get_child(response_node, "data"); + tmp_node = purple_xmlnode_get_child(response_node, "statusCode"); + data_node = purple_xmlnode_get_child(response_node, "data"); if (data_node != NULL) { - host_node = xmlnode_get_child(data_node, "host"); - port_node = xmlnode_get_child(data_node, "port"); - cookie_node = xmlnode_get_child(data_node, "cookie"); + host_node = purple_xmlnode_get_child(data_node, "host"); + port_node = purple_xmlnode_get_child(data_node, "port"); + cookie_node = purple_xmlnode_get_child(data_node, "cookie"); } /* Make sure we have a status code */ - if (tmp_node == NULL || (tmp = xmlnode_get_data_unescaped(tmp_node)) == NULL) { + if (tmp_node == NULL || (tmp = purple_xmlnode_get_data_unescaped(tmp_node)) == NULL) { char *msg; purple_debug_error("oscar", "startOSCARSession response was " "missing statusCode: %s\n", response); @@ -210,7 +210,7 @@ static gboolean parse_start_oscar_session_response(PurpleConnection *gc, const g purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); g_free(msg); - xmlnode_free(response_node); + purple_xmlnode_free(response_node); return FALSE; } @@ -218,13 +218,13 @@ static gboolean parse_start_oscar_session_response(PurpleConnection *gc, const g code = atoi(tmp); if (code != 200) { - xmlnode *status_detail_node; + PurpleXmlNode *status_detail_node; guint status_detail = 0; - status_detail_node = xmlnode_get_child(response_node, + status_detail_node = purple_xmlnode_get_child(response_node, "statusDetailCode"); if (status_detail_node) { - gchar *data = xmlnode_get_data(status_detail_node); + gchar *data = purple_xmlnode_get_data(status_detail_node); if (data) { status_detail = atoi(data); g_free(data); @@ -251,7 +251,7 @@ static gboolean parse_start_oscar_session_response(PurpleConnection *gc, const g } g_free(tmp); - xmlnode_free(response_node); + purple_xmlnode_free(response_node); return FALSE; } g_free(tmp); @@ -267,14 +267,14 @@ static gboolean parse_start_oscar_session_response(PurpleConnection *gc, const g purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); g_free(msg); - xmlnode_free(response_node); + purple_xmlnode_free(response_node); return FALSE; } if (strcmp(encryption_type, OSCAR_NO_ENCRYPTION) != 0) { - tls_node = xmlnode_get_child(data_node, "tlsCertName"); + tls_node = purple_xmlnode_get_child(data_node, "tlsCertName"); if (tls_node != NULL) { - *tls_certname = xmlnode_get_data_unescaped(tls_node); + *tls_certname = purple_xmlnode_get_data_unescaped(tls_node); } else { if (strcmp(encryption_type, OSCAR_OPPORTUNISTIC_ENCRYPTION) == 0) { purple_debug_warning("oscar", "We haven't received a tlsCertName to use. We will not do SSL to BOS.\n"); @@ -284,16 +284,16 @@ static gboolean parse_start_oscar_session_response(PurpleConnection *gc, const g gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("You required encryption in your account settings, but one of the servers doesn't support it.")); - xmlnode_free(response_node); + purple_xmlnode_free(response_node); return FALSE; } } } /* Extract data from the XML */ - *host = xmlnode_get_data_unescaped(host_node); - tmp = xmlnode_get_data_unescaped(port_node); - *cookie = xmlnode_get_data_unescaped(cookie_node); + *host = purple_xmlnode_get_data_unescaped(host_node); + tmp = purple_xmlnode_get_data_unescaped(port_node); + *cookie = purple_xmlnode_get_data_unescaped(cookie_node); if (*host == NULL || **host == '\0' || tmp == NULL || *tmp == '\0' || *cookie == NULL || **cookie == '\0') { @@ -308,7 +308,7 @@ static gboolean parse_start_oscar_session_response(PurpleConnection *gc, const g g_free(*host); g_free(tmp); g_free(*cookie); - xmlnode_free(response_node); + purple_xmlnode_free(response_node); return FALSE; } @@ -422,12 +422,12 @@ static void send_start_oscar_session(OscarData *od, const char *token, const cha static gboolean parse_client_login_response(PurpleConnection *gc, const gchar *response, gsize response_len, char **token, char **secret, time_t *hosttime) { OscarData *od = purple_connection_get_protocol_data(gc); - xmlnode *response_node, *tmp_node, *data_node; - xmlnode *secret_node = NULL, *hosttime_node = NULL, *token_node = NULL, *tokena_node = NULL; + PurpleXmlNode *response_node, *tmp_node, *data_node; + PurpleXmlNode *secret_node = NULL, *hosttime_node = NULL, *token_node = NULL, *tokena_node = NULL; char *tmp; /* Parse the response as XML */ - response_node = xmlnode_from_str(response, response_len); + response_node = purple_xmlnode_from_str(response, response_len); if (response_node == NULL) { char *msg; @@ -442,18 +442,18 @@ static gboolean parse_client_login_response(PurpleConnection *gc, const gchar *r } /* Grab the necessary XML nodes */ - tmp_node = xmlnode_get_child(response_node, "statusCode"); - data_node = xmlnode_get_child(response_node, "data"); + tmp_node = purple_xmlnode_get_child(response_node, "statusCode"); + data_node = purple_xmlnode_get_child(response_node, "data"); if (data_node != NULL) { - secret_node = xmlnode_get_child(data_node, "sessionSecret"); - hosttime_node = xmlnode_get_child(data_node, "hostTime"); - token_node = xmlnode_get_child(data_node, "token"); + secret_node = purple_xmlnode_get_child(data_node, "sessionSecret"); + hosttime_node = purple_xmlnode_get_child(data_node, "hostTime"); + token_node = purple_xmlnode_get_child(data_node, "token"); if (token_node != NULL) - tokena_node = xmlnode_get_child(token_node, "a"); + tokena_node = purple_xmlnode_get_child(token_node, "a"); } /* Make sure we have a status code */ - if (tmp_node == NULL || (tmp = xmlnode_get_data_unescaped(tmp_node)) == NULL) { + if (tmp_node == NULL || (tmp = purple_xmlnode_get_data_unescaped(tmp_node)) == NULL) { char *msg; purple_debug_error("oscar", "clientLogin response was " "missing statusCode: %s\n", response); @@ -462,7 +462,7 @@ static gboolean parse_client_login_response(PurpleConnection *gc, const gchar *r purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); g_free(msg); - xmlnode_free(response_node); + purple_xmlnode_free(response_node); return FALSE; } @@ -473,8 +473,8 @@ static gboolean parse_client_login_response(PurpleConnection *gc, const gchar *r status_code = atoi(tmp); g_free(tmp); - tmp_node = xmlnode_get_child(response_node, "statusDetailCode"); - if (tmp_node != NULL && (tmp = xmlnode_get_data_unescaped(tmp_node)) != NULL) { + tmp_node = purple_xmlnode_get_child(response_node, "statusDetailCode"); + if (tmp_node != NULL && (tmp = purple_xmlnode_get_data_unescaped(tmp_node)) != NULL) { status_detail_code = atoi(tmp); g_free(tmp); } @@ -507,7 +507,7 @@ static gboolean parse_client_login_response(PurpleConnection *gc, const gchar *r g_free(msg); } - xmlnode_free(response_node); + purple_xmlnode_free(response_node); return FALSE; } g_free(tmp); @@ -524,14 +524,14 @@ static gboolean parse_client_login_response(PurpleConnection *gc, const gchar *r purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); g_free(msg); - xmlnode_free(response_node); + purple_xmlnode_free(response_node); return FALSE; } /* Extract data from the XML */ - *token = xmlnode_get_data_unescaped(tokena_node); - *secret = xmlnode_get_data_unescaped(secret_node); - tmp = xmlnode_get_data_unescaped(hosttime_node); + *token = purple_xmlnode_get_data_unescaped(tokena_node); + *secret = purple_xmlnode_get_data_unescaped(secret_node); + tmp = purple_xmlnode_get_data_unescaped(hosttime_node); if (*token == NULL || **token == '\0' || *secret == NULL || **secret == '\0' || tmp == NULL || *tmp == '\0') { char *msg; @@ -545,14 +545,14 @@ static gboolean parse_client_login_response(PurpleConnection *gc, const gchar *r g_free(*token); g_free(*secret); g_free(tmp); - xmlnode_free(response_node); + purple_xmlnode_free(response_node); return FALSE; } *hosttime = strtol(tmp, NULL, 10); g_free(tmp); - xmlnode_free(response_node); + purple_xmlnode_free(response_node); return TRUE; } diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c index 5248bf85b7..fa1760ebe2 100644 --- a/libpurple/protocols/oscar/oscar.c +++ b/libpurple/protocols/oscar/oscar.c @@ -1851,7 +1851,7 @@ incomingim_chan4(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, guint16 smstype; guint32 taglen, smslen; char *tagstr = NULL, *smsmsg = NULL; - xmlnode *xmlroot = NULL, *xmltmp = NULL; + PurpleXmlNode *xmlroot = NULL, *xmltmp = NULL; gchar *uin = NULL, *message = NULL; /* From libicq2000-0.3.2/src/ICQ.cpp */ @@ -1885,23 +1885,23 @@ incomingim_chan4(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, /* Check if this is an SMS being sent from server */ if ((smstype == 0) && (!strcmp(tagstr, "ICQSMS")) && (smsmsg != NULL)) { - xmlroot = xmlnode_from_str(smsmsg, -1); + xmlroot = purple_xmlnode_from_str(smsmsg, -1); if (xmlroot != NULL) { - xmltmp = xmlnode_get_child(xmlroot, "sender"); + xmltmp = purple_xmlnode_get_child(xmlroot, "sender"); if (xmltmp != NULL) - uin = xmlnode_get_data(xmltmp); + uin = purple_xmlnode_get_data(xmltmp); - xmltmp = xmlnode_get_child(xmlroot, "text"); + xmltmp = purple_xmlnode_get_child(xmlroot, "text"); if (xmltmp != NULL) - message = xmlnode_get_data(xmltmp); + message = purple_xmlnode_get_data(xmltmp); if ((uin != NULL) && (message != NULL)) serv_got_im(gc, uin, message, 0, time(NULL)); g_free(uin); g_free(message); - xmlnode_free(xmlroot); + purple_xmlnode_free(xmlroot); } } g_free(tagstr); diff --git a/libpurple/protocols/simple/simple.c b/libpurple/protocols/simple/simple.c index 117e12ff42..d4af6929b6 100644 --- a/libpurple/protocols/simple/simple.c +++ b/libpurple/protocols/simple/simple.c @@ -872,7 +872,7 @@ static void simple_unsubscribe(char *name, struct simple_buddy *buddy, struct si static gboolean simple_add_lcs_contacts(struct simple_account_data *sip, struct sipmsg *msg, struct transaction *tc) { const gchar *tmp; - xmlnode *item, *group, *isc; + PurpleXmlNode *item, *group, *isc; const char *name_group; PurpleBuddy *b; PurpleGroup *g = NULL; @@ -885,11 +885,11 @@ static gboolean simple_add_lcs_contacts(struct simple_account_data *sip, struct purple_debug_info("simple", "simple_add_lcs_contacts->%s-%d\n", msg->body, len); /*Convert the contact from XML to Purple Buddies*/ - isc = xmlnode_from_str(msg->body, len); + isc = purple_xmlnode_from_str(msg->body, len); /* ToDo. Find for all groups */ - if ((group = xmlnode_get_child(isc, "group"))) { - name_group = xmlnode_get_attrib(group, "name"); + if ((group = purple_xmlnode_get_child(isc, "group"))) { + name_group = purple_xmlnode_get_attrib(group, "name"); purple_debug_info("simple", "name_group->%s\n", name_group); g = purple_blist_find_group(name_group); if(!g) @@ -902,13 +902,13 @@ static gboolean simple_add_lcs_contacts(struct simple_account_data *sip, struct g = purple_group_new("Buddies"); } - for(item = xmlnode_get_child(isc, "contact"); item; item = xmlnode_get_next_twin(item)) + for(item = purple_xmlnode_get_child(isc, "contact"); item; item = purple_xmlnode_get_next_twin(item)) { const char *uri; char *buddy_name; - uri = xmlnode_get_attrib(item, "uri"); - /*name = xmlnode_get_attrib(item, "name"); - groups = xmlnode_get_attrib(item, "groups");*/ + uri = purple_xmlnode_get_attrib(item, "uri"); + /*name = purple_xmlnode_get_attrib(item, "name"); + groups = purple_xmlnode_get_attrib(item, "groups");*/ purple_debug_info("simple", "URI->%s\n", uri); buddy_name = g_strdup_printf("sip:%s", uri); @@ -925,7 +925,7 @@ static gboolean simple_add_lcs_contacts(struct simple_account_data *sip, struct bs->name = g_strdup(purple_buddy_get_name(b)); g_hash_table_insert(sip->buddies, bs->name, bs); } - xmlnode_free(isc); + purple_xmlnode_free(isc); } return 0; } @@ -1056,8 +1056,8 @@ static void process_incoming_message(struct simple_account_data *sip, struct sip found = TRUE; } else if(!strncmp(contenttype, "application/im-iscomposing+xml", 30)) { - xmlnode *isc = xmlnode_from_str(msg->body, msg->bodylen); - xmlnode *state; + PurpleXmlNode *isc = purple_xmlnode_from_str(msg->body, msg->bodylen); + PurpleXmlNode *state; gchar *statedata; if(!isc) { @@ -1066,16 +1066,16 @@ static void process_incoming_message(struct simple_account_data *sip, struct sip return; } - state = xmlnode_get_child(isc, "state"); + state = purple_xmlnode_get_child(isc, "state"); if(!state) { purple_debug_info("simple", "process_incoming_message: no state found\n"); - xmlnode_free(isc); + purple_xmlnode_free(isc); g_free(from); return; } - statedata = xmlnode_get_data(state); + statedata = purple_xmlnode_get_data(state); if(statedata) { if(strstr(statedata, "active")) serv_got_typing(sip->gc, from, 0, PURPLE_IM_TYPING); @@ -1084,7 +1084,7 @@ static void process_incoming_message(struct simple_account_data *sip, struct sip g_free(statedata); } - xmlnode_free(isc); + purple_xmlnode_free(isc); send_sip_response(sip->gc, msg, 200, "OK", NULL); found = TRUE; } @@ -1187,8 +1187,8 @@ static void process_incoming_notify(struct simple_account_data *sip, struct sipm gchar *from; const gchar *fromhdr; gchar *basicstatus_data; - xmlnode *pidf; - xmlnode *basicstatus = NULL, *tuple, *status; + PurpleXmlNode *pidf; + PurpleXmlNode *basicstatus = NULL, *tuple, *status; gboolean isonline = FALSE; struct simple_buddy *b = NULL; const gchar *sshdr = NULL; @@ -1215,7 +1215,7 @@ static void process_incoming_notify(struct simple_account_data *sip, struct sipm return; } - pidf = xmlnode_from_str(msg->body, msg->bodylen); + pidf = purple_xmlnode_from_str(msg->body, msg->bodylen); if(!pidf) { purple_debug_info("simple", "process_incoming_notify: no parseable pidf\n"); @@ -1251,22 +1251,22 @@ static void process_incoming_notify(struct simple_account_data *sip, struct sipm return; } - if ((tuple = xmlnode_get_child(pidf, "tuple"))) - if ((status = xmlnode_get_child(tuple, "status"))) - basicstatus = xmlnode_get_child(status, "basic"); + if ((tuple = purple_xmlnode_get_child(pidf, "tuple"))) + if ((status = purple_xmlnode_get_child(tuple, "status"))) + basicstatus = purple_xmlnode_get_child(status, "basic"); if(!basicstatus) { purple_debug_info("simple", "process_incoming_notify: no basic found\n"); - xmlnode_free(pidf); + purple_xmlnode_free(pidf); g_free(from); return; } - basicstatus_data = xmlnode_get_data(basicstatus); + basicstatus_data = purple_xmlnode_get_data(basicstatus); if(!basicstatus_data) { purple_debug_info("simple", "process_incoming_notify: no basic data found\n"); - xmlnode_free(pidf); + purple_xmlnode_free(pidf); g_free(from); return; } @@ -1280,7 +1280,7 @@ static void process_incoming_notify(struct simple_account_data *sip, struct sipm else purple_prpl_got_user_status(sip->account, from, "offline", NULL); - xmlnode_free(pidf); + purple_xmlnode_free(pidf); g_free(from); g_free(basicstatus_data); diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c index 6445b3b6aa..bf0efddcda 100644 --- a/libpurple/protocols/yahoo/libymsg.c +++ b/libpurple/protocols/yahoo/libymsg.c @@ -4263,16 +4263,16 @@ static void yahoo_get_sms_carrier_cb(PurpleHttpConnection *http_conn, return ; } else { const gchar *got_data = purple_http_response_get_data(response, NULL); - xmlnode *validate_data_root = xmlnode_from_str(got_data, -1); - xmlnode *validate_data_child = xmlnode_get_child(validate_data_root, "mobile_no"); - const char *mobile_no = xmlnode_get_attrib(validate_data_child, "msisdn"); + PurpleXmlNode *validate_data_root = purple_xmlnode_from_str(got_data, -1); + PurpleXmlNode *validate_data_child = purple_xmlnode_get_child(validate_data_root, "mobile_no"); + const char *mobile_no = purple_xmlnode_get_attrib(validate_data_child, "msisdn"); - validate_data_root = xmlnode_copy(validate_data_child); - validate_data_child = xmlnode_get_child(validate_data_root, "status"); - status = xmlnode_get_data(validate_data_child); + validate_data_root = purple_xmlnode_copy(validate_data_child); + validate_data_child = purple_xmlnode_get_child(validate_data_root, "status"); + status = purple_xmlnode_get_data(validate_data_child); - validate_data_child = xmlnode_get_child(validate_data_root, "carrier"); - carrier = xmlnode_get_data(validate_data_child); + validate_data_child = purple_xmlnode_get_child(validate_data_root, "carrier"); + carrier = purple_xmlnode_get_data(validate_data_child); purple_debug_info("yahoo", "SMS validate data: %s\n", got_data); @@ -4289,8 +4289,8 @@ static void yahoo_get_sms_carrier_cb(PurpleHttpConnection *http_conn, PURPLE_MESSAGE_SYSTEM, time(NULL)); } - xmlnode_free(validate_data_child); - xmlnode_free(validate_data_root); + purple_xmlnode_free(validate_data_child); + purple_xmlnode_free(validate_data_root); g_free(sms_cb_data->who); g_free(sms_cb_data->what); g_free(sms_cb_data); @@ -4306,24 +4306,24 @@ static void yahoo_get_sms_carrier(PurpleConnection *gc, gpointer data) PurpleHttpCookieJar *cookiejar; struct yahoo_sms_carrier_cb_data *sms_cb_data; char *validate_request_str = NULL; - xmlnode *validate_request_root = NULL; - xmlnode *validate_request_child = NULL; + PurpleXmlNode *validate_request_root = NULL; + PurpleXmlNode *validate_request_child = NULL; if(!(sms_cb_data = data)) return; - validate_request_root = xmlnode_new("validate"); - xmlnode_set_attrib(validate_request_root, "intl", "us"); - xmlnode_set_attrib(validate_request_root, "version", YAHOO_CLIENT_VERSION); - xmlnode_set_attrib(validate_request_root, "qos", "0"); + validate_request_root = purple_xmlnode_new("validate"); + purple_xmlnode_set_attrib(validate_request_root, "intl", "us"); + purple_xmlnode_set_attrib(validate_request_root, "version", YAHOO_CLIENT_VERSION); + purple_xmlnode_set_attrib(validate_request_root, "qos", "0"); - validate_request_child = xmlnode_new_child(validate_request_root, "mobile_no"); - xmlnode_set_attrib(validate_request_child, "msisdn", sms_cb_data->who + 1); + validate_request_child = purple_xmlnode_new_child(validate_request_root, "mobile_no"); + purple_xmlnode_set_attrib(validate_request_child, "msisdn", sms_cb_data->who + 1); - validate_request_str = xmlnode_to_str(validate_request_root, NULL); + validate_request_str = purple_xmlnode_to_str(validate_request_root, NULL); - xmlnode_free(validate_request_child); - xmlnode_free(validate_request_root); + purple_xmlnode_free(validate_request_child); + purple_xmlnode_free(validate_request_root); req = purple_http_request_new(NULL); purple_http_request_set_url_printf(req, "http://validate.msg.yahoo.com" diff --git a/libpurple/protocols/yahoo/util.c b/libpurple/protocols/yahoo/util.c index 3790d0149f..8e8d34fbdf 100644 --- a/libpurple/protocols/yahoo/util.c +++ b/libpurple/protocols/yahoo/util.c @@ -380,13 +380,13 @@ static void append_attrs_datalist_foreach_cb(GQuark key_id, gpointer data, gpoin { const char *key; const char *value; - xmlnode *cur; + PurpleXmlNode *cur; key = g_quark_to_string(key_id); value = data; cur = user_data; - xmlnode_set_attrib(cur, key, value); + purple_xmlnode_set_attrib(cur, key, value); } /** @@ -394,14 +394,14 @@ static void append_attrs_datalist_foreach_cb(GQuark key_id, gpointer data, gpoin * currently building. This will be modified when opening a tag * or closing an existing tag. */ -static void yahoo_codes_to_html_add_tag(xmlnode **cur, const char *tag, gboolean is_closing_tag, const gchar *tag_name, gboolean is_font_tag) +static void yahoo_codes_to_html_add_tag(PurpleXmlNode **cur, const char *tag, gboolean is_closing_tag, const gchar *tag_name, gboolean is_font_tag) { if (is_closing_tag) { - xmlnode *tmp; + PurpleXmlNode *tmp; GSList *dangling_tags = NULL; /* Move up the DOM until we find the opening tag */ - for (tmp = *cur; tmp != NULL; tmp = xmlnode_get_parent(tmp)) { + for (tmp = *cur; tmp != NULL; tmp = purple_xmlnode_get_parent(tmp)) { /* Add one to tag_name when doing this comparison because it starts with a / */ if (g_str_equal(tmp->name, tag_name + 1)) /* Found */ @@ -416,7 +416,7 @@ static void yahoo_codes_to_html_add_tag(xmlnode **cur, const char *tag, gboolean } /* Move our current position up, now that we've closed a tag */ - *cur = xmlnode_get_parent(tmp); + *cur = purple_xmlnode_get_parent(tmp); /* Re-open any tags that were nested below the tag we just closed */ while (dangling_tags != NULL) { @@ -425,10 +425,10 @@ static void yahoo_codes_to_html_add_tag(xmlnode **cur, const char *tag, gboolean /* Create a copy of this tag+attributes (but not child tags or * data) at our new location */ - *cur = xmlnode_new_child(*cur, tmp->name); + *cur = purple_xmlnode_new_child(*cur, tmp->name); for (tmp = tmp->child; tmp != NULL; tmp = tmp->next) - if (tmp->type == XMLNODE_TYPE_ATTRIB) - xmlnode_set_attrib_full(*cur, tmp->name, + if (tmp->type == PURPLE_XMLNODE_TYPE_ATTRIB) + purple_xmlnode_set_attrib_full(*cur, tmp->name, tmp->xmlns, tmp->prefix, tmp->data); } } else { @@ -438,7 +438,7 @@ static void yahoo_codes_to_html_add_tag(xmlnode **cur, const char *tag, gboolean char *fontsize = NULL; purple_markup_find_tag(tag_name, tag, &start, &end, &attributes); - *cur = xmlnode_new_child(*cur, tag_name); + *cur = purple_xmlnode_new_child(*cur, tag_name); if (is_font_tag) { /* Special case for the font size attribute */ @@ -460,8 +460,8 @@ static void yahoo_codes_to_html_add_tag(xmlnode **cur, const char *tag, gboolean * style on a span tag. */ gchar *tmp = g_strdup_printf("font-size: %spt", fontsize); - *cur = xmlnode_new_child(*cur, "span"); - xmlnode_set_attrib(*cur, "style", tmp); + *cur = purple_xmlnode_new_child(*cur, "span"); + purple_xmlnode_set_attrib(*cur, "style", tmp); g_free(tmp); #else /* @@ -478,8 +478,8 @@ static void yahoo_codes_to_html_add_tag(xmlnode **cur, const char *tag, gboolean size = strtol(fontsize, NULL, 10); htmlsize = point_to_html(size); sprintf(tmp, "%u", htmlsize); - xmlnode_set_attrib(*cur, "size", tmp); - xmlnode_set_attrib(*cur, "absz", fontsize); + purple_xmlnode_set_attrib(*cur, "size", tmp); + purple_xmlnode_set_attrib(*cur, "absz", fontsize); #endif /* !USE_CSS_FORMATTING */ g_free(fontsize); } @@ -515,12 +515,12 @@ static gchar *yahoo_markup_get_tag_name(const char *tag, gboolean *is_closing_ta * Example: <font size="8">size 8 <font size="16">size 16 <font size="8">size 8 again * * But we want to send well-formed HTML to the core, so we step through - * the input string and build an xmlnode tree containing sanitized HTML. + * the input string and build an PurpleXmlNode tree containing sanitized HTML. */ char *yahoo_codes_to_html(const char *x) { size_t x_len; - xmlnode *html, *cur; + PurpleXmlNode *html, *cur; GString *cdata = g_string_new(NULL); guint i, j; gboolean no_more_gt_brackets = FALSE; @@ -528,7 +528,7 @@ char *yahoo_codes_to_html(const char *x) gchar *xmlstr1, *xmlstr2, *esc; x_len = strlen(x); - html = xmlnode_new("html"); + html = purple_xmlnode_new("html"); cur = html; for (i = 0; i < x_len; i++) { @@ -548,7 +548,7 @@ char *yahoo_codes_to_html(const char *x) /* Append any character data that belongs in the current node */ if (cdata->len > 0) { - xmlnode_insert_data(cur, cdata->str, cdata->len); + purple_xmlnode_insert_data(cur, cdata->str, cdata->len); g_string_truncate(cdata, 0); } @@ -556,12 +556,12 @@ char *yahoo_codes_to_html(const char *x) if (code[0] == '#') { #ifdef USE_CSS_FORMATTING gchar *tmp = g_strdup_printf("color: %s", code); - cur = xmlnode_new_child(cur, "span"); - xmlnode_set_attrib(cur, "style", tmp); + cur = purple_xmlnode_new_child(cur, "span"); + purple_xmlnode_set_attrib(cur, "style", tmp); g_free(tmp); #else - cur = xmlnode_new_child(cur, "font"); - xmlnode_set_attrib(cur, "color", code); + cur = purple_xmlnode_new_child(cur, "font"); + purple_xmlnode_set_attrib(cur, "color", code); #endif /* !USE_CSS_FORMATTING */ } else if ((match = g_hash_table_lookup(esc_codes_ht, code))) { @@ -633,7 +633,7 @@ char *yahoo_codes_to_html(const char *x) if (match[0] != '\0') { /* Append any character data that belongs in the current node */ if (cdata->len > 0) { - xmlnode_insert_data(cur, cdata->str, cdata->len); + purple_xmlnode_insert_data(cur, cdata->str, cdata->len); g_string_truncate(cdata, 0); } if (g_str_equal(tag_name, "font")) @@ -658,12 +658,12 @@ char *yahoo_codes_to_html(const char *x) /* Append any remaining character data */ if (cdata->len > 0) - xmlnode_insert_data(cur, cdata->str, cdata->len); + purple_xmlnode_insert_data(cur, cdata->str, cdata->len); g_string_free(cdata, TRUE); /* Serialize our HTML */ - xmlstr1 = xmlnode_to_str(html, NULL); - xmlnode_free(html); + xmlstr1 = purple_xmlnode_to_str(html, NULL); + purple_xmlnode_free(html); /* Strip off the outter HTML node */ /* This probably isn't necessary, especially if we made the outter HTML diff --git a/libpurple/protocols/yahoo/yahoo_aliases.c b/libpurple/protocols/yahoo/yahoo_aliases.c index db9e53db26..4ada1519f9 100644 --- a/libpurple/protocols/yahoo/yahoo_aliases.c +++ b/libpurple/protocols/yahoo/yahoo_aliases.c @@ -89,14 +89,14 @@ yahoo_fetch_aliases_cb(PurpleHttpConnection *http_conn, const char *hp, *wp, *mo; YahooFriend *f; PurpleBuddy *b; - xmlnode *item, *contacts; + PurpleXmlNode *item, *contacts; PurpleAccount *account; size_t len; account = purple_connection_get_account(gc); - /* Put our web response into a xmlnode for easy management */ + /* Put our web response into a PurpleXmlNode for easy management */ xml_raw = purple_http_response_get_data(response, &len); - contacts = xmlnode_from_str(xml_raw, -1); + contacts = purple_xmlnode_from_str(xml_raw, -1); if (purple_debug_is_verbose()) { purple_debug_misc("yahoo", @@ -111,20 +111,20 @@ yahoo_fetch_aliases_cb(PurpleHttpConnection *http_conn, " bytes of alias data\n", len); /* Loop around and around and around until we have gone through all the received aliases */ - for(item = xmlnode_get_child(contacts, "ct"); item; item = xmlnode_get_next_twin(item)) { + for(item = purple_xmlnode_get_child(contacts, "ct"); item; item = purple_xmlnode_get_next_twin(item)) { /* Yahoo replies with two types of contact (ct) record, we are only interested in the alias ones */ - if ((yid = xmlnode_get_attrib(item, "yi"))) { + if ((yid = purple_xmlnode_get_attrib(item, "yi"))) { YahooPersonalDetails *ypd = NULL; /* Grab all the bits of information we can */ - fn = xmlnode_get_attrib(item, "fn"); - ln = xmlnode_get_attrib(item, "ln"); - nn = xmlnode_get_attrib(item, "nn"); - mn = xmlnode_get_attrib(item, "mn"); - id = xmlnode_get_attrib(item, "id"); + fn = purple_xmlnode_get_attrib(item, "fn"); + ln = purple_xmlnode_get_attrib(item, "ln"); + nn = purple_xmlnode_get_attrib(item, "nn"); + mn = purple_xmlnode_get_attrib(item, "mn"); + id = purple_xmlnode_get_attrib(item, "id"); - hp = xmlnode_get_attrib(item, "hp"); - wp = xmlnode_get_attrib(item, "wp"); - mo = xmlnode_get_attrib(item, "mo"); + hp = purple_xmlnode_get_attrib(item, "hp"); + wp = purple_xmlnode_get_attrib(item, "wp"); + mo = purple_xmlnode_get_attrib(item, "mo"); full_name = nick_name = NULL; alias = NULL; @@ -188,7 +188,7 @@ yahoo_fetch_aliases_cb(PurpleHttpConnection *http_conn, g_free(nick_name); } } - xmlnode_free(contacts); + purple_xmlnode_free(contacts); } } @@ -220,7 +220,7 @@ static void yahoo_update_alias_cb(PurpleHttpConnection *http_conn, PurpleHttpResponse *response, gpointer _cb) { - xmlnode *node, *result; + PurpleXmlNode *node, *result; struct callback_data *cb = _cb; if (!purple_http_response_is_successful(response)) { @@ -232,7 +232,7 @@ yahoo_update_alias_cb(PurpleHttpConnection *http_conn, return; } - result = xmlnode_from_str( + result = purple_xmlnode_from_str( purple_http_response_get_data(response, NULL), -1); if (result == NULL) { @@ -244,9 +244,9 @@ yahoo_update_alias_cb(PurpleHttpConnection *http_conn, return; } - if ((node = xmlnode_get_child(result, "ct"))) { + if ((node = purple_xmlnode_get_child(result, "ct"))) { if (cb->id == NULL) { - const char *new_id = xmlnode_get_attrib(node, "id"); + const char *new_id = purple_xmlnode_get_attrib(node, "id"); if (new_id != NULL) { /* We now have an addressbook id for the friend; we should save it */ YahooFriend *f = yahoo_friend_find(cb->gc, cb->who); @@ -261,7 +261,7 @@ yahoo_update_alias_cb(PurpleHttpConnection *http_conn, purple_debug_error("yahoo", "Missing new addressbook id in add response for %s (weird).\n", cb->who); } else { - if (g_ascii_strncasecmp(xmlnode_get_attrib(node, "id"), cb->id, strlen(cb->id))==0) + if (g_ascii_strncasecmp(purple_xmlnode_get_attrib(node, "id"), cb->id, strlen(cb->id))==0) purple_debug_info("yahoo", "Alias update for %s succeeded\n", cb->who); else purple_debug_error("yahoo", "Alias update for %s failed (Contact record return mismatch)\n", @@ -273,7 +273,7 @@ yahoo_update_alias_cb(PurpleHttpConnection *http_conn, g_free(cb->who); g_free(cb->id); g_free(cb); - xmlnode_free(result); + purple_xmlnode_free(result); } void @@ -430,29 +430,29 @@ yahoo_set_userinfo_cb(PurpleConnection *gc, PurpleRequestFields *fields) PurpleHttpRequest *req; PurpleHttpCookieJar *cookiejar; - xmlnode *node = xmlnode_new("ab"); - xmlnode *ct = xmlnode_new_child(node, "ct"); + PurpleXmlNode *node = purple_xmlnode_new("ab"); + PurpleXmlNode *ct = purple_xmlnode_new_child(node, "ct"); YahooData *yd = purple_connection_get_protocol_data(gc); char *content; int len; int i; char * yfields[] = { "fn", "ln", "nn", "mn", "hp", "wp", "mo", NULL }; - xmlnode_set_attrib(node, "k", purple_connection_get_display_name(gc)); - xmlnode_set_attrib(node, "cc", "1"); /* XXX: ? */ + purple_xmlnode_set_attrib(node, "k", purple_connection_get_display_name(gc)); + purple_xmlnode_set_attrib(node, "cc", "1"); /* XXX: ? */ - xmlnode_set_attrib(ct, "e", "1"); - xmlnode_set_attrib(ct, "yi", purple_request_fields_get_string(fields, "yname")); - xmlnode_set_attrib(ct, "id", purple_request_fields_get_string(fields, "yid")); - xmlnode_set_attrib(ct, "pr", "0"); + purple_xmlnode_set_attrib(ct, "e", "1"); + purple_xmlnode_set_attrib(ct, "yi", purple_request_fields_get_string(fields, "yname")); + purple_xmlnode_set_attrib(ct, "id", purple_request_fields_get_string(fields, "yid")); + purple_xmlnode_set_attrib(ct, "pr", "0"); for (i = 0; yfields[i]; i++) { const char *v = purple_request_fields_get_string(fields, yfields[i]); - xmlnode_set_attrib(ct, yfields[i], v ? v : ""); + purple_xmlnode_set_attrib(ct, yfields[i], v ? v : ""); } - content = xmlnode_to_formatted_str(node, &len); - xmlnode_free(node); + content = purple_xmlnode_to_formatted_str(node, &len); + purple_xmlnode_free(node); #if 0 { @@ -462,19 +462,19 @@ yahoo_set_userinfo_cb(PurpleConnection *gc, PurpleRequestFields *fields) * the receiver's end, which is stupid, and thus not really * surprising. */ struct yahoo_userinfo *ui = g_new(struct yahoo_userinfo, 1); - node = xmlnode_new("contact"); + node = purple_xmlnode_new("contact"); for (i = 0; yfields[i]; i++) { const char *v = purple_request_fields_get_string(fields, yfields[i]); if (v) { - xmlnode *nd = xmlnode_new_child(node, yfields[i]); - xmlnode_insert_data(nd, v, -1); + PurpleXmlNode *nd = purple_xmlnode_new_child(node, yfields[i]); + purple_xmlnode_insert_data(nd, v, -1); } } ui->yd = yd; - ui->xml = xmlnode_to_str(node, NULL); - xmlnode_free(node); + ui->xml = purple_xmlnode_to_str(node, NULL); + purple_xmlnode_free(node); } #endif @@ -581,20 +581,20 @@ void yahoo_set_userinfo(PurpleConnection *gc) static gboolean parse_contact_details(YahooData *yd, const char *who, const char *xml) { - xmlnode *node, *nd; + PurpleXmlNode *node, *nd; YahooFriend *f; char *yid; - node = xmlnode_from_str(xml, -1); + node = purple_xmlnode_from_str(xml, -1); if (!node) { purple_debug_info("yahoo", "Received malformed XML for contact details from '%s':\n%s\n", who, xml); return FALSE; } - nd = xmlnode_get_child(node, "yi"); - if (!nd || !(yid = xmlnode_get_data(nd))) { - xmlnode_free(node); + nd = purple_xmlnode_get_child(node, "yi"); + if (!nd || !(yid = purple_xmlnode_get_data(nd))) { + purple_xmlnode_free(node); return FALSE; } @@ -608,14 +608,14 @@ parse_contact_details(YahooData *yd, const char *who, const char *xml) purple_debug_info("yahoo", "Ignoring contact details sent by %s about %s\n", who, yid); g_free(yid); - xmlnode_free(node); + purple_xmlnode_free(node); return FALSE; } f = yahoo_friend_find(yd->gc, yid); if (!f) { g_free(yid); - xmlnode_free(node); + purple_xmlnode_free(node); return FALSE; } else { int i; @@ -638,8 +638,8 @@ parse_contact_details(YahooData *yd, const char *who, const char *xml) yahoo_personal_details_reset(ypd, FALSE); for (i = 0; details[i].id; i++) { - nd = xmlnode_get_child(node, details[i].id); - *details[i].field = nd ? xmlnode_get_data(nd) : NULL; + nd = purple_xmlnode_get_child(node, details[i].id); + *details[i].field = nd ? purple_xmlnode_get_data(nd) : NULL; } if (ypd->names.nick) @@ -657,7 +657,7 @@ parse_contact_details(YahooData *yd, const char *who, const char *xml) } } - xmlnode_free(node); + purple_xmlnode_free(node); g_free(yid); return TRUE; } diff --git a/libpurple/savedstatuses.c b/libpurple/savedstatuses.c index 924a88cdba..f2c72020f4 100644 --- a/libpurple/savedstatuses.c +++ b/libpurple/savedstatuses.c @@ -234,42 +234,42 @@ remove_old_transient_statuses(void) * Writing to disk * *********************************************************************/ -static xmlnode * +static PurpleXmlNode * substatus_to_xmlnode(PurpleSavedStatusSub *substatus) { - xmlnode *node, *child; + PurpleXmlNode *node, *child; - node = xmlnode_new("substatus"); + node = purple_xmlnode_new("substatus"); - child = xmlnode_new_child(node, "account"); - xmlnode_set_attrib(child, "protocol", purple_account_get_protocol_id(substatus->account)); - xmlnode_insert_data(child, + child = purple_xmlnode_new_child(node, "account"); + purple_xmlnode_set_attrib(child, "protocol", purple_account_get_protocol_id(substatus->account)); + purple_xmlnode_insert_data(child, purple_normalize(substatus->account, purple_account_get_username(substatus->account)), -1); - child = xmlnode_new_child(node, "state"); - xmlnode_insert_data(child, purple_status_type_get_id(substatus->type), -1); + child = purple_xmlnode_new_child(node, "state"); + purple_xmlnode_insert_data(child, purple_status_type_get_id(substatus->type), -1); if (substatus->message != NULL) { - child = xmlnode_new_child(node, "message"); - xmlnode_insert_data(child, substatus->message, -1); + child = purple_xmlnode_new_child(node, "message"); + purple_xmlnode_insert_data(child, substatus->message, -1); } return node; } -static xmlnode * +static PurpleXmlNode * status_to_xmlnode(PurpleSavedStatus *status) { - xmlnode *node, *child; + PurpleXmlNode *node, *child; char buf[21]; GList *cur; - node = xmlnode_new("status"); + node = purple_xmlnode_new("status"); if (status->title != NULL) { - xmlnode_set_attrib(node, "name", status->title); + purple_xmlnode_set_attrib(node, "name", status->title); } else { @@ -281,50 +281,50 @@ status_to_xmlnode(PurpleSavedStatus *status) * whether the "name" attribute is set to something or if * it does not exist at all. */ - xmlnode_set_attrib(node, "name", "Auto-Cached"); - xmlnode_set_attrib(node, "transient", "true"); + purple_xmlnode_set_attrib(node, "name", "Auto-Cached"); + purple_xmlnode_set_attrib(node, "transient", "true"); } g_snprintf(buf, sizeof(buf), "%lu", status->creation_time); - xmlnode_set_attrib(node, "created", buf); + purple_xmlnode_set_attrib(node, "created", buf); g_snprintf(buf, sizeof(buf), "%lu", status->lastused); - xmlnode_set_attrib(node, "lastused", buf); + purple_xmlnode_set_attrib(node, "lastused", buf); g_snprintf(buf, sizeof(buf), "%u", status->usage_count); - xmlnode_set_attrib(node, "usage_count", buf); + purple_xmlnode_set_attrib(node, "usage_count", buf); - child = xmlnode_new_child(node, "state"); - xmlnode_insert_data(child, purple_primitive_get_id_from_type(status->type), -1); + child = purple_xmlnode_new_child(node, "state"); + purple_xmlnode_insert_data(child, purple_primitive_get_id_from_type(status->type), -1); if (status->message != NULL) { - child = xmlnode_new_child(node, "message"); - xmlnode_insert_data(child, status->message, -1); + child = purple_xmlnode_new_child(node, "message"); + purple_xmlnode_insert_data(child, status->message, -1); } for (cur = status->substatuses; cur != NULL; cur = cur->next) { child = substatus_to_xmlnode(cur->data); - xmlnode_insert_child(node, child); + purple_xmlnode_insert_child(node, child); } return node; } -static xmlnode * +static PurpleXmlNode * statuses_to_xmlnode(void) { - xmlnode *node, *child; + PurpleXmlNode *node, *child; GList *cur; - node = xmlnode_new("statuses"); - xmlnode_set_attrib(node, "version", "1.0"); + node = purple_xmlnode_new("statuses"); + purple_xmlnode_set_attrib(node, "version", "1.0"); for (cur = saved_statuses; cur != NULL; cur = cur->next) { child = status_to_xmlnode(cur->data); - xmlnode_insert_child(node, child); + purple_xmlnode_insert_child(node, child); } return node; @@ -333,7 +333,7 @@ statuses_to_xmlnode(void) static void sync_statuses(void) { - xmlnode *node; + PurpleXmlNode *node; char *data; if (!statuses_loaded) @@ -344,10 +344,10 @@ sync_statuses(void) } node = statuses_to_xmlnode(); - data = xmlnode_to_formatted_str(node, NULL); + data = purple_xmlnode_to_formatted_str(node, NULL); purple_util_write_data_to_file("status.xml", data, -1); g_free(data); - xmlnode_free(node); + purple_xmlnode_free(node); } static gboolean @@ -371,22 +371,22 @@ schedule_save(void) *********************************************************************/ static PurpleSavedStatusSub * -parse_substatus(xmlnode *substatus) +parse_substatus(PurpleXmlNode *substatus) { PurpleSavedStatusSub *ret; - xmlnode *node; + PurpleXmlNode *node; char *data; ret = g_new0(PurpleSavedStatusSub, 1); /* Read the account */ - node = xmlnode_get_child(substatus, "account"); + node = purple_xmlnode_get_child(substatus, "account"); if (node != NULL) { char *acct_name; const char *protocol; - acct_name = xmlnode_get_data(node); - protocol = xmlnode_get_attrib(node, "protocol"); + acct_name = purple_xmlnode_get_data(node); + protocol = purple_xmlnode_get_attrib(node, "protocol"); if ((acct_name != NULL) && (protocol != NULL)) ret->account = purple_accounts_find(acct_name, protocol); g_free(acct_name); @@ -399,8 +399,8 @@ parse_substatus(xmlnode *substatus) } /* Read the state */ - node = xmlnode_get_child(substatus, "state"); - if ((node != NULL) && ((data = xmlnode_get_data(node)) != NULL)) + node = purple_xmlnode_get_child(substatus, "state"); + if ((node != NULL) && ((data = purple_xmlnode_get_data(node)) != NULL)) { ret->type = purple_status_type_find_with_id( purple_account_get_status_types(ret->account), data); @@ -414,8 +414,8 @@ parse_substatus(xmlnode *substatus) } /* Read the message */ - node = xmlnode_get_child(substatus, "message"); - if ((node != NULL) && ((data = xmlnode_get_data(node)) != NULL)) + node = purple_xmlnode_get_child(substatus, "message"); + if ((node != NULL) && ((data = purple_xmlnode_get_data(node)) != NULL)) { ret->message = data; } @@ -449,21 +449,21 @@ parse_substatus(xmlnode *substatus) * I know. Moving, huh? */ static PurpleSavedStatus * -parse_status(xmlnode *status) +parse_status(PurpleXmlNode *status) { PurpleSavedStatus *ret; - xmlnode *node; + PurpleXmlNode *node; const char *attrib; char *data; int i; ret = g_new0(PurpleSavedStatus, 1); - attrib = xmlnode_get_attrib(status, "transient"); + attrib = purple_xmlnode_get_attrib(status, "transient"); if (!purple_strequal(attrib, "true")) { /* Read the title */ - attrib = xmlnode_get_attrib(status, "name"); + attrib = purple_xmlnode_get_attrib(status, "name"); ret->title = g_strdup(attrib); } @@ -480,35 +480,35 @@ parse_status(xmlnode *status) } /* Read the creation time */ - attrib = xmlnode_get_attrib(status, "created"); + attrib = purple_xmlnode_get_attrib(status, "created"); set_creation_time(ret, (attrib != NULL ? atol(attrib) : 0)); /* Read the last used time */ - attrib = xmlnode_get_attrib(status, "lastused"); + attrib = purple_xmlnode_get_attrib(status, "lastused"); ret->lastused = (attrib != NULL ? atol(attrib) : 0); /* Read the usage count */ - attrib = xmlnode_get_attrib(status, "usage_count"); + attrib = purple_xmlnode_get_attrib(status, "usage_count"); ret->usage_count = (attrib != NULL ? atol(attrib) : 0); /* Read the primitive status type */ - node = xmlnode_get_child(status, "state"); - if ((node != NULL) && ((data = xmlnode_get_data(node)) != NULL)) + node = purple_xmlnode_get_child(status, "state"); + if ((node != NULL) && ((data = purple_xmlnode_get_data(node)) != NULL)) { ret->type = purple_primitive_get_type_from_id(data); g_free(data); } /* Read the message */ - node = xmlnode_get_child(status, "message"); - if ((node != NULL) && ((data = xmlnode_get_data(node)) != NULL)) + node = purple_xmlnode_get_child(status, "message"); + if ((node != NULL) && ((data = purple_xmlnode_get_data(node)) != NULL)) { ret->message = data; } /* Read substatuses */ - for (node = xmlnode_get_child(status, "substatus"); node != NULL; - node = xmlnode_get_next_twin(node)) + for (node = purple_xmlnode_get_child(status, "substatus"); node != NULL; + node = purple_xmlnode_get_next_twin(node)) { PurpleSavedStatusSub *new; new = parse_substatus(node); @@ -529,7 +529,7 @@ parse_status(xmlnode *status) static void load_statuses(void) { - xmlnode *statuses, *status; + PurpleXmlNode *statuses, *status; statuses_loaded = TRUE; @@ -538,8 +538,8 @@ load_statuses(void) if (statuses == NULL) return; - for (status = xmlnode_get_child(statuses, "status"); status != NULL; - status = xmlnode_get_next_twin(status)) + for (status = purple_xmlnode_get_child(statuses, "status"); status != NULL; + status = purple_xmlnode_get_next_twin(status)) { PurpleSavedStatus *new; new = parse_status(status); @@ -547,7 +547,7 @@ load_statuses(void) } saved_statuses = g_list_sort(saved_statuses, saved_statuses_sort_func); - xmlnode_free(statuses); + purple_xmlnode_free(statuses); } diff --git a/libpurple/smiley.c b/libpurple/smiley.c index 9a3fbfdf79..1384a73369 100644 --- a/libpurple/smiley.c +++ b/libpurple/smiley.c @@ -127,26 +127,26 @@ purple_smiley_data_unstore(const char *filename); * Writing to disk * *********************************************************************/ -static xmlnode * +static PurpleXmlNode * smiley_to_xmlnode(PurpleSmiley *smiley) { PurpleSmileyPrivate *priv = NULL; - xmlnode *smiley_node = NULL; + PurpleXmlNode *smiley_node = NULL; - smiley_node = xmlnode_new(XML_SMILEY_TAG); + smiley_node = purple_xmlnode_new(XML_SMILEY_TAG); if (!smiley_node) return NULL; priv = PURPLE_SMILEY_GET_PRIVATE(smiley); - xmlnode_set_attrib(smiley_node, XML_SHORTCUT_ATTRIB_TAG, + purple_xmlnode_set_attrib(smiley_node, XML_SHORTCUT_ATTRIB_TAG, priv->shortcut); - xmlnode_set_attrib(smiley_node, XML_CHECKSUM_ATRIB_TAG, + purple_xmlnode_set_attrib(smiley_node, XML_CHECKSUM_ATRIB_TAG, priv->checksum); - xmlnode_set_attrib(smiley_node, XML_FILENAME_ATRIB_TAG, + purple_xmlnode_set_attrib(smiley_node, XML_FILENAME_ATRIB_TAG, purple_imgstore_get_filename(priv->img)); return smiley_node; @@ -155,30 +155,30 @@ smiley_to_xmlnode(PurpleSmiley *smiley) static void add_smiley_to_main_node(gpointer key, gpointer value, gpointer user_data) { - xmlnode *child_node; + PurpleXmlNode *child_node; child_node = smiley_to_xmlnode(value); - xmlnode_insert_child((xmlnode*)user_data, child_node); + purple_xmlnode_insert_child((PurpleXmlNode*)user_data, child_node); } -static xmlnode * +static PurpleXmlNode * smileys_to_xmlnode(void) { - xmlnode *root_node, *profile_node, *smileyset_node; + PurpleXmlNode *root_node, *profile_node, *smileyset_node; - root_node = xmlnode_new(XML_ROOT_TAG); - xmlnode_set_attrib(root_node, "version", "1.0"); + root_node = purple_xmlnode_new(XML_ROOT_TAG); + purple_xmlnode_set_attrib(root_node, "version", "1.0"); /* See the top comments above to understand why initial tag elements * are not being considered by now. */ - profile_node = xmlnode_new(XML_PROFILE_TAG); + profile_node = purple_xmlnode_new(XML_PROFILE_TAG); if (profile_node) { - xmlnode_set_attrib(profile_node, XML_PROFILE_NAME_ATTRIB_TAG, "Default"); - xmlnode_insert_child(root_node, profile_node); + purple_xmlnode_set_attrib(profile_node, XML_PROFILE_NAME_ATTRIB_TAG, "Default"); + purple_xmlnode_insert_child(root_node, profile_node); - smileyset_node = xmlnode_new(XML_SMILEY_SET_TAG); + smileyset_node = purple_xmlnode_new(XML_SMILEY_SET_TAG); if (smileyset_node) { - xmlnode_insert_child(profile_node, smileyset_node); + purple_xmlnode_insert_child(profile_node, smileyset_node); g_hash_table_foreach(smiley_shortcut_index, add_smiley_to_main_node, smileyset_node); } } @@ -189,7 +189,7 @@ smileys_to_xmlnode(void) static void sync_smileys(void) { - xmlnode *root_node; + PurpleXmlNode *root_node; char *data; if (!smileys_loaded) { @@ -199,11 +199,11 @@ sync_smileys(void) } root_node = smileys_to_xmlnode(); - data = xmlnode_to_formatted_str(root_node, NULL); + data = purple_xmlnode_to_formatted_str(root_node, NULL); purple_util_write_data_to_file(XML_FILE_NAME, data, -1); g_free(data); - xmlnode_free(root_node); + purple_xmlnode_free(root_node); } static gboolean @@ -227,15 +227,15 @@ purple_smileys_save(void) *********************************************************************/ static void -parse_smiley(xmlnode *smiley_node) +parse_smiley(PurpleXmlNode *smiley_node) { const char *shortcut = NULL; const char *checksum = NULL; const char *filename = NULL; - shortcut = xmlnode_get_attrib(smiley_node, XML_SHORTCUT_ATTRIB_TAG); - checksum = xmlnode_get_attrib(smiley_node, XML_CHECKSUM_ATRIB_TAG); - filename = xmlnode_get_attrib(smiley_node, XML_FILENAME_ATRIB_TAG); + shortcut = purple_xmlnode_get_attrib(smiley_node, XML_SHORTCUT_ATTRIB_TAG); + checksum = purple_xmlnode_get_attrib(smiley_node, XML_CHECKSUM_ATRIB_TAG); + filename = purple_xmlnode_get_attrib(smiley_node, XML_FILENAME_ATRIB_TAG); if ((shortcut == NULL) || (checksum == NULL) || (filename == NULL)) return; @@ -246,9 +246,9 @@ parse_smiley(xmlnode *smiley_node) static void purple_smileys_load(void) { - xmlnode *root_node, *profile_node; - xmlnode *smileyset_node = NULL; - xmlnode *smiley_node; + PurpleXmlNode *root_node, *profile_node; + PurpleXmlNode *smileyset_node = NULL; + PurpleXmlNode *smiley_node; smileys_loaded = TRUE; @@ -260,19 +260,19 @@ purple_smileys_load(void) /* See the top comments above to understand why initial tag elements * are not being considered by now. */ - profile_node = xmlnode_get_child(root_node, XML_PROFILE_TAG); + profile_node = purple_xmlnode_get_child(root_node, XML_PROFILE_TAG); if (profile_node) - smileyset_node = xmlnode_get_child(profile_node, XML_SMILEY_SET_TAG); + smileyset_node = purple_xmlnode_get_child(profile_node, XML_SMILEY_SET_TAG); if (smileyset_node) { - smiley_node = xmlnode_get_child(smileyset_node, XML_SMILEY_TAG); + smiley_node = purple_xmlnode_get_child(smileyset_node, XML_SMILEY_TAG); for (; smiley_node != NULL; - smiley_node = xmlnode_get_next_twin(smiley_node)) { + smiley_node = purple_xmlnode_get_next_twin(smiley_node)) { parse_smiley(smiley_node); } } - xmlnode_free(root_node); + purple_xmlnode_free(root_node); } /********************************************************************* diff --git a/libpurple/sound-theme-loader.c b/libpurple/sound-theme-loader.c index 2f2203bffc..630266bace 100644 --- a/libpurple/sound-theme-loader.c +++ b/libpurple/sound-theme-loader.c @@ -34,7 +34,7 @@ static PurpleTheme * purple_sound_loader_build(const gchar *theme_dir) { - xmlnode *root_node = NULL, *sub_node; + PurpleXmlNode *root_node = NULL, *sub_node; gchar *dir, *filename_full, *data = NULL; PurpleSoundTheme *theme = NULL; const gchar *name; @@ -45,7 +45,7 @@ purple_sound_loader_build(const gchar *theme_dir) filename_full = g_build_filename(dir, "theme.xml", NULL); if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR)) - root_node = xmlnode_from_file(dir, "theme.xml", "sound themes", "sound-theme-loader"); + root_node = purple_xmlnode_from_file(dir, "theme.xml", "sound themes", "sound-theme-loader"); g_free(filename_full); if (root_node == NULL) { @@ -53,34 +53,34 @@ purple_sound_loader_build(const gchar *theme_dir) return NULL; } - name = xmlnode_get_attrib(root_node, "name"); + name = purple_xmlnode_get_attrib(root_node, "name"); - if (name && purple_strequal(xmlnode_get_attrib(root_node, "type"), "sound")) { + if (name && purple_strequal(purple_xmlnode_get_attrib(root_node, "type"), "sound")) { /* Parse the tree */ - sub_node = xmlnode_get_child(root_node, "description"); - data = xmlnode_get_data(sub_node); + sub_node = purple_xmlnode_get_child(root_node, "description"); + data = purple_xmlnode_get_data(sub_node); - if (xmlnode_get_attrib(root_node, "name") != NULL) { + if (purple_xmlnode_get_attrib(root_node, "name") != NULL) { theme = g_object_new(PURPLE_TYPE_SOUND_THEME, "type", "sound", "name", name, - "author", xmlnode_get_attrib(root_node, "author"), - "image", xmlnode_get_attrib(root_node, "image"), + "author", purple_xmlnode_get_attrib(root_node, "author"), + "image", purple_xmlnode_get_attrib(root_node, "image"), "directory", dir, "description", data, NULL); - sub_node = xmlnode_get_child(root_node, "event"); + sub_node = purple_xmlnode_get_child(root_node, "event"); while (sub_node) { purple_sound_theme_set_file(theme, - xmlnode_get_attrib(sub_node, "name"), - xmlnode_get_attrib(sub_node, "file")); - sub_node = xmlnode_get_next_twin(sub_node); + purple_xmlnode_get_attrib(sub_node, "name"), + purple_xmlnode_get_attrib(sub_node, "file")); + sub_node = purple_xmlnode_get_next_twin(sub_node); } } } else purple_debug_warning("sound-theme-loader", "Missing attribute or problem with the root element\n"); - xmlnode_free(root_node); + purple_xmlnode_free(root_node); g_free(data); g_free(dir); return PURPLE_THEME(theme); diff --git a/libpurple/tests/check_libpurple.c b/libpurple/tests/check_libpurple.c index 5c024ce110..91e8a79ba9 100644 --- a/libpurple/tests/check_libpurple.c +++ b/libpurple/tests/check_libpurple.c @@ -90,7 +90,7 @@ int main(void) srunner_add_suite(sr, oscar_util_suite()); srunner_add_suite(sr, yahoo_util_suite()); srunner_add_suite(sr, util_suite()); - srunner_add_suite(sr, xmlnode_suite()); + srunner_add_suite(sr, purple_xmlnode_suite()); /* make this a libpurple "ui" */ purple_check_init(); diff --git a/libpurple/tests/test_jabber_caps.c b/libpurple/tests/test_jabber_caps.c index c0d4cd1893..0f534787d6 100644 --- a/libpurple/tests/test_jabber_caps.c +++ b/libpurple/tests/test_jabber_caps.c @@ -8,25 +8,25 @@ START_TEST(test_parse_invalid) { - xmlnode *query; + PurpleXmlNode *query; fail_unless(NULL == jabber_caps_parse_client_info(NULL)); /* Something other than a disco#info query */ - query = xmlnode_new("foo"); + query = purple_xmlnode_new("foo"); fail_unless(NULL == jabber_caps_parse_client_info(query)); - xmlnode_free(query); + purple_xmlnode_free(query); - query = xmlnode_new("query"); + query = purple_xmlnode_new("query"); fail_unless(NULL == jabber_caps_parse_client_info(query)); - xmlnode_set_namespace(query, "jabber:iq:last"); + purple_xmlnode_set_namespace(query, "jabber:iq:last"); fail_unless(NULL == jabber_caps_parse_client_info(query)); - xmlnode_free(query); + purple_xmlnode_free(query); } END_TEST #define assert_caps_calculate_match(hash_func, hash, str) { \ - xmlnode *query = xmlnode_from_str((str), -1); \ + PurpleXmlNode *query = purple_xmlnode_from_str((str), -1); \ PurpleHash *hasher = NULL; \ JabberCapsClientInfo *info = jabber_caps_parse_client_info(query); \ gchar *got_hash; \ diff --git a/libpurple/tests/test_xmlnode.c b/libpurple/tests/test_xmlnode.c index 264a468d92..67d373b480 100644 --- a/libpurple/tests/test_xmlnode.c +++ b/libpurple/tests/test_xmlnode.c @@ -16,40 +16,40 @@ START_TEST(test_xmlnode_billion_laughs_attack) the parser for the above XML document */ /* purple_debug_set_enabled(TRUE); */ - fail_if(xmlnode_from_str(malicious_xml_doc, -1), - "xmlnode_from_str() returned an XML tree, but we didn't want it to"); + fail_if(purple_xmlnode_from_str(malicious_xml_doc, -1), + "purple_xmlnode_from_str() returned an XML tree, but we didn't want it to"); } END_TEST #define check_doc_structure(x) { \ - xmlnode *ping, *child1, *child2; \ + PurpleXmlNode *ping, *child1, *child2; \ fail_if(x == NULL, "Failed to parse document"); \ - ping = xmlnode_get_child(x, "ping"); \ + ping = purple_xmlnode_get_child(x, "ping"); \ fail_if(ping == NULL, "Failed to find 'ping' child"); \ - child1 = xmlnode_get_child(ping, "child1"); \ + child1 = purple_xmlnode_get_child(ping, "child1"); \ fail_if(child1 == NULL, "Failed to find 'child1'"); \ - child2 = xmlnode_get_child(child1, "child2"); \ + child2 = purple_xmlnode_get_child(child1, "child2"); \ fail_if(child2 == NULL, "Failed to find 'child2'"); \ - xmlnode_new_child(child2, "a"); \ + purple_xmlnode_new_child(child2, "a"); \ \ - assert_string_equal("jabber:client", xmlnode_get_namespace(x)); \ - /* NOTE: xmlnode_get_namespace() returns the namespace of the element, not the + assert_string_equal("jabber:client", purple_xmlnode_get_namespace(x)); \ + /* NOTE: purple_xmlnode_get_namespace() returns the namespace of the element, not the * current default namespace. See http://www.w3.org/TR/xml-names/#defaulting and * http://www.w3.org/TR/xml-names/#dt-defaultNS. */ \ - assert_string_equal("urn:xmpp:ping", xmlnode_get_namespace(ping)); \ - assert_string_equal("jabber:client", xmlnode_get_namespace(child1)); \ - assert_string_equal("urn:xmpp:ping", xmlnode_get_namespace(child2)); \ + assert_string_equal("urn:xmpp:ping", purple_xmlnode_get_namespace(ping)); \ + assert_string_equal("jabber:client", purple_xmlnode_get_namespace(child1)); \ + assert_string_equal("urn:xmpp:ping", purple_xmlnode_get_namespace(child2)); \ /* * This fails (well, actually crashes [the ns is NULL]) unless - * xmlnode_new_child() actually sets the element namespace. - assert_string_equal("jabber:client", xmlnode_get_namespace(xmlnode_get_child(child2, "a"))); + * purple_xmlnode_new_child() actually sets the element namespace. + assert_string_equal("jabber:client", purple_xmlnode_get_namespace(purple_xmlnode_get_child(child2, "a"))); */ \ \ - assert_string_equal("jabber:client", xmlnode_get_default_namespace(x)); \ - assert_string_equal("jabber:client", xmlnode_get_default_namespace(ping)); \ - assert_string_equal("jabber:client", xmlnode_get_default_namespace(child1)); \ - assert_string_equal("jabber:client", xmlnode_get_default_namespace(child2)); \ + assert_string_equal("jabber:client", purple_xmlnode_get_default_namespace(x)); \ + assert_string_equal("jabber:client", purple_xmlnode_get_default_namespace(ping)); \ + assert_string_equal("jabber:client", purple_xmlnode_get_default_namespace(child1)); \ + assert_string_equal("jabber:client", purple_xmlnode_get_default_namespace(child2)); \ } START_TEST(test_xmlnode_prefixes) @@ -63,21 +63,21 @@ START_TEST(test_xmlnode_prefixes) "</ping:ping>" "</iq>"; char *str; - xmlnode *xml, *reparsed; + PurpleXmlNode *xml, *reparsed; - xml = xmlnode_from_str(xml_doc, -1); + xml = purple_xmlnode_from_str(xml_doc, -1); check_doc_structure(xml); - /* Check that xmlnode_from_str(xmlnode_to_str(xml, NULL), -1) is idempotent. */ - str = xmlnode_to_str(xml, NULL); + /* Check that purple_xmlnode_from_str(purple_xmlnode_to_str(xml, NULL), -1) is idempotent. */ + str = purple_xmlnode_to_str(xml, NULL); fail_if(str == NULL, "Failed to serialize XMLnode"); - reparsed = xmlnode_from_str(str, -1); + reparsed = purple_xmlnode_from_str(str, -1); fail_if(reparsed == NULL, "Failed to reparse xml document"); check_doc_structure(reparsed); g_free(str); - xmlnode_free(xml); - xmlnode_free(reparsed); + purple_xmlnode_free(xml); + purple_xmlnode_free(reparsed); } END_TEST @@ -103,21 +103,21 @@ START_TEST(test_strip_prefixes) "</html>" "</message>"; char *str; - xmlnode *xml; + PurpleXmlNode *xml; - xml = xmlnode_from_str(xml_doc, -1); + xml = purple_xmlnode_from_str(xml_doc, -1); fail_if(xml == NULL, "Failed to parse XML"); - xmlnode_strip_prefixes(xml); - str = xmlnode_to_str(xml, NULL); + purple_xmlnode_strip_prefixes(xml); + str = purple_xmlnode_to_str(xml, NULL); assert_string_equal_free(out, str); - xmlnode_free(xml); + purple_xmlnode_free(xml); } END_TEST Suite * -xmlnode_suite(void) +purple_xmlnode_suite(void) { Suite *s = suite_create("Utility Functions"); diff --git a/libpurple/tests/tests.h b/libpurple/tests/tests.h index 76f9c34f8f..572c58eea6 100644 --- a/libpurple/tests/tests.h +++ b/libpurple/tests/tests.h @@ -16,7 +16,7 @@ Suite * jabber_scram_suite(void); Suite * oscar_util_suite(void); Suite * yahoo_util_suite(void); Suite * util_suite(void); -Suite * xmlnode_suite(void); +Suite * purple_xmlnode_suite(void); /* helper macros */ #define assert_int_equal(expected, actual) { \ diff --git a/libpurple/upnp.c b/libpurple/upnp.c index 227e7c0867..18e358706c 100644 --- a/libpurple/upnp.c +++ b/libpurple/upnp.c @@ -178,9 +178,9 @@ fire_discovery_callbacks(gboolean success) } static gboolean -purple_upnp_compare_device(const xmlnode* device, const gchar* deviceType) +purple_upnp_compare_device(const PurpleXmlNode* device, const gchar* deviceType) { - xmlnode* deviceTypeNode = xmlnode_get_child(device, "deviceType"); + PurpleXmlNode* deviceTypeNode = purple_xmlnode_get_child(device, "deviceType"); char *tmp; gboolean ret; @@ -188,7 +188,7 @@ purple_upnp_compare_device(const xmlnode* device, const gchar* deviceType) return FALSE; } - tmp = xmlnode_get_data(deviceTypeNode); + tmp = purple_xmlnode_get_data(deviceTypeNode); ret = !g_ascii_strcasecmp(tmp, deviceType); g_free(tmp); @@ -196,9 +196,9 @@ purple_upnp_compare_device(const xmlnode* device, const gchar* deviceType) } static gboolean -purple_upnp_compare_service(const xmlnode* service, const gchar* serviceType) +purple_upnp_compare_service(const PurpleXmlNode* service, const gchar* serviceType) { - xmlnode* serviceTypeNode; + PurpleXmlNode* serviceTypeNode; char *tmp; gboolean ret; @@ -206,13 +206,13 @@ purple_upnp_compare_service(const xmlnode* service, const gchar* serviceType) return FALSE; } - serviceTypeNode = xmlnode_get_child(service, "serviceType"); + serviceTypeNode = purple_xmlnode_get_child(service, "serviceType"); if(serviceTypeNode == NULL) { return FALSE; } - tmp = xmlnode_get_data(serviceTypeNode); + tmp = purple_xmlnode_get_data(serviceTypeNode); ret = !g_ascii_strcasecmp(tmp, serviceType); g_free(tmp); @@ -224,11 +224,11 @@ purple_upnp_parse_description_response(const gchar* httpResponse, gsize len, const gchar* httpURL, const gchar* serviceType) { gchar *baseURL, *controlURL, *service; - xmlnode *xmlRootNode, *serviceTypeNode, *controlURLNode, *baseURLNode; + PurpleXmlNode *xmlRootNode, *serviceTypeNode, *controlURLNode, *baseURLNode; char *tmp; /* create the xml root node */ - if ((xmlRootNode = xmlnode_from_str(httpResponse, len)) == NULL) { + if ((xmlRootNode = purple_xmlnode_from_str(httpResponse, len)) == NULL) { purple_debug_error("upnp", "parse_description_response(): Could not parse xml root node\n"); return NULL; @@ -236,8 +236,8 @@ purple_upnp_parse_description_response(const gchar* httpResponse, gsize len, /* get the baseURL of the device */ baseURL = NULL; - if((baseURLNode = xmlnode_get_child(xmlRootNode, "URLBase")) != NULL) { - baseURL = xmlnode_get_data(baseURLNode); + if((baseURLNode = purple_xmlnode_get_child(xmlRootNode, "URLBase")) != NULL) { + baseURL = purple_xmlnode_get_data(baseURLNode); } /* fixes upnp-descriptions with empty urlbase-element */ if(baseURL == NULL){ @@ -247,79 +247,79 @@ purple_upnp_parse_description_response(const gchar* httpResponse, gsize len, /* get the serviceType child that has the service type as its data */ /* get urn:schemas-upnp-org:device:InternetGatewayDevice:1 and its devicelist */ - serviceTypeNode = xmlnode_get_child(xmlRootNode, "device"); + serviceTypeNode = purple_xmlnode_get_child(xmlRootNode, "device"); while(!purple_upnp_compare_device(serviceTypeNode, "urn:schemas-upnp-org:device:InternetGatewayDevice:1") && serviceTypeNode != NULL) { - serviceTypeNode = xmlnode_get_next_twin(serviceTypeNode); + serviceTypeNode = purple_xmlnode_get_next_twin(serviceTypeNode); } if(serviceTypeNode == NULL) { purple_debug_error("upnp", "parse_description_response(): could not get serviceTypeNode 1\n"); g_free(baseURL); - xmlnode_free(xmlRootNode); + purple_xmlnode_free(xmlRootNode); return NULL; } - serviceTypeNode = xmlnode_get_child(serviceTypeNode, "deviceList"); + serviceTypeNode = purple_xmlnode_get_child(serviceTypeNode, "deviceList"); if(serviceTypeNode == NULL) { purple_debug_error("upnp", "parse_description_response(): could not get serviceTypeNode 2\n"); g_free(baseURL); - xmlnode_free(xmlRootNode); + purple_xmlnode_free(xmlRootNode); return NULL; } /* get urn:schemas-upnp-org:device:WANDevice:1 and its devicelist */ - serviceTypeNode = xmlnode_get_child(serviceTypeNode, "device"); + serviceTypeNode = purple_xmlnode_get_child(serviceTypeNode, "device"); while(!purple_upnp_compare_device(serviceTypeNode, "urn:schemas-upnp-org:device:WANDevice:1") && serviceTypeNode != NULL) { - serviceTypeNode = xmlnode_get_next_twin(serviceTypeNode); + serviceTypeNode = purple_xmlnode_get_next_twin(serviceTypeNode); } if(serviceTypeNode == NULL) { purple_debug_error("upnp", "parse_description_response(): could not get serviceTypeNode 3\n"); g_free(baseURL); - xmlnode_free(xmlRootNode); + purple_xmlnode_free(xmlRootNode); return NULL; } - serviceTypeNode = xmlnode_get_child(serviceTypeNode, "deviceList"); + serviceTypeNode = purple_xmlnode_get_child(serviceTypeNode, "deviceList"); if(serviceTypeNode == NULL) { purple_debug_error("upnp", "parse_description_response(): could not get serviceTypeNode 4\n"); g_free(baseURL); - xmlnode_free(xmlRootNode); + purple_xmlnode_free(xmlRootNode); return NULL; } /* get urn:schemas-upnp-org:device:WANConnectionDevice:1 and its servicelist */ - serviceTypeNode = xmlnode_get_child(serviceTypeNode, "device"); + serviceTypeNode = purple_xmlnode_get_child(serviceTypeNode, "device"); while(serviceTypeNode && !purple_upnp_compare_device(serviceTypeNode, "urn:schemas-upnp-org:device:WANConnectionDevice:1")) { - serviceTypeNode = xmlnode_get_next_twin(serviceTypeNode); + serviceTypeNode = purple_xmlnode_get_next_twin(serviceTypeNode); } if(serviceTypeNode == NULL) { purple_debug_error("upnp", "parse_description_response(): could not get serviceTypeNode 5\n"); g_free(baseURL); - xmlnode_free(xmlRootNode); + purple_xmlnode_free(xmlRootNode); return NULL; } - serviceTypeNode = xmlnode_get_child(serviceTypeNode, "serviceList"); + serviceTypeNode = purple_xmlnode_get_child(serviceTypeNode, "serviceList"); if(serviceTypeNode == NULL) { purple_debug_error("upnp", "parse_description_response(): could not get serviceTypeNode 6\n"); g_free(baseURL); - xmlnode_free(xmlRootNode); + purple_xmlnode_free(xmlRootNode); return NULL; } /* get the serviceType variable passed to this function */ service = g_strdup_printf(SEARCH_REQUEST_DEVICE, serviceType); - serviceTypeNode = xmlnode_get_child(serviceTypeNode, "service"); + serviceTypeNode = purple_xmlnode_get_child(serviceTypeNode, "service"); while(!purple_upnp_compare_service(serviceTypeNode, service) && serviceTypeNode != NULL) { - serviceTypeNode = xmlnode_get_next_twin(serviceTypeNode); + serviceTypeNode = purple_xmlnode_get_next_twin(serviceTypeNode); } g_free(service); @@ -327,21 +327,21 @@ purple_upnp_parse_description_response(const gchar* httpResponse, gsize len, purple_debug_error("upnp", "parse_description_response(): could not get serviceTypeNode 7\n"); g_free(baseURL); - xmlnode_free(xmlRootNode); + purple_xmlnode_free(xmlRootNode); return NULL; } /* get the controlURL of the service */ - if((controlURLNode = xmlnode_get_child(serviceTypeNode, + if((controlURLNode = purple_xmlnode_get_child(serviceTypeNode, "controlURL")) == NULL) { purple_debug_error("upnp", "parse_description_response(): Could not find controlURL\n"); g_free(baseURL); - xmlnode_free(xmlRootNode); + purple_xmlnode_free(xmlRootNode); return NULL; } - tmp = xmlnode_get_data(controlURLNode); + tmp = purple_xmlnode_get_data(controlURLNode); if(baseURL && !purple_str_has_prefix(tmp, "http://") && !purple_str_has_prefix(tmp, "HTTP://")) { /* Handle absolute paths in a relative URL. This probably @@ -361,7 +361,7 @@ purple_upnp_parse_description_response(const gchar* httpResponse, gsize len, controlURL = tmp; } g_free(baseURL); - xmlnode_free(xmlRootNode); + purple_xmlnode_free(xmlRootNode); return controlURL; } diff --git a/libpurple/util.c b/libpurple/util.c index 552431ec53..02003b6c9a 100644 --- a/libpurple/util.c +++ b/libpurple/util.c @@ -3105,10 +3105,10 @@ purple_util_write_data_to_file_absolute(const char *filename_full, const char *d return TRUE; } -xmlnode * +PurpleXmlNode * purple_util_read_xml_from_file(const char *filename, const char *description) { - return xmlnode_from_file(purple_user_dir(), filename, description, "util"); + return purple_xmlnode_from_file(purple_user_dir(), filename, description, "util"); } /* diff --git a/libpurple/util.h b/libpurple/util.h index c4e2d7ef07..fac790edd5 100644 --- a/libpurple/util.h +++ b/libpurple/util.h @@ -743,7 +743,7 @@ int purple_build_dir(const char *path, int mode); * user directory ($HOME/.purple by default). The data is typically * a serialized version of one of Purple's config files, such as * prefs.xml, accounts.xml, etc. And the string is typically - * obtained using xmlnode_to_formatted_str. However, this function + * obtained using purple_xmlnode_to_formatted_str. However, this function * should work fine for saving binary files as well. * * @param filename The basename of the file to write in the purple_user_dir. @@ -778,7 +778,7 @@ purple_util_write_data_to_file_absolute(const char *filename_full, const char *d /** * Read the contents of a given file and parse the results into an - * xmlnode tree structure. This is intended to be used to read + * PurpleXmlNode tree structure. This is intended to be used to read * Purple's configuration xml files (prefs.xml, pounces.xml, etc.) * * @param filename The basename of the file to open in the purple_user_dir. @@ -787,10 +787,10 @@ purple_util_write_data_to_file_absolute(const char *filename_full, const char *d * user when the file can not be opened. For example, * "preferences," or "buddy pounces." * - * @return An xmlnode tree of the contents of the given file. Or NULL, if + * @return An PurpleXmlNode tree of the contents of the given file. Or NULL, if * the file does not exist or there was an error reading the file. */ -xmlnode *purple_util_read_xml_from_file(const char *filename, +PurpleXmlNode *purple_util_read_xml_from_file(const char *filename, const char *description); /** diff --git a/libpurple/xmlnode.c b/libpurple/xmlnode.c index 3c5cbbcae2..cce5f97115 100644 --- a/libpurple/xmlnode.c +++ b/libpurple/xmlnode.c @@ -1,5 +1,5 @@ /** - * @file xmlnode.c XML DOM functions + * @file PurpleXmlNode.c XML DOM functions */ /* purple @@ -46,42 +46,42 @@ # define NEWLINE_S "\n" #endif -static xmlnode* -new_node(const char *name, XMLNodeType type) +static PurpleXmlNode* +new_node(const char *name, PurpleXmlNodeType type) { - xmlnode *node = g_new0(xmlnode, 1); + PurpleXmlNode *node = g_new0(PurpleXmlNode, 1); node->name = g_strdup(name); node->type = type; - PURPLE_DBUS_REGISTER_POINTER(node, xmlnode); + PURPLE_DBUS_REGISTER_POINTER(node, PurpleXmlNode); return node; } -xmlnode* -xmlnode_new(const char *name) +PurpleXmlNode* +purple_xmlnode_new(const char *name) { g_return_val_if_fail(name != NULL && *name != '\0', NULL); - return new_node(name, XMLNODE_TYPE_TAG); + return new_node(name, PURPLE_XMLNODE_TYPE_TAG); } -xmlnode * -xmlnode_new_child(xmlnode *parent, const char *name) +PurpleXmlNode * +purple_xmlnode_new_child(PurpleXmlNode *parent, const char *name) { - xmlnode *node; + PurpleXmlNode *node; g_return_val_if_fail(parent != NULL, NULL); g_return_val_if_fail(name != NULL && *name != '\0', NULL); - node = new_node(name, XMLNODE_TYPE_TAG); + node = new_node(name, PURPLE_XMLNODE_TYPE_TAG); - xmlnode_insert_child(parent, node); + purple_xmlnode_insert_child(parent, node); #if 0 - /* This would give xmlnodes more appropriate namespacing + /* This would give PurpleXmlNodes more appropriate namespacing * when creating them. Otherwise, unless an explicit namespace - * is set, xmlnode_get_namespace() will return NULL, when + * is set, purple_xmlnode_get_namespace() will return NULL, when * there may be a default namespace. * * I'm unconvinced that it's useful, and concerned it may break things. @@ -89,14 +89,14 @@ xmlnode_new_child(xmlnode *parent, const char *name) * _insert_child would need the same thing, probably (assuming * xmlns->node == NULL) */ - xmlnode_set_namespace(node, xmlnode_get_default_namespace(node)) + purple_xmlnode_set_namespace(node, purple_xmlnode_get_default_namespace(node)) #endif return node; } void -xmlnode_insert_child(xmlnode *parent, xmlnode *child) +purple_xmlnode_insert_child(PurpleXmlNode *parent, PurpleXmlNode *child) { g_return_if_fail(parent != NULL); g_return_if_fail(child != NULL); @@ -113,9 +113,9 @@ xmlnode_insert_child(xmlnode *parent, xmlnode *child) } void -xmlnode_insert_data(xmlnode *node, const char *data, gssize size) +purple_xmlnode_insert_data(PurpleXmlNode *node, const char *data, gssize size) { - xmlnode *child; + PurpleXmlNode *child; gsize real_size; g_return_if_fail(node != NULL); @@ -124,25 +124,25 @@ xmlnode_insert_data(xmlnode *node, const char *data, gssize size) real_size = size == -1 ? strlen(data) : (gsize)size; - child = new_node(NULL, XMLNODE_TYPE_DATA); + child = new_node(NULL, PURPLE_XMLNODE_TYPE_DATA); child->data = g_memdup(data, real_size); child->data_sz = real_size; - xmlnode_insert_child(node, child); + purple_xmlnode_insert_child(node, child); } void -xmlnode_remove_attrib(xmlnode *node, const char *attr) +purple_xmlnode_remove_attrib(PurpleXmlNode *node, const char *attr) { - xmlnode *attr_node, *sibling = NULL; + PurpleXmlNode *attr_node, *sibling = NULL; g_return_if_fail(node != NULL); g_return_if_fail(attr != NULL); attr_node = node->child; while (attr_node) { - if(attr_node->type == XMLNODE_TYPE_ATTRIB && + if(attr_node->type == PURPLE_XMLNODE_TYPE_ATTRIB && purple_strequal(attr_node->name, attr)) { if (node->lastchild == attr_node) { @@ -150,12 +150,12 @@ xmlnode_remove_attrib(xmlnode *node, const char *attr) } if (sibling == NULL) { node->child = attr_node->next; - xmlnode_free(attr_node); + purple_xmlnode_free(attr_node); attr_node = node->child; } else { sibling->next = attr_node->next; sibling = attr_node->next; - xmlnode_free(attr_node); + purple_xmlnode_free(attr_node); attr_node = sibling; } } @@ -168,16 +168,16 @@ xmlnode_remove_attrib(xmlnode *node, const char *attr) } void -xmlnode_remove_attrib_with_namespace(xmlnode *node, const char *attr, const char *xmlns) +purple_xmlnode_remove_attrib_with_namespace(PurpleXmlNode *node, const char *attr, const char *xmlns) { - xmlnode *attr_node, *sibling = NULL; + PurpleXmlNode *attr_node, *sibling = NULL; g_return_if_fail(node != NULL); g_return_if_fail(attr != NULL); for(attr_node = node->child; attr_node; attr_node = attr_node->next) { - if(attr_node->type == XMLNODE_TYPE_ATTRIB && + if(attr_node->type == PURPLE_XMLNODE_TYPE_ATTRIB && purple_strequal(attr, attr_node->name) && purple_strequal(xmlns, attr_node->xmlns)) { @@ -189,7 +189,7 @@ xmlnode_remove_attrib_with_namespace(xmlnode *node, const char *attr, const char if (node->lastchild == attr_node) { node->lastchild = sibling; } - xmlnode_free(attr_node); + purple_xmlnode_free(attr_node); return; } sibling = attr_node; @@ -197,42 +197,42 @@ xmlnode_remove_attrib_with_namespace(xmlnode *node, const char *attr, const char } void -xmlnode_set_attrib(xmlnode *node, const char *attr, const char *value) +purple_xmlnode_set_attrib(PurpleXmlNode *node, const char *attr, const char *value) { - xmlnode_remove_attrib(node, attr); - xmlnode_set_attrib_full(node, attr, NULL, NULL, value); + purple_xmlnode_remove_attrib(node, attr); + purple_xmlnode_set_attrib_full(node, attr, NULL, NULL, value); } void -xmlnode_set_attrib_full(xmlnode *node, const char *attr, const char *xmlns, const char *prefix, const char *value) +purple_xmlnode_set_attrib_full(PurpleXmlNode *node, const char *attr, const char *xmlns, const char *prefix, const char *value) { - xmlnode *attrib_node; + PurpleXmlNode *attrib_node; g_return_if_fail(node != NULL); g_return_if_fail(attr != NULL); g_return_if_fail(value != NULL); - xmlnode_remove_attrib_with_namespace(node, attr, xmlns); - attrib_node = new_node(attr, XMLNODE_TYPE_ATTRIB); + purple_xmlnode_remove_attrib_with_namespace(node, attr, xmlns); + attrib_node = new_node(attr, PURPLE_XMLNODE_TYPE_ATTRIB); attrib_node->data = g_strdup(value); attrib_node->xmlns = g_strdup(xmlns); attrib_node->prefix = g_strdup(prefix); - xmlnode_insert_child(node, attrib_node); + purple_xmlnode_insert_child(node, attrib_node); } const char * -xmlnode_get_attrib(const xmlnode *node, const char *attr) +purple_xmlnode_get_attrib(const PurpleXmlNode *node, const char *attr) { - xmlnode *x; + PurpleXmlNode *x; g_return_val_if_fail(node != NULL, NULL); g_return_val_if_fail(attr != NULL, NULL); for(x = node->child; x; x = x->next) { - if(x->type == XMLNODE_TYPE_ATTRIB && purple_strequal(attr, x->name)) { + if(x->type == PURPLE_XMLNODE_TYPE_ATTRIB && purple_strequal(attr, x->name)) { return x->data; } } @@ -241,15 +241,15 @@ xmlnode_get_attrib(const xmlnode *node, const char *attr) } const char * -xmlnode_get_attrib_with_namespace(const xmlnode *node, const char *attr, const char *xmlns) +purple_xmlnode_get_attrib_with_namespace(const PurpleXmlNode *node, const char *attr, const char *xmlns) { - const xmlnode *x; + const PurpleXmlNode *x; g_return_val_if_fail(node != NULL, NULL); g_return_val_if_fail(attr != NULL, NULL); for(x = node->child; x; x = x->next) { - if(x->type == XMLNODE_TYPE_ATTRIB && + if(x->type == PURPLE_XMLNODE_TYPE_ATTRIB && purple_strequal(attr, x->name) && purple_strequal(xmlns, x->xmlns)) { return x->data; @@ -260,7 +260,7 @@ xmlnode_get_attrib_with_namespace(const xmlnode *node, const char *attr, const c } -void xmlnode_set_namespace(xmlnode *node, const char *xmlns) +void purple_xmlnode_set_namespace(PurpleXmlNode *node, const char *xmlns) { char *tmp; g_return_if_fail(node != NULL); @@ -276,16 +276,16 @@ void xmlnode_set_namespace(xmlnode *node, const char *xmlns) g_free(tmp); } -const char *xmlnode_get_namespace(const xmlnode *node) +const char *purple_xmlnode_get_namespace(const PurpleXmlNode *node) { g_return_val_if_fail(node != NULL, NULL); return node->xmlns; } -const char *xmlnode_get_default_namespace(const xmlnode *node) +const char *purple_xmlnode_get_default_namespace(const PurpleXmlNode *node) { - const xmlnode *current_node; + const PurpleXmlNode *current_node; const char *ns = NULL; g_return_val_if_fail(node != NULL, NULL); @@ -309,7 +309,7 @@ const char *xmlnode_get_default_namespace(const xmlnode *node) return ns; } -void xmlnode_set_prefix(xmlnode *node, const char *prefix) +void purple_xmlnode_set_prefix(PurpleXmlNode *node, const char *prefix) { g_return_if_fail(node != NULL); @@ -317,18 +317,18 @@ void xmlnode_set_prefix(xmlnode *node, const char *prefix) node->prefix = g_strdup(prefix); } -const char *xmlnode_get_prefix(const xmlnode *node) +const char *purple_xmlnode_get_prefix(const PurpleXmlNode *node) { g_return_val_if_fail(node != NULL, NULL); return node->prefix; } -const char *xmlnode_get_prefix_namespace(const xmlnode *node, const char *prefix) +const char *purple_xmlnode_get_prefix_namespace(const PurpleXmlNode *node, const char *prefix) { - const xmlnode *current_node; + const PurpleXmlNode *current_node; g_return_val_if_fail(node != NULL, NULL); - g_return_val_if_fail(prefix != NULL, xmlnode_get_default_namespace(node)); + g_return_val_if_fail(prefix != NULL, purple_xmlnode_get_default_namespace(node)); current_node = node; while (current_node) { @@ -348,38 +348,38 @@ const char *xmlnode_get_prefix_namespace(const xmlnode *node, const char *prefix return NULL; } -void xmlnode_strip_prefixes(xmlnode *node) +void purple_xmlnode_strip_prefixes(PurpleXmlNode *node) { - xmlnode *child; + PurpleXmlNode *child; const char *prefix; g_return_if_fail(node != NULL); for (child = node->child; child; child = child->next) { - if (child->type == XMLNODE_TYPE_TAG) - xmlnode_strip_prefixes(child); + if (child->type == PURPLE_XMLNODE_TYPE_TAG) + purple_xmlnode_strip_prefixes(child); } - prefix = xmlnode_get_prefix(node); + prefix = purple_xmlnode_get_prefix(node); if (prefix) { - const char *ns = xmlnode_get_prefix_namespace(node, prefix); - xmlnode_set_namespace(node, ns); - xmlnode_set_prefix(node, NULL); + const char *ns = purple_xmlnode_get_prefix_namespace(node, prefix); + purple_xmlnode_set_namespace(node, ns); + purple_xmlnode_set_prefix(node, NULL); } else { - xmlnode_set_namespace(node, xmlnode_get_default_namespace(node)); + purple_xmlnode_set_namespace(node, purple_xmlnode_get_default_namespace(node)); } } -xmlnode *xmlnode_get_parent(const xmlnode *child) +PurpleXmlNode *purple_xmlnode_get_parent(const PurpleXmlNode *child) { g_return_val_if_fail(child != NULL, NULL); return child->parent; } void -xmlnode_free(xmlnode *node) +purple_xmlnode_free(PurpleXmlNode *node) { - xmlnode *x, *y; + PurpleXmlNode *x, *y; g_return_if_fail(node != NULL); @@ -390,7 +390,7 @@ xmlnode_free(xmlnode *node) if (node->parent->lastchild == node) node->parent->lastchild = node->next; } else { - xmlnode *prev = node->parent->child; + PurpleXmlNode *prev = node->parent->child; while(prev && prev->next != node) { prev = prev->next; } @@ -406,7 +406,7 @@ xmlnode_free(xmlnode *node) x = node->child; while(x) { y = x->next; - xmlnode_free(x); + purple_xmlnode_free(x); x = y; } @@ -423,16 +423,16 @@ xmlnode_free(xmlnode *node) g_free(node); } -xmlnode* -xmlnode_get_child(const xmlnode *parent, const char *name) +PurpleXmlNode* +purple_xmlnode_get_child(const PurpleXmlNode *parent, const char *name) { - return xmlnode_get_child_with_namespace(parent, name, NULL); + return purple_xmlnode_get_child_with_namespace(parent, name, NULL); } -xmlnode * -xmlnode_get_child_with_namespace(const xmlnode *parent, const char *name, const char *ns) +PurpleXmlNode * +purple_xmlnode_get_child_with_namespace(const PurpleXmlNode *parent, const char *name, const char *ns) { - xmlnode *x, *ret = NULL; + PurpleXmlNode *x, *ret = NULL; char **names; char *parent_name, *child_name; @@ -447,9 +447,9 @@ xmlnode_get_child_with_namespace(const xmlnode *parent, const char *name, const /* XXX: Is it correct to ignore the namespace for the match if none was specified? */ const char *xmlns = NULL; if(ns) - xmlns = xmlnode_get_namespace(x); + xmlns = purple_xmlnode_get_namespace(x); - if(x->type == XMLNODE_TYPE_TAG && purple_strequal(parent_name, x->name) + if(x->type == PURPLE_XMLNODE_TYPE_TAG && purple_strequal(parent_name, x->name) && purple_strequal(ns, xmlns)) { ret = x; break; @@ -457,22 +457,22 @@ xmlnode_get_child_with_namespace(const xmlnode *parent, const char *name, const } if(child_name && ret) - ret = xmlnode_get_child(ret, child_name); + ret = purple_xmlnode_get_child(ret, child_name); g_strfreev(names); return ret; } char * -xmlnode_get_data(const xmlnode *node) +purple_xmlnode_get_data(const PurpleXmlNode *node) { GString *str = NULL; - xmlnode *c; + PurpleXmlNode *c; g_return_val_if_fail(node != NULL, NULL); for(c = node->child; c; c = c->next) { - if(c->type == XMLNODE_TYPE_DATA) { + if(c->type == PURPLE_XMLNODE_TYPE_DATA) { if(!str) str = g_string_new_len(c->data, c->data_sz); else @@ -487,9 +487,9 @@ xmlnode_get_data(const xmlnode *node) } char * -xmlnode_get_data_unescaped(const xmlnode *node) +purple_xmlnode_get_data_unescaped(const PurpleXmlNode *node) { - char *escaped = xmlnode_get_data(node); + char *escaped = purple_xmlnode_get_data(node); char *unescaped = escaped ? purple_unescape_html(escaped) : NULL; @@ -499,7 +499,7 @@ xmlnode_get_data_unescaped(const xmlnode *node) } static void -xmlnode_to_str_foreach_append_ns(const char *key, const char *value, +purple_xmlnode_to_str_foreach_append_ns(const char *key, const char *value, GString *buf) { if (*key) { @@ -510,11 +510,11 @@ xmlnode_to_str_foreach_append_ns(const char *key, const char *value, } static char * -xmlnode_to_str_helper(const xmlnode *node, int *len, gboolean formatting, int depth) +purple_xmlnode_to_str_helper(const PurpleXmlNode *node, int *len, gboolean formatting, int depth) { GString *text = g_string_new(""); const char *prefix; - const xmlnode *c; + const PurpleXmlNode *c; char *node_name, *esc, *esc2, *tab = NULL; gboolean need_end = FALSE, pretty = formatting; @@ -526,7 +526,7 @@ xmlnode_to_str_helper(const xmlnode *node, int *len, gboolean formatting, int de } node_name = g_markup_escape_text(node->name, -1); - prefix = xmlnode_get_prefix(node); + prefix = purple_xmlnode_get_prefix(node); if (prefix) { g_string_append_printf(text, "<%s:%s", prefix, node_name); @@ -536,7 +536,7 @@ xmlnode_to_str_helper(const xmlnode *node, int *len, gboolean formatting, int de if (node->namespace_map) { g_hash_table_foreach(node->namespace_map, - (GHFunc)xmlnode_to_str_foreach_append_ns, text); + (GHFunc)purple_xmlnode_to_str_foreach_append_ns, text); } else { /* Figure out if this node has a different default namespace from parent */ const char *xmlns = NULL; @@ -545,9 +545,9 @@ xmlnode_to_str_helper(const xmlnode *node, int *len, gboolean formatting, int de xmlns = node->xmlns; if (!xmlns) - xmlns = xmlnode_get_default_namespace(node); + xmlns = purple_xmlnode_get_default_namespace(node); if (node->parent) - parent_xmlns = xmlnode_get_default_namespace(node->parent); + parent_xmlns = purple_xmlnode_get_default_namespace(node->parent); if (!purple_strequal(xmlns, parent_xmlns)) { char *escaped_xmlns = g_markup_escape_text(xmlns, -1); @@ -557,8 +557,8 @@ xmlnode_to_str_helper(const xmlnode *node, int *len, gboolean formatting, int de } for(c = node->child; c; c = c->next) { - if(c->type == XMLNODE_TYPE_ATTRIB) { - const char *aprefix = xmlnode_get_prefix(c); + if(c->type == PURPLE_XMLNODE_TYPE_ATTRIB) { + const char *aprefix = purple_xmlnode_get_prefix(c); esc = g_markup_escape_text(c->name, -1); esc2 = g_markup_escape_text(c->data, -1); if (aprefix) { @@ -568,8 +568,8 @@ xmlnode_to_str_helper(const xmlnode *node, int *len, gboolean formatting, int de } g_free(esc); g_free(esc2); - } else if(c->type == XMLNODE_TYPE_TAG || c->type == XMLNODE_TYPE_DATA) { - if(c->type == XMLNODE_TYPE_DATA) + } else if(c->type == PURPLE_XMLNODE_TYPE_TAG || c->type == PURPLE_XMLNODE_TYPE_DATA) { + if(c->type == PURPLE_XMLNODE_TYPE_DATA) pretty = FALSE; need_end = TRUE; } @@ -580,12 +580,12 @@ xmlnode_to_str_helper(const xmlnode *node, int *len, gboolean formatting, int de for(c = node->child; c; c = c->next) { - if(c->type == XMLNODE_TYPE_TAG) { + if(c->type == PURPLE_XMLNODE_TYPE_TAG) { int esc_len; - esc = xmlnode_to_str_helper(c, &esc_len, pretty, depth+1); + esc = purple_xmlnode_to_str_helper(c, &esc_len, pretty, depth+1); text = g_string_append_len(text, esc, esc_len); g_free(esc); - } else if(c->type == XMLNODE_TYPE_DATA && c->data_sz > 0) { + } else if(c->type == PURPLE_XMLNODE_TYPE_DATA && c->data_sz > 0) { esc = g_markup_escape_text(c->data, c->data_sz); text = g_string_append(text, esc); g_free(esc); @@ -614,19 +614,19 @@ xmlnode_to_str_helper(const xmlnode *node, int *len, gboolean formatting, int de } char * -xmlnode_to_str(const xmlnode *node, int *len) +purple_xmlnode_to_str(const PurpleXmlNode *node, int *len) { - return xmlnode_to_str_helper(node, len, FALSE, 0); + return purple_xmlnode_to_str_helper(node, len, FALSE, 0); } char * -xmlnode_to_formatted_str(const xmlnode *node, int *len) +purple_xmlnode_to_formatted_str(const PurpleXmlNode *node, int *len) { char *xml, *xml_with_declaration; g_return_val_if_fail(node != NULL, NULL); - xml = xmlnode_to_str_helper(node, len, TRUE, 0); + xml = purple_xmlnode_to_str_helper(node, len, TRUE, 0); xml_with_declaration = g_strdup_printf("<?xml version='1.0' encoding='UTF-8' ?>" NEWLINE_S NEWLINE_S "%s", xml); g_free(xml); @@ -638,30 +638,30 @@ xmlnode_to_formatted_str(const xmlnode *node, int *len) } struct _xmlnode_parser_data { - xmlnode *current; + PurpleXmlNode *current; gboolean error; }; static void -xmlnode_parser_element_start_libxml(void *user_data, +purple_xmlnode_parser_element_start_libxml(void *user_data, const xmlChar *element_name, const xmlChar *prefix, const xmlChar *xmlns, int nb_namespaces, const xmlChar **namespaces, int nb_attributes, int nb_defaulted, const xmlChar **attributes) { struct _xmlnode_parser_data *xpd = user_data; - xmlnode *node; + PurpleXmlNode *node; int i, j; if(!element_name || xpd->error) { return; } else { if(xpd->current) - node = xmlnode_new_child(xpd->current, (const char*) element_name); + node = purple_xmlnode_new_child(xpd->current, (const char*) element_name); else - node = xmlnode_new((const char *) element_name); + node = purple_xmlnode_new((const char *) element_name); - xmlnode_set_namespace(node, (const char *) xmlns); - xmlnode_set_prefix(node, (const char *)prefix); + purple_xmlnode_set_namespace(node, (const char *) xmlns); + purple_xmlnode_set_prefix(node, (const char *)prefix); if (nb_namespaces != 0) { node->namespace_map = g_hash_table_new_full( @@ -684,7 +684,7 @@ xmlnode_parser_element_start_libxml(void *user_data, txt = attrib; attrib = purple_unescape_text(txt); g_free(txt); - xmlnode_set_attrib_full(node, name, NULL, prefix, attrib); + purple_xmlnode_set_attrib_full(node, name, NULL, prefix, attrib); g_free(attrib); } @@ -693,7 +693,7 @@ xmlnode_parser_element_start_libxml(void *user_data, } static void -xmlnode_parser_element_end_libxml(void *user_data, const xmlChar *element_name, +purple_xmlnode_parser_element_end_libxml(void *user_data, const xmlChar *element_name, const xmlChar *prefix, const xmlChar *xmlns) { struct _xmlnode_parser_data *xpd = user_data; @@ -708,7 +708,7 @@ xmlnode_parser_element_end_libxml(void *user_data, const xmlChar *element_name, } static void -xmlnode_parser_element_text_libxml(void *user_data, const xmlChar *text, int text_len) +purple_xmlnode_parser_element_text_libxml(void *user_data, const xmlChar *text, int text_len) { struct _xmlnode_parser_data *xpd = user_data; @@ -718,11 +718,11 @@ xmlnode_parser_element_text_libxml(void *user_data, const xmlChar *text, int tex if(!text || !text_len) return; - xmlnode_insert_data(xpd->current, (const char*) text, text_len); + purple_xmlnode_insert_data(xpd->current, (const char*) text, text_len); } static void -xmlnode_parser_error_libxml(void *user_data, const char *msg, ...) +purple_xmlnode_parser_error_libxml(void *user_data, const char *msg, ...) { struct _xmlnode_parser_data *xpd = user_data; char errmsg[2048]; @@ -738,28 +738,28 @@ xmlnode_parser_error_libxml(void *user_data, const char *msg, ...) } static void -xmlnode_parser_structural_error_libxml(void *user_data, xmlErrorPtr error) +purple_xmlnode_parser_structural_error_libxml(void *user_data, xmlErrorPtr error) { struct _xmlnode_parser_data *xpd = user_data; if (error && (error->level == XML_ERR_ERROR || error->level == XML_ERR_FATAL)) { xpd->error = TRUE; - purple_debug_error("xmlnode", "XML parser error for xmlnode %p: " + purple_debug_error("xmlnode", "XML parser error for PurpleXmlNode %p: " "Domain %i, code %i, level %i: %s", user_data, error->domain, error->code, error->level, error->message ? error->message : "(null)\n"); } else if (error) - purple_debug_warning("xmlnode", "XML parser error for xmlnode %p: " + purple_debug_warning("xmlnode", "XML parser error for PurpleXmlNode %p: " "Domain %i, code %i, level %i: %s", user_data, error->domain, error->code, error->level, error->message ? error->message : "(null)\n"); else - purple_debug_warning("xmlnode", "XML parser error for xmlnode %p\n", + purple_debug_warning("xmlnode", "XML parser error for PurpleXmlNode %p\n", user_data); } -static xmlSAXHandler xmlnode_parser_libxml = { +static xmlSAXHandler purple_xmlnode_parser_libxml = { NULL, /* internalSubset */ NULL, /* isStandalone */ NULL, /* hasInternalSubset */ @@ -777,28 +777,28 @@ static xmlSAXHandler xmlnode_parser_libxml = { NULL, /* startElement */ NULL, /* endElement */ NULL, /* reference */ - xmlnode_parser_element_text_libxml, /* characters */ + purple_xmlnode_parser_element_text_libxml, /* characters */ NULL, /* ignorableWhitespace */ NULL, /* processingInstruction */ NULL, /* comment */ NULL, /* warning */ - xmlnode_parser_error_libxml, /* error */ + purple_xmlnode_parser_error_libxml, /* error */ NULL, /* fatalError */ NULL, /* getParameterEntity */ NULL, /* cdataBlock */ NULL, /* externalSubset */ XML_SAX2_MAGIC, /* initialized */ NULL, /* _private */ - xmlnode_parser_element_start_libxml, /* startElementNs */ - xmlnode_parser_element_end_libxml, /* endElementNs */ - xmlnode_parser_structural_error_libxml, /* serror */ + purple_xmlnode_parser_element_start_libxml, /* startElementNs */ + purple_xmlnode_parser_element_end_libxml, /* endElementNs */ + purple_xmlnode_parser_structural_error_libxml, /* serror */ }; -xmlnode * -xmlnode_from_str(const char *str, gssize size) +PurpleXmlNode * +purple_xmlnode_from_str(const char *str, gssize size) { struct _xmlnode_parser_data *xpd; - xmlnode *ret; + PurpleXmlNode *ret; gsize real_size; g_return_val_if_fail(str != NULL, NULL); @@ -806,32 +806,32 @@ xmlnode_from_str(const char *str, gssize size) real_size = size < 0 ? strlen(str) : (gsize)size; xpd = g_new0(struct _xmlnode_parser_data, 1); - if (xmlSAXUserParseMemory(&xmlnode_parser_libxml, xpd, str, real_size) < 0) { + if (xmlSAXUserParseMemory(&purple_xmlnode_parser_libxml, xpd, str, real_size) < 0) { while(xpd->current && xpd->current->parent) xpd->current = xpd->current->parent; if(xpd->current) - xmlnode_free(xpd->current); + purple_xmlnode_free(xpd->current); xpd->current = NULL; } ret = xpd->current; if (xpd->error) { ret = NULL; if (xpd->current) - xmlnode_free(xpd->current); + purple_xmlnode_free(xpd->current); } g_free(xpd); return ret; } -xmlnode * -xmlnode_from_file(const char *dir,const char *filename, const char *description, const char *process) +PurpleXmlNode * +purple_xmlnode_from_file(const char *dir,const char *filename, const char *description, const char *process) { gchar *filename_full; GError *error = NULL; gchar *contents = NULL; gsize length; - xmlnode *node = NULL; + PurpleXmlNode *node = NULL; g_return_val_if_fail(dir != NULL, NULL); @@ -857,7 +857,7 @@ xmlnode_from_file(const char *dir,const char *filename, const char *description, if ((contents != NULL) && (length > 0)) { - node = xmlnode_from_str(contents, length); + node = purple_xmlnode_from_str(contents, length); /* If we were unable to parse the file then save its contents to a backup file */ if (node == NULL) @@ -897,18 +897,18 @@ xmlnode_from_file(const char *dir,const char *filename, const char *description, } static void -xmlnode_copy_foreach_ns(gpointer key, gpointer value, gpointer user_data) +purple_xmlnode_copy_foreach_ns(gpointer key, gpointer value, gpointer user_data) { GHashTable *ret = (GHashTable *)user_data; g_hash_table_insert(ret, g_strdup(key), g_strdup(value)); } -xmlnode * -xmlnode_copy(const xmlnode *src) +PurpleXmlNode * +purple_xmlnode_copy(const PurpleXmlNode *src) { - xmlnode *ret; - xmlnode *child; - xmlnode *sibling = NULL; + PurpleXmlNode *ret; + PurpleXmlNode *child; + PurpleXmlNode *sibling = NULL; g_return_val_if_fail(src != NULL, NULL); @@ -926,15 +926,15 @@ xmlnode_copy(const xmlnode *src) if (src->namespace_map) { ret->namespace_map = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - g_hash_table_foreach(src->namespace_map, xmlnode_copy_foreach_ns, ret->namespace_map); + g_hash_table_foreach(src->namespace_map, purple_xmlnode_copy_foreach_ns, ret->namespace_map); } for (child = src->child; child; child = child->next) { if (sibling) { - sibling->next = xmlnode_copy(child); + sibling->next = purple_xmlnode_copy(child); sibling = sibling->next; } else { - ret->child = xmlnode_copy(child); + ret->child = purple_xmlnode_copy(child); sibling = ret->child; } sibling->parent = ret; @@ -945,22 +945,22 @@ xmlnode_copy(const xmlnode *src) return ret; } -xmlnode * -xmlnode_get_next_twin(xmlnode *node) +PurpleXmlNode * +purple_xmlnode_get_next_twin(PurpleXmlNode *node) { - xmlnode *sibling; - const char *ns = xmlnode_get_namespace(node); + PurpleXmlNode *sibling; + const char *ns = purple_xmlnode_get_namespace(node); g_return_val_if_fail(node != NULL, NULL); - g_return_val_if_fail(node->type == XMLNODE_TYPE_TAG, NULL); + g_return_val_if_fail(node->type == PURPLE_XMLNODE_TYPE_TAG, NULL); for(sibling = node->next; sibling; sibling = sibling->next) { /* XXX: Is it correct to ignore the namespace for the match if none was specified? */ const char *xmlns = NULL; if(ns) - xmlns = xmlnode_get_namespace(sibling); + xmlns = purple_xmlnode_get_namespace(sibling); - if(sibling->type == XMLNODE_TYPE_TAG && purple_strequal(node->name, sibling->name) && + if(sibling->type == PURPLE_XMLNODE_TYPE_TAG && purple_strequal(node->name, sibling->name) && purple_strequal(ns, xmlns)) return sibling; } @@ -969,14 +969,14 @@ xmlnode_get_next_twin(xmlnode *node) } GType -xmlnode_get_type(void) +purple_xmlnode_get_type(void) { static GType type = 0; if (type == 0) { type = g_boxed_type_register_static("xmlnode", - (GBoxedCopyFunc)xmlnode_copy, - (GBoxedFreeFunc)xmlnode_free); + (GBoxedCopyFunc)purple_xmlnode_copy, + (GBoxedFreeFunc)purple_xmlnode_free); } return type; diff --git a/libpurple/xmlnode.h b/libpurple/xmlnode.h index b4011a3298..871be55de2 100644 --- a/libpurple/xmlnode.h +++ b/libpurple/xmlnode.h @@ -29,33 +29,33 @@ #include <glib.h> #include <glib-object.h> -#define PURPLE_TYPE_XMLNODE (xmlnode_get_type()) +#define PURPLE_TYPE_XMLNODE (purple_xmlnode_get_type()) /** - * The valid types for an xmlnode + * The valid types for an PurpleXmlNode */ typedef enum { - XMLNODE_TYPE_TAG, /**< Just a tag */ - XMLNODE_TYPE_ATTRIB, /**< Has attributes */ - XMLNODE_TYPE_DATA /**< Has data */ -} XMLNodeType; + PURPLE_XMLNODE_TYPE_TAG, /**< Just a tag */ + PURPLE_XMLNODE_TYPE_ATTRIB, /**< Has attributes */ + PURPLE_XMLNODE_TYPE_DATA /**< Has data */ +} PurpleXmlNodeType; /** - * An xmlnode. + * An PurpleXmlNode. */ -typedef struct _xmlnode xmlnode; -struct _xmlnode +typedef struct _PurpleXmlNode PurpleXmlNode; +struct _PurpleXmlNode { char *name; /**< The name of the node. */ char *xmlns; /**< The namespace of the node */ - XMLNodeType type; /**< The type of the node. */ + PurpleXmlNodeType type; /**< The type of the node. */ char *data; /**< The data for the node. */ size_t data_sz; /**< The size of the data. */ - xmlnode *parent; /**< The parent node or @c NULL.*/ - xmlnode *child; /**< The child node or @c NULL.*/ - xmlnode *lastchild; /**< The last child node or @c NULL.*/ - xmlnode *next; /**< The next node or @c NULL. */ + PurpleXmlNode *parent; /**< The parent node or @c NULL.*/ + PurpleXmlNode *child; /**< The child node or @c NULL.*/ + PurpleXmlNode *lastchild; /**< The last child node or @c NULL.*/ + PurpleXmlNode *next; /**< The next node or @c NULL. */ char *prefix; /**< The namespace prefix if any. */ GHashTable *namespace_map; /**< The namespace map. */ }; @@ -63,28 +63,28 @@ struct _xmlnode G_BEGIN_DECLS /** - * Returns the GType for the xmlnode boxed structure. + * Returns the GType for the PurpleXmlNode boxed structure. */ -GType xmlnode_get_type(void); +GType purple_xmlnode_get_type(void); /** - * Creates a new xmlnode. + * Creates a new PurpleXmlNode. * * @param name The name of the node. * * @return The new node. */ -xmlnode *xmlnode_new(const char *name); +PurpleXmlNode *purple_xmlnode_new(const char *name); /** - * Creates a new xmlnode child. + * Creates a new PurpleXmlNode child. * * @param parent The parent node. * @param name The name of the child node. * * @return The new child node. */ -xmlnode *xmlnode_new_child(xmlnode *parent, const char *name); +PurpleXmlNode *purple_xmlnode_new_child(PurpleXmlNode *parent, const char *name); /** * Inserts a node into a node as a child. @@ -92,7 +92,7 @@ xmlnode *xmlnode_new_child(xmlnode *parent, const char *name); * @param parent The parent node to insert child into. * @param child The child node to insert into parent. */ -void xmlnode_insert_child(xmlnode *parent, xmlnode *child); +void purple_xmlnode_insert_child(PurpleXmlNode *parent, PurpleXmlNode *child); /** * Gets a child node named name. @@ -102,7 +102,7 @@ void xmlnode_insert_child(xmlnode *parent, xmlnode *child); * * @return The child or NULL. */ -xmlnode *xmlnode_get_child(const xmlnode *parent, const char *name); +PurpleXmlNode *purple_xmlnode_get_child(const PurpleXmlNode *parent, const char *name); /** * Gets a child node named name in a namespace. @@ -113,7 +113,7 @@ xmlnode *xmlnode_get_child(const xmlnode *parent, const char *name); * * @return The child or NULL. */ -xmlnode *xmlnode_get_child_with_namespace(const xmlnode *parent, const char *name, const char *xmlns); +PurpleXmlNode *purple_xmlnode_get_child_with_namespace(const PurpleXmlNode *parent, const char *name, const char *xmlns); /** * Gets the next node with the same name as node. @@ -122,7 +122,7 @@ xmlnode *xmlnode_get_child_with_namespace(const xmlnode *parent, const char *nam * * @return The twin of node or NULL. */ -xmlnode *xmlnode_get_next_twin(xmlnode *node); +PurpleXmlNode *purple_xmlnode_get_next_twin(PurpleXmlNode *node); /** * Inserts data into a node. @@ -132,7 +132,7 @@ xmlnode *xmlnode_get_next_twin(xmlnode *node); * @param size The size of the data to insert. If data is * null-terminated you can pass in -1. */ -void xmlnode_insert_data(xmlnode *node, const char *data, gssize size); +void purple_xmlnode_insert_data(PurpleXmlNode *node, const char *data, gssize size); /** * Gets (escaped) data from a node. @@ -142,7 +142,7 @@ void xmlnode_insert_data(xmlnode *node, const char *data, gssize size); * @return The data from the node or NULL. This data is in raw escaped format. * You must g_free this string when finished using it. */ -char *xmlnode_get_data(const xmlnode *node); +char *purple_xmlnode_get_data(const PurpleXmlNode *node); /** * Gets unescaped data from a node. @@ -152,7 +152,7 @@ char *xmlnode_get_data(const xmlnode *node); * @return The data from the node, in unescaped form. You must g_free * this string when finished using it. */ -char *xmlnode_get_data_unescaped(const xmlnode *node); +char *purple_xmlnode_get_data_unescaped(const PurpleXmlNode *node); /** * Sets an attribute for a node. @@ -161,7 +161,7 @@ char *xmlnode_get_data_unescaped(const xmlnode *node); * @param attr The name of the attribute. * @param value The value of the attribute. */ -void xmlnode_set_attrib(xmlnode *node, const char *attr, const char *value); +void purple_xmlnode_set_attrib(PurpleXmlNode *node, const char *attr, const char *value); /** * Sets a namespaced attribute for a node @@ -172,7 +172,7 @@ void xmlnode_set_attrib(xmlnode *node, const char *attr, const char *value); * @param prefix The prefix of the attribute to set * @param value The value of the attribute */ -void xmlnode_set_attrib_full(xmlnode *node, const char *attr, const char *xmlns, +void purple_xmlnode_set_attrib_full(PurpleXmlNode *node, const char *attr, const char *xmlns, const char *prefix, const char *value); /** @@ -183,7 +183,7 @@ void xmlnode_set_attrib_full(xmlnode *node, const char *attr, const char *xmlns, * * @return The value of the attribute. */ -const char *xmlnode_get_attrib(const xmlnode *node, const char *attr); +const char *purple_xmlnode_get_attrib(const PurpleXmlNode *node, const char *attr); /** * Gets a namespaced attribute from a node @@ -194,7 +194,7 @@ const char *xmlnode_get_attrib(const xmlnode *node, const char *attr); * * @return The value of the attribute/ */ -const char *xmlnode_get_attrib_with_namespace(const xmlnode *node, const char *attr, const char *xmlns); +const char *purple_xmlnode_get_attrib_with_namespace(const PurpleXmlNode *node, const char *attr, const char *xmlns); /** * Removes an attribute from a node. @@ -202,7 +202,7 @@ const char *xmlnode_get_attrib_with_namespace(const xmlnode *node, const char *a * @param node The node to remove an attribute from. * @param attr The attribute to remove. */ -void xmlnode_remove_attrib(xmlnode *node, const char *attr); +void purple_xmlnode_remove_attrib(PurpleXmlNode *node, const char *attr); /** * Removes a namespaced attribute from a node @@ -211,7 +211,7 @@ void xmlnode_remove_attrib(xmlnode *node, const char *attr); * @param attr The attribute to remove * @param xmlns The namespace of the attribute to remove */ -void xmlnode_remove_attrib_with_namespace(xmlnode *node, const char *attr, const char *xmlns); +void purple_xmlnode_remove_attrib_with_namespace(PurpleXmlNode *node, const char *attr, const char *xmlns); /** * Sets the namespace of a node @@ -219,7 +219,7 @@ void xmlnode_remove_attrib_with_namespace(xmlnode *node, const char *attr, const * @param node The node to qualify * @param xmlns The namespace of the node */ -void xmlnode_set_namespace(xmlnode *node, const char *xmlns); +void purple_xmlnode_set_namespace(PurpleXmlNode *node, const char *xmlns); /** * Returns the namespace of a node @@ -227,7 +227,7 @@ void xmlnode_set_namespace(xmlnode *node, const char *xmlns); * @param node The node to get the namepsace from * @return The namespace of this node */ -const char *xmlnode_get_namespace(const xmlnode *node); +const char *purple_xmlnode_get_namespace(const PurpleXmlNode *node); /** * Returns the current default namespace. The default @@ -248,7 +248,7 @@ const char *xmlnode_get_namespace(const xmlnode *node); * @param node The node for which to return the default namespace * @return The default namespace of this node */ -const char *xmlnode_get_default_namespace(const xmlnode *node); +const char *purple_xmlnode_get_default_namespace(const PurpleXmlNode *node); /** * Returns the defined namespace for a prefix. @@ -257,7 +257,7 @@ const char *xmlnode_get_default_namespace(const xmlnode *node); * @param prefix The prefix for which to return the associated namespace. * @return The namespace for this prefix. */ -const char *xmlnode_get_prefix_namespace(const xmlnode *node, const char *prefix); +const char *purple_xmlnode_get_prefix_namespace(const PurpleXmlNode *node, const char *prefix); /** * Sets the prefix of a node @@ -265,7 +265,7 @@ const char *xmlnode_get_prefix_namespace(const xmlnode *node, const char *prefix * @param node The node to qualify * @param prefix The prefix of the node */ -void xmlnode_set_prefix(xmlnode *node, const char *prefix); +void purple_xmlnode_set_prefix(PurpleXmlNode *node, const char *prefix); /** * Returns the prefix of a node @@ -273,10 +273,10 @@ void xmlnode_set_prefix(xmlnode *node, const char *prefix); * @param node The node to get the prefix from * @return The prefix of this node */ -const char *xmlnode_get_prefix(const xmlnode *node); +const char *purple_xmlnode_get_prefix(const PurpleXmlNode *node); /** - * Remove all element prefixes from an xmlnode tree. The prefix's + * Remove all element prefixes from an PurpleXmlNode tree. The prefix's * namespace is transformed into the default namespace for an element. * * Note that this will not necessarily remove all prefixes in use @@ -286,7 +286,7 @@ const char *xmlnode_get_prefix(const xmlnode *node); * * @param node The node from which to strip prefixes */ -void xmlnode_strip_prefixes(xmlnode *node); +void purple_xmlnode_strip_prefixes(PurpleXmlNode *node); /** * Gets the parent node. @@ -295,7 +295,7 @@ void xmlnode_strip_prefixes(xmlnode *node); * * @return The parent or NULL. */ -xmlnode *xmlnode_get_parent(const xmlnode *child); +PurpleXmlNode *purple_xmlnode_get_parent(const PurpleXmlNode *child); /** * Returns the node in a string of xml. @@ -306,7 +306,7 @@ xmlnode *xmlnode_get_parent(const xmlnode *child); * @return The node represented as a string. You must * g_free this string when finished using it. */ -char *xmlnode_to_str(const xmlnode *node, int *len); +char *purple_xmlnode_to_str(const PurpleXmlNode *node, int *len); /** * Returns the node in a string of human readable xml. @@ -318,12 +318,12 @@ char *xmlnode_to_str(const xmlnode *node, int *len); * tab and new line characters. You must * g_free this string when finished using it. */ -char *xmlnode_to_formatted_str(const xmlnode *node, int *len); +char *purple_xmlnode_to_formatted_str(const PurpleXmlNode *node, int *len); /** * Creates a node from a string of XML. Calling this on the * root node of an XML document will parse the entire document - * into a tree of nodes, and return the xmlnode of the root. + * into a tree of nodes, and return the PurpleXmlNode of the root. * * @param str The string of xml. * @param size The size of the string, or -1 if @a str is @@ -331,7 +331,7 @@ char *xmlnode_to_formatted_str(const xmlnode *node, int *len); * * @return The new node. */ -xmlnode *xmlnode_from_str(const char *str, gssize size); +PurpleXmlNode *purple_xmlnode_from_str(const char *str, gssize size); /** * Creates a new node from the source node. @@ -340,30 +340,30 @@ xmlnode *xmlnode_from_str(const char *str, gssize size); * * @return A new copy of the src node. */ -xmlnode *xmlnode_copy(const xmlnode *src); +PurpleXmlNode *purple_xmlnode_copy(const PurpleXmlNode *src); /** * Frees a node and all of its children. * * @param node The node to free. */ -void xmlnode_free(xmlnode *node); +void purple_xmlnode_free(PurpleXmlNode *node); /** * Creates a node from a XML File. Calling this on the * root node of an XML document will parse the entire document - * into a tree of nodes, and return the xmlnode of the root. + * into a tree of nodes, and return the PurpleXmlNode of the root. * * @param dir The directory where the file is located * @param filename The filename * @param description A description of the file being parsed. Displayed to * the user if the file cannot be read. - * @param process The subsystem that is calling xmlnode_from_file. Used as + * @param process The subsystem that is calling purple_xmlnode_from_file. Used as * the category for debugging. * * @return The new node or NULL if an error occurred. */ -xmlnode *xmlnode_from_file(const char *dir, const char *filename, +PurpleXmlNode *purple_xmlnode_from_file(const char *dir, const char *filename, const char *description, const char *process); G_END_DECLS diff --git a/pidgin/gtkblist-theme-loader.c b/pidgin/gtkblist-theme-loader.c index 47dddee588..f2d476676a 100644 --- a/pidgin/gtkblist-theme-loader.c +++ b/pidgin/gtkblist-theme-loader.c @@ -43,15 +43,15 @@ *****************************************************************************/ static PidginThemeFont * -pidgin_theme_font_parse(xmlnode *node) +pidgin_theme_font_parse(PurpleXmlNode *node) { const char *font; const char *colordesc; GdkColor color; - font = xmlnode_get_attrib(node, "font"); + font = purple_xmlnode_get_attrib(node, "font"); - if ((colordesc = xmlnode_get_attrib(node, "color")) == NULL || + if ((colordesc = purple_xmlnode_get_attrib(node, "color")) == NULL || !gdk_color_parse(colordesc, &color)) gdk_color_parse(DEFAULT_TEXT_COLOR, &color); @@ -59,9 +59,9 @@ pidgin_theme_font_parse(xmlnode *node) } static GdkColor * -parse_color(xmlnode *node, const char *tag) +parse_color(PurpleXmlNode *node, const char *tag) { - const char *temp = xmlnode_get_attrib(node, tag); + const char *temp = purple_xmlnode_get_attrib(node, tag); GdkColor color; if (temp && gdk_color_parse(temp, &color)) { @@ -77,7 +77,7 @@ parse_color(xmlnode *node, const char *tag) static PurpleTheme * pidgin_blist_loader_build(const gchar *theme_dir) { - xmlnode *root_node = NULL, *sub_node, *sub_sub_node; + PurpleXmlNode *root_node = NULL, *sub_node, *sub_sub_node; gchar *dir, *filename_full, *data = NULL; const gchar *temp, *name; gboolean success = TRUE; @@ -119,7 +119,7 @@ pidgin_blist_loader_build(const gchar *theme_dir) filename_full = g_build_filename(dir, "theme.xml", NULL); if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR)) - root_node = xmlnode_from_file(dir, "theme.xml", "buddy list themes", "blist-loader"); + root_node = purple_xmlnode_from_file(dir, "theme.xml", "buddy list themes", "blist-loader"); g_free(filename_full); if (root_node == NULL) { @@ -127,19 +127,19 @@ pidgin_blist_loader_build(const gchar *theme_dir) return NULL; } - sub_node = xmlnode_get_child(root_node, "description"); - data = xmlnode_get_data(sub_node); + sub_node = purple_xmlnode_get_child(root_node, "description"); + data = purple_xmlnode_get_data(sub_node); - name = xmlnode_get_attrib(root_node, "name"); + name = purple_xmlnode_get_attrib(root_node, "name"); /* <blist> */ - success = name && purple_strequal(xmlnode_get_attrib(root_node, "type"), "pidgin buddy list"); + success = name && purple_strequal(purple_xmlnode_get_attrib(root_node, "type"), "pidgin buddy list"); if (!success) purple_debug_warning("gtkblist-theme-loader", "Missing attribute or problem with the root element\n"); if (success) { - if ((success = (sub_node = xmlnode_get_child(root_node, "blist")) != NULL)) + if ((success = (sub_node = purple_xmlnode_get_child(root_node, "blist")) != NULL)) bgcolor = parse_color(sub_node, "color"); else purple_debug_warning("gtkblist-theme-loader", "Missing or problem with tags: <blist>.\n"); @@ -147,8 +147,8 @@ pidgin_blist_loader_build(const gchar *theme_dir) /* <groups> */ if (success) { - if ((success = (sub_node = xmlnode_get_child(root_node, "groups")) != NULL - && (sub_sub_node = xmlnode_get_child(sub_node, "expanded")) != NULL)) { + if ((success = (sub_node = purple_xmlnode_get_child(root_node, "groups")) != NULL + && (sub_sub_node = purple_xmlnode_get_child(sub_node, "expanded")) != NULL)) { expanded = pidgin_theme_font_parse(sub_sub_node); expanded_bgcolor = parse_color(sub_sub_node, "background"); } else @@ -156,7 +156,7 @@ pidgin_blist_loader_build(const gchar *theme_dir) } if (success) { - if ((success = sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "collapsed")) != NULL)) { + if ((success = sub_node != NULL && (sub_sub_node = purple_xmlnode_get_child(sub_node, "collapsed")) != NULL)) { collapsed = pidgin_theme_font_parse(sub_sub_node); collapsed_bgcolor = parse_color(sub_sub_node, "background"); } else @@ -165,21 +165,21 @@ pidgin_blist_loader_build(const gchar *theme_dir) /* <buddys> */ if (success) { - if ((success = (sub_node = xmlnode_get_child(root_node, "buddys")) != NULL && - (sub_sub_node = xmlnode_get_child(sub_node, "placement")) != NULL)) { + if ((success = (sub_node = purple_xmlnode_get_child(root_node, "buddys")) != NULL && + (sub_sub_node = purple_xmlnode_get_child(sub_node, "placement")) != NULL)) { - layout.status_icon = (temp = xmlnode_get_attrib(sub_sub_node, "status_icon")) != NULL ? atoi(temp) : 0; - layout.text = (temp = xmlnode_get_attrib(sub_sub_node, "name")) != NULL ? atoi(temp) : 1; - layout.emblem = (temp = xmlnode_get_attrib(sub_sub_node, "emblem")) != NULL ? atoi(temp) : 2; - layout.protocol_icon = (temp = xmlnode_get_attrib(sub_sub_node, "protocol_icon")) != NULL ? atoi(temp) : 3; - layout.buddy_icon = (temp = xmlnode_get_attrib(sub_sub_node, "buddy_icon")) != NULL ? atoi(temp) : 4; - layout.show_status = (temp = xmlnode_get_attrib(sub_sub_node, "status_icon")) != NULL ? atoi(temp) != 0 : 1; + layout.status_icon = (temp = purple_xmlnode_get_attrib(sub_sub_node, "status_icon")) != NULL ? atoi(temp) : 0; + layout.text = (temp = purple_xmlnode_get_attrib(sub_sub_node, "name")) != NULL ? atoi(temp) : 1; + layout.emblem = (temp = purple_xmlnode_get_attrib(sub_sub_node, "emblem")) != NULL ? atoi(temp) : 2; + layout.protocol_icon = (temp = purple_xmlnode_get_attrib(sub_sub_node, "protocol_icon")) != NULL ? atoi(temp) : 3; + layout.buddy_icon = (temp = purple_xmlnode_get_attrib(sub_sub_node, "buddy_icon")) != NULL ? atoi(temp) : 4; + layout.show_status = (temp = purple_xmlnode_get_attrib(sub_sub_node, "status_icon")) != NULL ? atoi(temp) != 0 : 1; } else purple_debug_warning("gtkblist-theme-loader", "Missing or problem with tags: <buddys> <placement>.\n"); } if (success) { - if ((success = (sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "background")) != NULL))) + if ((success = (sub_node != NULL && (sub_sub_node = purple_xmlnode_get_child(sub_node, "background")) != NULL))) contact_color = parse_color(sub_sub_node, "color"); else purple_debug_warning("gtkblist-theme-loader", "Missing or problem with tags: <buddys> <background>.\n"); @@ -187,7 +187,7 @@ pidgin_blist_loader_build(const gchar *theme_dir) for (i = 0; success && lookups[i].tag; i++) { if ((success = (sub_node != NULL && - (sub_sub_node = xmlnode_get_child(sub_node, lookups[i].tag)) != NULL))) { + (sub_sub_node = purple_xmlnode_get_child(sub_node, lookups[i].tag)) != NULL))) { *(lookups[i].font) = pidgin_theme_font_parse(sub_sub_node); } else { *(lookups[i].font) = NULL; @@ -195,14 +195,14 @@ pidgin_blist_loader_build(const gchar *theme_dir) } /* name is required for theme manager */ - success = (success && xmlnode_get_attrib(root_node, "name") != NULL); + success = (success && purple_xmlnode_get_attrib(root_node, "name") != NULL); /* the new theme */ theme = g_object_new(PIDGIN_TYPE_BLIST_THEME, "type", "blist", "name", name, - "author", xmlnode_get_attrib(root_node, "author"), - "image", xmlnode_get_attrib(root_node, "image"), + "author", purple_xmlnode_get_attrib(root_node, "author"), + "image", purple_xmlnode_get_attrib(root_node, "image"), "directory", dir, "description", data, "background-color", bgcolor, @@ -230,7 +230,7 @@ pidgin_blist_loader_build(const gchar *theme_dir) pidgin_theme_font_free(expanded); pidgin_theme_font_free(collapsed); - xmlnode_free(root_node); + purple_xmlnode_free(root_node); g_free(data); g_free(dir); diff --git a/pidgin/gtkconv-theme-loader.c b/pidgin/gtkconv-theme-loader.c index c2f8c02204..b82dcd0373 100644 --- a/pidgin/gtkconv-theme-loader.c +++ b/pidgin/gtkconv-theme-loader.c @@ -32,22 +32,22 @@ *****************************************************************************/ static GHashTable * -read_info_plist(xmlnode *plist) +read_info_plist(PurpleXmlNode *plist) { GHashTable *info; - xmlnode *key, *value; + PurpleXmlNode *key, *value; gboolean fail = FALSE; info = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - for (key = xmlnode_get_child(plist, "dict/key"); + for (key = purple_xmlnode_get_child(plist, "dict/key"); key; - key = xmlnode_get_next_twin(key)) { + key = purple_xmlnode_get_next_twin(key)) { char *keyname; GValue *val; ; - for (value = key->next; value && value->type != XMLNODE_TYPE_TAG; value = value->next) + for (value = key->next; value && value->type != PURPLE_XMLNODE_TYPE_TAG; value = value->next) ; if (!value) { fail = TRUE; @@ -57,7 +57,7 @@ read_info_plist(xmlnode *plist) val = g_new0(GValue, 1); if (g_str_equal(value->name, "string")) { g_value_init(val, G_TYPE_STRING); - g_value_take_string(val, xmlnode_get_data_unescaped(value)); + g_value_take_string(val, purple_xmlnode_get_data_unescaped(value)); } else if (g_str_equal(value->name, "true")) { g_value_init(val, G_TYPE_BOOLEAN); @@ -68,13 +68,13 @@ read_info_plist(xmlnode *plist) g_value_set_boolean(val, FALSE); } else if (g_str_equal(value->name, "real")) { - char *temp = xmlnode_get_data_unescaped(value); + char *temp = purple_xmlnode_get_data_unescaped(value); g_value_init(val, G_TYPE_FLOAT); g_value_set_float(val, atof(temp)); g_free(temp); } else if (g_str_equal(value->name, "integer")) { - char *temp = xmlnode_get_data_unescaped(value); + char *temp = purple_xmlnode_get_data_unescaped(value); g_value_init(val, G_TYPE_INT); g_value_set_int(val, atoi(temp)); g_free(temp); @@ -87,7 +87,7 @@ read_info_plist(xmlnode *plist) break; } - keyname = xmlnode_get_data_unescaped(key); + keyname = purple_xmlnode_get_data_unescaped(key); g_hash_table_insert(info, keyname, val); } @@ -117,7 +117,7 @@ pidgin_conv_loader_build(const gchar *dir) { PidginConvTheme *theme = NULL; char *contents; - xmlnode *plist; + PurpleXmlNode *plist; GHashTable *info; GValue *val; int MessageViewVersion; @@ -130,7 +130,7 @@ pidgin_conv_loader_build(const gchar *dir) /* Load Info.plist for theme information */ contents = g_build_filename(dir, "Contents", NULL); - plist = xmlnode_from_file(contents, "Info.plist", "Info.plist", "gtkconv-theme-loader"); + plist = purple_xmlnode_from_file(contents, "Info.plist", "Info.plist", "gtkconv-theme-loader"); g_free(contents); if (plist == NULL) { purple_debug_error("gtkconv-theme-loader", @@ -139,7 +139,7 @@ pidgin_conv_loader_build(const gchar *dir) } info = read_info_plist(plist); - xmlnode_free(plist); + purple_xmlnode_free(plist); if (info == NULL) { purple_debug_error("gtkconv-theme-loader", "Failed to load Contents/Info.plist in %s\n", dir); diff --git a/pidgin/gtkicon-theme-loader.c b/pidgin/gtkicon-theme-loader.c index d488ade28b..a7c64104be 100644 --- a/pidgin/gtkicon-theme-loader.c +++ b/pidgin/gtkicon-theme-loader.c @@ -33,7 +33,7 @@ static PurpleTheme * pidgin_icon_loader_build(const gchar *theme_dir) { - xmlnode *root_node = NULL, *sub_node; + PurpleXmlNode *root_node = NULL, *sub_node; gchar *dir, *filename_full, *data = NULL; PidginIconTheme *theme = NULL; const gchar *name; @@ -44,7 +44,7 @@ pidgin_icon_loader_build(const gchar *theme_dir) filename_full = g_build_filename(dir, "theme.xml", NULL); if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR)) - root_node = xmlnode_from_file(dir, "theme.xml", "icon themes", "icon-theme-loader"); + root_node = purple_xmlnode_from_file(dir, "theme.xml", "icon themes", "icon-theme-loader"); g_free(filename_full); if (root_node == NULL) { @@ -52,34 +52,34 @@ pidgin_icon_loader_build(const gchar *theme_dir) return NULL; } - name = xmlnode_get_attrib(root_node, "name"); + name = purple_xmlnode_get_attrib(root_node, "name"); if (name) { /* Parse the tree */ - sub_node = xmlnode_get_child(root_node, "description"); - data = xmlnode_get_data(sub_node); + sub_node = purple_xmlnode_get_child(root_node, "description"); + data = purple_xmlnode_get_data(sub_node); - if (xmlnode_get_attrib(root_node, "name") != NULL) { + if (purple_xmlnode_get_attrib(root_node, "name") != NULL) { theme = g_object_new(PIDGIN_TYPE_STATUS_ICON_THEME, "type", "status-icon", "name", name, - "author", xmlnode_get_attrib(root_node, "author"), - "image", xmlnode_get_attrib(root_node, "image"), + "author", purple_xmlnode_get_attrib(root_node, "author"), + "image", purple_xmlnode_get_attrib(root_node, "image"), "directory", dir, "description", data, NULL); - sub_node = xmlnode_get_child(root_node, "icon"); + sub_node = purple_xmlnode_get_child(root_node, "icon"); while (sub_node) { pidgin_icon_theme_set_icon(theme, - xmlnode_get_attrib(sub_node, "id"), - xmlnode_get_attrib(sub_node, "file")); - sub_node = xmlnode_get_next_twin(sub_node); + purple_xmlnode_get_attrib(sub_node, "id"), + purple_xmlnode_get_attrib(sub_node, "file")); + sub_node = purple_xmlnode_get_next_twin(sub_node); } } } - xmlnode_free(root_node); + purple_xmlnode_free(root_node); g_free(data); return PURPLE_THEME(theme); } diff --git a/pidgin/plugins/disco/xmppdisco.c b/pidgin/plugins/disco/xmppdisco.c index ccadd0c281..a468f5dd84 100644 --- a/pidgin/plugins/disco/xmppdisco.c +++ b/pidgin/plugins/disco/xmppdisco.c @@ -56,7 +56,7 @@ static GHashTable *iq_callbacks = NULL; static gboolean iq_listening = FALSE; typedef void (*XmppIqCallback)(PurpleConnection *pc, const char *type, - const char *id, const char *from, xmlnode *iq, + const char *id, const char *from, PurpleXmlNode *iq, gpointer data); struct item_data { @@ -116,7 +116,7 @@ remove_iq_callbacks_by_pc(gpointer key, gpointer value, gpointer user_data) static gboolean xmpp_iq_received(PurpleConnection *pc, const char *type, const char *id, - const char *from, xmlnode *iq) + const char *from, PurpleXmlNode *iq) { struct xmpp_iq_cb_data *cb_data; @@ -162,18 +162,18 @@ static void xmpp_disco_info_do(PurpleConnection *pc, gpointer cbdata, const char *jid, const char *node, XmppIqCallback cb) { - xmlnode *iq, *query; + PurpleXmlNode *iq, *query; char *id = generate_next_id(); - iq = xmlnode_new("iq"); - xmlnode_set_attrib(iq, "type", "get"); - xmlnode_set_attrib(iq, "to", jid); - xmlnode_set_attrib(iq, "id", id); + iq = purple_xmlnode_new("iq"); + purple_xmlnode_set_attrib(iq, "type", "get"); + purple_xmlnode_set_attrib(iq, "to", jid); + purple_xmlnode_set_attrib(iq, "id", id); - query = xmlnode_new_child(iq, "query"); - xmlnode_set_namespace(query, NS_DISCO_INFO); + query = purple_xmlnode_new_child(iq, "query"); + purple_xmlnode_set_namespace(query, NS_DISCO_INFO); if (node) - xmlnode_set_attrib(query, "node", node); + purple_xmlnode_set_attrib(query, "node", node); /* Steals id */ xmpp_iq_register_callback(pc, id, cbdata, cb); @@ -181,25 +181,25 @@ xmpp_disco_info_do(PurpleConnection *pc, gpointer cbdata, const char *jid, purple_signal_emit(purple_connection_get_prpl(pc), "jabber-sending-xmlnode", pc, &iq); if (iq != NULL) - xmlnode_free(iq); + purple_xmlnode_free(iq); } static void xmpp_disco_items_do(PurpleConnection *pc, gpointer cbdata, const char *jid, const char *node, XmppIqCallback cb) { - xmlnode *iq, *query; + PurpleXmlNode *iq, *query; char *id = generate_next_id(); - iq = xmlnode_new("iq"); - xmlnode_set_attrib(iq, "type", "get"); - xmlnode_set_attrib(iq, "to", jid); - xmlnode_set_attrib(iq, "id", id); + iq = purple_xmlnode_new("iq"); + purple_xmlnode_set_attrib(iq, "type", "get"); + purple_xmlnode_set_attrib(iq, "to", jid); + purple_xmlnode_set_attrib(iq, "id", id); - query = xmlnode_new_child(iq, "query"); - xmlnode_set_namespace(query, NS_DISCO_ITEMS); + query = purple_xmlnode_new_child(iq, "query"); + purple_xmlnode_set_namespace(query, NS_DISCO_ITEMS); if (node) - xmlnode_set_attrib(query, "node", node); + purple_xmlnode_set_attrib(query, "node", node); /* Steals id */ xmpp_iq_register_callback(pc, id, cbdata, cb); @@ -207,19 +207,19 @@ xmpp_disco_items_do(PurpleConnection *pc, gpointer cbdata, const char *jid, purple_signal_emit(purple_connection_get_prpl(pc), "jabber-sending-xmlnode", pc, &iq); if (iq != NULL) - xmlnode_free(iq); + purple_xmlnode_free(iq); } static XmppDiscoServiceType -disco_service_type_from_identity(xmlnode *identity) +disco_service_type_from_identity(PurpleXmlNode *identity) { const char *category, *type; if (!identity) return XMPP_DISCO_SERVICE_TYPE_OTHER; - category = xmlnode_get_attrib(identity, "category"); - type = xmlnode_get_attrib(identity, "type"); + category = purple_xmlnode_get_attrib(identity, "category"); + type = purple_xmlnode_get_attrib(identity, "type"); if (!category) return XMPP_DISCO_SERVICE_TYPE_OTHER; @@ -275,11 +275,11 @@ disco_type_from_string(const gchar *str) static void got_info_cb(PurpleConnection *pc, const char *type, const char *id, - const char *from, xmlnode *iq, gpointer data) + const char *from, PurpleXmlNode *iq, gpointer data) { struct item_data *item_data = data; PidginDiscoList *list = item_data->list; - xmlnode *query; + PurpleXmlNode *query; --list->fetch_count; @@ -287,10 +287,10 @@ got_info_cb(PurpleConnection *pc, const char *type, const char *id, goto out; if (g_str_equal(type, "result") && - (query = xmlnode_get_child(iq, "query"))) { - xmlnode *identity = xmlnode_get_child(query, "identity"); + (query = purple_xmlnode_get_child(iq, "query"))) { + PurpleXmlNode *identity = purple_xmlnode_get_child(query, "identity"); XmppDiscoService *service; - xmlnode *feature; + PurpleXmlNode *feature; service = g_new0(XmppDiscoService, 1); service->list = item_data->list; @@ -322,15 +322,15 @@ got_info_cb(PurpleConnection *pc, const char *type, const char *id, service->description = item_data->name; item_data->name = NULL; } else if (identity) - service->description = g_strdup(xmlnode_get_attrib(identity, "name")); + service->description = g_strdup(purple_xmlnode_get_attrib(identity, "name")); /* TODO: Overlap with service->name a bit */ service->jid = g_strdup(from); - for (feature = xmlnode_get_child(query, "feature"); feature; - feature = xmlnode_get_next_twin(feature)) { + for (feature = purple_xmlnode_get_child(query, "feature"); feature; + feature = purple_xmlnode_get_next_twin(feature)) { const char *var; - if (!(var = xmlnode_get_attrib(feature, "var"))) + if (!(var = purple_xmlnode_get_attrib(feature, "var"))) continue; if (g_str_equal(var, NS_REGISTER)) @@ -345,7 +345,7 @@ got_info_cb(PurpleConnection *pc, const char *type, const char *id, if (service->type == XMPP_DISCO_SERVICE_TYPE_GATEWAY) service->gateway_type = g_strdup(disco_type_from_string( - xmlnode_get_attrib(identity, "type"))); + purple_xmlnode_get_attrib(identity, "type"))); pidgin_disco_add_service(list, service, service->parent); } @@ -362,11 +362,11 @@ out: static void got_items_cb(PurpleConnection *pc, const char *type, const char *id, - const char *from, xmlnode *iq, gpointer data) + const char *from, PurpleXmlNode *iq, gpointer data) { struct item_data *item_data = data; PidginDiscoList *list = item_data->list; - xmlnode *query; + PurpleXmlNode *query; gboolean has_items = FALSE; --list->fetch_count; @@ -375,14 +375,14 @@ got_items_cb(PurpleConnection *pc, const char *type, const char *id, goto out; if (g_str_equal(type, "result") && - (query = xmlnode_get_child(iq, "query"))) { - xmlnode *item; + (query = purple_xmlnode_get_child(iq, "query"))) { + PurpleXmlNode *item; - for (item = xmlnode_get_child(query, "item"); item; - item = xmlnode_get_next_twin(item)) { - const char *jid = xmlnode_get_attrib(item, "jid"); - const char *name = xmlnode_get_attrib(item, "name"); - const char *node = xmlnode_get_attrib(item, "node"); + for (item = purple_xmlnode_get_child(query, "item"); item; + item = purple_xmlnode_get_next_twin(item)) { + const char *jid = purple_xmlnode_get_attrib(item, "jid"); + const char *name = purple_xmlnode_get_attrib(item, "name"); + const char *node = purple_xmlnode_get_attrib(item, "node"); has_items = TRUE; @@ -432,24 +432,24 @@ out: static void server_items_cb(PurpleConnection *pc, const char *type, const char *id, - const char *from, xmlnode *iq, gpointer data) + const char *from, PurpleXmlNode *iq, gpointer data) { struct item_data *cb_data = data; PidginDiscoList *list = cb_data->list; - xmlnode *query; + PurpleXmlNode *query; g_free(cb_data); --list->fetch_count; if (g_str_equal(type, "result") && - (query = xmlnode_get_child(iq, "query"))) { - xmlnode *item; - - for (item = xmlnode_get_child(query, "item"); item; - item = xmlnode_get_next_twin(item)) { - const char *jid = xmlnode_get_attrib(item, "jid"); - const char *name = xmlnode_get_attrib(item, "name"); - const char *node = xmlnode_get_attrib(item, "node"); + (query = purple_xmlnode_get_child(iq, "query"))) { + PurpleXmlNode *item; + + for (item = purple_xmlnode_get_child(query, "item"); item; + item = purple_xmlnode_get_next_twin(item)) { + const char *jid = purple_xmlnode_get_attrib(item, "jid"); + const char *name = purple_xmlnode_get_attrib(item, "name"); + const char *node = purple_xmlnode_get_attrib(item, "node"); struct item_data *item_data; if (!jid) @@ -474,23 +474,23 @@ server_items_cb(PurpleConnection *pc, const char *type, const char *id, static void server_info_cb(PurpleConnection *pc, const char *type, const char *id, - const char *from, xmlnode *iq, gpointer data) + const char *from, PurpleXmlNode *iq, gpointer data) { struct item_data *cb_data = data; PidginDiscoList *list = cb_data->list; - xmlnode *query; - xmlnode *error; + PurpleXmlNode *query; + PurpleXmlNode *error; gboolean items = FALSE; --list->fetch_count; if (g_str_equal(type, "result") && - (query = xmlnode_get_child(iq, "query"))) { - xmlnode *feature; + (query = purple_xmlnode_get_child(iq, "query"))) { + PurpleXmlNode *feature; - for (feature = xmlnode_get_child(query, "feature"); feature; - feature = xmlnode_get_next_twin(feature)) { - const char *var = xmlnode_get_attrib(feature, "var"); + for (feature = purple_xmlnode_get_child(query, "feature"); feature; + feature = purple_xmlnode_get_next_twin(feature)) { + const char *var = purple_xmlnode_get_attrib(feature, "var"); if (purple_strequal(var, NS_DISCO_ITEMS)) { items = TRUE; break; @@ -508,9 +508,9 @@ server_info_cb(PurpleConnection *pc, const char *type, const char *id, } } else { - error = xmlnode_get_child(iq, "error"); - if (xmlnode_get_child(error, "remote-server-not-found") - || xmlnode_get_child(error, "jid-malformed")) { + error = purple_xmlnode_get_child(iq, "error"); + if (purple_xmlnode_get_child(error, "remote-server-not-found") + || purple_xmlnode_get_child(error, "jid-malformed")) { purple_notify_error(my_plugin, _("Error"), _("Server does not exist"), NULL); @@ -567,21 +567,21 @@ void xmpp_disco_service_expand(XmppDiscoService *service) void xmpp_disco_service_register(XmppDiscoService *service) { - xmlnode *iq, *query; + PurpleXmlNode *iq, *query; char *id = generate_next_id(); - iq = xmlnode_new("iq"); - xmlnode_set_attrib(iq, "type", "get"); - xmlnode_set_attrib(iq, "to", service->jid); - xmlnode_set_attrib(iq, "id", id); + iq = purple_xmlnode_new("iq"); + purple_xmlnode_set_attrib(iq, "type", "get"); + purple_xmlnode_set_attrib(iq, "to", service->jid); + purple_xmlnode_set_attrib(iq, "id", id); - query = xmlnode_new_child(iq, "query"); - xmlnode_set_namespace(query, NS_REGISTER); + query = purple_xmlnode_new_child(iq, "query"); + purple_xmlnode_set_namespace(query, NS_REGISTER); purple_signal_emit(purple_connection_get_prpl(service->list->pc), "jabber-sending-xmlnode", service->list->pc, &iq); if (iq != NULL) - xmlnode_free(iq); + purple_xmlnode_free(iq); g_free(id); } diff --git a/pidgin/plugins/xmppconsole.c b/pidgin/plugins/xmppconsole.c index 8882dbecab..78d1ee52d1 100644 --- a/pidgin/plugins/xmppconsole.c +++ b/pidgin/plugins/xmppconsole.c @@ -63,10 +63,10 @@ static void *xmpp_console_handle = NULL; "</style></head></html>" static char * -xmlnode_to_pretty_str(xmlnode *node, int *len) +purple_xmlnode_to_pretty_str(PurpleXmlNode *node, int *len) { GString *text = g_string_new(""); - xmlnode *c; + PurpleXmlNode *c; char *node_name, *esc, *esc2; gboolean need_end = FALSE, pretty = TRUE; @@ -94,7 +94,7 @@ xmlnode_to_pretty_str(xmlnode *node, int *len) } for (c = node->child; c; c = c->next) { - if (c->type == XMLNODE_TYPE_ATTRIB) { + if (c->type == PURPLE_XMLNODE_TYPE_ATTRIB) { esc = g_markup_escape_text(c->name, -1); esc2 = g_markup_escape_text(c->data, -1); g_string_append_printf(text, @@ -103,8 +103,8 @@ xmlnode_to_pretty_str(xmlnode *node, int *len) esc, esc2); g_free(esc); g_free(esc2); - } else if (c->type == XMLNODE_TYPE_TAG || c->type == XMLNODE_TYPE_DATA) { - if (c->type == XMLNODE_TYPE_DATA) + } else if (c->type == PURPLE_XMLNODE_TYPE_TAG || c->type == PURPLE_XMLNODE_TYPE_DATA) { + if (c->type == PURPLE_XMLNODE_TYPE_DATA) pretty = FALSE; need_end = TRUE; } @@ -118,16 +118,16 @@ xmlnode_to_pretty_str(xmlnode *node, int *len) need_end = FALSE; for (c = node->child; c; c = c->next) { - if (c->type == XMLNODE_TYPE_TAG) { + if (c->type == PURPLE_XMLNODE_TYPE_TAG) { int esc_len; - esc = xmlnode_to_pretty_str(c, &esc_len); + esc = purple_xmlnode_to_pretty_str(c, &esc_len); if (!need_end) { g_string_append(text, "<div class=tab>"); need_end = TRUE; } text = g_string_append_len(text, esc, esc_len); g_free(esc); - } else if (c->type == XMLNODE_TYPE_DATA && c->data_sz > 0) { + } else if (c->type == PURPLE_XMLNODE_TYPE_DATA && c->data_sz > 0) { esc = g_markup_escape_text(c->data, c->data_sz); text = g_string_append(text, esc); g_free(esc); @@ -156,13 +156,13 @@ xmlnode_to_pretty_str(xmlnode *node, int *len) } static void -xmlnode_received_cb(PurpleConnection *gc, xmlnode **packet, gpointer null) +purple_xmlnode_received_cb(PurpleConnection *gc, PurpleXmlNode **packet, gpointer null) { char *str, *formatted; if (!console || console->gc != gc) return; - str = xmlnode_to_pretty_str(*packet, NULL); + str = purple_xmlnode_to_pretty_str(*packet, NULL); formatted = g_strdup_printf("<div class=incoming>%s</div>", str); gtk_webview_append_html(GTK_WEBVIEW(console->webview), formatted); g_free(formatted); @@ -170,25 +170,25 @@ xmlnode_received_cb(PurpleConnection *gc, xmlnode **packet, gpointer null) } static void -xmlnode_sent_cb(PurpleConnection *gc, char **packet, gpointer null) +purple_xmlnode_sent_cb(PurpleConnection *gc, char **packet, gpointer null) { char *str; char *formatted; - xmlnode *node; + PurpleXmlNode *node; if (!console || console->gc != gc) return; - node = xmlnode_from_str(*packet, -1); + node = purple_xmlnode_from_str(*packet, -1); if (!node) return; - str = xmlnode_to_pretty_str(node, NULL); + str = purple_xmlnode_to_pretty_str(node, NULL); formatted = g_strdup_printf("<div class=outgoing>%s</div>", str); gtk_webview_append_html(GTK_WEBVIEW(console->webview), formatted); g_free(formatted); g_free(str); - xmlnode_free(node); + purple_xmlnode_free(node); } static gboolean @@ -228,7 +228,7 @@ entry_changed_cb(GtkWidget *webview, void *data) int height; int pad_top, pad_inside, pad_bottom; #endif - xmlnode *node; + PurpleXmlNode *node; #if 0 /* TODO WebKit: Do entry auto-sizing... */ @@ -258,7 +258,7 @@ entry_changed_cb(GtkWidget *webview, void *data) if (!str) return; xmlstr = g_strdup_printf("<xml>%s</xml>", str); - node = xmlnode_from_str(xmlstr, -1); + node = purple_xmlnode_from_str(xmlstr, -1); if (node) { gtk_webview_clear_formatting(GTK_WEBVIEW(console->entry)); } else { @@ -267,7 +267,7 @@ entry_changed_cb(GtkWidget *webview, void *data) g_free(str); g_free(xmlstr); if (node) - xmlnode_free(node); + purple_xmlnode_free(node); } static void iq_clicked_cb(GtkWidget *w, gpointer nul) @@ -717,9 +717,9 @@ plugin_load(PurplePlugin *plugin) xmpp_console_handle = plugin; purple_signal_connect(jabber, "jabber-receiving-xmlnode", xmpp_console_handle, - PURPLE_CALLBACK(xmlnode_received_cb), NULL); + PURPLE_CALLBACK(purple_xmlnode_received_cb), NULL); purple_signal_connect(jabber, "jabber-sending-text", xmpp_console_handle, - PURPLE_CALLBACK(xmlnode_sent_cb), NULL); + PURPLE_CALLBACK(purple_xmlnode_sent_cb), NULL); purple_signal_connect(purple_connections_get_handle(), "signing-on", plugin, PURPLE_CALLBACK(signing_on_cb), NULL); purple_signal_connect(purple_connections_get_handle(), "signed-off", |