changeset 10490:a3a540ed2518

[gaim-migrate @ 11780] some random jabber stuff, remove a duplicate #define, and shuffle account loading so we're not emitting signals that haven't been registered yet committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sat, 08 Jan 2005 21:10:17 +0000
parents 8dffdd8861b5
children 9655389f4b81
files src/account.c src/gtkdialogs.h src/protocols/jabber/buddy.c src/protocols/jabber/jabber.c src/protocols/jabber/message.c src/protocols/jabber/presence.c
diffstat 6 files changed, 22 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/account.c	Sat Jan 08 20:51:16 2005 +0000
+++ b/src/account.c	Sat Jan 08 21:10:17 2005 +0000
@@ -537,9 +537,9 @@
 	for (child = xmlnode_get_child(node, "account"); child != NULL;
 			child = xmlnode_get_next_twin(child))
 	{
-		GaimAccount *new;
-		new = parse_account(child);
-		gaim_accounts_add(new);
+		GaimAccount *new_acct;
+		new_acct = parse_account(child);
+		gaim_accounts_add(new_acct);
 	}
 }
 
@@ -1669,8 +1669,6 @@
 {
 	void *handle = gaim_accounts_get_handle();
 
-	load_accounts();
-
 	gaim_signal_register(handle, "account-connecting",
 						 gaim_marshal_VOID__POINTER, NULL, 1,
 						 gaim_value_new(GAIM_TYPE_SUBTYPE,
@@ -1709,6 +1707,9 @@
 	gaim_signal_register(handle, "account-removed",
 						 gaim_marshal_VOID__POINTER, NULL, 1,
 						 gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_ACCOUNT));
+
+	load_accounts();
+
 }
 
 void
--- a/src/gtkdialogs.h	Sat Jan 08 20:51:16 2005 +0000
+++ b/src/gtkdialogs.h	Sat Jan 08 21:10:17 2005 +0000
@@ -52,8 +52,6 @@
 /**
  * Our UI's identifier.
  */
-#define GAIM_GTK_UI "gtk-gaim"
-
 #define GAIM_DIALOG(x)	x = gtk_window_new(GTK_WINDOW_TOPLEVEL); \
 			gtk_window_set_type_hint(GTK_WINDOW(x), GDK_WINDOW_TYPE_HINT_DIALOG)
 #define GAIM_WINDOW_ICONIFIED(x) (gdk_window_get_state(GTK_WIDGET(x)->window) & GDK_WINDOW_STATE_ICONIFIED)
--- a/src/protocols/jabber/buddy.c	Sat Jan 08 20:51:16 2005 +0000
+++ b/src/protocols/jabber/buddy.c	Sat Jan 08 21:10:17 2005 +0000
@@ -593,6 +593,8 @@
 	if(!from)
 		return;
 
+	/* XXX: handle the error case */
+
 	resource_name = jabber_get_resource(from);
 	bare_jid = jabber_get_bare_jid(from);
 
--- a/src/protocols/jabber/jabber.c	Sat Jan 08 20:51:16 2005 +0000
+++ b/src/protocols/jabber/jabber.c	Sat Jan 08 21:10:17 2005 +0000
@@ -971,7 +971,10 @@
 			gaim_value_new(GAIM_TYPE_STRING), NULL);
 	types = g_list_append(types, type);
 
-	type = gaim_status_type_new_full(GAIM_STATUS_ONLINE, "online", _("Online"), FALSE, TRUE, FALSE);
+	type = gaim_status_type_new_with_attrs(GAIM_STATUS_ONLINE, "online",
+			_("Online"), FALSE, TRUE, FALSE, "priority", _("Priority"),
+			gaim_value_new(GAIM_TYPE_INT), "message", _("Message"),
+			gaim_value_new(GAIM_TYPE_STRING), NULL);
 	types = g_list_append(types, type);
 
 	type = gaim_status_type_new_with_attrs(GAIM_STATUS_AVAILABLE, "available",
--- a/src/protocols/jabber/message.c	Sat Jan 08 20:51:16 2005 +0000
+++ b/src/protocols/jabber/message.c	Sat Jan 08 21:10:17 2005 +0000
@@ -69,13 +69,16 @@
 	if(jabber_find_unnormalized_conv(jm->from, jm->js->gc->account)) {
 		from = g_strdup(jm->from);
 	} else  if(jid->node) {
-		GaimConversation *conv;
+		if(jid->resource) {
+			GaimConversation *conv;
 
-		from = g_strdup_printf("%s@%s", jid->node, jid->domain);
-		conv = jabber_find_unnormalized_conv(from, jm->js->gc->account);
-		if(conv)
-			gaim_conversation_set_name(conv, jm->from);
-		g_free(from);
+			from = g_strdup_printf("%s@%s", jid->node, jid->domain);
+			conv = jabber_find_unnormalized_conv(from, jm->js->gc->account);
+			if(conv) {
+				gaim_conversation_set_name(conv, jm->from);
+			}
+			g_free(from);
+		}
 		from = g_strdup(jm->from);
 	} else {
 		from = g_strdup(jid->domain);
--- a/src/protocols/jabber/presence.c	Sat Jan 08 20:51:16 2005 +0000
+++ b/src/protocols/jabber/presence.c	Sat Jan 08 21:10:17 2005 +0000
@@ -71,7 +71,7 @@
 
 			gaim_status_to_jabber(gstatus, &state, &msg, &priority);
 
-			if (state == JABBER_BUDDY_STATE_UNAVAILABLE) {
+			if (state == JABBER_BUDDY_STATE_UNAVAILABLE || state == JABBER_BUDDY_STATE_UNKNOWN) {
 				jabber_buddy_remove_resource(jb, js->user->resource);
 			} else {
 				jabber_buddy_track_resource(jb, js->user->resource, priority, state, msg);