Mercurial > pidgin
changeset 22868:10fb6ced9bc8
merge of '245104c3da64bf99627578bd68d6cda42ee16b43'
and '68e91ac241a8cba7102b6f868b76189a265c6d5b'
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Thu, 08 May 2008 03:22:03 +0000 |
parents | 502bac8b2b4c (diff) f28047b68678 (current diff) |
children | 1334c0de8f32 |
files | |
diffstat | 5 files changed, 68 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/oscar/oscar.c Thu May 08 03:20:28 2008 +0000 +++ b/libpurple/protocols/oscar/oscar.c Thu May 08 03:22:03 2008 +0000 @@ -4546,7 +4546,7 @@ { /* Do nothing! */ } - else if (primitive == PURPLE_STATUS_AVAILABLE) + else if (primitive == PURPLE_STATUS_AVAILABLE || primitive == PURPLE_STATUS_INVISIBLE) { const char *status_html, *itmsurl; char *status_text = NULL;
--- a/libpurple/util.c Thu May 08 03:20:28 2008 +0000 +++ b/libpurple/util.c Thu May 08 03:22:03 2008 +0000 @@ -1525,6 +1525,8 @@ while(*p && *p != '>') { if(!g_ascii_strncasecmp(p, "src=", strlen("src="))) { const char *q = p + strlen("src="); + if (src) + g_string_free(src, TRUE); src = g_string_new(""); if(*q == '\'' || *q == '\"') q++; @@ -1535,6 +1537,8 @@ p = q; } else if(!g_ascii_strncasecmp(p, "alt=", strlen("alt="))) { const char *q = p + strlen("alt="); + if (alt) + g_string_free(alt, TRUE); alt = g_string_new(""); if(*q == '\'' || *q == '\"') q++; @@ -1572,6 +1576,8 @@ if (url) g_string_free(url, TRUE); url = g_string_new(""); + if (cdata) + g_string_free(cdata, TRUE); cdata = g_string_new(""); if(*q == '\'' || *q == '\"') q++; @@ -4209,8 +4215,7 @@ /* not sure if this fallback is useful at all */ if (!node->data) node->data = g_strdup (s+5); } else { - result = g_list_remove_link(result, node); - g_list_free_1 (node); + result = g_list_delete_link(result, node); } g_free (s); }
--- a/pidgin/gtknotify.c Thu May 08 03:20:28 2008 +0000 +++ b/pidgin/gtknotify.c Thu May 08 03:22:03 2008 +0000 @@ -425,7 +425,7 @@ * count > 0 mean non-detailed. */ static void * -pidgin_notify_add_mail(GtkTreeStore *treemodel, PurpleAccount *account, char *notification, const char *url, int count, gboolean clear) +pidgin_notify_add_mail(GtkTreeStore *treemodel, PurpleAccount *account, char *notification, const char *url, int count, gboolean clear, gboolean *new_data) { PidginNotifyMailData *data = NULL; GtkTreeIter iter; @@ -492,6 +492,9 @@ PIDGIN_MAIL_DATA, &data, -1); if (icon) g_object_unref(icon); + + if (new_data) + *new_data = new_n; return data; } @@ -503,7 +506,8 @@ GtkWidget *dialog = NULL; char *notification; PurpleAccount *account; - PidginNotifyMailData *data = NULL; + PidginNotifyMailData *data = NULL, *data2; + gboolean new_data; /* Don't bother updating if there aren't new emails and we don't have any displayed currently */ if (count == 0 && mail_dialog == NULL) @@ -550,9 +554,12 @@ g_free(subject_text); /* If we don't keep track of this, will leak "data" for each of the notifications except the last */ - if (data) - data->purple_has_handle = FALSE; - data = pidgin_notify_add_mail(mail_dialog->treemodel, account, notification, urls ? *urls : NULL, 0, FALSE); + data2 = pidgin_notify_add_mail(mail_dialog->treemodel, account, notification, urls ? *urls : NULL, 0, FALSE, &new_data); + if (new_data) { + if (data) + data->purple_has_handle = FALSE; + data = data2; + } g_free(notification); if (urls != NULL) @@ -564,13 +571,18 @@ "%s has %d new messages.", (int)count), *tos, (int)count); - data = pidgin_notify_add_mail(mail_dialog->treemodel, account, notification, urls ? *urls : NULL, count, FALSE); + data2 = pidgin_notify_add_mail(mail_dialog->treemodel, account, notification, urls ? *urls : NULL, count, FALSE, &new_data); + if (new_data) { + if (data) + data->purple_has_handle = FALSE; + data = data2; + } g_free(notification); } else { GtkTreeIter iter; /* Clear out all mails for the account */ - pidgin_notify_add_mail(mail_dialog->treemodel, account, NULL, NULL, 0, TRUE); + pidgin_notify_add_mail(mail_dialog->treemodel, account, NULL, NULL, 0, TRUE, NULL); if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(mail_dialog->treemodel), &iter)) { /* There is no API to clear the headline specifically */
--- a/pidgin/gtksound.c Thu May 08 03:20:28 2008 +0000 +++ b/pidgin/gtksound.c Thu May 08 03:22:03 2008 +0000 @@ -384,6 +384,26 @@ } #endif +#ifndef _WIN32 +static gboolean +expire_old_child(gpointer data) +{ + pid_t pid = GPOINTER_TO_INT(data); + + if (waitpid(pid, NULL, WNOHANG | WUNTRACED) < 0) { + if (errno == ECHILD) + return FALSE; + else + purple_debug_warning("gtksound", "Child is ill, pid: %d (%s)\n", pid, strerror(errno)); + } + + if (kill(pid, SIGKILL) < 0) + purple_debug_error("gtksound", "Killing process %d failed (%s)\n", pid, strerror(errno)); + + return FALSE; +} +#endif + static void pidgin_sound_play_file(const char *filename) { @@ -418,7 +438,9 @@ const char *sound_cmd; char *command; char *esc_filename; + char **argv = NULL; GError *error = NULL; + GPid pid; sound_cmd = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/sound/command"); @@ -436,11 +458,25 @@ else command = g_strdup_printf("%s %s", sound_cmd, esc_filename); - if(!g_spawn_command_line_async(command, &error)) { - purple_debug_error("gtksound", "sound command could not be launched: %s\n", error->message); + if (!g_shell_parse_argv(command, NULL, &argv, &error)) { + purple_debug_error("gtksound", "error parsing command %s (%s)\n", + command, error->message); g_error_free(error); + g_free(esc_filename); + g_free(command); + return; } + if (!g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, + NULL, NULL, &pid, &error)) { + purple_debug_error("gtksound", "sound command could not be launched: %s\n", + error->message); + g_error_free(error); + } else { + purple_timeout_add_seconds(15, expire_old_child, GINT_TO_POINTER(pid)); + } + + g_strfreev(argv); g_free(esc_filename); g_free(command); return;
--- a/pidgin/gtkutils.c Thu May 08 03:20:28 2008 +0000 +++ b/pidgin/gtkutils.c Thu May 08 03:22:03 2008 +0000 @@ -116,12 +116,14 @@ if ((path = g_find_program_in_path("gconftool-2"))) { char *font = NULL; + char *err = NULL; g_free(path); if (g_spawn_command_line_sync( "gconftool-2 -g /desktop/gnome/interface/document_font_name", - &font, NULL, NULL, NULL)) { + &font, &err, NULL, NULL)) { desc = pango_font_description_from_string(font); } + g_free(err); g_free(font); } }