changeset 10216:09876d57c520

[gaim-migrate @ 11343] jabber can now set away messages, but can't come back when another account is logged in...someone feel free to clue me in as to what I did wrong committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sat, 20 Nov 2004 05:12:59 +0000
parents 132e8767b2f6
children 6f49ce1d394d
files src/protocols/jabber/buddy.c src/protocols/jabber/jabber.c src/protocols/jabber/presence.c src/protocols/jabber/presence.h
diffstat 4 files changed, 24 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/jabber/buddy.c	Sat Nov 20 04:50:16 2004 +0000
+++ b/src/protocols/jabber/buddy.c	Sat Nov 20 05:12:59 2004 +0000
@@ -424,7 +424,7 @@
 
 	gpresence = gaim_account_get_presence(gc->account);
 	status = gaim_presence_get_active_status(gpresence);
-	jabber_presence_send(gc, status);
+	jabber_presence_send(gc->account, status);
 }
 
 /*
--- a/src/protocols/jabber/jabber.c	Sat Nov 20 04:50:16 2004 +0000
+++ b/src/protocols/jabber/jabber.c	Sat Nov 20 05:12:59 2004 +0000
@@ -742,7 +742,7 @@
 {
 	JabberStream *js = gc->proto_data;
 
-	jabber_presence_send(gc, NULL); /* XXX: FIXME: EEK! */
+	jabber_presence_send(gc->account, NULL);
 	jabber_send_raw(js, "</stream:stream>", -1);
 
 	if(js->gsc) {
@@ -814,7 +814,7 @@
 			jabber_roster_request(js);
 			gpresence = gaim_account_get_presence(js->gc->account);
 			status = gaim_presence_get_active_status(gpresence);
-			jabber_presence_send(js->gc, status);
+			jabber_presence_send(js->gc->account, status);
 			jabber_disco_items_server(js);
 			serv_finish_login(js->gc);
 			break;
@@ -1528,7 +1528,7 @@
 	jabber_set_info,				/* set_info */
 	jabber_send_typing,				/* send_typing */
 	jabber_buddy_get_info,			/* get_info */
-	NULL,							/* set_away */
+	jabber_presence_send,			/* set_away */
 	jabber_idle_set,				/* set_idle */
 	NULL,							/* change_passwd */
 	jabber_roster_add_buddy,		/* add_buddy */
--- a/src/protocols/jabber/presence.c	Sat Nov 20 04:50:16 2004 +0000
+++ b/src/protocols/jabber/presence.c	Sat Nov 20 05:12:59 2004 +0000
@@ -82,8 +82,9 @@
 }
 
 
-void jabber_presence_send(GaimConnection *gc, GaimStatus *status)
+void jabber_presence_send(GaimAccount *account, GaimStatus *status)
 {
+	GaimConnection *gc = account->gc;
 	JabberStream *js = gc->proto_data;
 	xmlnode *presence, *x, *photo;
 	char *stripped = NULL;
@@ -533,24 +534,25 @@
 
 void gaim_status_to_jabber(const GaimStatus *status, JabberBuddyState *state, const char **msg, int *priority)
 {
-	const char *status_id;
+	const char *status_id = NULL;
+
+	*state = JABBER_BUDDY_STATE_UNKNOWN;
+	*msg = NULL;
+	*priority = 0;
 
 	if(!status) {
-		*state = JABBER_BUDDY_STATE_UNKNOWN;
-		*msg = NULL;
-		*priority = 0;
-		return;
+		*state = JABBER_BUDDY_STATE_UNAVAILABLE;
+	} else {
+		if(state) {
+			status_id = gaim_status_get_id(status);
+			*state = jabber_buddy_status_id_get_state(status_id);
+		}
+
+		if(msg)
+			*msg = gaim_status_get_attr_string(status, "message");
+
+		if(priority)
+			*priority = gaim_status_get_attr_int(status, "priority");
 	}
 
-	if(state) {
-		status_id = gaim_status_get_id(status);
-		*state = jabber_buddy_status_id_get_state(status_id);
-	}
-
-	if(msg)
-		*msg = gaim_status_get_attr_string(status, "message");
-
-	if(priority)
-		*priority = gaim_status_get_attr_int(status, "priority");
-
 }
--- a/src/protocols/jabber/presence.h	Sat Nov 20 04:50:16 2004 +0000
+++ b/src/protocols/jabber/presence.h	Sat Nov 20 05:12:59 2004 +0000
@@ -26,7 +26,7 @@
 #include "jabber.h"
 #include "xmlnode.h"
 
-void jabber_presence_send(GaimConnection *gc, GaimStatus *status);
+void jabber_presence_send(GaimAccount *account, GaimStatus *status);
 xmlnode *jabber_presence_create(JabberBuddyState state, const char *msg, int priority);
 void jabber_presence_parse(JabberStream *js, xmlnode *packet);
 void jabber_presence_subscription_set(JabberStream *js, const char *who,