changeset 1805:caa605e70917

[gaim-migrate @ 1815] i have that sting song, the one they play in the mercedes commercial, stuck in my head. what the hell are the words to that song. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 05 May 2001 10:36:08 +0000
parents c7b288ea3892
children c649b63382b7
files plugins/jabber/jabber.c src/buddy.c src/dialogs.c src/gaim.h src/multi.h src/prefs.c src/sound.c src/util.c
diffstat 8 files changed, 84 insertions(+), 93 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/jabber/jabber.c	Sat May 05 00:15:58 2001 +0000
+++ b/plugins/jabber/jabber.c	Sat May 05 10:36:08 2001 +0000
@@ -728,7 +728,7 @@
 			jd->pending_chats = g_slist_remove(jd->pending_chats, jc);
 		} else if (!(b = find_buddy(GJ_GC(j), buddy))) {
 			b = add_buddy(GJ_GC(j), "Buddies", buddy, buddy);
-			do_export(NULL, NULL);
+			do_export(GJ_GC(j));
 		}
 	}
 
@@ -854,10 +854,9 @@
 					if (strcasecmp(sub, "from") && strcasecmp(sub, "none") &&
 							!(b = find_buddy(GJ_GC(j), buddyname))) {
 						debug_printf("adding buddy: %s\n", buddyname);
-						b =
-						    add_buddy(GJ_GC(j), groupname, buddyname,
+						b = add_buddy(GJ_GC(j), groupname, buddyname,
 							      name ? name : buddyname);
-						do_export(0, 0);
+						do_export(GJ_GC(j));
 					} else if (b) {
 						debug_printf("updating buddy: %s/%s\n", buddyname, name);
 						g_snprintf(b->name, sizeof(b->name), "%s", buddyname);
@@ -881,7 +880,7 @@
 			if (strcasecmp(sub, "from") && strcasecmp(sub, "none") &&
 					!(b = find_buddy(GJ_GC(j), buddyname))) {
 				b = add_buddy(GJ_GC(j), "Buddies", buddyname, name ? name : Jid);
-				do_export(0, 0);
+				do_export(GJ_GC(j));
 			}
 			g_free(buddyname);
 		}
--- a/src/buddy.c	Sat May 05 00:15:58 2001 +0000
+++ b/src/buddy.c	Sat May 05 10:36:08 2001 +0000
@@ -726,7 +726,7 @@
 	gtk_ctree_node_set_text(GTK_CTREE(edittree), node, 0, b->name);
 	if (gs) bs = find_buddy_show(gs, b->name);
 	if (bs) gtk_label_set(GTK_LABEL(bs->label), b->name);
-	do_export(0, 0);
+	do_export(b->gc);
 }
 
 static gboolean click_edit_tree(GtkWidget *widget, GdkEventButton *event, gpointer data)
@@ -871,7 +871,7 @@
 
 	// flush buddy list to cache
 
-	do_export( (GtkWidget *) NULL, 0 );
+	do_export(gc);
 }
 
 void remove_group(struct gaim_connection *gc, struct group *rem_g)
@@ -908,7 +908,7 @@
 
         // flush buddy list to cache
 
-        do_export( (GtkWidget *) NULL, 0 );
+        do_export(gc);
 }
 
 
@@ -1090,8 +1090,11 @@
 		} else
 			new_g->members = g_slist_append(new_g->members, buddy);
 
-		if (buddy->gc != new_g->gc)
+		do_export(buddy->gc);
+		if (buddy->gc != new_g->gc) {
+			do_export(new_g->gc);
 			build_edit_tree();
+		}
 	} else /* group */ {
 		/* move the group. if moving connections, copy the group, and each buddy in the
 		 * group. if the buddy exists in the new connection, leave it where it is. */
@@ -1132,6 +1135,7 @@
 					mem = mem->next;
 				}
 			}
+			do_export(pc);
 		} else {
 			g = group;
 			gc = g->gc;
@@ -1147,11 +1151,10 @@
 					gc->groups = g_slist_prepend(gc->groups, g);
 			} else
 				gc->groups = g_slist_append(gc->groups, g);
+			do_export(gc);
 		}
 	}
 
-	do_export( (GtkWidget *) NULL, 0 );
-
 	redo_buddy_list();
 	update_num_groups();
 }
@@ -1345,11 +1348,11 @@
 			g = find_group_by_buddy(b->gc, b->name);
 			remove_buddy(b->gc, g, b);
 			gtk_ctree_remove_node(GTK_CTREE(edittree), node);
-			do_export( (GtkWidget *) NULL, 0 );
+			do_export(b->gc);
 		} else if (*type == EDIT_GROUP) {
 			remove_group(((struct group *)type)->gc, (struct group *)type);
 			gtk_ctree_remove_node(GTK_CTREE(edittree), node);
-			do_export( (GtkWidget *) NULL, 0 );
+			do_export(((struct group *)type)->gc);
                 }
 
         } else {
@@ -1363,13 +1366,6 @@
         show_import_dialog();
 }
 
-void export_callback(GtkWidget *widget, void *null)
-{
-        show_export_dialog();
-}
-
-
-
 void do_quit()
 {
 #ifdef GAIM_PLUGINS
@@ -2571,8 +2567,8 @@
 
         gaim_new_item_with_pixmap(menu, _("Import Buddy List"), import_small_xpm,
 			GTK_SIGNAL_FUNC(import_callback), 0, 0, 0);
-        gaim_new_item_with_pixmap(menu, _("Export Buddy List"), export_small_xpm,
-			GTK_SIGNAL_FUNC(export_callback), 0, 0, 0);
+        /*gaim_new_item_with_pixmap(menu, _("Export Buddy List"), export_small_xpm,
+			GTK_SIGNAL_FUNC(show_export_dialog), 0, 0, 0);*/
 	gaim_separator(menu);
 	gaim_new_item_with_pixmap(menu, _("Signoff"), logout_icon_xpm,
 			GTK_SIGNAL_FUNC(signoff_all), 'd', GDK_CONTROL_MASK, "Ctl+D");
@@ -2940,7 +2936,7 @@
 	if (how_many == 0 && !from_do_import) {
 		do_import((GtkWidget *)NULL, gc);
 	} else if (gc && (bud_list_cache_exists(gc) == FALSE)) {
-		do_export((GtkWidget *)NULL, 0);
+		do_export(gc);
 	}
 }
 
--- a/src/dialogs.c	Sat May 05 00:15:58 2001 +0000
+++ b/src/dialogs.c	Sat May 05 10:36:08 2001 +0000
@@ -796,13 +796,14 @@
 	} else if (connections) {
 		add_buddy(connections->data, grp, who, whoalias);
 		serv_add_buddy(connections->data, who);
+		a->gc = connections->data;
 	}
 
         if (c != NULL) {
 		update_buttons_by_protocol(c);
 	}
         
-	do_export( (GtkWidget *) NULL, 0 );
+	do_export(a->gc);
 
         destroy_dialog(NULL, a->window);
 }
@@ -814,9 +815,12 @@
 	grp = gtk_entry_get_text(GTK_ENTRY(a->entry));
 
 	if (a->gc) add_group(a->gc, grp);
-	else if (connections) add_group(connections->data, grp);
-
-	do_export( (GtkWidget *) NULL, 0 );
+	else if (connections) {
+		add_group(connections->data, grp);
+		a->gc = connections->data;
+	}
+
+	do_export(a->gc);
 
 	destroy_dialog(NULL, a->window);
 }
@@ -1820,7 +1824,7 @@
 			p->gc->deny = g_slist_append(p->gc->deny, name);
 			build_block_list();
 			serv_add_deny(p->gc, name);
-			do_export(0, 0);
+			do_export(p->gc);
 		} else
 			g_free(name);
         } else {
@@ -1837,7 +1841,7 @@
 			p->gc->permit = g_slist_append(p->gc->permit, name);
 			build_allow_list();
 			serv_add_permit(p->gc, name);
-			do_export(0, 0);
+			do_export(p->gc);
 		} else
 			g_free(name);
         }
@@ -2788,19 +2792,20 @@
 /* if dummy is 0, save to ~/.gaim/screenname.blist, where screenname is each
  * signed in user. Else, let user choose */
 
-void do_export(GtkWidget *w, void *dummy)
+void do_export(struct gaim_connection *g)
 {
+	FILE *dir;
         FILE *f;
-	gint show_dialog = (int) dummy;
-        char *buf = g_malloc(BUF_LONG * 2);
+        char buf[32 * 1024];
         char *file;
 	char path[PATHSIZE];
-
+	char *g_screenname;
+
+	/*
 	if ( show_dialog == 1 ) {
 		file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(exportdialog));
 		strncpy( path, file, PATHSIZE - 1 );
 		if (file_is_dir(path, exportdialog)) {
-			g_free (buf);
 			return;
 		}
 		if ((f = fopen(path,"w"))) {
@@ -2815,50 +2820,38 @@
         	destroy_dialog(NULL, exportdialog);
         	exportdialog = NULL;
 	} else {
-		GSList *c = connections;
-		struct gaim_connection *g;
-		char *g_screenname;
-
-		file = gaim_user_dir();
-		if ( file != (char *) NULL ) {
-			FILE *dir;
-			strcpy(buf, file);
-			dir = fopen(buf, "r");
-			if (!dir)
-				mkdir(buf, S_IRUSR | S_IWUSR | S_IXUSR);
-			else
-				fclose(dir);
-
-			while (c) {
-				g = (struct gaim_connection *)c->data;
-
-				g_screenname = get_screenname_filename(g->username);
-
-				sprintf(path, "%s/%s.%d.blist", file, g_screenname,
-						(g->protocol == PROTO_OSCAR) ? PROTO_TOC : g->protocol);
-				if ((f = fopen(path,"w"))) {
-					debug_printf("writing %s\n", path);
-					toc_build_config(g, buf, 8192 - 1, TRUE);
-					fprintf(f, "%s\n", buf);
-					fclose(f);
-					chmod(buf, S_IRUSR | S_IWUSR);
-				} else {
-					debug_printf("unable to write %s\n", path);
-				}
-
-				g_free(g_screenname);
-
-				c = c->next;
-			}
-			g_free(file);
-		} else return;
+	*/
+
+	file = gaim_user_dir();
+	if (!file) return;
+
+	strcpy(buf, file);
+	dir = fopen(buf, "r");
+	if (!dir)
+		mkdir(buf, S_IRUSR | S_IWUSR | S_IXUSR);
+	else
+		fclose(dir);
+
+	g_screenname = get_screenname_filename(g->username);
+
+	sprintf(path, "%s/%s.%d.blist", file, g_screenname,
+			(g->protocol == PROTO_OSCAR) ? PROTO_TOC : g->protocol);
+	if ((f = fopen(path,"w"))) {
+		debug_printf("writing %s\n", path);
+		toc_build_config(g, buf, 8192 - 1, TRUE);
+		fprintf(f, "%s\n", buf);
+		fclose(f);
+		chmod(buf, S_IRUSR | S_IWUSR);
+	} else {
+		debug_printf("unable to write %s\n", path);
 	}
 
-	g_free(buf);
-        
+	g_free(g_screenname);
+	g_free(file);
 }
 
-	
+
+/*
 void show_export_dialog()
 {
         char *buf = g_malloc(BUF_LEN);
@@ -2887,6 +2880,7 @@
         gdk_window_raise(exportdialog->window);
 
 }
+*/
 
 /* if gc is non-NULL, then import from ~/.gaim/gc->username.blist, else let user
    choose */
@@ -2992,7 +2986,7 @@
 	if ( from_dialog ) {
 		/* save what we just did to cache */
 
-		do_export( (GtkWidget *) NULL, 0 );
+		do_export(gc);
                	destroy_dialog(NULL, importdialog);
                	importdialog = NULL;
 	} 
@@ -3391,7 +3385,7 @@
 	char *al = gtk_entry_get_text(GTK_ENTRY(aliasname));
 	g_snprintf(b->show, sizeof(b->show), "%s", (al && strlen(al)) ? al : b->name);
 	handle_buddy_rename(b, b->name);
-	do_export(0, 0);
+	do_export(b->gc);
 	destroy_dialog(aliasdlg, aliasdlg);
 }
 
@@ -3793,7 +3787,7 @@
 			handle_group_rename(g, prevname);
 			g_free(prevname);
 		}
-		do_export(0, 0);
+		do_export(g->gc);
 	}
 
 	destroy_dialog(rename_dialog, rename_dialog);
--- a/src/gaim.h	Sat May 05 00:15:58 2001 +0000
+++ b/src/gaim.h	Sat May 05 10:36:08 2001 +0000
@@ -795,7 +795,7 @@
 
 /* Functions in dialogs.c */
 extern void alias_dialog_bud(struct buddy *);
-extern void do_export(GtkWidget *, void *);
+extern void do_export(struct gaim_connection *);
 extern void show_warn_dialog(struct gaim_connection *, char *);
 extern void do_error_dialog(char *, char *);
 extern void show_error_dialog(char *);
@@ -805,8 +805,8 @@
 extern void show_add_group(struct gaim_connection *);
 extern void show_add_perm(struct gaim_connection *, char *, gboolean);
 extern void destroy_all_dialogs();
+extern void show_import_dialog();
 extern void show_export_dialog();
-extern void show_import_dialog();
 extern void show_new_bp();
 extern void show_log_dialog(struct conversation *);
 extern void show_find_email(struct gaim_connection *gc);
--- a/src/multi.h	Sat May 05 00:15:58 2001 +0000
+++ b/src/multi.h	Sat May 05 10:36:08 2001 +0000
@@ -54,7 +54,6 @@
 
 	char username[64];
 	char password[32];
-	char g_screenname[64];
 	int options; /* same as aim_user options */
 	guint keepalive;
 	/* stuff needed for per-connection idle times */
--- a/src/prefs.c	Sat May 05 00:15:58 2001 +0000
+++ b/src/prefs.c	Sat May 05 10:36:08 2001 +0000
@@ -1797,7 +1797,7 @@
 {
 	current_deny_gc->permdeny = data;
 	serv_set_permit_deny(current_deny_gc);
-	do_export(NULL, 0);
+	do_export(current_deny_gc);
 }
 
 static GtkWidget *deny_opt(char *label, int which, GtkWidget *box, GtkWidget *set)
@@ -1967,7 +1967,7 @@
 		build_block_list();
 	}
 
-	do_export(0, 0);
+	do_export(current_deny_gc);
 }
 
 static void deny_page()
--- a/src/sound.c	Sat May 05 00:15:58 2001 +0000
+++ b/src/sound.c	Sat May 05 10:36:08 2001 +0000
@@ -176,16 +176,6 @@
 
 }
 
-static int play_esd_file(char *file)
-{
-	int esd_stat;
-	int fd = open(file, O_RDONLY);
-	if (fd <= 0)
-		return 0;
-	esd_stat = esd_play_file(NULL, file, 1);
-	return esd_stat;
-}
-
 static int can_play_esd()
 {
 	esd_format_t format = ESD_BITS16 | ESD_STREAM | ESD_PLAY | ESD_MONO;
@@ -329,7 +319,7 @@
 			_exit(0);
 		}
 #ifdef ESD_SOUND
-		if (play_esd_file(filename))
+		if (esd_play_file(NULL, filename, 1))
 			_exit(0);
 #endif
 
--- a/src/util.c	Sat May 05 00:15:58 2001 +0000
+++ b/src/util.c	Sat May 05 10:36:08 2001 +0000
@@ -1503,3 +1503,16 @@
 
 	fclose(fd);
 }
+
+time_t get_time(int year, int month, int day, int hour, int min, int sec)
+{
+	struct tm tm;
+
+	tm.tm_year = year - 1900;
+	tm.tm_mon = month - 1;
+	tm.tm_mday = day;
+	tm.tm_hour = hour;
+	tm.tm_min = min;
+	tm.tm_sec = sec >= 0 ? sec : time(NULL) % 60;
+	return mktime(&tm);
+}