pidgin/pidgin

Merged in default (pull request #624)

2019-11-04, Gary Kramlich
935e9fe8bdc9
Merged in default (pull request #624)

Remove several utility functions

Approved-by: Gary Kramlich
--- a/ChangeLog.API Sun Nov 03 23:51:59 2019 -0500
+++ b/ChangeLog.API Mon Nov 04 11:01:03 2019 +0000
@@ -393,6 +393,7 @@
* purple_buddy_icons_has_custom_icon
* purple_buddy_icons_find_custom_icon
* purple_buddy_icons_set_custom_icon
+ * purple_build_dir. Use g_mkdir_with_parents instead
* purple_certificate_check_signature_chain_with_failing. Use
purple_certificate_check_signature_chain, instead
* purple_certificate_display_x509. Use purple_request_certificate,
@@ -416,10 +417,12 @@
event loop yourself. See GLib Main Event Loop docs.
* PurpleEventLoopUiOps. Manually drive the GLib event loop
yourself. See GLib Main Event Loop docs.
+ * purple_get_host_name. Use g_get_host_name, instead.
* purple_get_tzoff_str(). Use g_date_time_format, instead.
* purple_ip_address_is_valid, purple_ipv4_address_is_valid, and
purple_ipv6_address_is_valid. Use g_hostname_is_ip_address()
or #GInetAddress instead.
+ * purple_markup_extract_info_field
* PurpleMimeDocument, PurpleMimePart,
purple_mime_document_new, purple_mime_document_free,
purple_mime_document_parse, purple_mime_document_parsen,
@@ -496,6 +499,9 @@
* purple_status_type_set_primary_attr
* purple_strlcat
* purple_strlcpy
+ * purple_str_binary_to_ascii
+ * purple_str_has_prefix. Use g_str_has_prefix instead
+ * purple_str_has_suffix. Use g_str_has_suffix instead
* purple_str_size_to_units. Use g_format_size() instead.
* purple_timeout_*. Use g_timeout_* or g_idle_* instead.
* purple_txt_cancel
@@ -508,6 +514,7 @@
purple_util_fetch_url_request, instead.
* purple_util_get_image_checksum. Use
g_compute_checksum_for_data(G_CHECKSUM_SHA1, ...), instead.
+ * purple_uts35_to_str
* PurpleCertificateVerificationStatus.PURPLE_CERTIFICATE_INVALID
* PurpleConnectionUiOps.report_disconnect_reason
* PurplePluginProtocolInfo.add_buddy_with_invite
--- a/finch/gntrequest.c Sun Nov 03 23:51:59 2019 -0500
+++ b/finch/gntrequest.c Mon Nov 04 11:01:03 2019 +0000
@@ -433,9 +433,9 @@
purple_request_field_string_get_default_value(field));
gnt_entry_set_masked(GNT_ENTRY(entry),
purple_request_field_string_is_masked(field));
- if (hint && purple_str_has_prefix(hint, "screenname")) {
+ if (hint && g_str_has_prefix(hint, "screenname")) {
PurpleBlistNode *node = purple_blist_get_default_root();
- gboolean offline = purple_str_has_suffix(hint, "all");
+ gboolean offline = g_str_has_suffix(hint, "all");
for (; node; node = purple_blist_node_next(node, offline)) {
if (!PURPLE_IS_BUDDY(node))
continue;
--- a/libpurple/core.c Sun Nov 03 23:51:59 2019 -0500
+++ b/libpurple/core.c Mon Nov 04 11:01:03 2019 +0000
@@ -249,7 +249,7 @@
purple_log_uninit();
_purple_message_uninit();
/* Everything after util_uninit cannot try to write things to the
- * confdir nor use purple_escape_js
+ * confdir.
*/
purple_util_uninit();
--- a/libpurple/image-store.c Sun Nov 03 23:51:59 2019 -0500
+++ b/libpurple/image-store.c Mon Nov 04 11:01:03 2019 +0000
@@ -169,8 +169,9 @@
g_return_val_if_fail(uri != NULL, NULL);
- if (!purple_str_has_prefix(uri, PURPLE_IMAGE_STORE_PROTOCOL))
+ if (!g_str_has_prefix(uri, PURPLE_IMAGE_STORE_PROTOCOL)) {
return NULL;
+ }
uri += sizeof(PURPLE_IMAGE_STORE_PROTOCOL) - 1;
if (uri[0] == '-')
--- a/libpurple/keyring.c Sun Nov 03 23:51:59 2019 -0500
+++ b/libpurple/keyring.c Mon Nov 04 11:01:03 2019 +0000
@@ -1287,8 +1287,7 @@
GPluginPluginInfo *info =
GPLUGIN_PLUGIN_INFO(purple_plugin_get_info(plugin));
- if (!purple_str_has_prefix(gplugin_plugin_info_get_id(info),
- "keyring-")) {
+ if (!g_str_has_prefix(gplugin_plugin_info_get_id(info), "keyring-")) {
continue;
}
--- a/libpurple/log.c Sun Nov 03 23:51:59 2019 -0500
+++ b/libpurple/log.c Mon Nov 04 11:01:03 2019 +0000
@@ -871,7 +871,7 @@
if (dir == NULL)
return;
- purple_build_dir (dir, S_IRUSR | S_IWUSR | S_IXUSR);
+ g_mkdir_with_parents(dir, S_IRUSR | S_IWUSR | S_IXUSR);
dt = g_date_time_to_local(log->time);
tz = purple_escape_filename(g_date_time_get_timezone_abbreviation(dt));
@@ -927,9 +927,8 @@
while ((filename = g_dir_read_name(dir)))
{
- if (purple_str_has_suffix(filename, ext) &&
- strlen(filename) >= (17 + strlen(ext)))
- {
+ if (g_str_has_suffix(filename, ext) &&
+ strlen(filename) >= (17 + strlen(ext))) {
PurpleLog *log;
PurpleLogCommonLoggerData *data;
GDateTime *stamp = purple_str_to_date_time(purple_unescape_filename(filename), FALSE);
@@ -971,9 +970,8 @@
while ((filename = g_dir_read_name(dir)))
{
- if (purple_str_has_suffix(filename, ext) &&
- strlen(filename) >= (17 + strlen(ext)))
- {
+ if (g_str_has_suffix(filename, ext) &&
+ strlen(filename) >= (17 + strlen(ext))) {
char *tmp = g_build_filename(path, filename, NULL);
GStatBuf st;
if (g_stat(tmp, &st))
--- a/libpurple/plugins/autoaccept.c Sun Nov 03 23:51:59 2019 -0500
+++ b/libpurple/plugins/autoaccept.c Mon Nov 04 11:01:03 2019 +0000
@@ -54,8 +54,9 @@
{
if (!g_file_test(dir, G_FILE_TEST_IS_DIR))
{
- if (purple_build_dir(dir, S_IRUSR | S_IWUSR | S_IXUSR))
+ if (g_mkdir_with_parents(dir, S_IRUSR | S_IWUSR | S_IXUSR)) {
return FALSE;
+ }
}
return TRUE;
--- a/libpurple/plugins/log_reader.c Sun Nov 03 23:51:59 2019 -0500
+++ b/libpurple/plugins/log_reader.c Mon Nov 04 11:01:03 2019 +0000
@@ -100,9 +100,11 @@
const gchar *file;
while ((file = g_dir_read_name(dir))) {
- if (!purple_str_has_prefix(file, sn))
+ if (!g_str_has_prefix(file, sn)) {
continue;
- if (purple_str_has_suffix(file, ".html") || purple_str_has_suffix(file, ".AdiumHTMLLog")) {
+ }
+ if (g_str_has_suffix(file, ".html") ||
+ g_str_has_suffix(file, ".AdiumHTMLLog")) {
GDateTime *dt;
gint year, month, day, hour, minute, second;
const char *date = file;
@@ -165,7 +167,7 @@
list = g_list_prepend(list, log);
}
- } else if (purple_str_has_suffix(file, ".adiumLog")) {
+ } else if (g_str_has_suffix(file, ".adiumLog")) {
GDateTime *dt;
gint year, month, day, hour, minute, second;
const char *date = file;
@@ -269,8 +271,7 @@
/* This problem only seems to show up on Windows.
* The BOM is displaying as a space at the beginning of the log.
*/
- if (purple_str_has_prefix(read, "\xef\xbb\xbf"))
- {
+ if (g_str_has_prefix(read, "\xef\xbb\xbf")) {
/* FIXME: This feels so wrong... */
char *temp = g_strdup(&(read[3]));
g_free(read);
@@ -578,8 +579,9 @@
while ((name = g_dir_read_name(dir))) {
const char *c = name;
- if (!purple_str_has_prefix(c, username))
+ if (!g_str_has_prefix(c, username)) {
continue;
+ }
c += strlen(username);
while (*c) {
@@ -631,8 +633,9 @@
const char *c = name;
gchar *full_path;
- if (!purple_str_has_prefix(c, username))
+ if (!g_str_has_prefix(c, username)) {
continue;
+ }
c += strlen(username);
while (*c) {
@@ -862,16 +865,18 @@
* friendly name or alias. For this test, "match" is defined as:
* ^(friendly_name|alias)([^a-zA-Z0-9].*)?$
*/
- from_name_matches = (purple_str_has_prefix(from_name, friendly_name) &&
- !isalnum(*(from_name + friendly_name_length))) ||
- (purple_str_has_prefix(from_name, alias) &&
- !isalnum(*(from_name + alias_length)));
-
- to_name_matches = to_name != NULL && (
- (purple_str_has_prefix(to_name, friendly_name) &&
- !isalnum(*(to_name + friendly_name_length))) ||
- (purple_str_has_prefix(to_name, alias) &&
- !isalnum(*(to_name + alias_length))));
+ from_name_matches =
+ (g_str_has_prefix(from_name, friendly_name) &&
+ !isalnum(*(from_name + friendly_name_length))) ||
+ (g_str_has_prefix(from_name, alias) &&
+ !isalnum(*(from_name + alias_length)));
+
+ to_name_matches =
+ to_name != NULL &&
+ ((g_str_has_prefix(to_name, friendly_name) &&
+ !isalnum(*(to_name + friendly_name_length))) ||
+ (g_str_has_prefix(to_name, alias) &&
+ !isalnum(*(to_name + alias_length))));
if (from_name_matches) {
if (!to_name_matches) {
@@ -901,15 +906,13 @@
* matches their alias. For this test, "match" is
* defined as: ^alias([^a-zA-Z0-9].*)?$
*/
- from_name_matches = (purple_str_has_prefix(
- from_name, alias) &&
- !isalnum(*(from_name +
- alias_length)));
-
- to_name_matches = to_name && (purple_str_has_prefix(
- to_name, alias) &&
- !isalnum(*(to_name +
- alias_length)));
+ from_name_matches =
+ (g_str_has_prefix(from_name, alias) &&
+ !isalnum(*(from_name + alias_length)));
+
+ to_name_matches = to_name &&
+ (g_str_has_prefix(to_name, alias) &&
+ !isalnum(*(to_name + alias_length)));
g_free(alias);
@@ -929,17 +932,17 @@
* this test, "match" is defined as:
* ^friendly_name([^a-zA-Z0-9].*)?$
*/
- from_name_matches = (purple_str_has_prefix(
- from_name,
- server_alias) &&
- !isalnum(*(from_name +
- friendly_name_length)));
-
- to_name_matches = to_name && (
- (purple_str_has_prefix(
- to_name, server_alias) &&
- !isalnum(*(to_name +
- friendly_name_length))));
+ from_name_matches =
+ (g_str_has_prefix(from_name,
+ server_alias) &&
+ !isalnum(*(from_name +
+ friendly_name_length)));
+
+ to_name_matches =
+ to_name &&
+ ((g_str_has_prefix(to_name, server_alias) &&
+ !isalnum(*(to_name +
+ friendly_name_length))));
if (from_name_matches) {
if (!to_name_matches) {
@@ -1142,7 +1145,7 @@
}
*c = '\0';
- if (purple_str_has_prefix(line, "Session Close ")) {
+ if (g_str_has_prefix(line, "Session Close ")) {
if (data && !data->length) {
if (!(data->length = last_line_offset - data->offset)) {
/* This log had no data, so we remove it. */
@@ -1156,7 +1159,7 @@
}
}
} else if (line[0] && line[1] && line[2] &&
- purple_str_has_prefix(&line[3], "sion Start ")) {
+ g_str_has_prefix(&line[3], "sion Start ")) {
/* The conditional is to make sure we're not reading off
* the end of the string. We don't want strlen(), as that'd
* have to count the whole string needlessly.
@@ -1418,17 +1421,18 @@
line++;
}
- if (purple_str_has_prefix(line, "*** ")) {
+ if (g_str_has_prefix(line, "*** ")) {
line += (sizeof("*** ") - 1);
g_string_append(formatted, "<b>");
footer = "</b>";
- if (purple_str_has_prefix(line, "NOTE: This user is offline.")) {
+ if (g_str_has_prefix(line, "NOTE: This user is offline.")) {
line = _("User is offline.");
- } else if (purple_str_has_prefix(line,
- "NOTE: Your status is currently set to ")) {
+ } else if (g_str_has_prefix(
+ line,
+ "NOTE: Your status is currently set to ")) {
line += (sizeof("NOTE: ") - 1);
- } else if (purple_str_has_prefix(line, "Auto-response sent to ")) {
+ } else if (g_str_has_prefix(line, "Auto-response sent to ")) {
g_string_append(formatted, _("Auto-response sent:"));
while (*line && *line != ':')
line++;
@@ -1462,8 +1466,8 @@
g_string_append(formatted, log->name);
line = " logged in.";
- } else if (purple_str_has_prefix(line,
- "One or more messages may have been undeliverable.")) {
+ } else if (g_str_has_prefix(line, "One or more messages may "
+ "have been undeliverable.")) {
g_string_append(formatted,
"<span style=\"color: #ff0000;\">");
@@ -1472,8 +1476,8 @@
"undeliverable."));
line = "";
footer = "</span></b>";
- } else if (purple_str_has_prefix(line,
- "You have been disconnected.")) {
+ } else if (g_str_has_prefix(line,
+ "You have been disconnected.")) {
g_string_append(formatted,
"<span style=\"color: #ff0000;\">");
@@ -1481,8 +1485,8 @@
_("You were disconnected from the server."));
line = "";
footer = "</span></b>";
- } else if (purple_str_has_prefix(line,
- "You are currently disconnected.")) {
+ } else if (g_str_has_prefix(
+ line, "You are currently disconnected.")) {
g_string_append(formatted,
"<span style=\"color: #ff0000;\">");
@@ -1490,15 +1494,16 @@
"will not be received unless you are "
"logged in.");
footer = "</span></b>";
- } else if (purple_str_has_prefix(line,
- "Your previous message has not been sent.")) {
+ } else if (g_str_has_prefix(line, "Your previous message has "
+ "not been sent.")) {
g_string_append(formatted,
"<span style=\"color: #ff0000;\">");
- if (purple_str_has_prefix(line,
- "Your previous message has not been sent. "
- "Reason: Maximum length exceeded.")) {
+ if (g_str_has_prefix(
+ line,
+ "Your previous message has not been sent. "
+ "Reason: Maximum length exceeded.")) {
g_string_append(formatted,
_("Message could not be sent because "
@@ -1514,7 +1519,7 @@
footer = "</span></b>";
}
- } else if (purple_str_has_prefix(line, data->their_nickname)) {
+ } else if (g_str_has_prefix(line, data->their_nickname)) {
if (buddy != NULL) {
const char *alias = purple_buddy_get_alias(buddy);
@@ -1684,8 +1689,8 @@
gboolean add_new_log = FALSE;
if (c && *c) {
- if (purple_str_has_prefix(c, QIP_LOG_IN_MESSAGE) ||
- purple_str_has_prefix(c, QIP_LOG_OUT_MESSAGE)) {
+ if (g_str_has_prefix(c, QIP_LOG_IN_MESSAGE) ||
+ g_str_has_prefix(c, QIP_LOG_OUT_MESSAGE)) {
char *tmp;
@@ -1841,12 +1846,12 @@
while (c && *c) {
gboolean is_in_message = FALSE;
- if (purple_str_has_prefix(line, QIP_LOG_IN_MESSAGE_ESC) ||
- purple_str_has_prefix(line, QIP_LOG_OUT_MESSAGE_ESC)) {
+ if (g_str_has_prefix(line, QIP_LOG_IN_MESSAGE_ESC) ||
+ g_str_has_prefix(line, QIP_LOG_OUT_MESSAGE_ESC)) {
char *tmp;
- is_in_message = purple_str_has_prefix(line, QIP_LOG_IN_MESSAGE_ESC);
+ is_in_message = g_str_has_prefix(line, QIP_LOG_IN_MESSAGE_ESC);
/* find EOL */
c = strchr(c, '\n');
@@ -2010,7 +2015,7 @@
gint year, month, day, hour, minute, second;
GDateTime *dt;
while (c && *c) {
- if (purple_str_has_prefix(c, AMSN_LOG_CONV_START)) {
+ if (g_str_has_prefix(c, AMSN_LOG_CONV_START)) {
char month_str[4];
if (sscanf(c + strlen(AMSN_LOG_CONV_START),
"%u %3s %u %u:%u:%u",
@@ -2027,7 +2032,7 @@
offset = c - contents;
start_log = c;
}
- } else if (purple_str_has_prefix(c, AMSN_LOG_CONV_END) && found_start) {
+ } else if (g_str_has_prefix(c, AMSN_LOG_CONV_END) && found_start) {
data = g_new0(struct amsn_logger_data, 1);
data->path = g_strdup(filename);
data->offset = offset;
@@ -2215,7 +2220,7 @@
if (!end)
break;
*end = '\0';
- if (purple_str_has_prefix(start, AMSN_LOG_FORMAT_TAG) && in_span) {
+ if (g_str_has_prefix(start, AMSN_LOG_FORMAT_TAG) && in_span) {
/* New format for this line */
g_string_append(formatted, "</span><br>");
in_span = FALSE;
@@ -2244,19 +2249,19 @@
old_tag = tag + 7; /* C + xxxxxx */
} else {
/* |"Lxxx is a 3-digit colour code */
- if (purple_str_has_prefix(tag, "RED")) {
+ if (g_str_has_prefix(tag, "RED")) {
g_string_append(formatted, "<span style=\"color: red;\">");
in_span = TRUE;
- } else if (purple_str_has_prefix(tag, "GRA")) {
+ } else if (g_str_has_prefix(tag, "GRA")) {
g_string_append(formatted, "<span style=\"color: gray;\">");
in_span = TRUE;
- } else if (purple_str_has_prefix(tag, "NOR")) {
+ } else if (g_str_has_prefix(tag, "NOR")) {
g_string_append(formatted, "<span style=\"color: black;\">");
in_span = TRUE;
- } else if (purple_str_has_prefix(tag, "ITA")) {
+ } else if (g_str_has_prefix(tag, "ITA")) {
g_string_append(formatted, "<span style=\"color: blue;\">");
in_span = TRUE;
- } else if (purple_str_has_prefix(tag, "GRE")) {
+ } else if (g_str_has_prefix(tag, "GRE")) {
g_string_append(formatted, "<span style=\"color: darkgreen;\">");
in_span = TRUE;
} else {
@@ -2429,7 +2434,7 @@
*temp = '\0';
/* Set path. */
- if (purple_str_has_suffix(value, "trillian.exe")) {
+ if (g_str_has_suffix(value, "trillian.exe")) {
value[strlen(value) - (sizeof("trillian.exe") - 1)] = '\0';
path = g_build_filename(value, "users", "default", "talk.ini", NULL);
}
@@ -2472,7 +2477,7 @@
*cursor = '\0';
/* XXX: This assumes the first Directory key is under [Logging]. */
- if (purple_str_has_prefix(line, "Directory=")) {
+ if (g_str_has_prefix(line, "Directory=")) {
line += (sizeof("Directory=") - 1);
g_strchomp(line);
purple_prefs_add_string(
--- a/libpurple/protocols/bonjour/mdns_dns_sd.c Sun Nov 03 23:51:59 2019 -0500
+++ b/libpurple/protocols/bonjour/mdns_dns_sd.c Mon Nov 04 11:01:03 2019 +0000
@@ -460,7 +460,7 @@
gboolean _mdns_init_session(BonjourDnsSd *data) {
data->mdns_impl_data = g_new0(Win32SessionImplData, 1);
- bonjour_dns_sd_set_jid(data->account, purple_get_host_name());
+ bonjour_dns_sd_set_jid(data->account, g_get_host_name());
return TRUE;
}
--- a/libpurple/protocols/gg/edisc.c Sun Nov 03 23:51:59 2019 -0500
+++ b/libpurple/protocols/gg/edisc.c Mon Nov 04 11:01:03 2019 +0000
@@ -358,15 +358,14 @@
msg = soup_message_new("PUT", "https://drive.mpa.gg.pl/signin");
ggp_edisc_set_defaults(msg);
- metadata =
- g_strdup_printf("{"
- "\"id\": \"%032x\", "
- "\"name\": \"%s\", "
- "\"os_version\": \"" GGP_EDISC_OS "\", "
- "\"client_version\": \"%s\", "
- "\"type\": \"" GGP_EDISC_TYPE "\"}",
- g_random_int_range(1, 1 << 16),
- purple_get_host_name(), ggp_libgaduw_version(gc));
+ metadata = g_strdup_printf("{"
+ "\"id\": \"%032x\", "
+ "\"name\": \"%s\", "
+ "\"os_version\": \"" GGP_EDISC_OS "\", "
+ "\"client_version\": \"%s\", "
+ "\"type\": \"" GGP_EDISC_TYPE "\"}",
+ g_random_int_range(1, 1 << 16),
+ g_get_host_name(), ggp_libgaduw_version(gc));
tmp = g_strdup_printf("IMToken %s", imtoken);
soup_message_headers_replace(msg->request_headers, "Authorization", tmp);
--- a/libpurple/protocols/jabber/google/google_presence.c Sun Nov 03 23:51:59 2019 -0500
+++ b/libpurple/protocols/jabber/google/google_presence.c Mon Nov 04 11:01:03 2019 +0000
@@ -26,7 +26,7 @@
{
if (!js->googletalk)
return;
- if (jbr->status && purple_str_has_prefix(jbr->status, "♫ ")) {
+ if (jbr->status && g_str_has_prefix(jbr->status, "♫ ")) {
purple_protocol_got_user_status(purple_connection_get_account(js->gc), user, "tune",
PURPLE_TUNE_TITLE, jbr->status + strlen("♫ "), NULL);
g_free(jbr->status);
--- a/libpurple/protocols/sametime/sametime.c Sun Nov 03 23:51:59 2019 -0500
+++ b/libpurple/protocols/sametime/sametime.c Mon Nov 04 11:01:03 2019 +0000
@@ -812,7 +812,7 @@
static gboolean buddy_is_external(PurpleBuddy *b) {
g_return_val_if_fail(b != NULL, FALSE);
- return purple_str_has_prefix(purple_buddy_get_name(b), "@E ");
+ return g_str_has_prefix(purple_buddy_get_name(b), "@E ");
}
@@ -3869,9 +3869,10 @@
b = purple_blist_find_buddy(acct, who);
user_info = purple_notify_user_info_new();
- if(purple_str_has_prefix(who, "@E ")) {
- purple_notify_user_info_add_pair_html(user_info, _("External User"), NULL);
- }
+ if (g_str_has_prefix(who, "@E ")) {
+ purple_notify_user_info_add_pair_html(user_info, _("External User"),
+ NULL);
+ }
purple_notify_user_info_add_pair_plaintext(user_info, _("User ID"), who);
--- a/libpurple/protocols/silc/ops.c Sun Nov 03 23:51:59 2019 -0500
+++ b/libpurple/protocols/silc/ops.c Mon Nov 04 11:01:03 2019 +0000
@@ -182,7 +182,7 @@
}
/* Image */
- if (purple_str_has_prefix(type, "image/")) {
+ if (g_str_has_prefix(type, "image/")) {
char tmp[32];
PurpleImage *img;
guint img_id;
--- a/libpurple/protocols/simple/simple.c Sun Nov 03 23:51:59 2019 -0500
+++ b/libpurple/protocols/simple/simple.c Mon Nov 04 11:01:03 2019 +0000
@@ -1288,8 +1288,7 @@
while (ssparts[i])
{
g_strchug(ssparts[i]);
- if (purple_str_has_prefix(ssparts[i], "terminated"))
- {
+ if (g_str_has_prefix(ssparts[i], "terminated")) {
purple_debug_info("simple", "Subscription expired!");
if (b->dialog)
{
--- a/libpurple/upnp.c Sun Nov 03 23:51:59 2019 -0500
+++ b/libpurple/upnp.c Mon Nov 04 11:01:03 2019 +0000
@@ -340,8 +340,8 @@
}
tmp = purple_xmlnode_get_data(controlURLNode);
- if(baseURL && !purple_str_has_prefix(tmp, "http://") &&
- !purple_str_has_prefix(tmp, "HTTP://")) {
+ if (baseURL && !g_str_has_prefix(tmp, "http://") &&
+ !g_str_has_prefix(tmp, "HTTP://")) {
/* Handle absolute paths in a relative URL. This probably
* belongs in util.c. */
if (tmp[0] == '/') {
@@ -355,7 +355,7 @@
controlURL = g_strdup_printf("%s%s", baseURL, tmp);
}
g_free(tmp);
- }else{
+ } else {
controlURL = tmp;
}
g_free(baseURL);
--- a/libpurple/util.c Sun Nov 03 23:51:59 2019 -0500
+++ b/libpurple/util.c Mon Nov 04 11:01:03 2019 +0000
@@ -35,15 +35,9 @@
static gchar *config_dir = NULL;
static gchar *data_dir = NULL;
-static JsonNode *escape_js_node = NULL;
-static JsonGenerator *escape_js_gen = NULL;
-
void
purple_util_init(void)
{
- escape_js_node = json_node_new(JSON_NODE_VALUE);
- escape_js_gen = json_generator_new();
- json_node_set_boolean(escape_js_node, FALSE);
}
void
@@ -65,12 +59,6 @@
g_free(data_dir);
data_dir = NULL;
-
- json_node_free(escape_js_node);
- escape_js_node = NULL;
-
- g_object_unref(escape_js_gen);
- escape_js_gen = NULL;
}
/**************************************************************************
@@ -573,333 +561,6 @@
return retval;
}
-char *
-purple_uts35_to_str(const char *format, size_t len, struct tm *tm)
-{
- GString *string;
- guint i, count;
-
- if (tm == NULL) {
- time_t now = time(NULL);
- tm = localtime(&now);
- }
-
- string = g_string_sized_new(len);
- i = 0;
- while (i < len) {
- count = 1;
- while ((i + count) < len && format[i] == format[i+count])
- count++;
-
- switch (format[i]) {
- /* Era Designator */
- case 'G':
- if (count <= 3) {
- /* Abbreviated */
- } else if (count == 4) {
- /* Full */
- } else if (count >= 5) {
- /* Narrow */
- count = 5;
- }
- break;
-
-
- /* Year */
- case 'y':
- if (count == 2) {
- /* Two-digits only */
- g_string_append(string, purple_utf8_strftime("%y", tm));
- } else {
- /* Zero-padding */
- g_string_append_printf(string, "%0*d",
- count,
- tm->tm_year + 1900);
- }
- break;
-
- /* Year (in "Week of Year" based calendars) */
- case 'Y':
- if (count == 2) {
- /* Two-digits only */
- } else {
- /* Zero-padding */
- }
- break;
-
- /* Extended Year */
- case 'u':
- break;
-
- /* Cyclic Year Name */
- case 'U':
- if (count <= 3) {
- /* Abbreviated */
- } else if (count == 4) {
- /* Full */
- } else if (count >= 5) {
- /* Narrow */
- count = 5;
- }
- break;
-
-
- /* Quarter */
- case 'Q':
- /* Stand-alone Quarter */
- case 'q':
- if (count <= 2) {
- /* Numerical */
- } else if (count == 3) {
- /* Abbreviation */
- } else if (count >= 4) {
- /* Full */
- count = 4;
- }
- break;
-
- /* Month */
- case 'M':
- /* Stand-alone Month */
- case 'L':
- if (count <= 2) {
- /* Numerical */
- g_string_append(string, purple_utf8_strftime("%m", tm));
- } else if (count == 3) {
- /* Abbreviation */
- g_string_append(string, purple_utf8_strftime("%b", tm));
- } else if (count == 4) {
- /* Full */
- g_string_append(string, purple_utf8_strftime("%B", tm));
- } else if (count >= 5) {
- g_string_append_len(string, purple_utf8_strftime("%b", tm), 1);
- count = 5;
- }
- break;
-
- /* Ignored */
- case 'l':
- break;
-
-
- /* Week of Year */
- case 'w':
- g_string_append(string, purple_utf8_strftime("%W", tm));
- count = MIN(count, 2);
- break;
-
- /* Week of Month */
- case 'W':
- count = 1;
- break;
-
-
- /* Day of Month */
- case 'd':
- g_string_append(string, purple_utf8_strftime("%d", tm));
- count = MIN(count, 2);
- break;
-
- /* Day of Year */
- case 'D':
- g_string_append(string, purple_utf8_strftime("%j", tm));
- count = MIN(count, 3);
- break;
-
- /* Day of Year in Month */
- case 'F':
- count = 1;
- break;
-
- /* Modified Julian Day */
- case 'g':
- break;
-
-
- /* Day of Week */
- case 'E':
- if (count <= 3) {
- /* Short */
- g_string_append(string, purple_utf8_strftime("%a", tm));
- } else if (count == 4) {
- /* Full */
- g_string_append(string, purple_utf8_strftime("%A", tm));
- } else if (count >= 5) {
- /* Narrow */
- g_string_append_len(string, purple_utf8_strftime("%a", tm), 1);
- count = 5;
- }
- break;
-
- /* Local Day of Week */
- case 'e':
- if (count <= 2) {
- /* Numeric */
- g_string_append(string, purple_utf8_strftime("%u", tm));
- } else if (count == 3) {
- /* Short */
- g_string_append(string, purple_utf8_strftime("%a", tm));
- } else if (count == 4) {
- /* Full */
- g_string_append(string, purple_utf8_strftime("%A", tm));
- } else if (count >= 5) {
- /* Narrow */
- g_string_append_len(string, purple_utf8_strftime("%a", tm), 1);
- count = 5;
- }
- break;
-
- /* Stand-alone Local Day of Week */
- case 'c':
- if (count <= 2) {
- /* Numeric */
- g_string_append(string, purple_utf8_strftime("%u", tm));
- count = 1;
- } else if (count == 3) {
- /* Short */
- g_string_append(string, purple_utf8_strftime("%a", tm));
- } else if (count == 4) {
- /* Full */
- g_string_append(string, purple_utf8_strftime("%A", tm));
- } else if (count >= 5) {
- /* Narrow */
- g_string_append_len(string, purple_utf8_strftime("%a", tm), 1);
- count = 5;
- }
- break;
-
-
- /* AM/PM */
- case 'a':
- g_string_append(string, purple_utf8_strftime("%p", tm));
- break;
-
-
- /* Hour (1-12) */
- case 'h':
- if (count == 1) {
- /* No padding */
- g_string_append(string, purple_utf8_strftime("%I", tm));
- } else if (count >= 2) {
- /* Zero-padded */
- g_string_append(string, purple_utf8_strftime("%I", tm));
- count = 2;
- }
- break;
-
- /* Hour (0-23) */
- case 'H':
- if (count == 1) {
- /* No padding */
- g_string_append(string, purple_utf8_strftime("%H", tm));
- } else if (count >= 2) {
- /* Zero-padded */
- g_string_append(string, purple_utf8_strftime("%H", tm));
- count = 2;
- }
- break;
-
- /* Hour (0-11) */
- case 'K':
- /* Hour (1-24) */
- case 'k':
- if (count == 1) {
- /* No padding */
- } else if (count >= 2) {
- /* Zero-padded */
- count = 2;
- }
- break;
-
- /* Hour (hHkK by locale) */
- case 'j':
- break;
-
-
- /* Minute */
- case 'm':
- g_string_append(string, purple_utf8_strftime("%M", tm));
- count = MIN(count, 2);
- break;
-
-
- /* Second */
- case 's':
- g_string_append(string, purple_utf8_strftime("%S", tm));
- count = MIN(count, 2);
- break;
-
- /* Fractional Sub-second */
- case 'S':
- break;
-
- /* Millisecond */
- case 'A':
- break;
-
-
- /* Time Zone (specific non-location format) */
- case 'z':
- if (count <= 3) {
- /* Short */
- } else if (count >= 4) {
- /* Full */
- count = 4;
- }
- break;
-
- /* Time Zone */
- case 'Z':
- if (count <= 3) {
- /* RFC822 */
- g_string_append(string, purple_utf8_strftime("%z", tm));
- } else if (count == 4) {
- /* Localized GMT */
- } else if (count >= 5) {
- /* ISO8601 */
- g_string_append(string, purple_utf8_strftime("%z", tm));
- count = 5;
- }
- break;
-
- /* Time Zone (generic non-location format) */
- case 'v':
- if (count <= 3) {
- /* Short */
- g_string_append(string, purple_utf8_strftime("%Z", tm));
- count = 1;
- } else if (count >= 4) {
- /* Long */
- g_string_append(string, purple_utf8_strftime("%Z", tm));
- count = 4;
- }
- break;
-
- /* Time Zone */
- case 'V':
- if (count <= 3) {
- /* Same as z */
- count = 1;
- } else if (count >= 4) {
- /* Generic Location Format) */
- g_string_append(string, purple_utf8_strftime("%Z", tm));
- count = 4;
- }
- break;
-
-
- default:
- g_string_append_len(string, format + i, count);
- break;
- }
-
- i += count;
- }
-
- return g_string_free(string, FALSE);
-}
-
-
/**************************************************************************
* Markup Functions
**************************************************************************/
@@ -1282,100 +943,6 @@
return found;
}
-gboolean
-purple_markup_extract_info_field(const char *str, int len, PurpleNotifyUserInfo *user_info,
- const char *start_token, int skip,
- const char *end_token, char check_value,
- const char *no_value_token,
- const char *display_name, gboolean is_link,
- const char *link_prefix,
- PurpleInfoFieldFormatCallback format_cb)
-{
- const char *p, *q;
-
- g_return_val_if_fail(str != NULL, FALSE);
- g_return_val_if_fail(user_info != NULL, FALSE);
- g_return_val_if_fail(start_token != NULL, FALSE);
- g_return_val_if_fail(end_token != NULL, FALSE);
- g_return_val_if_fail(display_name != NULL, FALSE);
-
- p = strstr(str, start_token);
-
- if (p == NULL)
- return FALSE;
-
- p += strlen(start_token) + skip;
-
- if (p >= str + len)
- return FALSE;
-
- if (check_value != '\0' && *p == check_value)
- return FALSE;
-
- q = strstr(p, end_token);
-
- /* Trim leading blanks */
- while (*p != '\n' && g_ascii_isspace(*p)) {
- p += 1;
- }
-
- /* Trim trailing blanks */
- while (q > p && g_ascii_isspace(*(q - 1))) {
- q -= 1;
- }
-
- /* Don't bother with null strings */
- if (p == q)
- return FALSE;
-
- if (q != NULL && (!no_value_token ||
- strncmp(p, no_value_token, strlen(no_value_token)))) {
- GString *dest = g_string_new("");
-
- if (is_link)
- {
- g_string_append(dest, "<a href=\"");
-
- if (link_prefix)
- g_string_append(dest, link_prefix);
-
- if (format_cb != NULL)
- {
- char *reformatted = format_cb(p, q - p);
- g_string_append(dest, reformatted);
- g_free(reformatted);
- }
- else
- g_string_append_len(dest, p, q - p);
- g_string_append(dest, "\">");
-
- if (link_prefix)
- g_string_append(dest, link_prefix);
-
- g_string_append_len(dest, p, q - p);
- g_string_append(dest, "</a>");
- }
- else
- {
- if (format_cb != NULL)
- {
- char *reformatted = format_cb(p, q - p);
- g_string_append(dest, reformatted);
- g_free(reformatted);
- }
- else
- g_string_append_len(dest, p, q - p);
- }
-
- purple_notify_user_info_add_pair_html(user_info, display_name, dest->str);
- g_string_free(dest, TRUE);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
struct purple_parse_tag {
char *src_tag;
char *dest_tag;
@@ -2599,7 +2166,7 @@
gboolean xdg_path_exists;
/* Create destination directory */
- mkdir_res = purple_build_dir(purple_xdg_dir, S_IRWXU);
+ mkdir_res = g_mkdir_with_parents(purple_xdg_dir, S_IRWXU);
if (mkdir_res == -1) {
purple_debug_error("util", "Error creating xdg directory %s: %s; failed migration\n",
purple_xdg_dir, g_strerror(errno));
@@ -2648,11 +2215,6 @@
custom_user_dir = NULL;
}
-int purple_build_dir(const char *path, int mode)
-{
- return g_mkdir_with_parents(path, mode);
-}
-
static gboolean
purple_util_write_data_to_file_common(const char *dir, const char *filename, const char *data, gssize size)
{
@@ -3112,12 +2674,6 @@
}
gboolean
-purple_str_has_prefix(const char *s, const char *p)
-{
- return g_str_has_prefix(s, p);
-}
-
-gboolean
purple_str_has_caseprefix(const gchar *s, const gchar *p)
{
g_return_val_if_fail(s, FALSE);
@@ -3126,12 +2682,6 @@
return (g_ascii_strncasecmp(s, p, strlen(p)) == 0);
}
-gboolean
-purple_str_has_suffix(const char *s, const char *x)
-{
- return g_str_has_suffix(s, x);
-}
-
char *
purple_str_add_cr(const char *text)
{
@@ -3351,27 +2901,6 @@
}
-char *
-purple_str_binary_to_ascii(const unsigned char *binary, guint len)
-{
- GString *ret;
- guint i;
-
- g_return_val_if_fail(len > 0, NULL);
-
- ret = g_string_sized_new(len);
-
- for (i = 0; i < len; i++)
- if (binary[i] < 32 || binary[i] > 126)
- g_string_append_printf(ret, "\\x%02x", binary[i] & 0xFF);
- else if (binary[i] == '\\')
- g_string_append(ret, "\\\\");
- else
- g_string_append_c(ret, binary[i]);
-
- return g_string_free(ret, FALSE);
-}
-
size_t
purple_utf16_size(const gunichar2 *str)
{
@@ -4146,18 +3675,6 @@
return buf;
}
-gchar * purple_escape_js(const gchar *str)
-{
- gchar *escaped;
-
- json_node_set_string(escape_js_node, str);
- json_generator_set_root(escape_js_gen, escape_js_node);
- escaped = json_generator_to_data(escape_js_gen, NULL);
- json_node_set_boolean(escape_js_node, FALSE);
-
- return escaped;
-}
-
void purple_restore_default_signal_handlers(void)
{
#ifndef _WIN32
@@ -4252,12 +3769,6 @@
return g_string_free(string, FALSE);
}
-const gchar *
-purple_get_host_name(void)
-{
- return g_get_host_name();
-}
-
gchar *
purple_uuid_random(void)
{
--- a/libpurple/util.h Sun Nov 03 23:51:59 2019 -0500
+++ b/libpurple/util.h Mon Nov 04 11:01:03 2019 +0000
@@ -306,21 +306,6 @@
*/
GDateTime *purple_str_to_date_time(const char *timestamp, gboolean utc);
-/**
- * purple_uts35_to_str:
- * @format: The formatting string, according to UTS \#35
- * See http://unicode.org/reports/tr35/
- * (NOTE: not all formats are supported)
- * @len: The length of the formatting string
- * @tm: The time to format, or %NULL to use the current local time
- *
- * Formats a datetime according to a UTS-35 Date Format Pattern.
- *
- * Returns: The time, formatted as per the user's settings.
- */
-char *purple_uts35_to_str(const char *format, size_t len, struct tm *tm);
-
-
/**************************************************************************/
/* Markup Functions */
/**************************************************************************/
@@ -362,38 +347,6 @@
GData **attributes);
/**
- * purple_markup_extract_info_field:
- * @str: The string to parse.
- * @len: The size of str.
- * @user_info: The destination PurpleNotifyUserInfo to which the new
- * field info should be added.
- * @start_token: The beginning token.
- * @skip: The number of characters to skip after the
- * start token.
- * @end_token: The ending token.
- * @check_value: The value that the last character must meet.
- * @no_value_token: The token indicating no value is given.
- * @display_name: The short descriptive name to display for this token.
- * @is_link: TRUE if this should be a link, or FALSE otherwise.
- * @link_prefix: The prefix for the link.
- * @format_cb: (scope call): A callback to format the value before adding it.
- *
- * Extracts a field of data from HTML.
- *
- * This is a scary function. It used to be used for MSN and Yahoo prpls,
- * but since those prpls have been removed, this is now deprecated.
- *
- * Returns: TRUE if successful, or FALSE otherwise.
- */
-gboolean purple_markup_extract_info_field(const char *str, int len, PurpleNotifyUserInfo *user_info,
- const char *start_token, int skip,
- const char *end_token, char check_value,
- const char *no_value_token,
- const char *display_name, gboolean is_link,
- const char *link_prefix,
- PurpleInfoFieldFormatCallback format_cb);
-
-/**
* purple_markup_html_to_xhtml:
* @html: The HTML markup.
* @dest_xhtml: The destination XHTML output.
@@ -638,19 +591,6 @@
void purple_util_set_user_dir(const char *dir);
/**
- * purple_build_dir:
- * @path: The path you wish to create. Note that it must start
- * from the root or this function will fail.
- * @mode: Unix-style permissions for this directory.
- *
- * Builds a complete path from the root, making any directories along
- * the path which do not already exist.
- *
- * Returns: 0 for success, nonzero on any error.
- */
-int purple_build_dir(const char *path, int mode);
-
-/**
* purple_util_write_data_to_file:
* @filename: The basename of the file to write in the purple_user_dir.
* @data: A string of data to write.
@@ -987,18 +927,6 @@
gboolean purple_validate(const PurpleProtocol *protocol, const char *str);
/**
- * purple_str_has_prefix:
- * @s: The string to check.
- * @p: The prefix in question.
- *
- * Compares two strings to see if the first contains the second as
- * a proper prefix.
- *
- * Returns: TRUE if p is a prefix of s, otherwise FALSE.
- */
-gboolean purple_str_has_prefix(const char *s, const char *p);
-
-/**
* purple_str_has_caseprefix:
* @s: The string to check.
* @p: The prefix in question.
@@ -1012,18 +940,6 @@
purple_str_has_caseprefix(const gchar *s, const gchar *p);
/**
- * purple_str_has_suffix:
- * @s: The string to check.
- * @x: The suffix in question.
- *
- * Compares two strings to see if the second is a proper suffix
- * of the first.
- *
- * Returns: TRUE if x is a a suffix of s, otherwise FALSE.
- */
-gboolean purple_str_has_suffix(const char *s, const char *x);
-
-/**
* purple_strdup_withhtml:
* @src: The source string.
*
@@ -1157,22 +1073,6 @@
char *purple_str_seconds_to_string(guint sec);
/**
- * purple_str_binary_to_ascii:
- * @binary: A string of random data, possibly with embedded NULs
- * and such.
- * @len: The length in bytes of the input string. Must not be 0.
- *
- * Converts a binary string into a NUL terminated ascii string,
- * replacing nonascii characters and characters below SPACE (including
- * NUL) into \\xyy, where yy are two hex digits. Also backslashes are
- * changed into two backslashes (\\\\). The returned, newly allocated
- * string can be outputted to the console, and must be g_free()d.
- *
- * Returns: A newly allocated ASCIIZ string.
- */
-char *purple_str_binary_to_ascii(const unsigned char *binary, guint len);
-
-/**
* purple_utf16_size:
* @str: String to check.
*
@@ -1244,16 +1144,6 @@
gboolean purple_email_is_valid(const char *address);
/**
- * purple_ipv6_address_is_valid:
- * @ip: The IP address to validate.
- *
- * Checks if the given IP address is a syntactically valid IPv6 address.
- *
- * Returns: True if the IP address is syntactically correct.
- */
-gboolean purple_ipv6_address_is_valid(const char *ip);
-
-/**
* purple_uri_list_extract_uris:
* @uri_list: An uri-list in the standard format.
*
@@ -1421,16 +1311,6 @@
const char *purple_escape_filename(const char *str);
/**
- * purple_escape_js:
- * @str: The string to escape.
- *
- * Escapes javascript-unfriendly substrings from a string.
- *
- * Returns: The javascript-safe string (must be g_free'd after use).
- */
-gchar * purple_escape_js(const gchar *str);
-
-/**
* purple_restore_default_signal_handlers:
*
* Restore default signal handlers for signals which might reasonably have
@@ -1440,16 +1320,6 @@
void purple_restore_default_signal_handlers(void);
/**
- * purple_get_host_name:
- *
- * Gets the host name of the machine. If it not possible to determine the
- * host name, "localhost" is returned
- *
- * Returns: The hostname
- */
-const gchar *purple_get_host_name(void);
-
-/**
* purple_uuid_random:
*
* Returns a type 4 (random) UUID
--- a/pidgin/gtkblist.c Sun Nov 03 23:51:59 2019 -0500
+++ b/pidgin/gtkblist.c Mon Nov 04 11:01:03 2019 +0000
@@ -5687,8 +5687,9 @@
enteredstring = g_utf8_casefold(tmp, -1);
g_free(tmp);
- if (purple_str_has_prefix(compare, enteredstring))
+ if (g_str_has_prefix(compare, enteredstring)) {
res = FALSE;
+ }
g_free(enteredstring);
}
--- a/pidgin/gtkconv.c Sun Nov 03 23:51:59 2019 -0500
+++ b/pidgin/gtkconv.c Mon Nov 04 11:01:03 2019 +0000
@@ -479,7 +479,7 @@
cmd = talkatu_buffer_get_plain_text(TALKATU_BUFFER(buffer));
- if (cmd && purple_str_has_prefix(cmd, prefix)) {
+ if (cmd && g_str_has_prefix(cmd, prefix)) {
PurpleCmdStatus status;
char *error, *cmdline, *markup, *send_history;
--- a/pidgin/gtkdialogs.c Sun Nov 03 23:51:59 2019 -0500
+++ b/pidgin/gtkdialogs.c Mon Nov 04 11:01:03 2019 +0000
@@ -417,8 +417,9 @@
username = g_strdup(purple_normalize(account,
purple_request_fields_get_string(fields, "screenname")));
- if (username != NULL && purple_str_has_suffix(username, "rocksmyworld"))
+ if (username != NULL && g_str_has_suffix(username, "rocksmyworld")) {
found = pidgin_dialogs_ee(username);
+ }
if (!found && username != NULL && *username != '\0' && account != NULL)
pidgin_retrieve_user_info(purple_account_get_connection(account), username);
--- a/pidgin/gtkprefs.c Sun Nov 03 23:51:59 2019 -0500
+++ b/pidgin/gtkprefs.c Mon Nov 04 11:01:03 2019 +0000
@@ -1259,8 +1259,9 @@
gchar *destdir_escaped = g_shell_quote(destdir);
gchar *command;
- if (!g_file_test(destdir, G_FILE_TEST_IS_DIR))
- purple_build_dir(destdir, S_IRUSR | S_IWUSR | S_IXUSR);
+ if (!g_file_test(destdir, G_FILE_TEST_IS_DIR)) {
+ g_mkdir_with_parents(destdir, S_IRUSR | S_IWUSR | S_IXUSR);
+ }
command = g_strdup_printf("tar > /dev/null xzf %s -C %s", path_escaped, destdir_escaped);
g_free(path_escaped);
@@ -1298,8 +1299,9 @@
purple_theme_get_name(theme),
"purple", info->type, NULL);
- if (!g_file_test(theme_dest, G_FILE_TEST_IS_DIR))
- purple_build_dir(theme_dest, S_IRUSR | S_IWUSR | S_IXUSR);
+ if (!g_file_test(theme_dest, G_FILE_TEST_IS_DIR)) {
+ g_mkdir_with_parents(theme_dest, S_IRUSR | S_IWUSR | S_IXUSR);
+ }
g_free(theme_dest);
theme_dest = g_build_filename(purple_data_dir(), "themes",
@@ -1344,8 +1346,9 @@
g_free(source_name);
}
- if (!g_file_test(temp_path, G_FILE_TEST_IS_DIR))
- purple_build_dir(temp_path, S_IRUSR | S_IWUSR | S_IXUSR);
+ if (!g_file_test(temp_path, G_FILE_TEST_IS_DIR)) {
+ g_mkdir_with_parents(temp_path, S_IRUSR | S_IWUSR | S_IXUSR);
+ }
if (purple_theme_file_copy(path, temp_file)) {
/* find the theme, could be in subfolder */
@@ -1357,8 +1360,9 @@
purple_theme_get_name(theme), "purple",
info->type, NULL);
- if(!g_file_test(theme_dest, G_FILE_TEST_IS_DIR))
- purple_build_dir(theme_dest, S_IRUSR | S_IWUSR | S_IXUSR);
+ if(!g_file_test(theme_dest, G_FILE_TEST_IS_DIR)) {
+ g_mkdir_with_parents(theme_dest, S_IRUSR | S_IWUSR | S_IXUSR);
+ }
if (g_rename(purple_theme_get_dir(theme), theme_dest)) {
purple_debug_error("gtkprefs", "Error renaming %s to %s: "
--- a/pidgin/gtkrequest.c Sun Nov 03 23:51:59 2019 -0500
+++ b/pidgin/gtkrequest.c Mon Nov 04 11:01:03 2019 +0000
@@ -1073,8 +1073,7 @@
if ((type_hint = purple_request_field_get_field_type_hint(field)) != NULL)
{
- if (purple_str_has_prefix(type_hint, "screenname"))
- {
+ if (g_str_has_prefix(type_hint, "screenname")) {
GtkWidget *optmenu = NULL;
PurpleRequestFieldGroup *group = purple_request_field_get_group(field);
GList *fields = purple_request_field_group_get_fields(group);
--- a/pidgin/gtkutils.c Sun Nov 03 23:51:59 2019 -0500
+++ b/pidgin/gtkutils.c Mon Nov 04 11:01:03 2019 +0000
@@ -1374,7 +1374,7 @@
#ifndef _WIN32
/* Are we trying to send a .desktop file? */
- else if (purple_str_has_suffix(basename, ".desktop")) {
+ else if (g_str_has_suffix(basename, ".desktop")) {
pidgin_dnd_file_send_desktop(account, who, filename);
continue;
@@ -1579,8 +1579,7 @@
val1.g_type = 0;
gtk_tree_model_get_value(model, iter, COMPLETION_NORMALIZED_COLUMN, &val1);
tmp = g_value_get_string(&val1);
- if (tmp != NULL && purple_str_has_prefix(tmp, key))
- {
+ if (tmp != NULL && g_str_has_prefix(tmp, key)) {
g_value_unset(&val1);
return TRUE;
}
@@ -1589,8 +1588,7 @@
val2.g_type = 0;
gtk_tree_model_get_value(model, iter, COMPLETION_COMPARISON_COLUMN, &val2);
tmp = g_value_get_string(&val2);
- if (tmp != NULL && purple_str_has_prefix(tmp, key))
- {
+ if (tmp != NULL && g_str_has_prefix(tmp, key)) {
g_value_unset(&val2);
return TRUE;
}
@@ -2351,15 +2349,13 @@
normalized = g_utf8_casefold(tmp, -1);
g_free(tmp);
- if (purple_str_has_prefix(normalized, enteredstring))
- {
+ if (g_str_has_prefix(normalized, enteredstring)) {
g_free(withmarkup);
g_free(enteredstring);
g_free(normalized);
return FALSE;
}
-
/* Use Pango to separate by words. */
len = g_utf8_strlen(normalized, -1);
log_attrs = g_new(PangoLogAttr, len + 1);
@@ -2371,8 +2367,7 @@
for (i = 0; i < (len - 1) ; i++)
{
if (log_attrs[i].is_word_start &&
- purple_str_has_prefix(word, enteredstring))
- {
+ g_str_has_prefix(word, enteredstring)) {
result = FALSE;
break;
}
@@ -2390,7 +2385,7 @@
if (!g_unichar_isalnum(c))
{
word = g_utf8_find_next_char(word, NULL);
- if (purple_str_has_prefix(word, enteredstring))
+ if (g_str_has_prefix(word, enteredstring))
{
result = FALSE;
break;
--- a/pidgin/gtkxfer.c Sun Nov 03 23:51:59 2019 -0500
+++ b/pidgin/gtkxfer.c Mon Nov 04 11:01:03 2019 +0000
@@ -482,10 +482,11 @@
{
char *escaped = g_shell_quote(filename);
- if (purple_str_has_suffix(filename, ".desktop"))
+ if (g_str_has_suffix(filename, ".desktop")) {
command = g_strdup_printf("kfmclient openURL %s 'text/plain'", escaped);
- else
+ } else {
command = g_strdup_printf("kfmclient openURL %s", escaped);
+ }
g_free(escaped);
}
else
--- a/pidgin/pidgincontactcompletion.c Sun Nov 03 23:51:59 2019 -0500
+++ b/pidgin/pidgincontactcompletion.c Mon Nov 04 11:01:03 2019 +0000
@@ -113,7 +113,7 @@
return FALSE;
}
- if(!purple_str_has_prefix(name, key)) {
+ if (!g_str_has_prefix(name, key)) {
g_free(name);
return FALSE;
}