[ekg2-commit] r4611 - trunk/plugins/icq: trunk/plugins/icq/icq.c trunk/plugins/icq/icq.h trunk/plugins/icq/icq_caps.c trunk/plugins/icq/icq_caps.h trunk/plugins/icq/icq_snac_handlers_03buddy.inc

SVN commit svn w toxygen.net
Wto, 9 Wrz 2008, 01:54:13 CEST


Author: wiechu
Date: 2008-09-09 01:54:12 +0200 (Tue, 09 Sep 2008)
New Revision: 4611

Modified:
   trunk/plugins/icq/icq.c
   trunk/plugins/icq/icq.h
   trunk/plugins/icq/icq_caps.c
   trunk/plugins/icq/icq_caps.h
   trunk/plugins/icq/icq_snac_handlers_03buddy.inc
Log:
    start handle xstatus & few fix.

Modified: trunk/plugins/icq/icq.c
===================================================================
--- trunk/plugins/icq/icq.c	2008-09-08 20:40:15 UTC (rev 4610)
+++ trunk/plugins/icq/icq.c	2008-09-08 23:54:12 UTC (rev 4611)
@@ -173,13 +173,10 @@
 #ifdef DBG_AIMCONTACTSEND
 	icq_pack_append_cap(tlv_5, CAP_CONTACTS);		/* Client supports buddy lists transfer. */
 #endif
-#if 0
-	BYTE bXStatus = getContactXStatus(NULL);
-	if (bXStatus)
-	{
-		packBuffer(tlv_5, capXStatus[bXStatus-1], 0x10);
-	}
-#endif
+
+	if (j->xstatus)
+		icq_pack_append_xstatus(tlv_5, j->xstatus);
+
 	icq_pack_append_cap(tlv_5, CAP_ICQDIRECT);		/* Something called "route finder". */
 
 	/*packDWord(&packet, 0x178c2d9b); // Unknown cap
@@ -1386,10 +1383,14 @@
 	userlist_t *u	= *va_arg(ap, userlist_t **);
 	int quiet	= *va_arg(ap, int *);
 	const char *tmp;
+	int i;
 
 	if (!u || valid_plugin_uid(&icq_plugin, u->uid) != 1)
 		return 1;
 
+	if ( (i = user_private_item_get_int(u, "xstatus")) )
+		printq("icq_user_info_generic", _("xStatus"), icq_xstatus_name(i));
+
 	if ( (tmp = int2time_str("%Y-%m-%d %H:%M", user_private_item_get_int(u, "online"))) )
 		printq("icq_user_info_generic", _("Online since"), tmp);
 

Modified: trunk/plugins/icq/icq.h
===================================================================
--- trunk/plugins/icq/icq.h	2008-09-08 20:40:15 UTC (rev 4610)
+++ trunk/plugins/icq/icq.h	2008-09-08 23:54:12 UTC (rev 4611)
@@ -42,6 +42,7 @@
 	int ssi;		/* server-side-userlist? */
 	int aim;		/* aim-ok? */
 	int default_group_id;	/* XXX ?wo? TEMP! We should support list of groups */
+	int xstatus;
 	char *default_group_name;
 	string_t cookie;	/* connection login cookie */
 	string_t stream_buf;

Modified: trunk/plugins/icq/icq_caps.c
===================================================================
--- trunk/plugins/icq/icq_caps.c	2008-09-08 20:40:15 UTC (rev 4610)
+++ trunk/plugins/icq/icq_caps.c	2008-09-08 23:54:12 UTC (rev 4611)
@@ -113,6 +113,106 @@
 		return;
 	}
 
-	string_append_raw(pkt, _caps[cap_id], 0x10);
+	string_append_raw(pkt, (char *) _caps[cap_id], 0x10);
 
 }
+
+/*
+ * xStatuses
+ *
+ */
+
+static const _capability_t _capXStatus[XSTATUS_COUNT] = {
+  {0x63, 0x62, 0x73, 0x37, 0xa0, 0x3f, 0x49, 0xff, 0x80, 0xe5, 0xf7, 0x09, 0xcd, 0xe0, 0xa4, 0xee},
+  {0x5a, 0x58, 0x1e, 0xa1, 0xe5, 0x80, 0x43, 0x0c, 0xa0, 0x6f, 0x61, 0x22, 0x98, 0xb7, 0xe4, 0xc7},
+  {0x83, 0xc9, 0xb7, 0x8e, 0x77, 0xe7, 0x43, 0x78, 0xb2, 0xc5, 0xfb, 0x6c, 0xfc, 0xc3, 0x5b, 0xec},
+  {0xe6, 0x01, 0xe4, 0x1c, 0x33, 0x73, 0x4b, 0xd1, 0xbc, 0x06, 0x81, 0x1d, 0x6c, 0x32, 0x3d, 0x81},
+  {0x8c, 0x50, 0xdb, 0xae, 0x81, 0xed, 0x47, 0x86, 0xac, 0xca, 0x16, 0xcc, 0x32, 0x13, 0xc7, 0xb7},
+  {0x3f, 0xb0, 0xbd, 0x36, 0xaf, 0x3b, 0x4a,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x8c, 0xd7, 0xdf, 0x8e, 0x29, 0x03, 0x52},
+  {0x16, 0xf5, 0xb7, 0x6f, 0xa9, 0xd2, 0x40, 0x35, 0x8c, 0xc5, 0xc0, 0x84, 0x70, 0x3c, 0x98, 0xfa},
+  {0x63, 0x14, 0x36, 0xff, 0x3f, 0x8a, 0x40, 0xd0, 0xa5, 0xcb, 0x7b, 0x66, 0xe0, 0x51, 0xb3, 0x64},
+  {0xb7, 0x08, 0x67, 0xf5, 0x38, 0x25, 0x43, 0x27, 0xa1, 0xff, 0xcf, 0x4c, 0xc1, 0x93, 0x97, 0x97},
+  {0xdd, 0xcf, 0x0e, 0xa9, 0x71, 0x95, 0x40, 0x48, 0xa9, 0xc6, 0x41, 0x32, 0x06, 0xd6, 0xf2, 0x80}
+};
+
+const char* _nameXStatus[XSTATUS_COUNT] = {
+	"Shopping",
+	"Taking a bath",
+	"Tired",
+	"Party",
+	"Drinking beer",
+	"Thinking",
+	"Eating",
+	"Watching TV",
+	"Meeting",
+	"Coffee",
+	"Listening to music",
+	"Business",
+	"Shooting",
+	"Having fun",
+	"On the phone",
+	"Gaming",
+	"Studying",
+	"Feeling sick",
+	"Sleeping",
+	"Surfing",
+	"Browsing",
+	"Working",
+	"Typing",
+	"Angry",
+	"Picnic",
+	"Cooking",
+	"Smoking",
+	"I'm high",
+	"On WC",
+	"To be or not to be",
+	"Watching pro7 on TV",
+	"Love"};
+
+
+const char *icq_xstatus_name(int id) {
+	if ((id <=0) || (id > XSTATUS_COUNT))
+		return "unknown";
+	return _nameXStatus[id-1];
+}
+
+int icq_xstatus_id(unsigned char *buf) {
+	int i;
+	if (!buf)
+		return 0;
+	for (i=0; i<XSTATUS_COUNT; i++) {
+		if (!memcmp(buf, _capXStatus[i], 0x10))
+			return i+1;
+	}
+	return 0;
+}
+
+void icq_pack_append_xstatus(string_t pkt, int x_id) {
+	if ((x_id <=0) || (x_id > XSTATUS_COUNT))
+		return;
+
+	string_append_raw(pkt, (char *) _capXStatus[x_id-1], 0x10);
+
+}

Modified: trunk/plugins/icq/icq_caps.h
===================================================================
--- trunk/plugins/icq/icq_caps.h	2008-09-08 20:40:15 UTC (rev 4610)
+++ trunk/plugins/icq/icq_caps.h	2008-09-08 23:54:12 UTC (rev 4611)
@@ -37,4 +37,18 @@
 
 void icq_pack_append_cap(string_t pkt, int cap_id);
 
+
+/*
+ * xStatuses
+ *
+ */
+
+#define XSTATUS_COUNT 32
+
+const char *icq_xstatus_name(int id);
+
+int icq_xstatus_id(unsigned char *buf);
+
+void icq_pack_append_xstatus(string_t pkt, int x_id);
+
 #endif

Modified: trunk/plugins/icq/icq_snac_handlers_03buddy.inc
===================================================================
--- trunk/plugins/icq/icq_snac_handlers_03buddy.inc	2008-09-08 20:40:15 UTC (rev 4610)
+++ trunk/plugins/icq/icq_snac_handlers_03buddy.inc	2008-09-08 23:54:12 UTC (rev 4611)
@@ -179,6 +179,10 @@
 					user_private_item_set_int(u, "online", t->nr);
 				break;
 
+			case 0x04: /* ?wo? AIM idle timer? XXX */
+				debug_white("icq_snac_buddy_online() idle %d\n", t->nr);
+				break;
+
 			case 0x05: /* Time when this account was registered (unix time_t) */
 				if (u && t->nr)
 					user_private_item_set_int(u, "member", t->nr);
@@ -246,7 +250,7 @@
 						user_private_item_set_int(u, "dcc.flag", tlv_c.tcp_flag);
 						user_private_item_set_int(u, "dcc.ver", tlv_c.version);
 						user_private_item_set_int(u, "dcc.cookie", tlv_c.conn_cookie);
-						user_private_item_set_int(u, "dcc.web_port", tlv_c.web_port);
+						user_private_item_set_int(u, "dcc.web_port", tlv_c.web_port);	// ?wo? do we need it?
 					}
 					if (t->len >= 12 && icq_unpack_nc(t->buf, t->len, "23 III", &tlv_c.ts1, &tlv_c.ts3, &tlv_c.ts3))
 						;
@@ -271,8 +275,12 @@
 						caps |= 1 << cid;
 						if (cid == CAP_UTF)
 							user_private_item_set_int(u, "utf", 1);
+					} else if ((cid = icq_xstatus_id(data))) {
+						user_private_item_set_int(u, "xstatus", cid);
 					} else {
-						/* client id???*/
+						/* ?wo? client id???*/
+						debug_error("Unknown cap\n");
+						icq_hexdump(DEBUG_ERROR, data, 0x10);
 					}
 					data  += 0x10;		// capability length
 					d_len -= 0x10;



Więcej informacji o liście dyskusyjnej ekg2-commit