changeset 1155:f4d4a14752ee

[gaim-migrate @ 1165] Heres the rest of the BP crap. committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Tue, 28 Nov 2000 10:20:23 +0000
parents 938d9cd76148
children b6b2d26a4e2f
files src/buddy.c src/dialogs.c src/gaim.h src/gaimrc.c
diffstat 4 files changed, 26 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/buddy.c	Tue Nov 28 05:57:56 2000 +0000
+++ b/src/buddy.c	Tue Nov 28 10:20:23 2000 +0000
@@ -1304,17 +1304,24 @@
         
         struct buddy_pounce *b;
 	struct conversation *c;
+	struct aim_user *u;
 
 	GList *bp = buddy_pounces;
         
 	who = g_strdup(normalize(name));
 
-	/* FIXME: we should decide somewhere who we're pouncing as */
 	while(bp) {
-		b = (struct buddy_pounce *)bp->data;;
+		b = (struct buddy_pounce *)bp->data;
 		bp = bp->next; /* increment the list here because rem_bp can make our handle bad */
 
-                if (!strcasecmp(who, normalize(b->name))) {
+		u = find_user(b->pouncer, b->protocol); /* find our user */
+		if (u == NULL) continue;
+
+                if (!strcasecmp(who, normalize(b->name))) { /* find someone to pounce */
+			/* check and see if we're signed on as the pouncer */
+
+			if (u->gc == NULL) continue;
+			
 			if (b->popup == 1)
 			{
 				c = find_conversation(name);
@@ -1328,8 +1335,7 @@
                                 	c = new_conversation(name);
 
                         	write_to_conv(c, b->message, WFLAG_SEND, NULL);
-
-                                serv_send_im(c->gc, name, b->message, 0);
+                                serv_send_im(u->gc, name, b->message, 0);
 			}
                         
                         rem_bp(NULL, b);
--- a/src/dialogs.c	Tue Nov 28 05:57:56 2000 +0000
+++ b/src/dialogs.c	Tue Nov 28 10:20:23 2000 +0000
@@ -1050,6 +1050,8 @@
 	g_snprintf(bp->message, 2048, "%s", gtk_entry_get_text(GTK_ENTRY(b->messentry)));
 	g_snprintf(bp->pouncer, 80, "%s", b->user->username);
 
+	bp->protocol = b->user->protocol;
+
 	if (GTK_TOGGLE_BUTTON(b->openwindow)->active)
 		bp->popup = 1;
 	else
--- a/src/gaim.h	Tue Nov 28 05:57:56 2000 +0000
+++ b/src/gaim.h	Tue Nov 28 10:20:23 2000 +0000
@@ -247,7 +247,8 @@
 	int sendim;
 	
 	char pouncer[80];
-	
+	int protocol;
+
 	int signon;
 	int unaway;
 	int unidle;
--- a/src/gaimrc.c	Tue Nov 28 05:57:56 2000 +0000
+++ b/src/gaimrc.c	Tue Nov 28 10:20:23 2000 +0000
@@ -279,20 +279,21 @@
 		{
 			b = g_new0(struct buddy_pounce, 1);
 
-			g_snprintf(b->name, sizeof(b->name),  "%s", p->value[1]);
-			g_snprintf(b->message, sizeof(b->message), "%s", p->value[2]);
-			g_snprintf(b->pouncer, sizeof(b->pouncer), "%s", p->value[0]);
+			g_snprintf(b->name, sizeof(b->name),  "%s", p->value[0]);
+			g_snprintf(b->message, sizeof(b->message), "%s", p->value[1]);
 
-			b->popup = atoi(p->value[3]);
-			b->sendim = atoi(p->value[4]);
+			b->popup = atoi(p->value[2]);
+			b->sendim = atoi(p->value[3]);
 
 			/* Let's check our version and see what's going on here */
-			if ((p->value[5]) && (strlen(p->value[5]) > 0))
+			if ((p->value[4]) && (strlen(p->value[4]) > 0))
 			{
 				/* If we have data, lets use it */
-				b->signon = atoi(p->value[5]);		
-				b->unaway = atoi(p->value[6]);		
-				b->unidle = atoi(p->value[7]);		
+				g_snprintf(b->pouncer, sizeof(b->pouncer), "%s", p->value[4]);
+				b->protocol = atoi(p->value[5]);
+				b->signon = atoi(p->value[6]);		
+				b->unaway = atoi(p->value[7]);		
+				b->unidle = atoi(p->value[8]);		
 			}
 			else
 			{
@@ -330,7 +331,7 @@
 				str2[0] = 0;
 			}
 
-			fprintf(f, "\tentry { %s } { %s } { %s } { %d } { %d } { %d } { %d } { %d }\n", b->pouncer, str1, str2, b->popup, b->sendim, b->signon, b->unaway, b->unidle);
+			fprintf(f, "\tentry { %s } { %s } { %d } { %d } { %s } { %d } { %d } { %d } { %d }\n", str1, str2, b->popup, b->sendim, b->pouncer, b->protocol, b->signon, b->unaway, b->unidle);
 
 			/* escape_text2 uses malloc(), so we don't want to g_free these */
 			free(str1);