changeset 10289:5683613ea692

[gaim-migrate @ 11464] don't let jabber ignore your own presence committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Wed, 01 Dec 2004 23:32:46 +0000
parents 627b081e9617
children 9384f4492872
files src/protocols/jabber/jabber.c src/protocols/jabber/roster.c
diffstat 2 files changed, 21 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/jabber/jabber.c	Wed Dec 01 23:24:17 2004 +0000
+++ b/src/protocols/jabber/jabber.c	Wed Dec 01 23:32:46 2004 +0000
@@ -102,10 +102,13 @@
 		xmlnode *jid;
 		char *full_jid;
 		if((jid = xmlnode_get_child(bind, "jid")) && (full_jid = xmlnode_get_data(jid))) {
+			JabberBuddy *my_jb = NULL;
 			jabber_id_free(js->user);
 			if(!(js->user = jabber_id_new(full_jid))) {
 				gaim_connection_error(js->gc, _("Invalid response from server."));
 			}
+			if((my_jb = jabber_buddy_find(js, full_jid, TRUE)))
+				my_jb->subscription |= JABBER_SUB_BOTH;
 		}
 	} else {
 		char *msg = jabber_parse_error(js, packet);
@@ -350,6 +353,7 @@
 			"connect_server", "");
 	const char *server;
 	JabberStream *js;
+	JabberBuddy *my_jb = NULL;
 
 	gc->flags |= GAIM_CONNECTION_HTML;
 	js = gc->proto_data = g_new0(JabberStream, 1);
@@ -385,6 +389,9 @@
 		g_free(me);
 	}
 
+	if((my_jb = jabber_buddy_find(js, gaim_account_get_username(account), TRUE)))
+		my_jb->subscription |= JABBER_SUB_BOTH;
+
 	server = connect_server[0] ? connect_server : js->user->domain;
 
 	jabber_stream_set_state(js, JABBER_STREAM_CONNECTING);
@@ -681,6 +688,7 @@
 {
 	GaimConnection *gc = gaim_account_get_connection(account);
 	JabberStream *js;
+	JabberBuddy *my_jb = NULL;
 	const char *connect_server = gaim_account_get_string(account,
 			"connect_server", "");
 	const char *server;
@@ -714,6 +722,9 @@
 		g_free(me);
 	}
 
+	if((my_jb = jabber_buddy_find(js, gaim_account_get_username(account), TRUE)))
+		my_jb->subscription |= JABBER_SUB_BOTH;
+
 	server = connect_server[0] ? connect_server : js->user->domain;
 
 	jabber_stream_set_state(js, JABBER_STREAM_CONNECTING);
--- a/src/protocols/jabber/roster.c	Wed Dec 01 23:24:17 2004 +0000
+++ b/src/protocols/jabber/roster.c	Wed Dec 01 23:32:46 2004 +0000
@@ -160,18 +160,16 @@
 		if(!(jb = jabber_buddy_find(js, jid, TRUE)))
 			continue;
 
-		if(!subscription)
-			jb->subscription = JABBER_SUB_NONE;
-		else if(!strcmp(subscription, "to"))
-			jb->subscription = JABBER_SUB_TO;
-		else if(!strcmp(subscription, "from"))
-			jb->subscription = JABBER_SUB_FROM;
-		else if(!strcmp(subscription, "both"))
-			jb->subscription = JABBER_SUB_BOTH;
-		else if(!strcmp(subscription, "remove"))
-			jb->subscription = JABBER_SUB_REMOVE;
-		else
-			jb->subscription = JABBER_SUB_NONE;
+		if(subscription) {
+			if(!strcmp(subscription, "to"))
+				jb->subscription = JABBER_SUB_TO;
+			else if(!strcmp(subscription, "from"))
+				jb->subscription = JABBER_SUB_FROM;
+			else if(!strcmp(subscription, "both"))
+				jb->subscription = JABBER_SUB_BOTH;
+			else if(!strcmp(subscription, "remove"))
+				jb->subscription = JABBER_SUB_REMOVE;
+		}
 
 		if(ask && !strcmp(ask, "subscribe"))
 			jb->subscription |= JABBER_SUB_PENDING;