changeset 14242:85f3808ca472

[gaim-migrate @ 16924] Got rid of a bunch of warnings. committer: Tailor Script <tailor@pidgin.im>
author Mark Huetsch <markhuetsch>
date Sun, 20 Aug 2006 23:16:44 +0000
parents c54ea2572de9
children 0fed2f42ab3e
files libgaim/protocols/qq/file_trans.c libgaim/protocols/qq/group_opt.c libgaim/protocols/qq/im.c libgaim/protocols/qq/qq.c libgaim/protocols/qq/send_core.h libgaim/protocols/qq/send_file.c libgaim/protocols/qq/send_file.h libgaim/protocols/qq/utils.c libgaim/protocols/qq/utils.h
diffstat 9 files changed, 49 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/protocols/qq/file_trans.c	Sun Aug 20 23:08:42 2006 +0000
+++ b/libgaim/protocols/qq/file_trans.c	Sun Aug 20 23:16:44 2006 +0000
@@ -38,8 +38,7 @@
 #include "proxy.h"
 #include "send_core.h"
 #include "send_file.h"
-
-extern gchar *hex_dump_to_str (const guint8 *buffer, gint bytes);
+#include "utils.h"
 
 struct _qq_file_header {
 	guint8 tag;
@@ -76,7 +75,7 @@
 	return (~uid) ^ key;
 }
 
-static void _fill_filename_md5(const gchar *filename, gchar *md5)
+static void _fill_filename_md5(const gchar *filename, guint8 *md5)
 {
 	GaimCipher *cipher;
 	GaimCipherContext *context;
@@ -90,7 +89,7 @@
 	gaim_cipher_context_destroy(context);
 }
 
-static void _fill_file_md5(const gchar *filename, gint filelen, gchar *md5)
+static void _fill_file_md5(const gchar *filename, gint filelen, guint8 *md5)
 {
 	FILE *fp;
 	guint8 *buffer;
@@ -274,7 +273,6 @@
 	bytes += create_packet_dw(buf, &cursor, _encrypt_qq_uid(to_uid, file_key));
 	bytes += create_packet_data(buf, &cursor, data, len);
 
-	ssize_t _qq_xfer_write(const char *buf, size_t len, GaimXfer *xfer);
 	if (bytes == len + 12) {
 		_qq_xfer_write(buf, bytes, qd->xfer);
 	} else
@@ -282,15 +280,12 @@
 	return bytes;
 }
 
-extern gchar *_gen_session_md5(gint uid, guint8 *session_key);
-
 /* send a file to udp channel with QQ_FILE_CONTROL_PACKET_TAG */
 void qq_send_file_ctl_packet(GaimConnection *gc, guint16 packet_type, guint32 to_uid, guint8 hellobyte)
 {
 	qq_data *qd;
 	gint bytes, bytes_expected, encrypted_len;
-	guint8 *raw_data, *cursor, *encrypted_data;
-	gchar *md5;
+	guint8 *raw_data, *cursor, *encrypted_data, *md5;
 	time_t now;
 	ft_info *info;
 	
@@ -393,9 +388,9 @@
 		guint32 fragment_index, guint16 seq, guint8 *data, gint len)
 {
 	gint bytes;
-	guint8 *raw_data, *cursor;
+	guint8 *raw_data, *cursor, filename_md5[QQ_KEY_LENGTH], file_md5[QQ_KEY_LENGTH];
 	guint32 fragment_size = 1000;
-	gchar file_md5[16], filename_md5[16], *filename;
+	gchar *filename;
 	gint filename_len, filesize;
 	qq_data *qd;
 	ft_info *info;
@@ -529,7 +524,7 @@
 	guint16 packet_type;
 	guint16 seq;
 	guint8 hellobyte;
-	gchar *md5;
+	guint8 *md5;
 	ft_info *info = (ft_info *) qd->xfer->data;
 
 	decrypted_data = g_newa(guint8, len);
--- a/libgaim/protocols/qq/group_opt.c	Sun Aug 20 23:08:42 2006 +0000
+++ b/libgaim/protocols/qq/group_opt.c	Sun Aug 20 23:16:44 2006 +0000
@@ -75,7 +75,7 @@
 	gint i;
 	for (i = 0; list[i] < 0xffffffff; i++) {;
 	}
-	_quick_sort(list, 0, i - 1);
+	_quick_sort((gint *) list, 0, i - 1);
 }
 
 static void _qq_group_member_opt(GaimConnection *gc, qq_group *group, gint operation, guint32 *members)
--- a/libgaim/protocols/qq/im.c	Sun Aug 20 23:08:42 2006 +0000
+++ b/libgaim/protocols/qq/im.c	Sun Aug 20 23:16:44 2006 +0000
@@ -23,7 +23,6 @@
 #include "conversation.h"
 #include "debug.h"
 #include "internal.h"
-#include "cipher.h"
 #include "notify.h"
 #include "server.h"
 #include "util.h"
@@ -209,27 +208,6 @@
 	}
 }
 
-/* generate a md5 key using uid and session_key */
-gchar *_gen_session_md5(gint uid, guint8 *session_key)
-{
-	guint8 *src, md5_str[QQ_KEY_LENGTH], *cursor;
-	GaimCipher *cipher;
-        GaimCipherContext *context;
-
-	src = g_newa(guint8, 20);
-	cursor = src;
-	create_packet_dw(src, &cursor, uid);
-	create_packet_data(src, &cursor, session_key, QQ_KEY_LENGTH);
-
-	cipher = gaim_ciphers_find_cipher("md5");
-	context = gaim_cipher_context_new(cipher, NULL);
-	gaim_cipher_context_append(context, src, 20);
-	gaim_cipher_context_digest(context, sizeof(md5_str), md5_str, NULL);
-	gaim_cipher_context_destroy(context);
-
-	return g_memdup(md5_str, QQ_KEY_LENGTH);
-}
-
 /* when we receive a message,
  * we send an ACK which is the first 16 bytes of incoming packet */
 static void _qq_send_packet_recv_im_ack(GaimConnection *gc, guint16 seq, guint8 *data)
@@ -449,11 +427,11 @@
 void qq_send_packet_im(GaimConnection *gc, guint32 to_uid, gchar *msg, gint type)
 {
 	qq_data *qd;
-	guint8 *cursor, *raw_data, *send_im_tail;
+	guint8 *cursor, *raw_data, *send_im_tail, *md5;
 	guint16 client_tag, normal_im_type;
 	gint msg_len, raw_len, font_name_len, tail_len, bytes;
 	time_t now;
-	gchar *md5, *msg_filtered;
+	gchar *msg_filtered;
 	GData *attribs;
 	gchar *font_size = NULL, *font_color = NULL, *font_name = NULL, *tmp;
 	gboolean is_bold = FALSE, is_italic = FALSE, is_underline = FALSE;
--- a/libgaim/protocols/qq/qq.c	Sun Aug 20 23:08:42 2006 +0000
+++ b/libgaim/protocols/qq/qq.c	Sun Aug 20 23:16:44 2006 +0000
@@ -511,10 +511,12 @@
 	g_string_free(info, TRUE);
 }
 
+/*
 static void _qq_menu_search_or_add_permanent_group(GaimPluginAction *action)
 {
 	gaim_roomlist_show_with_account(NULL);
 }
+*/
 
 /*
 static void _qq_menu_create_permanent_group(GaimPluginAction * action)
--- a/libgaim/protocols/qq/send_core.h	Sun Aug 20 23:08:42 2006 +0000
+++ b/libgaim/protocols/qq/send_core.h	Sun Aug 20 23:16:44 2006 +0000
@@ -33,5 +33,7 @@
 gint qq_send_cmd(GaimConnection *gc, guint16 cmd, gboolean is_auto_seq, guint16 seq, 
 		gboolean need_ack, guint8 *data, gint len);
 gint _qq_send_packet(GaimConnection * gc, guint8 *buf, gint len, guint16 cmd);
+gint _create_packet_head_seq(guint8 *buf, guint8 **cursor,
+		GaimConnection *gc, guint16 cmd, gboolean is_auto_seq, guint16 *seq);
 
 #endif
--- a/libgaim/protocols/qq/send_file.c	Sun Aug 20 23:08:42 2006 +0000
+++ b/libgaim/protocols/qq/send_file.c	Sun Aug 20 23:16:44 2006 +0000
@@ -166,6 +166,7 @@
 }
 
 /* start file transfer process */
+/*
 static void _qq_xfer_send_start (GaimXfer *xfer)
 {
 	GaimAccount *account;
@@ -176,7 +177,9 @@
 	gc = gaim_account_get_connection(account);
 	info = (ft_info *) xfer->data;
 }
+*/
 
+/*
 static void _qq_xfer_send_ack (GaimXfer *xfer, const char *buffer, size_t len)
 {
 	GaimAccount *account;
@@ -186,10 +189,13 @@
 	gc = gaim_account_get_connection(account);
 	qq_process_recv_file(gc, (guint8 *) buffer, len);
 }
+*/
 
+/*
 static void _qq_xfer_recv_start(GaimXfer *xfer)
 {
 }
+*/
 
 static void _qq_xfer_end(GaimXfer *xfer)
 {
@@ -269,15 +275,13 @@
 }
 
 
-extern gchar *_gen_session_md5(gint uid, guint8 *session_key);
-
 /* fill in the common information of file transfer */
 static gint _qq_create_packet_file_header
 (guint8 *raw_data, guint8 **cursor, guint32 to_uid, guint16 message_type, qq_data *qd, gboolean seq_ack)
 {
 	gint bytes;
 	time_t now;
-	gchar *md5;
+	guint8 *md5;
 	guint16 seq;
 	ft_info *info;
 
@@ -934,6 +938,7 @@
 	gaim_xfer_request (xfer);
 }
 
+/*
 static void qq_send_packet_request_key(GaimConnection *gc, guint8 key)
 {
 	qq_send_cmd(gc, QQ_CMD_REQUEST_KEY, TRUE, 0, TRUE, &key, 1);
@@ -942,3 +947,4 @@
 static void qq_process_recv_request_key(GaimConnection *gc)
 {
 }
+*/
--- a/libgaim/protocols/qq/send_file.h	Sun Aug 20 23:08:42 2006 +0000
+++ b/libgaim/protocols/qq/send_file.h	Sun Aug 20 23:16:44 2006 +0000
@@ -58,4 +58,6 @@
 void qq_send_file(GaimConnection *gc, const char *who, const char *file);
 void qq_get_conn_info(guint8 *data, guint8 **cursor, gint data_len, ft_info *info);
 gint qq_fill_conn_info(guint8 *data, guint8 **cursor, ft_info *info);
+gssize _qq_xfer_write(const guint8 *buf, size_t len, GaimXfer *xfer);
+
 #endif
--- a/libgaim/protocols/qq/utils.c	Sun Aug 20 23:08:42 2006 +0000
+++ b/libgaim/protocols/qq/utils.c	Sun Aug 20 23:16:44 2006 +0000
@@ -20,8 +20,9 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include "cipher.h"
+#include "limits.h"
 #include "stdlib.h"
-#include "limits.h"
 #include "string.h"
 
 #ifdef _WIN32
@@ -31,6 +32,7 @@
 #include "char_conv.h"
 #include "debug.h"
 #include "prefs.h"
+#include "qq.h"
 #include "util.h"
 #include "utils.h"
 
@@ -109,6 +111,26 @@
 	return segments;
 }
 
+/* generate a md5 key using uid and session_key */
+guint8 *_gen_session_md5(gint uid, guint8 *session_key)
+{
+        guint8 *src, md5_str[QQ_KEY_LENGTH];
+        GaimCipher *cipher;
+        GaimCipherContext *context;
+
+        src = g_newa(guint8, 20);
+	memcpy(src, &uid, 4);
+	memcpy(src, session_key, QQ_KEY_LENGTH);
+
+        cipher = gaim_ciphers_find_cipher("md5");
+        context = gaim_cipher_context_new(cipher, NULL);
+        gaim_cipher_context_append(context, src, 20);
+        gaim_cipher_context_digest(context, sizeof(md5_str), md5_str, NULL);
+        gaim_cipher_context_destroy(context);
+
+        return g_memdup(md5_str, QQ_KEY_LENGTH);
+}
+
 /* given a four-byte ip data, convert it into a human readable ip string
  * the return needs to be freed */
 gchar *gen_ip_str(guint8 *ip)
--- a/libgaim/protocols/qq/utils.h	Sun Aug 20 23:08:42 2006 +0000
+++ b/libgaim/protocols/qq/utils.h	Sun Aug 20 23:16:44 2006 +0000
@@ -33,6 +33,7 @@
 gint qq_string_to_dec_value(const gchar *str);
 
 gchar **split_data(guint8 *data, gint len, const gchar *delimit, gint expected_fields);
+guint8 *_gen_session_md5(gint uid, guint8 *session_key);
 gchar *gen_ip_str(guint8 *ip);
 guint8 *str_ip_gen(gchar *str);
 gchar *uid_to_gaim_name(guint32 uid);