gobjectification: 014c75a9: Fix QQ compile.

qulogic at pidgin.im qulogic at pidgin.im
Tue Aug 12 00:56:09 EDT 2008


-----------------------------------------------------------------
Revision: 014c75a99463f0a83906538aa28b5b8262d4a402
Ancestor: 885e7f25fe0a3b2510605ace5d58038cd697e54c
Author: qulogic at pidgin.im
Date: 2008-08-11T07:08:25
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/014c75a99463f0a83906538aa28b5b8262d4a402

Modified files:
        libpurple/protocols/qq/group_info.c
        libpurple/protocols/qq/qq.c libpurple/protocols/qq/qq_base.c
        libpurple/protocols/qq/qq_network.c
        libpurple/protocols/qq/qq_process.c
        libpurple/protocols/qq/utils.c

ChangeLog: 

Fix QQ compile.

-------------- next part --------------
============================================================
--- libpurple/protocols/qq/group_info.c	e9eb446a0a171ae7a3d13a5f1bbe2cfaa03f50e9
+++ libpurple/protocols/qq/group_info.c	3a64a96d614b53e79c396d7307f0cd7649a61704
@@ -71,8 +71,9 @@ void qq_send_cmd_group_all_get_online_me
 	qq_group *group;
 	GList *list;
 
-	g_return_if_fail(gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	list = qd->groups;
 	while (list != NULL) {
============================================================
--- libpurple/protocols/qq/qq.c	09f6b9a47e5d7083ce0cdb351ff88b64446735b1
+++ libpurple/protocols/qq/qq.c	71fb2598b8d6c43aa2cf33eda579232024801dee
@@ -516,7 +516,7 @@ static void _qq_menu_show_login_info(Pur
 	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	info = g_string_new("<html><body>\n");
 
-	g_string_append_printf(info, _("<b>Current Online</b>: %d<br>\n"), qd->all_online);
+	g_string_append_printf(info, _("<b>Current Online</b>: %d<br>\n"), qd->total_online);
 	g_string_append_printf(info, _("<b>Last Refresh</b>: %s<br>\n"), ctime(&qd->last_get_online));
 
 	g_string_append(info, "<hr>\n");
@@ -524,7 +524,7 @@ static void _qq_menu_show_login_info(Pur
 	g_string_append_printf(info, _("<b>Server</b>: %s: %d<br>\n"), qd->server_name, qd->real_port);
 	g_string_append_printf(info, _("<b>Connection Mode</b>: %s<br>\n"), qd->use_tcp ? "TCP" : "UDP");
 	g_string_append_printf(info, _("<b>Real hostname</b>: %s: %d<br>\n"), qd->real_hostname, qd->real_port);
-	g_string_append_printf(info, _("<b>My Public IP</b>: %s<br>\n"), qd->my_ip);
+	g_string_append_printf(info, _("<b>My Public IP</b>: %s<br>\n"), inet_ntoa(qd->my_ip));
 
 	g_string_append(info, "<hr>\n");
 	g_string_append(info, "<i>Information below may not be accurate</i><br>\n");
============================================================
--- libpurple/protocols/qq/qq_base.c	529b343ed51bb7740d680c11e73b2f473bca9d48
+++ libpurple/protocols/qq/qq_base.c	6236c82e103b8756d9b192080eb35432fba2461d
@@ -153,7 +153,7 @@ static gint8 process_login_ok(PurpleConn
 	qq_data *qd;
 	qq_login_reply_ok_packet lrop;
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	/* FIXME, check QQ_LOGIN_REPLY_OK_PACKET_LEN here */
 	bytes = 0;
 
@@ -225,7 +225,7 @@ static gint8 process_login_redirect(Purp
 	gint bytes;
 	qq_login_reply_redirect_packet lrrp;
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	bytes = 0;
 	/* 000-000: reply code */
 	bytes += qq_get8(&lrrp.result, data + bytes);
@@ -277,8 +277,9 @@ void qq_send_packet_token(PurpleConnecti
 	guint8 buf[16] = {0};
 	gint bytes = 0;
 
-	g_return_if_fail(gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	bytes += qq_put8(buf + bytes, 0);
 	
@@ -295,8 +296,9 @@ void qq_send_packet_login(PurpleConnecti
 	guint8 *encrypted_data;
 	gint encrypted_len;
 
-	g_return_if_fail(gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	g_return_if_fail(qd->token != NULL && qd->token_len > 0);
 
@@ -360,8 +362,9 @@ guint8 qq_process_token_reply(PurpleConn
 
 	g_return_val_if_fail(buf != NULL && buf_len != 0, -1);
 
-	g_return_val_if_fail(gc != NULL  && gc->proto_data != NULL, -1);
-	qd = (qq_data *) gc->proto_data;
+	g_return_val_if_fail(gc != NULL, -1);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_val_if_fail(qd != NULL, -1);
 
 	ret = buf[0];
 	
@@ -400,7 +403,7 @@ void qq_send_packet_logout(PurpleConnect
 	gint i;
 	qq_data *qd;
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	for (i = 0; i < 4; i++)
 		qq_send_cmd_detail(qd, QQ_CMD_LOGOUT, 0xffff, FALSE, qd->password_twice_md5, QQ_KEY_LENGTH);
 
@@ -415,7 +418,7 @@ guint8 qq_process_login_reply(guint8 *da
 
 	g_return_val_if_fail(data != NULL && data_len != 0, QQ_LOGIN_REPLY_ERR_MISC);
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	switch (data[0]) {
 		case QQ_LOGIN_REPLY_OK:
@@ -453,7 +456,7 @@ void qq_send_packet_keep_alive(PurpleCon
 	guint8 raw_data[16] = {0};
 	gint bytes= 0;
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	/* In fact, we can send whatever we like to server
 	 * with this command, server return the same result including
@@ -471,7 +474,7 @@ gboolean qq_process_keep_alive(guint8 *d
 
 	g_return_val_if_fail(data != NULL && data_len != 0, FALSE);
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	/* qq_show_packet("Keep alive reply packet", data, len); */
 
============================================================
--- libpurple/protocols/qq/qq_network.c	31954b419164b311179b092b612ab9ab14bfb731
+++ libpurple/protocols/qq/qq_network.c	71689b7f22d9f342a99dd0b5373000c2df0c03e8
@@ -1091,8 +1091,9 @@ gint qq_send_room_cmd(PurpleConnection *
 	gint bytes_sent;
 	guint16 seq;
 	
-	g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1);
-	qd = (qq_data *) gc->proto_data;
+	g_return_val_if_fail(gc != NULL, -1);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_val_if_fail(qd != NULL, -1);
 
 	buf = g_newa(guint8, MAX_PACKET_SIZE);
 	memset(buf, 0, MAX_PACKET_SIZE);
============================================================
--- libpurple/protocols/qq/qq_process.c	9dfd5fbbb3544fd5b8f71905085661c643d1a563
+++ libpurple/protocols/qq/qq_process.c	17285fc09bc6dde9423462e2b8dee74a1921d2e9
@@ -74,7 +74,7 @@ static void process_cmd_unknow(PurpleCon
 
 	qq_show_packet(title, data, data_len);
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	qq_hex_dump(PURPLE_DEBUG_WARNING, "QQ",
 			data, data_len,
@@ -96,8 +96,9 @@ void qq_proc_cmd_server(PurpleConnection
 	guint8 *data;
 	gint data_len;
 
-	g_return_if_fail (gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail (gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail (qd != NULL);
 
 	data = g_newa(guint8, rcved_len);
 	data_len = qq_decrypt(data, rcved, rcved_len, qd->session_key);
@@ -138,15 +139,15 @@ static void process_cmd_login(PurpleConn
 	qq_data *qd;
 	guint ret_8;
 
-	g_return_if_fail (gc != NULL && gc->proto_data != NULL);
-	
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail (gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail (qd != NULL);
 
 	ret_8 = qq_process_login_reply(data, data_len, gc);
 	if (ret_8 == QQ_LOGIN_REPLY_OK) {
 		purple_debug(PURPLE_DEBUG_INFO, "QQ", "Login repliess OK; everything is fine\n");
 
-		purple_connection_set_state(gc, PURPLE_CONNECTED);
+		purple_connection_set_state(gc, PURPLE_CONNECTION_STATE_CONNECTED);
 		qd->logged_in = TRUE;	/* must be defined after sev_finish_login */
 
 		/* now initiate QQ Qun, do it first as it may take longer to finish */
@@ -180,8 +181,8 @@ static void process_cmd_login(PurpleConn
 	}
 
 	if (ret_8 == QQ_LOGIN_REPLY_ERR_PWD) {
-		if (!purple_account_get_remember_password(gc->account)) {
-			purple_account_set_password(gc->account, NULL);
+		if (!purple_account_get_remember_password(purple_connection_get_account(gc))) {
+			purple_account_set_password(purple_connection_get_account(gc), NULL);
 		}
 		purple_connection_error_reason(gc,
 			PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Incorrect password."));
@@ -233,8 +234,9 @@ void qq_proc_room_cmd_reply(PurpleConnec
 	gint bytes;
 	guint8 reply_cmd, reply;
 
-	g_return_if_fail (gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail (gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail (qd != NULL);
 
 	data = g_newa(guint8, rcved_len);
 	data_len = qq_decrypt(data, rcved, rcved_len, qd->session_key);
@@ -373,8 +375,9 @@ void qq_proc_cmd_reply(PurpleConnection 
 
 	g_return_if_fail(rcved_len > 0);
 
-	g_return_if_fail (gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail (gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail (qd != NULL);
 
 	data = g_newa(guint8, rcved_len);
 	if (cmd == QQ_CMD_TOKEN) {
============================================================
--- libpurple/protocols/qq/utils.c	9dc69d41de8ced4739e415b0894c7f9a52832847
+++ libpurple/protocols/qq/utils.c	3fc864586fb567e148fbf8e15c2e77e4d9417481
@@ -30,7 +30,7 @@
 #include "win32dep.h"
 #endif
 
-#include "cipher.h"
+#include "md5cipher.h"
 
 #include "char_conv.h"
 #include "debug.h"
@@ -55,16 +55,14 @@ void qq_get_md5(guint8 *md5, gint md5_le
 void qq_get_md5(guint8 *md5, gint md5_len, const guint8* const src, gint src_len)
 {
 	PurpleCipher *cipher;
-	PurpleCipherContext *context;
 
 	g_return_if_fail(md5 != NULL && md5_len > 0);
 	g_return_if_fail(src != NULL && src_len > 0);
 
-	cipher = purple_ciphers_find_cipher("md5");
-	context = purple_cipher_context_new(cipher, NULL);
-	purple_cipher_context_append(context, src, src_len);
-	purple_cipher_context_digest(context, md5_len, md5, NULL);
-	purple_cipher_context_destroy(context);
+	cipher = purple_md5_cipher_new();
+	purple_cipher_append(cipher, src, src_len);
+	purple_cipher_digest(cipher, md5_len, md5, NULL);
+	g_object_unref(G_OBJECT(cipher));
 }
 
 gchar *get_name_by_index_str(gchar **array, const gchar *index_str, gint amount)


More information about the Commits mailing list