comparison libpurple/protocols/myspace/myspace.c @ 17895:06d60201e371

Use constants for IP address list, defined in myspace.h.
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Wed, 20 Jun 2007 03:58:26 +0000
parents 333fe6ac1046
children 01d7e5096dde
comparison
equal deleted inserted replaced
17894:333fe6ac1046 17895:06d60201e371
527 * but only first 0x10 used for the RC4 key. */ 527 * but only first 0x10 used for the RC4 key. */
528 purple_cipher_context_set_option(rc4, "key_len", (gpointer)0x10); 528 purple_cipher_context_set_option(rc4, "key_len", (gpointer)0x10);
529 purple_cipher_context_set_key(rc4, key); 529 purple_cipher_context_set_key(rc4, key);
530 #endif 530 #endif
531 531
532 /* TODO: obtain IPs of network interfaces. This is not immediately 532 /* TODO: obtain IPs of network interfaces */
533 * important because you can still connect and perform basic 533
534 * functions of the protocol. There is also a high chance that the addreses
535 * are RFC1918 private, so the servers couldn't do anything with them
536 * anyways except make note of that fact. Probably important for any
537 * kind of direct connection, or file transfer functionality.
538 */
539 /* rc4 encrypt: 534 /* rc4 encrypt:
540 * nonce1+email+IP list */ 535 * nonce1+email+IP list */
541 data_len = NONCE_SIZE + strlen(email) 536
542 /* TODO: change to length of IP list */ 537 data_len = NONCE_SIZE + strlen(email) + MSIM_LOGIN_IP_LIST_LEN;
543 + 25;
544 data = g_new0(guchar, data_len); 538 data = g_new0(guchar, data_len);
545 memcpy(data, nonce, NONCE_SIZE); 539 memcpy(data, nonce, NONCE_SIZE);
546 memcpy(data + NONCE_SIZE, email, strlen(email)); 540 memcpy(data + NONCE_SIZE, email, strlen(email));
547 memcpy(data + NONCE_SIZE + strlen(email), 541 memcpy(data + NONCE_SIZE + strlen(email), MSIM_LOGIN_IP_LIST, MSIM_LOGIN_IP_LIST_LEN);
548 /* TODO: IP addresses of network interfaces */
549 "\x00\x00\x00\x00\x05\x7f\x00\x00\x01\x00\x00\x00\x00\x0a\x00\x00\x40\xc0\xa8\x58\x01\xc0\xa8\x3c\x01", 25);
550 542
551 #ifdef MSIM_USE_PURPLE_RC4 543 #ifdef MSIM_USE_PURPLE_RC4
552 data_out = g_new0(guchar, data_len); 544 data_out = g_new0(guchar, data_len);
553 545
554 purple_cipher_context_encrypt(rc4, (const guchar *)data, 546 purple_cipher_context_encrypt(rc4, (const guchar *)data,
1224 1216
1225 g_free(errmsg); 1217 g_free(errmsg);
1226 1218
1227 purple_debug_info("msim", "msim_error: %s\n", full_errmsg); 1219 purple_debug_info("msim", "msim_error: %s\n", full_errmsg);
1228 1220
1229 /* TODO: do something with the error # (localization of errmsg?) */
1230 purple_notify_error(session->account, g_strdup(_("MySpaceIM Error")), 1221 purple_notify_error(session->account, g_strdup(_("MySpaceIM Error")),
1231 full_errmsg, NULL); 1222 full_errmsg, NULL);
1232 1223
1233 /* Destroy session if fatal. */ 1224 /* Destroy session if fatal. */
1234 if (msim_msg_get(msg, "fatal")) 1225 if (msim_msg_get(msg, "fatal"))
1312 1303
1313 /* Add buddy if not found */ 1304 /* Add buddy if not found */
1314 buddy = purple_find_buddy(session->account, username); 1305 buddy = purple_find_buddy(session->account, username);
1315 if (!buddy) 1306 if (!buddy)
1316 { 1307 {
1317 /* TODO: purple aliases, userids and usernames */
1318 purple_debug_info("msim", 1308 purple_debug_info("msim",
1319 "msim_status: making new buddy for %s\n", username); 1309 "msim_status: making new buddy for %s\n", username);
1320 buddy = purple_buddy_new(session->account, username, NULL); 1310 buddy = purple_buddy_new(session->account, username, NULL);
1321 1311
1322 purple_blist_add_buddy(buddy, NULL, NULL, NULL); 1312 purple_blist_add_buddy(buddy, NULL, NULL, NULL);