cpw.nader.asynclogging-3: 57e9190a: Fixed issue related to not normalizing a...
morshed.nader at gmail.com
morshed.nader at gmail.com
Wed May 18 19:45:42 EDT 2011
----------------------------------------------------------------------
Revision: 57e9190a8cc3622e05d9053c72f4f3e343be5d3f
Parent: 3e6316f6fba71092ddc0bf37aa2ae997c924c5dc
Author: morshed.nader at gmail.com
Date: 05/17/11 07:07:09
Branch: im.pidgin.cpw.nader.asynclogging-3
URL: http://d.pidgin.im/viewmtn/revision/info/57e9190a8cc3622e05d9053c72f4f3e343be5d3f
Changelog:
Fixed issue related to not normalizing account names in purple_log_sets_common
Changes against parent 3e6316f6fba71092ddc0bf37aa2ae997c924c5dc
patched libpurple/log.c
-------------- next part --------------
============================================================
--- libpurple/log.c 6441be0b8e4d3b7df080574e6f9cca25ecbfd91f
+++ libpurple/log.c 12831f2011e6d03345c8ab1e10be95c254940a1b
@@ -2686,14 +2686,15 @@ log_get_log_sets_common(GCancellable *ca
protocol_unescaped = g_strdup(purple_unescape_filename(protocol));
/* Find all the accounts for protocol. */
- for (account_iter = purple_accounts_get_all(); account_iter != NULL;
+ for (account_iter = purple_accounts_get_all();
+ account_iter != NULL;
account_iter = g_list_next(account_iter))
{
PurplePlugin *prpl;
PurplePluginProtocolInfo *prpl_info;
const gchar *prpl_protocol;
- prpl = purple_find_prpl(purple_account_get_protocol_id((PurpleAccount *) account_iter->data));
+ prpl = purple_find_prpl(purple_account_get_protocol_id(account_iter->data));
if (prpl == NULL)
continue;
@@ -2710,11 +2711,13 @@ log_get_log_sets_common(GCancellable *ca
while ((username = g_dir_read_name(protocol_dir)) != NULL) {
PurpleAccount *account = NULL;
const gchar *username_unescaped;
- gchar *username_path = g_build_filename(protocol_path, username,
- NULL);
- gchar *name;
+ gchar *username_path, *name;
- if ((username_dir = g_dir_open(username_path, 0, NULL)) == NULL) {
+ username_path = g_build_filename(protocol_path, username, NULL);
+ /* XXX: Handle error here */
+ username_dir = g_dir_open(username_path, 0, NULL);
+
+ if (username_dir == NULL) {
g_free(username_path);
continue;
}
@@ -2727,14 +2730,21 @@ log_get_log_sets_common(GCancellable *ca
account_iter = g_list_next(account_iter))
{
/* XXX: PURPLE_ACCOUNT(...)->username */
- if (purple_strequal(((PurpleAccount *) account_iter->data)->username,
- username_unescaped))
+ if (purple_strequal(username_unescaped,
+ purple_normalize(account_iter->data, ((PurpleAccount *) account_iter->data)->username)))
{
account = account_iter->data;
break;
}
}
+ if (account == NULL) {
+ /* XXX: Warning? This means they have logs left around from a deleted account */
+ g_free(username_path);
+ g_dir_close(username_dir);
+ continue;
+ }
+
/* Don't worry about the cast, name will point to dynamically allocated memory shortly. */
while ((name = (gchar *) g_dir_read_name(username_dir)) != NULL) {
/* IMPORTANT: Always initialize all members of PurpleLogSet */
@@ -2751,7 +2761,6 @@ log_get_log_sets_common(GCancellable *ca
set->type = PURPLE_LOG_IM;
set->name = name;
set->account = account; /* XXX: g_object_ref */
- purple_debug_info("log", "account: %p\n", account);
/* set->buddy is always set below */
set->normalized_name = g_strdup(purple_normalize(account, name));
More information about the Commits
mailing list