comparison src/dialogs.c @ 1977:7b3f1eb1ef7d

[gaim-migrate @ 1987] updated icqlib. fixed import dialog (watch debug window for errors). adam's (not mid's) patch for oscar. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 09 Jun 2001 14:46:51 +0000
parents 97b1667e1255
children e43c267b1a8a
comparison
equal deleted inserted replaced
1976:24aed1c31342 1977:7b3f1eb1ef7d
2887 int len; 2887 int len;
2888 FILE *f; 2888 FILE *f;
2889 gboolean from_dialog = FALSE; 2889 gboolean from_dialog = FALSE;
2890 2890
2891 if ( !gc ) { 2891 if ( !gc ) {
2892 debug_printf("want to import file ");
2892 file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(importdialog)); 2893 file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(importdialog));
2893 strncpy( path, file, PATHSIZE - 1 ); 2894 debug_printf("%s", file);
2894 if (file_is_dir(path, importdialog)) { 2895 if (file_is_dir(file, importdialog)) {
2896 debug_printf(" but it is a directory\n");
2895 g_free (buf); 2897 g_free (buf);
2896 g_free (first); 2898 g_free (first);
2897 return; 2899 return;
2898 } 2900 }
2901 strncpy( path, file, PATHSIZE - 1 );
2899 /* FIXME : import buddy list file. moderately important */ 2902 /* FIXME : import buddy list file. moderately important */
2900 gc = connections->data; 2903 gc = connections->data;
2901 from_dialog = TRUE; 2904 from_dialog = TRUE;
2902 } else { 2905 } else {
2903 g_screenname = get_screenname_filename(gc->username); 2906 g_screenname = get_screenname_filename(gc->username);
2908 (gc->protocol == PROTO_OSCAR) ? PROTO_TOC : gc->protocol); 2911 (gc->protocol == PROTO_OSCAR) ? PROTO_TOC : gc->protocol);
2909 g_free(file); 2912 g_free(file);
2910 g_free(g_screenname); 2913 g_free(g_screenname);
2911 } else { 2914 } else {
2912 g_free(g_screenname); 2915 g_free(g_screenname);
2916 g_free(buf);
2917 g_free(first);
2913 return; 2918 return;
2914 } 2919 }
2915 } 2920 }
2916 2921
2917 if (!(f = fopen(path,"r"))) { 2922 if (!(f = fopen(path,"r"))) {
2918 if ( !gc ) { 2923 if (from_dialog) {
2924 debug_printf(" but it can't be opened\n");
2919 g_snprintf(buf, BUF_LONG / 2, _("Error reading file %s"), path); 2925 g_snprintf(buf, BUF_LONG / 2, _("Error reading file %s"), path);
2920 do_error_dialog(buf, _("Error")); 2926 do_error_dialog(buf, _("Error"));
2921 destroy_dialog(NULL, importdialog); 2927 destroy_dialog(NULL, importdialog);
2922 importdialog = NULL; 2928 importdialog = NULL;
2923 } 2929 }
2958 buf = g_malloc(8193); 2964 buf = g_malloc(8193);
2959 g_snprintf(buf, 8192, "toc_set_config {%s}\n", buf2); 2965 g_snprintf(buf, 8192, "toc_set_config {%s}\n", buf2);
2960 g_free(buf2); 2966 g_free(buf2);
2961 /* Something else */ 2967 /* Something else */
2962 } else { 2968 } else {
2963 if ( !gc ) { 2969 if (from_dialog) {
2970 debug_printf(" but I don't recognize the format\n");
2964 destroy_dialog(NULL, importdialog); 2971 destroy_dialog(NULL, importdialog);
2965 importdialog = NULL; 2972 importdialog = NULL;
2966 } 2973 }
2967 g_free(buf); 2974 g_free(buf);
2968 g_free(first); 2975 g_free(first);
2969 fclose( f ); 2976 fclose( f );
2970 return; 2977 return;
2971 } 2978 }
2979
2980 if (from_dialog)
2981 debug_printf("\n");
2972 2982
2973 parse_toc_buddy_list(gc, buf, 1); 2983 parse_toc_buddy_list(gc, buf, 1);
2974 2984
2975 fclose( f ); 2985 fclose( f );
2976 2986