pidgin.openq: 8b0581e9: 2011.02.06 - flos <lonicerae(at)gmail.co...

csyfek at gmail.com csyfek at gmail.com
Sun Feb 6 01:45:52 EST 2011


----------------------------------------------------------------------
Revision: 8b0581e99b8581a83bffeabd450221bf4314fb44
Parent:   54b4e76b47fbab4631b1ef3b529fe6699969d2bc
Author:   csyfek at gmail.com
Date:     02/06/11 01:43:26
Branch:   im.pidgin.pidgin.openq
URL: http://d.pidgin.im/viewmtn/revision/info/8b0581e99b8581a83bffeabd450221bf4314fb44

Changelog: 

2011.02.06 - flos <lonicerae(at)gmail.com>
* 'typedef struct _X {} X' cleaned
* added a check
* added some comment

Changes against parent 54b4e76b47fbab4631b1ef3b529fe6699969d2bc

  patched  libpurple/protocols/qq/file_trans.c
  patched  libpurple/protocols/qq/group.h
  patched  libpurple/protocols/qq/im.c
  patched  libpurple/protocols/qq/qq.h
  patched  libpurple/protocols/qq/qq_define.h
  patched  libpurple/protocols/qq/qq_network.c
  patched  libpurple/protocols/qq/qq_trans.c
  patched  libpurple/protocols/qq/qq_trans.h

-------------- next part --------------
============================================================
--- libpurple/protocols/qq/file_trans.c	23b0b55cc7bfec840a72fd04221526dc91376068
+++ libpurple/protocols/qq/file_trans.c	2d8030a56d144995061e3e8662a9aafad01b5c01
@@ -38,15 +38,13 @@
 #include "send_file.h"
 #include "utils.h"
 
-struct _qq_file_header {
+typedef struct _qq_file_header {
 	guint16 client_ver;
 	guint8 file_key;
 	UID sender_uid;
 	UID receiver_uid;
-};
+} qq_file_header;
 
-typedef struct _qq_file_header qq_file_header;
-
 static guint32 _get_file_key(guint8 seed)
 {
 	guint32 key;
============================================================
--- libpurple/protocols/qq/group.h	f425fa0f8e5024e9d87d19e39b50fb6d5217564c
+++ libpurple/protocols/qq/group.h	192871ebeb39bbcdeaa9eecd8dc5f21cb104311c
@@ -40,8 +40,7 @@ typedef enum {
 	QQ_ROOM_ROLE_ADMIN
 } qq_room_role;
 
-typedef struct _qq_room_data qq_room_data;
-struct _qq_room_data {
+typedef struct _qq_room_data {
 	/* all these will be saved when we exit Purple */
 	qq_room_role my_role;	/* my role for this room */
 	guint32 id;
@@ -57,7 +56,7 @@ struct _qq_room_data {
 
 	gboolean is_got_buddies;
 	GList *members;
-};
+} qq_room_data;
 
 GList *qq_chat_info(PurpleConnection *gc);
 GHashTable *qq_chat_info_defaults(PurpleConnection *gc, const gchar *chat_name);
============================================================
--- libpurple/protocols/qq/qq_define.h	2a705c60728583f3fb3af72e2abd6642d73c5663
+++ libpurple/protocols/qq/qq_define.h	3f176a87c5e5689e39ce5bb16eea91f3b4cce0a4
@@ -37,6 +37,7 @@
 #define QQ_CLIENT_111D 0x111D	/* QQ2007 */
 #define QQ_CLIENT_115B 0x115B	/* QQ2008 He Sui */
 #define QQ_CLIENT_1663 0x1663	/* QQ2009 Release */
+#define QQ_CLIENT_1801 0x1801	/* QQ2009 International Beta1 */
 
 const gchar *qq_get_ver_desc(gint source);
 
============================================================
--- libpurple/protocols/qq/im.c	b9f9939b150822fbc12cc3012d29140ff9e44563
+++ libpurple/protocols/qq/im.c	be262c256a9b323f86955f67af69f320ccc1458c
@@ -67,15 +67,14 @@ enum
 	QQ_NORMAL_IM_FILE_EX_NOTIFY_IP = 0x87
 };
 
-typedef struct _qq_im_header qq_im_header;
-struct _qq_im_header {
+typedef struct _qq_im_header {
 	/* this is the common part of normal_text */
 	guint16 version_from;
 	UID uid_from;
 	UID uid_to;
 	guint8 session_md5[QQ_KEY_LENGTH];
 	guint16 im_type;
-};
+} qq_im_header;
 
 /* read the common parts of the normal_im,
  * returns the bytes read if succeed, or -1 if there is any error */
@@ -93,11 +92,10 @@ static gint get_im_header(qq_im_header *
 	return bytes;
 }
 
-typedef struct _qq_emoticon qq_emoticon;
-struct _qq_emoticon {
+typedef struct _qq_emoticon {
 	guint8 symbol;
 	gchar *name;
-};
+} qq_emoticon;
 
 static gboolean emoticons_is_sorted = FALSE;
 /* Map for purple smiley convert to qq, need qsort */
============================================================
--- libpurple/protocols/qq/qq.h	994f0ee89e3352b71eef4c5af6b5812356f29941
+++ libpurple/protocols/qq/qq.h	5528688ea51f10d31ad0751ba7f39d53c1d8dd6b
@@ -43,22 +43,15 @@ typedef guint32 UID;
 typedef guint32 UPDCLS;
 typedef guint32 UID;
 
-typedef struct _qq_data qq_data;
-typedef struct _qq_buddy_data qq_buddy_data;
-typedef struct _qq_interval qq_interval;
-typedef struct _qq_net_stat qq_net_stat;
-typedef struct _qq_login_data qq_login_data;
-typedef struct _qq_captcha_data qq_captcha_data;
-
-struct _qq_captcha_data {
+typedef struct _qq_captcha_data {
 	guint8 *token;
 	guint16 token_len;
 	guint8 next_index;
 	guint8 *data;
 	guint16 data_len;
-};
+} qq_captcha_data;
 
-struct _qq_login_data {
+typedef struct _qq_login_data {
 	guint8 random_key[QQ_KEY_LENGTH];			/* first encrypt key generated by client */
 	guint8 *token;				/* get from server */
 	guint8 token_len;
@@ -71,23 +64,23 @@ struct _qq_login_data {
 	guint8 *login_token;
 	guint16 login_token_len;
 	guint8 login_key[QQ_KEY_LENGTH];
-};
+} qq_login_data;
 
-struct _qq_interval {
+typedef struct _qq_interval {
 	gint resend;
 	gint keep_alive;
 	gint update;
-};
+} qq_interval;
 
-struct _qq_net_stat {
+typedef struct _qq_net_stat {
 	glong sent;
 	glong resend;
 	glong lost;
 	glong rcved;
 	glong rcved_dup;
-};
+} qq_net_stat;
 
-struct _qq_buddy_data {
+typedef struct _qq_buddy_data {
 	UID uid;
 	guint16 face;		/* index: 0 - 299 */
 	guint8 age;
@@ -108,7 +101,7 @@ struct _qq_buddy_data {
 	gchar** memo;
 
 	gint8  role;		/* role in group, used only in group->members list */
-};
+} qq_buddy_data;
 
 typedef struct _qq_connection qq_connection;
 struct _qq_connection {
@@ -122,7 +115,7 @@ struct _qq_connection {
 	int tcp_rxlen;
 };
 
-struct _qq_data {
+typedef struct _qq_data {
 	PurpleConnection *gc;
 
 	GSList *openconns;
@@ -194,6 +187,6 @@ struct _qq_data {
 	guint32 custom;
 
 	guint16 send_im_id;		/* send IM sequence number */
-};
+} qq_data;
 
 #endif
============================================================
--- libpurple/protocols/qq/qq_network.c	23098527e28ce526f834df70924a4e8b94bcfc14
+++ libpurple/protocols/qq/qq_network.c	50797fae2b215d4eb71b21a0128ce71a3b4a5996
@@ -42,11 +42,11 @@
 #define QQ_DEFAULT_PORT					8000
 
 /* set QQ_CONNECT_MAX to 1, when test reconnecting */
-#define QQ_CONNECT_MAX						3
+#define QQ_CONNECT_MAX				3
 #define QQ_CONNECT_INTERVAL			2
-#define QQ_CONNECT_CHECK					5
-#define QQ_KEEP_ALIVE_INTERVAL		60
-#define QQ_TRANS_INTERVAL				10
+#define QQ_CONNECT_CHECK			5
+#define QQ_KEEP_ALIVE_INTERVAL			60
+#define QQ_TRANS_INTERVAL			10
 
 gboolean connect_to_server(PurpleConnection *gc, gchar *server, gint port);
 
@@ -63,6 +63,7 @@ static qq_connection *connection_create(
 
 static qq_connection *connection_create(qq_data *qd, int fd) {
 	qq_connection *ret = g_new0(qq_connection, 1);
+	g_return_val_if_fail(ret != NULL, NULL);
 	ret->fd = fd;
 	qd->openconns = g_slist_append(qd->openconns, ret);
 	return ret;
@@ -772,9 +773,14 @@ static void connect_cb(gpointer data, gi
 	}
 
 	/* _qq_show_socket("Got login socket", source); */
+	/* ok, already connected to the server */
 	qd->fd = source;
 	conn = connection_create(qd, source);
+	g_return_if_fail( conn != NULL );
+
 	if (qd->use_tcp) {
+		/* events which match "PURPLE_INPUT_READ" of
+		 * "source" would trigger the callback function */
 		conn->input_handler = purple_input_add(source, PURPLE_INPUT_READ, tcp_pending, gc);
 	} else {
 		conn->input_handler = purple_input_add(source, PURPLE_INPUT_READ, udp_pending, gc);
============================================================
--- libpurple/protocols/qq/qq_trans.c	b2e268c2fcf80bb2a4bad7093b9513fc40da7e01
+++ libpurple/protocols/qq/qq_trans.c	e181182f610d0af3a44603abc3a278b0808bf196
@@ -42,26 +42,7 @@ enum {
 	QQ_TRANS_IS_REPLY = 0x08				/* server command before login*/
 };
 
-struct _qq_transaction {
-	guint8 flag;
-	guint16 seq;
-	guint16 cmd;
 
-	guint8 room_cmd;
-	guint32 room_id;
-
-	guint8 *data;
-	gint data_len;
-
-	gint fd;
-	gint send_retries;
-	gint rcved_times;
-	gint scan_times;
-
-	UPDCLS update_class;
-	guint32 ship32;
-};
-
 gboolean qq_trans_is_server(qq_transaction *trans)
 {
 	g_return_val_if_fail(trans != NULL, FALSE);
============================================================
--- libpurple/protocols/qq/qq_trans.h	71426ee8a3a120b8bbbc768a24775cd5ed85420d
+++ libpurple/protocols/qq/qq_trans.h	8681dbb2995105cefb8c99a3199a71bde5f635f3
@@ -28,8 +28,26 @@
 #include <glib.h>
 #include "qq.h"
 
-typedef struct _qq_transaction qq_transaction;
+typedef struct _qq_transaction {
+	guint8 flag;
+	guint16 seq;
+	guint16 cmd;
 
+	guint8 room_cmd;
+	guint32 room_id;
+
+	guint8 *data;
+	gint data_len;
+
+	gint fd;
+	gint send_retries;
+	gint rcved_times;
+	gint scan_times;
+
+	UPDCLS update_class;
+	guint32 ship32;
+} qq_transaction;
+
 qq_transaction *qq_trans_find_rcved(PurpleConnection *gc, guint16 cmd, guint16 seq);
 gboolean qq_trans_is_server(qq_transaction *trans) ;
 gboolean qq_trans_is_dup(qq_transaction *trans);


More information about the Commits mailing list