Mercurial > pidgin.yaz
changeset 23795:679a61dcf5c2
Fix compatibility with glib < 2.4 for g_markup_printf_escaped. untested.
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Fri, 15 Aug 2008 02:42:52 +0000 |
parents | 142c1ff499fd |
children | d572fb194e61 a6001ea0acbc |
files | ChangeLog.API libpurple/protocols/msn/contact.c libpurple/protocols/msn/msn.c libpurple/protocols/msn/page.c libpurple/util.c libpurple/util.h |
diffstat | 6 files changed, 44 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog.API Fri Aug 15 02:34:21 2008 +0000 +++ b/ChangeLog.API Fri Aug 15 02:42:52 2008 +0000 @@ -21,6 +21,7 @@ * purple_cmds_get_handle, purple_cmds_init, purple_cmds_uninit * cmd-added and cmd-removed signals * purple_get_host_name + * purple_markup_printf_escaped * purple_util_fetch_url_len (temporary function overload to add max_len param) * purple_util_fetch_url_request_len
--- a/libpurple/protocols/msn/contact.c Fri Aug 15 02:34:21 2008 +0000 +++ b/libpurple/protocols/msn/contact.c Fri Aug 15 02:42:52 2008 +0000 @@ -221,7 +221,7 @@ purple_debug_info("msn", "Creating an Address Book.\n"); - body = g_markup_printf_escaped(MSN_ADD_ADDRESSBOOK_TEMPLATE, + body = purple_markup_printf_escaped(MSN_ADD_ADDRESSBOOK_TEMPLATE, msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS), session->user->passport); @@ -408,7 +408,7 @@ update_str = g_strdup_printf(MSN_GET_CONTACT_UPDATE_XML,update_time); } - body = g_markup_printf_escaped(MSN_GET_CONTACT_TEMPLATE, partner_scenario_str, + body = purple_markup_printf_escaped(MSN_GET_CONTACT_TEMPLATE, partner_scenario_str, msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS), update_str ? update_str : ""); @@ -807,7 +807,7 @@ else if (LastChanged != NULL) update_str = g_strdup_printf(MSN_GET_ADDRESS_UPDATE_XML, LastChanged); - body = g_markup_printf_escaped(MSN_GET_ADDRESS_TEMPLATE, + body = purple_markup_printf_escaped(MSN_GET_ADDRESS_TEMPLATE, MsnSoapPartnerScenarioText[partner_scenario], msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS), update_str ? update_str : "");
--- a/libpurple/protocols/msn/msn.c Fri Aug 15 02:34:21 2008 +0000 +++ b/libpurple/protocols/msn/msn.c Fri Aug 15 02:42:52 2008 +0000 @@ -714,7 +714,7 @@ char *tmp2; if (purple_presence_is_idle(presence)) { - tmp2 = g_markup_printf_escaped("%s/%s", name, _("Idle")); + tmp2 = purple_markup_printf_escaped("%s/%s", name, _("Idle")); } else { tmp2 = g_markup_escape_text(name, -1); }
--- a/libpurple/protocols/msn/page.c Fri Aug 15 02:34:21 2008 +0000 +++ b/libpurple/protocols/msn/page.c Fri Aug 15 02:42:52 2008 +0000 @@ -53,7 +53,7 @@ g_return_val_if_fail(page != NULL, NULL); - str = g_markup_printf_escaped( + str = purple_markup_printf_escaped( "<TEXT xml:space=\"preserve\" enc=\"utf-8\">%s</TEXT>", msn_page_get_body(page));
--- a/libpurple/util.c Fri Aug 15 02:34:21 2008 +0000 +++ b/libpurple/util.c Fri Aug 15 02:42:52 2008 +0000 @@ -2499,6 +2499,29 @@ return g_strndup(tag+1, i-1); } +char * +purple_markup_printf_escaped(const char *format, ...) +{ + va_list args; + char *ret; + +#if GLIB_CHECK_VERSION(2,4,0) + va_start(args, format); + ret = g_markup_vprintf_escaped(format, args); + va_end(args); +#else + char *tmp; + + va_start(args, format); + tmp = g_strdup_vprintf(format, args); + va_end(args); + ret = g_markup_escape_text(tmp, -1); + g_free(tmp); + +#endif + + return ret; +} /************************************************************************** * Path/Filename Functions **************************************************************************/
--- a/libpurple/util.h Fri Aug 15 02:34:21 2008 +0000 +++ b/libpurple/util.h Fri Aug 15 02:42:52 2008 +0000 @@ -576,6 +576,21 @@ char * purple_markup_get_css_property(const gchar *style, const gchar *opt); +/** + * + * Formats arguments according to @a format, escaping all string and character + * arguments in the fashion of g_markup_escape_text(). This is useful when you + * want to insert literal strings into XML-style markup output, without having + * to worry that the strings might themselves contain markup. + * + * This exists for Glib backwards compatibility reasons. + * + * @param format The format + * + * @return The string + */ +char * purple_markup_printf_escaped(const char *format, ...); + /*@}*/