pidgin/pidgin

Merged in default (pull request #624)

16 months ago, 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 "