changeset 1354:6b0a7cea1dd1

[gaim-migrate @ 1364] yay. state. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 22 Dec 2000 03:14:27 +0000
parents f6a8bca11766
children 04874e92af24
files pixmaps/Makefile.am pixmaps/available-away.xpm pixmaps/available-chat.xpm pixmaps/available-dnd.xpm pixmaps/available-xa.xpm plugins/jabber/jabber.c
diffstat 6 files changed, 148 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pixmaps/Makefile.am	Fri Dec 22 02:26:11 2000 +0000
+++ b/pixmaps/Makefile.am	Fri Dec 22 03:14:27 2000 +0000
@@ -6,6 +6,10 @@
 		aimicon2.xpm			\
 		angel.xpm			\
 		aol_icon.xpm			\
+		available-away.xpm		\
+		available-chat.xpm		\
+		available-dnd.xpm		\
+		available-xa.xpm		\
 		available.xpm			\
 		away.xpm			\
 		away_icon.xpm			\
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pixmaps/available-away.xpm	Fri Dec 22 03:14:27 2000 +0000
@@ -0,0 +1,25 @@
+/* XPM */
+static char * available_away_xpm[] = {
+"15 15 7 1",
+" 	c None",
+".	c #333333",
+"+	c #FFFF00",
+"@	c #FF0000",
+"#	c #FFFFFF",
+"$	c #000000",
+"%	c #4C4C4C",
+"               ",
+"      ...      ",
+"     .+++.     ",
+"    .+++++.    ",
+"   @@@@@@@@@   ",
+"  @#########@  ",
+" @#$##$##$$##@ ",
+" @#$$#$#$##$#@ ",
+" @#$#$$#$$$$#@ ",
+" @#$##$#$##$#@ ",
+"  @#########@  ",
+"   @@@@@@@@@   ",
+"     %.$$%     ",
+"      ...      ",
+"               "};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pixmaps/available-chat.xpm	Fri Dec 22 03:14:27 2000 +0000
@@ -0,0 +1,24 @@
+/* XPM */
+static char * available_chat_xpm[] = {
+"15 15 6 1",
+" 	c None",
+".	c #333333",
+"+	c #FFFF00",
+"@	c #666666",
+"#	c #000000",
+"$	c #4C4C4C",
+"               ",
+"      ...      ",
+"     .+++.     ",
+"    .+++++.    ",
+"   .++@+@++.   ",
+"   .+@+@+@+.   ",
+"   .+@+++###   ",
+"    .+@+#+++#  ",
+"    .+@#+++++# ",
+"     .#++#+#++#",
+"     .#+++++++#",
+"     $#++#+#++#",
+"     $.#++#++# ",
+"      ..#+++#  ",
+"         ###   "};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pixmaps/available-dnd.xpm	Fri Dec 22 03:14:27 2000 +0000
@@ -0,0 +1,26 @@
+/* XPM */
+static char * available_dnd_xpm[] = {
+"15 15 8 1",
+" 	c None",
+".	c #333333",
+"+	c #FFFF00",
+"@	c #666666",
+"#	c #7F0000",
+"$	c #FF0000",
+"%	c #FFFFFF",
+"&	c #4C4C4C",
+"               ",
+"      ...      ",
+"     .+++.     ",
+"    .+++++.    ",
+"   .++@+@++.   ",
+"   .+@+@+@+.   ",
+"   .+@+++###   ",
+"    .+@+#$$$#  ",
+"    .+@#%@$@%# ",
+"     .#$@%@%@$#",
+"     .#$$@%@$$#",
+"     &#$@%@%@$#",
+"     &.#%@$@%# ",
+"      ..#$$$#  ",
+"         ###   "};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pixmaps/available-xa.xpm	Fri Dec 22 03:14:27 2000 +0000
@@ -0,0 +1,28 @@
+/* XPM */
+static char * available_xa_xpm[] = {
+"15 15 10 1",
+" 	c None",
+".	c #FF0000",
+"+	c #333333",
+"@	c #FFFF00",
+"#	c #7F0000",
+"$	c #666666",
+"%	c #FFFFFF",
+"&	c #000000",
+"*	c #B2B2B2",
+"=	c #4C4C4C",
+"               ",
+"     .+++.     ",
+"    .+@@@+.    ",
+"    .@@@@@.##  ",
+"   +.@$@##.%#  ",
+"   +.###%%%&&# ",
+"  ##.%%%*%&&%# ",
+"  #%*&*&%&%*&# ",
+"  #%&%&&%&&%&# ",
+"  #%&%&%&&%%%# ",
+"   #*&*%%%###  ",
+"   #%%####     ",
+"   ###+&&=     ",
+"      +++      ",
+"               "};
--- a/plugins/jabber/jabber.c	Fri Dec 22 02:26:11 2000 +0000
+++ b/plugins/jabber/jabber.c	Fri Dec 22 03:14:27 2000 +0000
@@ -50,6 +50,10 @@
 #include "jabber.h"
 
 #include "pixmaps/available.xpm"
+#include "pixmaps/available-away.xpm"
+#include "pixmaps/available-chat.xpm"
+#include "pixmaps/available-xa.xpm"
+#include "pixmaps/available-dnd.xpm"
 
 /* The priv member of gjconn's is a gaim_connection for now. */
 #define GJ_GC(x) ((struct gaim_connection *)(x)->priv)
@@ -58,6 +62,11 @@
 #define IQ_AUTH 0
 #define IQ_ROSTER 1
 
+#define UC_AWAY 0x38
+#define UC_CHAT 0x48
+#define UC_XA   0x98
+#define UC_DND  0x118
+
 typedef struct gjconn_struct {
 	/* Core structure */
 	pool p;			/* Memory allocation pool */
@@ -440,11 +449,29 @@
 	struct buddy *b;
 	jid who;
 	char *buddy;
+	xmlnode y;
+	char *show;
+	int state;
 
 	to = xmlnode_get_attrib(p->x, "to");
 	from = xmlnode_get_attrib(p->x, "from");
 	type = xmlnode_get_attrib(p->x, "type");
 
+	if ((y = xmlnode_get_tag(p->x, "show"))) {
+		show = xmlnode_get_data(y);
+		if (!strcmp(show, "away")) {
+			state = UC_AWAY;
+		} else if (!strcmp(show, "chat")) {
+			state = UC_CHAT;
+		} else if (!strcmp(show, "xa")) {
+			state = UC_XA;
+		} else if (!strcmp(show, "dnd")) {
+			state = UC_DND;
+		}
+	} else {
+		state = UC_NORMAL;
+	}
+
 	who = jid_new(j->p, from);
 	if (who->user == NULL) {
 		/* FIXME: transport */
@@ -454,7 +481,7 @@
 	buddy = g_strdup_printf("%s@%s", who->user, who->server);
 
 	if (!(b = find_buddy(GJ_GC(j), buddy))) {
-		add_buddy(GJ_GC(j), "Buddies", buddy, buddy);
+		b = add_buddy(GJ_GC(j), "Buddies", buddy, buddy);
 		build_edit_tree();
 		do_export(NULL, NULL);
 	}
@@ -462,7 +489,7 @@
 	if (type && (strcasecmp(type, "unavailable") == 0))
 		serv_got_update(GJ_GC(j), buddy, 0, 0, 0, 0, 0, 0);
 	else
-		serv_got_update(GJ_GC(j), buddy, 1, 0, 0, 0, 0, 0);
+		serv_got_update(GJ_GC(j), buddy, 1, 0, 0, 0, state, 0);
 
 	g_free(buddy);
 
@@ -774,7 +801,18 @@
 
 static char **jabber_list_icon(int uc)
 {
-	return available_xpm;
+	switch (uc) {
+	case UC_AWAY:
+		return available_away_xpm;
+	case UC_CHAT:
+		return available_chat_xpm;
+	case UC_XA:
+		return available_xa_xpm;
+	case UC_DND:
+		return available_dnd_xpm;
+	default:
+		return available_xpm;
+	}
 }
 
 static struct prpl *my_protocol = NULL;