Mercurial > pidgin
changeset 21331:6e23ec8b1634
merge of '0f99eebc17d3efab8dac3d72feb857ab25b06cb7'
and 'a179eb8d8fc4c8bc156bdf775c617e04119282da'
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sun, 11 Nov 2007 18:11:46 +0000 |
parents | 48c6c89a8158 (diff) a97f24eda509 (current diff) |
children | f96753f63587 |
files | share/Makefile.am share/Makefile.mingw |
diffstat | 1 files changed, 12 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/gg/gg.c Sun Nov 11 18:09:33 2007 +0000 +++ b/libpurple/protocols/gg/gg.c Sun Nov 11 18:11:46 2007 +0000 @@ -254,16 +254,14 @@ /* */ /* static void ggp_callback_buddylist_save_ok(PurpleConnection *gc, const char *file) {{{ */ -static void ggp_callback_buddylist_save_ok(PurpleConnection *gc, const char *file) +static void ggp_callback_buddylist_save_ok(PurpleConnection *gc, const char *filename) { PurpleAccount *account = purple_connection_get_account(gc); - FILE *fh; char *buddylist = ggp_buddylist_dump(account); - gchar *msg; purple_debug_info("gg", "Saving...\n"); - purple_debug_info("gg", "file = %s\n", file); + purple_debug_info("gg", "file = %s\n", filename); if (buddylist == NULL) { purple_notify_info(account, _("Save Buddylist..."), @@ -272,30 +270,18 @@ return; } - if ((fh = g_fopen(file, "wb")) == NULL) { - msg = g_strconcat(_("Couldn't open file"), ": ", file, "\n", NULL); - purple_debug_error("gg", "Could not open file: %s\n", file); - purple_notify_error(account, _("Couldn't open file"), msg, NULL); - g_free(msg); - g_free(buddylist); - return; + if(purple_util_write_data_to_file_absolute(filename, buddylist, -1)) { + purple_notify_info(account, _("Save Buddylist..."), + _("Buddylist saved successfully!"), NULL); + } else { + gchar *primary = g_strdup_printf( + _("Couldn't write buddy list for %s to %s"), + purple_account_get_username(account), filename); + purple_notify_error(account, _("Save Buddylist..."), + primary, NULL); + g_free(primary); } - if (!fwrite(buddylist, strlen(buddylist), 1, fh)) { - const gchar *err = g_strerror(errno); - gchar *title = g_strdup_printf( - _("Couldn't write buddylist to %s"), err); - - purple_debug_error("gg", "Error writing %s: %s\n", file, err); - purple_notify_error(account, title, title, err); - - g_free(title); - } else { - purple_notify_info(account, _("Save Buddylist..."), - _("Buddylist saved successfully!"), NULL); - } - - fclose(fh); g_free(buddylist); } /* }}} */