Mercurial > pidgin
comparison libgaim/protocols/qq/utils.c @ 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 | 7cf90e0b6180 |
children | 584cbd1628d0 |
comparison
equal
deleted
inserted
replaced
14241:c54ea2572de9 | 14242:85f3808ca472 |
---|---|
18 * You should have received a copy of the GNU General Public License | 18 * You should have received a copy of the GNU General Public License |
19 * along with this program; if not, write to the Free Software | 19 * along with this program; if not, write to the Free Software |
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 */ | 21 */ |
22 | 22 |
23 #include "cipher.h" | |
24 #include "limits.h" | |
23 #include "stdlib.h" | 25 #include "stdlib.h" |
24 #include "limits.h" | |
25 #include "string.h" | 26 #include "string.h" |
26 | 27 |
27 #ifdef _WIN32 | 28 #ifdef _WIN32 |
28 #include "win32dep.h" | 29 #include "win32dep.h" |
29 #endif | 30 #endif |
30 | 31 |
31 #include "char_conv.h" | 32 #include "char_conv.h" |
32 #include "debug.h" | 33 #include "debug.h" |
33 #include "prefs.h" | 34 #include "prefs.h" |
35 #include "qq.h" | |
34 #include "util.h" | 36 #include "util.h" |
35 #include "utils.h" | 37 #include "utils.h" |
36 | 38 |
37 #define QQ_NAME_FORMAT "qq-%d" | 39 #define QQ_NAME_FORMAT "qq-%d" |
38 | 40 |
105 | 107 |
106 segments[expected_fields] = NULL; | 108 segments[expected_fields] = NULL; |
107 } | 109 } |
108 | 110 |
109 return segments; | 111 return segments; |
112 } | |
113 | |
114 /* generate a md5 key using uid and session_key */ | |
115 guint8 *_gen_session_md5(gint uid, guint8 *session_key) | |
116 { | |
117 guint8 *src, md5_str[QQ_KEY_LENGTH]; | |
118 GaimCipher *cipher; | |
119 GaimCipherContext *context; | |
120 | |
121 src = g_newa(guint8, 20); | |
122 memcpy(src, &uid, 4); | |
123 memcpy(src, session_key, QQ_KEY_LENGTH); | |
124 | |
125 cipher = gaim_ciphers_find_cipher("md5"); | |
126 context = gaim_cipher_context_new(cipher, NULL); | |
127 gaim_cipher_context_append(context, src, 20); | |
128 gaim_cipher_context_digest(context, sizeof(md5_str), md5_str, NULL); | |
129 gaim_cipher_context_destroy(context); | |
130 | |
131 return g_memdup(md5_str, QQ_KEY_LENGTH); | |
110 } | 132 } |
111 | 133 |
112 /* given a four-byte ip data, convert it into a human readable ip string | 134 /* given a four-byte ip data, convert it into a human readable ip string |
113 * the return needs to be freed */ | 135 * the return needs to be freed */ |
114 gchar *gen_ip_str(guint8 *ip) | 136 gchar *gen_ip_str(guint8 *ip) |