END_TEST START_TEST(test_util_unescape_filename) { assert_string_equal("bar", purple_unescape_filename("bar")); assert_string_equal("@ar", purple_unescape_filename("@ar")); assert_string_equal("!ar", purple_unescape_filename("!ar")); assert_string_equal("!ar", purple_unescape_filename("%21ar")); assert_string_equal("%ar", purple_unescape_filename("%25ar")); }
GList * purple_tls_certificate_list_ids() { gchar *dir_path; GDir *dir; const gchar *entry; GList *idlist = NULL; GError *error = NULL; /* Ensure certificate directory exists */ if (!ensure_certificate_dir(&error)) { purple_debug_error("tls-certificate", "Error creating certificate directory: %s", error->message); g_clear_error(&error); return NULL; } /* Open certificate directory */ dir_path = make_certificate_path(NULL); dir = g_dir_open(dir_path, 0, &error); if (dir == NULL) { purple_debug_error("tls-certificate", "Error opening certificate directory (%s): %s", dir_path, error->message); g_free(dir_path); g_clear_error(&error); return NULL; } g_free(dir_path); /* Traverse the directory listing and create an idlist */ while ((entry = g_dir_read_name(dir)) != NULL) { /* Unescape the filename * (GLib owns original string) */ const char *unescaped = purple_unescape_filename(entry); /* Copy the entry name into our list * (Purple own the escaped string) */ idlist = g_list_prepend(idlist, g_strdup(unescaped)); } g_dir_close(dir); return idlist; }