changeset 25149:7da3cf2530b7

2009.02.21 - flos <lonicerae(at)gmail.com> * Added 'qq_strlen' and 'qq_strcmp' funtions in qq.h * Fixed compiling problems with lower version of GTK+
author SHiNE CsyFeK <csyfek@gmail.com>
date Tue, 24 Feb 2009 13:15:34 +0000
parents 59ed7712be5e
children d673ccc44a6e
files libpurple/protocols/qq/ChangeLog libpurple/protocols/qq/buddy_info.c libpurple/protocols/qq/buddy_info.h libpurple/protocols/qq/buddy_list.c libpurple/protocols/qq/buddy_list.h libpurple/protocols/qq/buddy_memo.c libpurple/protocols/qq/buddy_memo.h libpurple/protocols/qq/group_info.c libpurple/protocols/qq/group_info.h libpurple/protocols/qq/qq.c libpurple/protocols/qq/qq.h libpurple/protocols/qq/qq_network.c libpurple/protocols/qq/qq_network.h libpurple/protocols/qq/qq_process.c libpurple/protocols/qq/qq_process.h libpurple/protocols/qq/qq_trans.c libpurple/protocols/qq/qq_trans.h
diffstat 17 files changed, 50 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/qq/ChangeLog	Fri Feb 20 18:00:32 2009 +0000
+++ b/libpurple/protocols/qq/ChangeLog	Tue Feb 24 13:15:34 2009 +0000
@@ -1,3 +1,7 @@
+2009.02.21 - flos <lonicerae(at)gmail.com>
+	* Added 'qq_strlen' and 'qq_strcmp' funtions in qq.h
+	* Fixed compiling problems with lower version of GTK+
+
 2009.02.21 - flos <lonicerae(at)gmail.com>
 	* Rewrite whole buddy memo part
 	* Remove 'qq_to_utf8_len' and 'utf8_to_qq_len' functions in char_conv.c
--- a/libpurple/protocols/qq/buddy_info.c	Fri Feb 20 18:00:32 2009 +0000
+++ b/libpurple/protocols/qq/buddy_info.c	Tue Feb 24 13:15:34 2009 +0000
@@ -222,7 +222,7 @@
 }
 
 void qq_request_buddy_info(PurpleConnection *gc, guint32 uid,
-		gint update_class, int action)
+		guint32 update_class, int action)
 {
 	qq_data *qd;
 	gchar raw_data[16] = {0};
@@ -752,7 +752,7 @@
 	qq_send_cmd(gc, QQ_CMD_GET_LEVEL, buf, bytes);
 }
 
-void qq_request_get_buddies_level(PurpleConnection *gc, gint update_class)
+void qq_request_get_buddies_level(PurpleConnection *gc, guint32 update_class)
 {
 	qq_data *qd = (qq_data *) gc->proto_data;
 	PurpleBuddy *buddy;
--- a/libpurple/protocols/qq/buddy_info.h	Fri Feb 20 18:00:32 2009 +0000
+++ b/libpurple/protocols/qq/buddy_info.h	Tue Feb 24 13:15:34 2009 +0000
@@ -79,14 +79,14 @@
 void qq_change_icon_cb(PurpleConnection *gc, const char *filepath);
 
 void qq_request_buddy_info(PurpleConnection *gc, guint32 uid,
-		gint update_class, int action);
+		guint32 update_class, int action);
 void qq_set_custom_icon(PurpleConnection *gc, PurpleStoredImage *img);
 void qq_process_change_info(PurpleConnection *gc, guint8 *data, gint data_len);
 void qq_process_get_buddy_info(guint8 *data, gint data_len, guint32 action, PurpleConnection *gc);
 
 void qq_request_get_level(PurpleConnection *gc, guint32 uid);
 void qq_request_get_level_2007(PurpleConnection *gc, guint32 uid);
-void qq_request_get_buddies_level(PurpleConnection *gc, gint update_class);
+void qq_request_get_buddies_level(PurpleConnection *gc, guint32 update_class);
 void qq_process_get_level_reply(guint8 *buf, gint buf_len, PurpleConnection *gc);
 
 void qq_update_buddy_icon(PurpleAccount *account, const gchar *who, gint face);
--- a/libpurple/protocols/qq/buddy_list.c	Fri Feb 20 18:00:32 2009 +0000
+++ b/libpurple/protocols/qq/buddy_list.c	Tue Feb 24 13:15:34 2009 +0000
@@ -56,7 +56,7 @@
 } qq_buddy_online;
 
 /* get a list of online_buddies */
-void qq_request_get_buddies_online(PurpleConnection *gc, guint8 position, gint update_class)
+void qq_request_get_buddies_online(PurpleConnection *gc, guint8 position, guint32 update_class)
 {
 	qq_data *qd;
 	guint8 *raw_data;
@@ -82,7 +82,7 @@
 
 /* position starts with 0x0000,
  * server may return a position tag if list is too long for one packet */
-void qq_request_get_buddies(PurpleConnection *gc, guint16 position, gint update_class)
+void qq_request_get_buddies(PurpleConnection *gc, guint16 position, guint32 update_class)
 {
 	qq_data *qd;
 	guint8 raw_data[16] = {0};
@@ -106,7 +106,7 @@
 }
 
 /* get all list, buddies & Quns with groupsid support */
-void qq_request_get_buddies_and_rooms(PurpleConnection *gc, guint32 position, gint update_class)
+void qq_request_get_buddies_and_rooms(PurpleConnection *gc, guint32 position, guint32 update_class)
 {
 	guint8 raw_data[16] = {0};
 	gint bytes = 0;
@@ -462,7 +462,7 @@
 }
 
 /* send a packet to change my online status */
-void qq_request_change_status(PurpleConnection *gc, gint update_class)
+void qq_request_change_status(PurpleConnection *gc, guint32 update_class)
 {
 	qq_data *qd;
 	guint8 raw_data[16] = {0};
--- a/libpurple/protocols/qq/buddy_list.h	Fri Feb 20 18:00:32 2009 +0000
+++ b/libpurple/protocols/qq/buddy_list.h	Tue Feb 24 13:15:34 2009 +0000
@@ -40,16 +40,16 @@
 	guint8 unknown_key[QQ_KEY_LENGTH];
 } qq_buddy_status;
 
-void qq_request_get_buddies_online(PurpleConnection *gc, guint8 position, gint update_class);
+void qq_request_get_buddies_online(PurpleConnection *gc, guint8 position, guint32 update_class);
 guint8 qq_process_get_buddies_online(guint8 *data, gint data_len, PurpleConnection *gc);
 
-void qq_request_get_buddies(PurpleConnection *gc, guint16 position, gint update_class);
+void qq_request_get_buddies(PurpleConnection *gc, guint16 position, guint32 update_class);
 guint16 qq_process_get_buddies(guint8 *data, gint data_len, PurpleConnection *gc);
 
-void qq_request_get_buddies_and_rooms(PurpleConnection *gc, guint32 position, gint update_class);
+void qq_request_get_buddies_and_rooms(PurpleConnection *gc, guint32 position, guint32 update_class);
 guint32 qq_process_get_buddies_and_rooms(guint8 *data, gint data_len, PurpleConnection *gc);
 
-void qq_request_change_status(PurpleConnection *gc, gint update_class);
+void qq_request_change_status(PurpleConnection *gc, guint32 update_class);
 void qq_process_change_status(guint8 *data, gint data_len, PurpleConnection *gc);
 void qq_process_buddy_change_status(guint8 *data, gint data_len, PurpleConnection *gc);
 
--- a/libpurple/protocols/qq/buddy_memo.c	Fri Feb 20 18:00:32 2009 +0000
+++ b/libpurple/protocols/qq/buddy_memo.c	Tue Feb 24 13:15:34 2009 +0000
@@ -171,7 +171,7 @@
 		else {
 			value = utf8_to_qq(utf8_str, QQ_CHARSET_DEFAULT);
 			/* Warnning: value will be string "(NULL)" instead of NULL */
-			if (!g_strcmp0("(NULL)", value)) {
+			if (!qq_strcmp("(NULL)", value)) {
 				value = g_strdup("");
 			}
 		}
@@ -321,7 +321,7 @@
 }
 
 /* request buddy memo */
-void qq_request_buddy_memo(PurpleConnection *gc, guint32 bd_uid, gint update_class, int action)
+void qq_request_buddy_memo(PurpleConnection *gc, guint32 bd_uid, guint32 update_class, int action)
 {
 	guint8 raw_data[16] = {0};
 	gint bytes;
--- a/libpurple/protocols/qq/buddy_memo.h	Fri Feb 20 18:00:32 2009 +0000
+++ b/libpurple/protocols/qq/buddy_memo.h	Tue Feb 24 13:15:34 2009 +0000
@@ -18,7 +18,7 @@
 
 void qq_process_get_buddy_memo(PurpleConnection *gc, guint8* data, gint data_len, guint32 action);
 
-void qq_request_buddy_memo(PurpleConnection *gc, guint32 bd_uid, gint update_class, int action);
+void qq_request_buddy_memo(PurpleConnection *gc, guint32 bd_uid, guint32 update_class, int action);
 
 void qq_create_buddy_memo(PurpleConnection *gc, guint32 bd_uid, int action);
 
--- a/libpurple/protocols/qq/group_info.c	Fri Feb 20 18:00:32 2009 +0000
+++ b/libpurple/protocols/qq/group_info.c	Tue Feb 24 13:15:34 2009 +0000
@@ -65,7 +65,7 @@
 }
 
 /* send packet to get info for each group member */
-gint qq_request_room_get_buddies(PurpleConnection *gc, guint32 room_id, gint update_class)
+gint qq_request_room_get_buddies(PurpleConnection *gc, guint32 room_id, guint32 update_class)
 {
 	guint8 *raw_data;
 	gint bytes, num;
--- a/libpurple/protocols/qq/group_info.h	Fri Feb 20 18:00:32 2009 +0000
+++ b/libpurple/protocols/qq/group_info.h	Tue Feb 24 13:15:34 2009 +0000
@@ -34,7 +34,7 @@
 	QQ_ROOM_INFO_DISPLAY
 };
 
-gint qq_request_room_get_buddies(PurpleConnection *gc, guint32 room_id, gint update_class);
+gint qq_request_room_get_buddies(PurpleConnection *gc, guint32 room_id, guint32 update_class);
 
 void qq_process_room_cmd_get_info(guint8 *data, gint len, guint32 action, PurpleConnection *gc);
 void qq_process_room_cmd_get_onlines(guint8 *data, gint len, PurpleConnection *gc);
--- a/libpurple/protocols/qq/qq.c	Fri Feb 20 18:00:32 2009 +0000
+++ b/libpurple/protocols/qq/qq.c	Tue Feb 24 13:15:34 2009 +0000
@@ -851,7 +851,7 @@
 	purple_debug_info("QQ", "alias=%s\n", alias);
 	purple_debug_info("QQ", "server_alias=%s\n", server_alias);
 
-	if (!g_strcmp0(alias, server_alias)) {
+	if (!qq_strcmp(alias, server_alias)) {
 		qq_create_buddy_memo(gc, bd_uid, QQ_BUDDY_MEMO_MODIFY);
 	}
 }
--- a/libpurple/protocols/qq/qq.h	Fri Feb 20 18:00:32 2009 +0000
+++ b/libpurple/protocols/qq/qq.h	Tue Feb 24 13:15:34 2009 +0000
@@ -36,6 +36,10 @@
 
 #define QQ_KEY_LENGTH       16
 
+/* steal from kazehakase :) */
+#define qq_strlen(s) ((s)!=NULL?strlen(s):0)
+#define qq_strcmp(s1,s2) ((s1)!=NULL && (s2)!=NULL?strcmp(s1,s2):0)
+
 typedef struct _qq_data qq_data;
 typedef struct _qq_buddy_data qq_buddy_data;
 typedef struct _qq_interval qq_interval;
--- a/libpurple/protocols/qq/qq_network.c	Fri Feb 20 18:00:32 2009 +0000
+++ b/libpurple/protocols/qq/qq_network.c	Tue Feb 24 13:15:34 2009 +0000
@@ -268,7 +268,7 @@
 	guint16 seq;		/* May be ack_seq or send_seq, depends on cmd */
 	guint8 room_cmd;
 	guint32 room_id;
-	gint update_class;
+	guint32 update_class;
 	guint32 ship32;
 	int ret;
 
@@ -1130,7 +1130,8 @@
 
 /* Encrypt data with session_key, and send packet out */
 static gint send_cmd_detail(PurpleConnection *gc, guint16 cmd, guint16 seq,
-	guint8 *data, gint data_len, gboolean is_save2trans, gint update_class, guint32 ship32)
+	guint8 *data, gint data_len, gboolean is_save2trans,
+        guint32 update_class, guint32 ship32)
 {
 	qq_data *qd;
 	guint8 *encrypted;
@@ -1160,7 +1161,7 @@
 }
 
 gint qq_send_cmd_mess(PurpleConnection *gc, guint16 cmd, guint8 *data, gint data_len,
-		gint update_class, guint32 ship32)
+		guint32 update_class, guint32 ship32)
 {
 	qq_data *qd;
 	guint16 seq;
@@ -1234,7 +1235,7 @@
 }
 
 static gint send_room_cmd(PurpleConnection *gc, guint8 room_cmd, guint32 room_id,
-		guint8 *data, gint data_len, gint update_class, guint32 ship32)
+		guint8 *data, gint data_len, guint32 update_class, guint32 ship32)
 {
 	qq_data *qd;
 	guint8 *buf;
@@ -1288,7 +1289,7 @@
 }
 
 gint qq_send_room_cmd_mess(PurpleConnection *gc, guint8 room_cmd, guint32 room_id,
-		guint8 *data, gint data_len, gint update_class, guint32 ship32)
+		guint8 *data, gint data_len, guint32 update_class, guint32 ship32)
 {
 	g_return_val_if_fail(room_cmd > 0, -1);
 	return send_room_cmd(gc, room_cmd, room_id, data, data_len, update_class, ship32);
--- a/libpurple/protocols/qq/qq_network.h	Fri Feb 20 18:00:32 2009 +0000
+++ b/libpurple/protocols/qq/qq_network.h	Tue Feb 24 13:15:34 2009 +0000
@@ -39,7 +39,7 @@
 		guint8 *encrypted_data, gint encrypted_len, gboolean is_save2trans);
 gint qq_send_cmd(PurpleConnection *gc, guint16 cmd, guint8 *data, gint datalen);
 gint qq_send_cmd_mess(PurpleConnection *gc, guint16 cmd, guint8 *data, gint data_len,
-		gint update_class, guint32 ship32);
+		guint32 update_class, guint32 ship32);
 
 gint qq_send_server_reply(PurpleConnection *gc, guint16 cmd, guint16 seq,
 		guint8 *data, gint data_len);
@@ -47,7 +47,7 @@
 gint qq_send_room_cmd(PurpleConnection *gc, guint8 room_cmd, guint32 room_id,
 		guint8 *data, gint data_len);
 gint qq_send_room_cmd_mess(PurpleConnection *gc, guint8 room_cmd, guint32 room_id,
-		guint8 *data, gint data_len, gint update_class, guint32 ship32);
+		guint8 *data, gint data_len, guint32 update_class, guint32 ship32);
 gint qq_send_room_cmd_only(PurpleConnection *gc, guint8 room_cmd, guint32 room_id);
 gint qq_send_room_cmd_noid(PurpleConnection *gc, guint8 room_cmd,
 		guint8 *data, gint data_len);
--- a/libpurple/protocols/qq/qq_process.c	Fri Feb 20 18:00:32 2009 +0000
+++ b/libpurple/protocols/qq/qq_process.c	Tue Feb 24 13:15:34 2009 +0000
@@ -741,7 +741,7 @@
 
 void qq_proc_room_cmds(PurpleConnection *gc, guint16 seq,
 		guint8 room_cmd, guint32 room_id, guint8 *rcved, gint rcved_len,
-		gint update_class, guint32 ship32)
+		guint32 update_class, guint32 ship32)
 {
 	qq_data *qd;
 	guint8 *data;
@@ -877,7 +877,7 @@
 }
 
 guint8 qq_proc_login_cmds(PurpleConnection *gc,  guint16 cmd, guint16 seq,
-		guint8 *rcved, gint rcved_len, gint update_class, guint32 ship32)
+		guint8 *rcved, gint rcved_len, guint32 update_class, guint32 ship32)
 {
 	qq_data *qd;
 	guint8 *data = NULL;
@@ -1029,7 +1029,7 @@
 }
 
 void qq_proc_client_cmds(PurpleConnection *gc, guint16 cmd, guint16 seq,
-		guint8 *rcved, gint rcved_len, gint update_class, guint32 ship32)
+		guint8 *rcved, gint rcved_len, guint32 update_class, guint32 ship32)
 {
 	qq_data *qd;
 
--- a/libpurple/protocols/qq/qq_process.h	Fri Feb 20 18:00:32 2009 +0000
+++ b/libpurple/protocols/qq/qq_process.h	Tue Feb 24 13:15:34 2009 +0000
@@ -39,12 +39,12 @@
 };
 
 guint8 qq_proc_login_cmds(PurpleConnection *gc,  guint16 cmd, guint16 seq,
-		guint8 *rcved, gint rcved_len, gint update_class, guint32 ship32);
+		guint8 *rcved, gint rcved_len, guint32 update_class, guint32 ship32);
 void qq_proc_client_cmds(PurpleConnection *gc, guint16 cmd, guint16 seq,
-		guint8 *rcved, gint rcved_len, gint update_class, guint32 ship32);
+		guint8 *rcved, gint rcved_len, guint32 update_class, guint32 ship32);
 void qq_proc_room_cmds(PurpleConnection *gc, guint16 seq,
 		guint8 room_cmd, guint32 room_id, guint8 *rcved, gint rcved_len,
-		gint update_class, guint32 ship32);
+		guint32 update_class, guint32 ship32);
 
 void qq_proc_server_cmd(PurpleConnection *gc, guint16 cmd, guint16 seq, guint8 *rcved, gint rcved_len);
 
--- a/libpurple/protocols/qq/qq_trans.c	Fri Feb 20 18:00:32 2009 +0000
+++ b/libpurple/protocols/qq/qq_trans.c	Tue Feb 24 13:15:34 2009 +0000
@@ -58,7 +58,7 @@
 	gint rcved_times;
 	gint scan_times;
 
-	gint update_class;
+	guint32 update_class;
 	guint32 ship32;
 };
 
@@ -94,20 +94,20 @@
 	return trans->room_id;
 }
 
-gint qq_trans_get_class(qq_transaction *trans)
+guint32 qq_trans_get_class(qq_transaction *trans)
 {
 	g_return_val_if_fail(trans != NULL, QQ_CMD_CLASS_NONE);
 	return trans->update_class;
 }
 
-gint qq_trans_get_ship(qq_transaction *trans)
+guint32 qq_trans_get_ship(qq_transaction *trans)
 {
 	g_return_val_if_fail(trans != NULL, 0);
 	return trans->ship32;
 }
 
 static qq_transaction *trans_create(PurpleConnection *gc, gint fd,
-	guint16 cmd, guint16 seq, guint8 *data, gint data_len, gint update_class, guint32 ship32)
+	guint16 cmd, guint16 seq, guint8 *data, gint data_len, guint32 update_class, guint32 ship32)
 {
 	qq_data *qd;
 	qq_transaction *trans;
@@ -179,7 +179,7 @@
 }
 
 void qq_trans_add_client_cmd(PurpleConnection *gc,
-	guint16 cmd, guint16 seq, guint8 *data, gint data_len, gint update_class, guint32 ship32)
+	guint16 cmd, guint16 seq, guint8 *data, gint data_len, guint32 update_class, guint32 ship32)
 {
 	qq_data *qd = (qq_data *)gc->proto_data;
 	qq_transaction *trans = trans_create(gc, qd->fd, cmd, seq, data, data_len, update_class, ship32);
@@ -219,7 +219,7 @@
 
 void qq_trans_add_room_cmd(PurpleConnection *gc,
 		guint16 seq, guint8 room_cmd, guint32 room_id, guint8 *data, gint data_len,
-		gint update_class, guint32 ship32)
+		guint32 update_class, guint32 ship32)
 {
 	qq_data *qd = (qq_data *)gc->proto_data;
 	qq_transaction *trans = trans_create(gc, qd->fd, QQ_CMD_ROOM, seq, data, data_len,
--- a/libpurple/protocols/qq/qq_trans.h	Fri Feb 20 18:00:32 2009 +0000
+++ b/libpurple/protocols/qq/qq_trans.h	Tue Feb 24 13:15:34 2009 +0000
@@ -35,14 +35,14 @@
 gboolean qq_trans_is_dup(qq_transaction *trans);
 guint8 qq_trans_get_room_cmd(qq_transaction *trans);
 guint32 qq_trans_get_room_id(qq_transaction *trans);
-gint qq_trans_get_class(qq_transaction *trans);
-gint qq_trans_get_ship(qq_transaction *trans);
+guint32 qq_trans_get_class(qq_transaction *trans);
+guint32 qq_trans_get_ship(qq_transaction *trans);
 
 void qq_trans_add_client_cmd(PurpleConnection *gc, guint16 cmd, guint16 seq,
-		guint8 *data, gint data_len, gint update_class, guint32 ship32);
+		guint8 *data, gint data_len, guint32 update_class, guint32 ship32);
 void qq_trans_add_room_cmd(PurpleConnection *gc,
 		guint16 seq, guint8 room_cmd, guint32 room_id,
-		guint8 *data, gint data_len, gint update_class, guint32 ship32);
+		guint8 *data, gint data_len, guint32 update_class, guint32 ship32);
 void qq_trans_add_server_cmd(PurpleConnection *gc, guint16 cmd, guint16 seq,
 	guint8 *rcved, gint rcved_len);
 void qq_trans_add_server_reply(PurpleConnection *gc, guint16 cmd, guint16 seq,