| 166 char * |
166 char * |
| 167 msn_encode_mime(const char *str) |
167 msn_encode_mime(const char *str) |
| 168 { |
168 { |
| 169 char *base64; |
169 char *base64; |
| 170 |
170 |
| 171 base64 = gaim_base64_encode((guchar *)str, strlen(str)); |
171 base64 = purple_base64_encode((guchar *)str, strlen(str)); |
| 172 return g_strdup_printf("=?utf-8?B?%s?=", base64); |
172 return g_strdup_printf("=?utf-8?B?%s?=", base64); |
| 173 } |
173 } |
| 174 |
174 |
| 175 /* |
175 /* |
| 176 * We need this because we're only supposed to encode spaces in the font |
176 * We need this because we're only supposed to encode spaces in the font |
| 479 { |
479 { |
| 480 char temp[64]; |
480 char temp[64]; |
| 481 struct tm ctime; |
481 struct tm ctime; |
| 482 time_t ts; |
482 time_t ts; |
| 483 |
483 |
| 484 gaim_debug_info("MaYuan","convert string is{%s}\n",timestr); |
484 purple_debug_info("MaYuan","convert string is{%s}\n",timestr); |
| 485 tzset(); |
485 tzset(); |
| 486 /*copy string first*/ |
486 /*copy string first*/ |
| 487 memset(temp, 0, sizeof(temp)); |
487 memset(temp, 0, sizeof(temp)); |
| 488 strncpy(temp, timestr, strlen(timestr)); |
488 strncpy(temp, timestr, strlen(timestr)); |
| 489 |
489 |
| 526 */ |
526 */ |
| 527 #define BUFSIZE 256 |
527 #define BUFSIZE 256 |
| 528 void |
528 void |
| 529 msn_handle_chl(char *input, char *output) |
529 msn_handle_chl(char *input, char *output) |
| 530 { |
530 { |
| 531 GaimCipher *cipher; |
531 PurpleCipher *cipher; |
| 532 GaimCipherContext *context; |
532 PurpleCipherContext *context; |
| 533 char *productKey = MSNP13_WLM_PRODUCT_KEY, |
533 char *productKey = MSNP13_WLM_PRODUCT_KEY, |
| 534 *productID = MSNP13_WLM_PRODUCT_ID, |
534 *productID = MSNP13_WLM_PRODUCT_ID, |
| 535 *hexChars = "0123456789abcdef", |
535 *hexChars = "0123456789abcdef", |
| 536 buf[BUFSIZE]; |
536 buf[BUFSIZE]; |
| 537 unsigned char md5Hash[16], *newHash; |
537 unsigned char md5Hash[16], *newHash; |
| 542 int i, bigEndian; |
542 int i, bigEndian; |
| 543 |
543 |
| 544 /* Determine our endianess */ |
544 /* Determine our endianess */ |
| 545 bigEndian = isBigEndian(); |
545 bigEndian = isBigEndian(); |
| 546 |
546 |
| 547 /* Create the MD5 hash by using Gaim MD5 algorithm*/ |
547 /* Create the MD5 hash by using Purple MD5 algorithm*/ |
| 548 cipher = gaim_ciphers_find_cipher("md5"); |
548 cipher = purple_ciphers_find_cipher("md5"); |
| 549 context = gaim_cipher_context_new(cipher, NULL); |
549 context = purple_cipher_context_new(cipher, NULL); |
| 550 |
550 |
| 551 gaim_cipher_context_append(context, (const guchar *)input, |
551 purple_cipher_context_append(context, (const guchar *)input, |
| 552 strlen(input)); |
552 strlen(input)); |
| 553 gaim_cipher_context_append(context, (const guchar *)productKey, |
553 purple_cipher_context_append(context, (const guchar *)productKey, |
| 554 strlen(productKey)); |
554 strlen(productKey)); |
| 555 gaim_cipher_context_digest(context, sizeof(md5Hash), md5Hash, NULL); |
555 purple_cipher_context_digest(context, sizeof(md5Hash), md5Hash, NULL); |
| 556 gaim_cipher_context_destroy(context); |
556 purple_cipher_context_destroy(context); |
| 557 |
557 |
| 558 /* Split it into four integers */ |
558 /* Split it into four integers */ |
| 559 md5Parts = (unsigned int *)md5Hash; |
559 md5Parts = (unsigned int *)md5Hash; |
| 560 for(i=0; i<4; i++){ |
560 for(i=0; i<4; i++){ |
| 561 /* check for endianess */ |
561 /* check for endianess */ |