[ekg2-commit] r4266 - trunk/plugins/icq: trunk/plugins/icq/icq.c trunk/plugins/icq/icq_snac_handlers_15extension.c trunk/plugins/icq/misc.c

SVN commit svn w toxygen.net
Sob, 9 Sie 2008, 23:41:47 CEST


Author: wiechu
Date: 2008-08-09 23:41:47 +0200 (Sat, 09 Aug 2008)
New Revision: 4266

Modified:
   trunk/plugins/icq/icq.c
   trunk/plugins/icq/icq_snac_handlers_15extension.c
   trunk/plugins/icq/misc.c
Log:
    - add whitespaces to icq_unpack_common() format
    - fix icq_snac_extension_userfound_common()

Modified: trunk/plugins/icq/icq.c
===================================================================
--- trunk/plugins/icq/icq.c	2008-08-09 21:03:46 UTC (rev 4265)
+++ trunk/plugins/icq/icq.c	2008-08-09 21:41:47 UTC (rev 4266)
@@ -1,5 +1,6 @@
 /*
  *  (C) Copyright 2006-2008 Jakub Zawadzki <darkjames w darkjames.ath.cx>
+ *                     2008 Wiesław Ochmiński <wiechu w wiechu.com>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License Version 2 as
@@ -1004,7 +1005,7 @@
 	const char *last_name = NULL;
 	const char *first_name = NULL;
 	int only_online = 0;
-	int gender = 0;	/* XXX? 1-> female, 2->male. check. */
+	int gender = 0;
 
 	char **argv;
 	int i;

Modified: trunk/plugins/icq/icq_snac_handlers_15extension.c
===================================================================
--- trunk/plugins/icq/icq_snac_handlers_15extension.c	2008-08-09 21:03:46 UTC (rev 4265)
+++ trunk/plugins/icq/icq_snac_handlers_15extension.c	2008-08-09 21:41:47 UTC (rev 4266)
@@ -6,6 +6,7 @@
  *
  * ekg2 port:
  *  (C) Copyright 2006-2008 Jakub Zawadzki <darkjames w darkjames.ath.cx>
+ *                     2008 Wiesław Ochmiński <wiechu w wiechu.com>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License Version 2 as
@@ -317,9 +318,13 @@
 	char *email = NULL;
 	char *full_name;
 	char *temp;
+	const char *__age = NULL;
+	const char *__gender = "";
+	const char *__active = "";
 
 	uint32_t uin;
 	uint16_t len2;
+	uint8_t auth, status, gender, age;
 
 	debug_function("icq_snac_extension_userfound()\n");
 
@@ -357,10 +362,15 @@
 	else
 		full_name = xstrdup(first_name[0] ? first_name : last_name);
 
-#define birthyear	NULL
-#define gender		""
-#define active		""
-
+	if (ICQ_UNPACK(&buf, "cc x cc", &auth, &status, &gender, &age)) {
+		if (age)
+			__age = itoa(age);		// XXX calculate birthyear?
+		if (gender)
+			__gender = (gender==2) ? "m" : "f";
+	} else {
+		debug_error("icq_snac_extension_userfound_common() broken\n");
+		auth = status = gender = age = 0;
+	}
 	/* XXX, "search_results_multi", "search_results_single" */
 	/* XXX, instead of email we had city */
 	/* XXX, some time ago i was thinking to of function which
@@ -384,11 +394,10 @@
 	 */
 
 	print_info(NULL, s, "search_results_multi", itoa(uin), full_name, nickname, email,
-			birthyear ? birthyear : ("-"), gender, active);
+			__age ? __age : ("-"), __gender, __active);
 
 	xfree(full_name);
 
-	/* ?WO? gender, age, etc... ??? */
 	icq_hexdump(DEBUG_WHITE, buf, len);
 #if 0
 	// Authentication needed flag
@@ -480,6 +489,11 @@
 }
 
 SNAC_SUBHANDLER(icq_snac_extension_replyreq) {
+	/*
+	 * Handle SNAC(0x15, 0x3) -- Meta information response
+	 *
+	 */
+
 	struct {
 		uint16_t len;
 		uint32_t uid;

Modified: trunk/plugins/icq/misc.c
===================================================================
--- trunk/plugins/icq/misc.c	2008-08-09 21:03:46 UTC (rev 4265)
+++ trunk/plugins/icq/misc.c	2008-08-09 21:41:47 UTC (rev 4266)
@@ -382,6 +382,12 @@
 				len -= 2;
 				break;
 
+			case ' ':	/* skip whitespaces */
+			case 0x09:
+			case 0x0A:
+			case 0x0D:
+				break;
+
 			default:
 				debug_error("icq_unpack() unknown format: %c\n", *format);
 				goto err2;



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