# HG changeset patch # User Richard Laager # Date 1142275907 0 # Node ID 2f0d4179ec0525b1896013fa4282a1cb455fac7d # Parent d2aadcdbec6cb3db5409a0a69a8046f884245dc0 [gaim-migrate @ 15873] Use gaim_str_has_prefix() and gaim_str_has_suffix() for compatibility with old versions of glib. committer: Tailor Script diff -r d2aadcdbec6c -r 2f0d4179ec05 plugins/log_reader.c --- a/plugins/log_reader.c Mon Mar 13 18:48:49 2006 +0000 +++ b/plugins/log_reader.c Mon Mar 13 18:51:47 2006 +0000 @@ -96,9 +96,9 @@ const gchar *file; while ((file = g_dir_read_name(dir))) { - if (!g_str_has_prefix(file, sn)) + if (!gaim_str_has_prefix(file, sn)) continue; - if (g_str_has_suffix(file, ".html") || g_str_has_suffix(file, ".AdiumHTMLLog")) { + if (gaim_str_has_suffix(file, ".html") || gaim_str_has_suffix(file, ".AdiumHTMLLog")) { struct tm tm; const char *date = file; @@ -163,7 +163,7 @@ list = g_list_append(list, log); } - } else if (g_str_has_suffix(file, ".adiumLog")) { + } else if (gaim_str_has_suffix(file, ".adiumLog")) { struct tm tm; const char *date = file; @@ -268,7 +268,7 @@ /* This problem only seems to show up on Windows. * The BOM is displaying as a space at the beginning of the log. */ - if (g_str_has_prefix(read, "\xef\xbb\xbf")) + if (gaim_str_has_prefix(read, "\xef\xbb\xbf")) { /* FIXME: This feels so wrong... */ char *temp = g_strdup(&(read[3])); @@ -587,7 +587,7 @@ while ((name = g_dir_read_name(dir))) { const char *c = name; - if (!g_str_has_prefix(c, username)) + if (!gaim_str_has_prefix(c, username)) continue; c += strlen(username); @@ -641,7 +641,7 @@ while ((name = g_dir_read_name(dir))) { const char *c = name; - if (!g_str_has_prefix(c, username)) + if (!gaim_str_has_prefix(c, username)) continue; c += strlen(username); @@ -857,9 +857,9 @@ * ^(friendly_name|alias)([^a-zA-Z0-9].*)?$ */ from_name_matches = from_name != NULL && ( - (g_str_has_prefix(from_name, friendly_name) && + (gaim_str_has_prefix(from_name, friendly_name) && !isalnum(*(from_name + friendly_name_length))) || - (g_str_has_prefix(from_name, log->account->alias) && + (gaim_str_has_prefix(from_name, log->account->alias) && !isalnum(*(from_name + alias_length)))); to_name_matches = to_name != NULL && ( @@ -895,12 +895,12 @@ * matches their alias. For this test, "match" is * defined as: ^alias([^a-zA-Z0-9].*)?$ */ - from_name_matches = (g_str_has_prefix( + from_name_matches = (gaim_str_has_prefix( from_name, alias) && !isalnum(*(from_name + alias_length))); - to_name_matches = (g_str_has_prefix( + to_name_matches = (gaim_str_has_prefix( to_name, alias) && !isalnum(*(to_name + alias_length))); @@ -923,13 +923,13 @@ * this test, "match" is defined as: * ^friendly_name([^a-zA-Z0-9].*)?$ */ - from_name_matches = (g_str_has_prefix( + from_name_matches = (gaim_str_has_prefix( from_name, buddy->server_alias) && !isalnum(*(from_name + friendly_name_length))); - to_name_matches = (g_str_has_prefix( + to_name_matches = (gaim_str_has_prefix( to_name, buddy->server_alias) && !isalnum(*(to_name + friendly_name_length))); @@ -1130,7 +1130,7 @@ } *c = '\0'; - if (g_str_has_prefix(line, "Session Close ")) { + if (gaim_str_has_prefix(line, "Session Close ")) { if (data && !data->length) data->length = last_line_offset - data->offset; if (!data->length) { @@ -1144,7 +1144,7 @@ list = g_list_delete_link(list, last); } } else if (line[0] && line[1] && line [3] && - g_str_has_prefix(&line[3], "sion Start ")) { + gaim_str_has_prefix(&line[3], "sion Start ")) { char *their_nickname = line; char *timestamp; @@ -1397,17 +1397,17 @@ line += 2; } - if (g_str_has_prefix(line, "*** ")) { + if (gaim_str_has_prefix(line, "*** ")) { line += (sizeof("*** ") - 1); g_string_append(formatted, ""); footer = ""; - if (g_str_has_prefix(line, "NOTE: This user is offline.")) { + if (gaim_str_has_prefix(line, "NOTE: This user is offline.")) { line = _("User is offline."); - } else if (g_str_has_prefix(line, + } else if (gaim_str_has_prefix(line, "NOTE: Your status is currently set to ")) { line += (sizeof("NOTE: ") - 1); - } else if (g_str_has_prefix(line, "Auto-response sent to ")) { + } else if (gaim_str_has_prefix(line, "Auto-response sent to ")) { g_string_append(formatted, _("Auto-response sent:")); while (*line && *line != ':') line++; @@ -1429,7 +1429,7 @@ else g_string_append(formatted, log->name); line = " logged in."; - } else if (g_str_has_prefix(line, + } else if (gaim_str_has_prefix(line, "One or more messages may have been undeliverable.")) { g_string_append(formatted, @@ -1439,7 +1439,7 @@ "undeliverable.")); line = ""; footer = ""; - } else if (g_str_has_prefix(line, + } else if (gaim_str_has_prefix(line, "You have been disconnected.")) { g_string_append(formatted, @@ -1448,7 +1448,7 @@ _("You were disconnected from the server.")); line = ""; footer = ""; - } else if (g_str_has_prefix(line, + } else if (gaim_str_has_prefix(line, "You are currently disconnected.")) { g_string_append(formatted, @@ -1457,13 +1457,13 @@ "will not be received unless you are " "logged in."); footer = ""; - } else if (g_str_has_prefix(line, + } else if (gaim_str_has_prefix(line, "Your previous message has not been sent.")) { g_string_append(formatted, ""); - if (g_str_has_prefix(line, + if (gaim_str_has_prefix(line, "Your previous message has not been sent. " "Reason: Maximum length exceeded.")) { @@ -1481,7 +1481,7 @@ footer = ""; } - } else if (g_str_has_prefix(line, data->their_nickname)) { + } else if (gaim_str_has_prefix(line, data->their_nickname)) { if (buddy != NULL && buddy->alias) { line += strlen(data->their_nickname) + 2; g_string_append_printf(formatted, @@ -1709,7 +1709,7 @@ *temp = '\0'; /* Set path. */ - if (g_str_has_suffix(value, "trillian.exe")) + if (gaim_str_has_suffix(value, "trillian.exe")) { value[strlen(value) - (sizeof("trillian.exe") - 1)] = '\0'; path = g_build_filename(value, "users", "default", "talk.ini", NULL); @@ -1778,7 +1778,7 @@ *contents = '\0'; /* XXX: This assumes the first Directory key is under [Logging]. */ - if (g_str_has_prefix(line, "Directory=")) { + if (gaim_str_has_prefix(line, "Directory=")) { line += (sizeof("Directory=") - 1); g_strchomp(line); gaim_prefs_add_string(