changeset 976:2586b2a3725e

[gaim-migrate @ 986] warning works better, i hope :-P for every one fixme i get rid of i add 3, i swear committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 11 Oct 2000 04:30:26 +0000
parents a45991891aba
children e5eac6b236f1
files src/conversation.c src/dialogs.c src/gaim.h src/perl.c src/rvous.c src/server.c src/toc.c src/util.c
diffstat 8 files changed, 105 insertions(+), 73 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Wed Oct 11 03:56:46 2000 +0000
+++ b/src/conversation.c	Wed Oct 11 04:30:26 2000 +0000
@@ -471,7 +471,7 @@
 
 void warn_callback(GtkWidget *widget, struct conversation *c)
 {
-        show_warn_dialog(c->name);
+        show_warn_dialog(c->gc, c->name);
 	gtk_widget_grab_focus(c->entry);
 }
 
--- a/src/dialogs.c	Wed Oct 11 03:56:46 2000 +0000
+++ b/src/dialogs.c	Wed Oct 11 04:30:26 2000 +0000
@@ -92,6 +92,7 @@
         GtkWidget *window;
         GtkWidget *anon;
         char *who;
+	struct gaim_connection *gc;
 };
 
 struct addbuddy {
@@ -299,14 +300,14 @@
 
 static void do_warn(GtkWidget *widget, struct warning *w)
 {
-        serv_warn(w->who, (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w->anon))) ?
+        serv_warn(w->gc, w->who, (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w->anon))) ?
                    1 : 0);
         
         destroy_dialog(NULL, w->window);
 }
 
 
-void show_warn_dialog(char *who)
+void show_warn_dialog(struct gaim_connection *gc, char *who)
 {
 	GtkWidget *cancel;
 	GtkWidget *warn;
@@ -357,6 +358,7 @@
         gtk_widget_show(label);
 
         w->who = who;
+	w->gc = gc;
 	
 	gtk_container_add(GTK_CONTAINER(frame), vbox);
 
--- a/src/gaim.h	Wed Oct 11 03:56:46 2000 +0000
+++ b/src/gaim.h	Wed Oct 11 04:30:26 2000 +0000
@@ -643,7 +643,7 @@
 extern void serv_set_permit_deny();
 extern void serv_build_config(char *, int, gboolean);
 extern void serv_save_config();
-extern void serv_warn(char *, int);
+extern void serv_warn(struct gaim_connection *, char *, int);
 extern void serv_set_dir(char *, char *, char *, char *, char *, char *, char *, int);
 extern void serv_dir_search(char *, char *, char *, char *, char *, char *, char *, char *);
 extern void serv_accept_chat(struct gaim_connection *, int);
@@ -810,7 +810,7 @@
 /* Functions in dialogs.c */
 extern void alias_dialog(struct buddy *);
 extern void do_export(GtkWidget *, void *);
-extern void show_warn_dialog(char *);
+extern void show_warn_dialog(struct gaim_connection *, char *);
 extern void do_error_dialog(char *, char *);
 extern void show_error_dialog(char *);
 extern void show_im_dialog();
--- a/src/perl.c	Wed Oct 11 03:56:46 2000 +0000
+++ b/src/perl.c	Wed Oct 11 04:30:26 2000 +0000
@@ -426,8 +426,10 @@
 		serv_set_idle(atoi(SvPV(ST(1), junk)));
 		*/
 	} else if (!strncasecmp(command, "warn", 4)) {
+		/* yet another perl FIXME
 		char *name = SvPV(ST(1), junk);
 		serv_warn(name, 0);
+		*/
 	}
 
 	XSRETURN(0);
--- a/src/rvous.c	Wed Oct 11 03:56:46 2000 +0000
+++ b/src/rvous.c	Wed Oct 11 04:30:26 2000 +0000
@@ -62,7 +62,9 @@
 
 static void warn_callback(GtkWidget *widget, struct file_transfer *ft)
 {
+	/* FIXME
         show_warn_dialog(ft->user);
+	*/
 }
 
 static void info_callback(GtkWidget *widget, struct file_transfer *ft)
--- a/src/server.c	Wed Oct 11 03:56:46 2000 +0000
+++ b/src/server.c	Wed Oct 11 04:30:26 2000 +0000
@@ -170,7 +170,8 @@
 
 void serv_get_info(char *name)
 {
-	/* FIXME */
+	/* FIXME: getting someone's info? how do you decide something like that? I think that
+	 * the buddy list/UI needs to be really changed before this gets fixed*/
 	struct gaim_connection *g = connections->data;
 	if (g->protocol == PROTO_TOC) {
         	char buf[MSG_LEN];
@@ -183,7 +184,7 @@
 
 void serv_get_away_msg(char *name)
 {
-	/* FIXME */
+	/* FIXME: see the serv_get_info comment above :-P */
 	struct gaim_connection *g = connections->data;
 	if (g->protocol == PROTO_TOC) {
 		/* HAHA! TOC doesn't have this yet */
@@ -194,7 +195,7 @@
 
 void serv_get_dir(char *name)
 {
-	/* FIXME */
+	/* FIXME: see the serv_get_info comment above :-P */
 	struct gaim_connection *g = connections->data;
 	if (g->protocol == PROTO_TOC) {
 		char buf[MSG_LEN];
@@ -243,18 +244,24 @@
 
 void serv_set_away(char *message)
 {
-	/* FIXME */
-	struct gaim_connection *g = connections->data;
-	if (g->protocol == PROTO_TOC) {
-	        char buf[MSG_LEN];
-	        if (message) {
-			escape_text(message);
-	                g_snprintf(buf, MSG_LEN, "toc_set_away \"%s\"", message);
-		} else
-	                g_snprintf(buf, MSG_LEN, "toc_set_away \"\"");
-		sflap_send(g, buf, -1, TYPE_DATA);
-	} else if (g->protocol == PROTO_OSCAR) {
-		aim_bos_setprofile(g->oscar_sess, g->oscar_conn, g->user_info, message, gaim_caps);
+	/* FIXME: for now, setting away sets *everyone* to away */
+	GSList *c = connections;
+	struct gaim_connection *g;
+
+	while (c) {
+		g = (struct gaim_connection *)c->data;
+		if (g->protocol == PROTO_TOC) {
+			char buf[MSG_LEN];
+			if (message) {
+				escape_text(message);
+				g_snprintf(buf, MSG_LEN, "toc_set_away \"%s\"", message);
+			} else
+				g_snprintf(buf, MSG_LEN, "toc_set_away \"\"");
+			sflap_send(g, buf, -1, TYPE_DATA);
+		} else if (g->protocol == PROTO_OSCAR) {
+			aim_bos_setprofile(g->oscar_sess, g->oscar_conn, g->user_info, message, gaim_caps);
+		}
+		c = c->next;
 	}
 }
 
@@ -276,7 +283,8 @@
 }
 
 void serv_change_passwd(char *orig, char *new) {
-	/* FIXME */
+	/* FIXME: passwords are the kinds of things you don't want randomly changed;
+	 * this whole thing is commented out :-P
 	struct gaim_connection *g = connections->data;
 	if (g->protocol == PROTO_TOC) {
 		char *buf = g_malloc(BUF_LONG); 
@@ -284,71 +292,91 @@
 		sflap_send(g, buf, strlen(buf), TYPE_DATA);
 		g_free(buf);
 	} else if (g->protocol == PROTO_OSCAR) {
-		/* Oscar change_passwd FIXME */
+		Oscar change_passwd FIXME
 	}
+	*/
 }
 
 void serv_add_buddy(char *name)
 {
-	/* FIXME */
-	struct gaim_connection *g = connections->data;
-	if (g->protocol == PROTO_TOC) {
-		char buf[1024];
-		g_snprintf(buf, sizeof(buf), "toc_add_buddy %s", normalize(name));
-		sflap_send(g, buf, -1, TYPE_DATA);
-	} else if (g->protocol == PROTO_OSCAR) {
-		aim_add_buddy(g->oscar_sess, g->oscar_conn, name);
+	/* FIXME: this will need to be changed. for now all buddies will be added to
+	 * all connections :-P */
+	GSList *c = connections;
+	struct gaim_connection *g;
+
+	while (c) {
+		g = (struct gaim_connection *)c->data;
+		if (g->protocol == PROTO_TOC) {
+			char buf[1024];
+			g_snprintf(buf, sizeof(buf), "toc_add_buddy %s", normalize(name));
+			sflap_send(g, buf, -1, TYPE_DATA);
+		} else if (g->protocol == PROTO_OSCAR) {
+			aim_add_buddy(g->oscar_sess, g->oscar_conn, name);
+		}
+		c = c->next;
 	}
 }
 
 void serv_add_buddies(GList *buddies)
 {
-	/* FIXME */
-	struct gaim_connection *g = connections->data;
-	if (g->protocol == PROTO_TOC) {
-		char buf[MSG_LEN];
-	        int n, num = 0;
+	/* FIXME: see the comment above for adding one buddy :-P */
+	GSList *c = connections;
+	struct gaim_connection *g;
+
+	while (c) {
+		g = (struct gaim_connection *)c->data;
+		if (g->protocol == PROTO_TOC) {
+			char buf[MSG_LEN];
+			int n, num = 0;
 
-	        n = g_snprintf(buf, sizeof(buf), "toc_add_buddy");
-	        while(buddies) {
-			/* i don't know why we choose 8, it just seems good */
-	                if (strlen(normalize(buddies->data)) > MSG_LEN - n - 8) {
-	                        sflap_send(g, buf, -1, TYPE_DATA);
-	                        n = g_snprintf(buf, sizeof(buf), "toc_add_buddy");
-	                        num = 0;
-	                }
-	                ++num;
-	                n += g_snprintf(buf + n, sizeof(buf) - n, " %s", normalize(buddies->data));
-	                buddies = buddies->next;
-	        }
-		sflap_send(g, buf, -1, TYPE_DATA);
-	} else if (g->protocol == PROTO_OSCAR) {
-		char buf[MSG_LEN];
-		int n = 0;
-		while(buddies) {
-			if (n > MSG_LEN - 18) {
-				aim_bos_setbuddylist(g->oscar_sess, g->oscar_conn, buf);
-				n = 0;
+			n = g_snprintf(buf, sizeof(buf), "toc_add_buddy");
+			while(buddies) {
+				/* i don't know why we choose 8, it just seems good */
+				if (strlen(normalize(buddies->data)) > MSG_LEN - n - 8) {
+					sflap_send(g, buf, -1, TYPE_DATA);
+					n = g_snprintf(buf, sizeof(buf), "toc_add_buddy");
+					num = 0;
+				}
+				++num;
+				n += g_snprintf(buf + n, sizeof(buf)-n, " %s", normalize(buddies->data));
+				buddies = buddies->next;
 			}
-			n += g_snprintf(buf + n, sizeof(buf) - n, "%s&",
-					(char *)buddies->data);
-			buddies = buddies->next;
+			sflap_send(g, buf, -1, TYPE_DATA);
+		} else if (g->protocol == PROTO_OSCAR) {
+			char buf[MSG_LEN];
+			int n = 0;
+			while(buddies) {
+				if (n > MSG_LEN - 18) {
+					aim_bos_setbuddylist(g->oscar_sess, g->oscar_conn, buf);
+					n = 0;
+				}
+				n += g_snprintf(buf + n, sizeof(buf) - n, "%s&",
+						(char *)buddies->data);
+				buddies = buddies->next;
+			}
+			aim_bos_setbuddylist(g->oscar_sess, g->oscar_conn, buf);
 		}
-		aim_bos_setbuddylist(g->oscar_sess, g->oscar_conn, buf);
+		c = c->next;
 	}
 }
 
 
 void serv_remove_buddy(char *name)
 {
-	/* FIXME */
-	struct gaim_connection *g = connections->data;
-	if (g->protocol == PROTO_TOC) {
-		char buf[1024];
-		g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", normalize(name));
-		sflap_send(g, buf, -1, TYPE_DATA);
-	} else if (g->protocol == PROTO_OSCAR) {
-		aim_remove_buddy(g->oscar_sess, g->oscar_conn, name);
+	/* FIXME: since we added them to all conns, we need to remove them from all conns */
+	GSList *c = connections;
+	struct gaim_connection *g;
+
+	while (c) {
+		g = (struct gaim_connection *)c->data;
+		if (g->protocol == PROTO_TOC) {
+			char buf[1024];
+			g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", normalize(name));
+			sflap_send(g, buf, -1, TYPE_DATA);
+		} else if (g->protocol == PROTO_OSCAR) {
+			aim_remove_buddy(g->oscar_sess, g->oscar_conn, name);
+		}
+		c = c->next;
 	}
 }
 
@@ -477,10 +505,8 @@
 }
 
 
-void serv_warn(char *name, int anon)
+void serv_warn(struct gaim_connection *g, char *name, int anon)
 {
-	/* FIXME */
-	struct gaim_connection *g = connections->data;
 	if (g->protocol == PROTO_TOC) {
 		char *send = g_malloc(256);
 		g_snprintf(send, 255, "toc_evil %s %s", name,
--- a/src/toc.c	Wed Oct 11 03:56:46 2000 +0000
+++ b/src/toc.c	Wed Oct 11 04:30:26 2000 +0000
@@ -39,7 +39,7 @@
 #include "gaim.h"
 #include "gnome_applet_mgr.h"
 
-#define REVISION "gaim:$Revision: 985 $"
+#define REVISION "gaim:$Revision: 986 $"
 
 
 static unsigned int peer_ver=0;
@@ -53,7 +53,7 @@
 
 /* ok. this function used to take username/password, and return 0 on success.
  * now, it takes username/password, and returns NULL on error or a new gaim_connection
- * on success. FIXME: should this modify the UI? or just sign in? */
+ * on success. */
 struct gaim_connection *toc_login(char *username, char *password)
 {
 	char *config;
--- a/src/util.c	Wed Oct 11 03:56:46 2000 +0000
+++ b/src/util.c	Wed Oct 11 04:30:26 2000 +0000
@@ -57,7 +57,7 @@
 	case '(':
 	case ')':
 	case '\0':
-	case '\n ':
+	case '\n':
 	case '<':
 	case '>':
 		return 1;