comparison libpurple/protocols/myspace/myspace.c @ 20628:b8962a8c5daa

merge of '33aead6e626883ef6ad44b79099f01d2da042d9a' and 'f76b9e1feb23d6a4308ca0c80f5f85765d985aff'
author Mark Doliner <mark@kingant.net>
date Sun, 23 Sep 2007 22:08:46 +0000
parents a2cb2a2fe424 52dce2882c03
children 7efdc052539d
comparison
equal deleted inserted replaced
20627:0584c704cc4a 20628:b8962a8c5daa
452 sha1 = purple_ciphers_find_cipher("sha1"); 452 sha1 = purple_ciphers_find_cipher("sha1");
453 key_context = purple_cipher_context_new(sha1, NULL); 453 key_context = purple_cipher_context_new(sha1, NULL);
454 purple_cipher_context_append(key_context, hash_pw, HASH_SIZE); 454 purple_cipher_context_append(key_context, hash_pw, HASH_SIZE);
455 purple_cipher_context_append(key_context, (guchar *)(nonce + NONCE_SIZE), NONCE_SIZE); 455 purple_cipher_context_append(key_context, (guchar *)(nonce + NONCE_SIZE), NONCE_SIZE);
456 purple_cipher_context_digest(key_context, sizeof(key), key, NULL); 456 purple_cipher_context_digest(key_context, sizeof(key), key, NULL);
457 purple_cipher_context_destroy(key_context);
457 458
458 #ifdef MSIM_DEBUG_LOGIN_CHALLENGE 459 #ifdef MSIM_DEBUG_LOGIN_CHALLENGE
459 purple_debug_info("msim", "key = "); 460 purple_debug_info("msim", "key = ");
460 for (i = 0; i < sizeof(key); i++) { 461 for (i = 0; i < sizeof(key); i++) {
461 purple_debug_info("msim", "%.2x ", key[i]); 462 purple_debug_info("msim", "%.2x ", key[i]);
1028 msim_set_status(PurpleAccount *account, PurpleStatus *status) 1029 msim_set_status(PurpleAccount *account, PurpleStatus *status)
1029 { 1030 {
1030 PurpleStatusType *type; 1031 PurpleStatusType *type;
1031 MsimSession *session; 1032 MsimSession *session;
1032 guint status_code; 1033 guint status_code;
1033 const gchar *statstring; 1034 gchar *statstring;
1034 1035
1035 session = (MsimSession *)account->gc->proto_data; 1036 session = (MsimSession *)account->gc->proto_data;
1036 1037
1037 g_return_if_fail(MSIM_SESSION_VALID(session)); 1038 g_return_if_fail(MSIM_SESSION_VALID(session));
1038 1039
1062 "status interpreting as online"); 1063 "status interpreting as online");
1063 status_code = MSIM_STATUS_CODE_ONLINE; 1064 status_code = MSIM_STATUS_CODE_ONLINE;
1064 break; 1065 break;
1065 } 1066 }
1066 1067
1067 statstring = purple_status_get_attr_string(status, "message"); 1068 statstring = (gchar *)purple_status_get_attr_string(status, "message");
1068 1069
1069 if (!statstring) { 1070 if (!statstring) {
1070 statstring = ""; 1071 statstring = "";
1071 } 1072 }
1072 1073
1073 /* Status strings are plain text. */ 1074 /* Status strings are plain text. */
1074 statstring = purple_markup_strip_html(statstring); 1075 statstring = purple_markup_strip_html(statstring);
1075 1076
1076 msim_set_status_code(session, status_code, g_strdup(statstring)); 1077 msim_set_status_code(session, status_code, statstring);
1077 } 1078 }
1078 1079
1079 /** Go idle. */ 1080 /** Go idle. */
1080 void 1081 void
1081 msim_set_idle(PurpleConnection *gc, int time) 1082 msim_set_idle(PurpleConnection *gc, int time)
1202 name = purple_buddy_get_name(buddy); 1203 name = purple_buddy_get_name(buddy);
1203 1204
1204 if (uid == wanted_uid) 1205 if (uid == wanted_uid)
1205 { 1206 {
1206 ret = g_strdup(name); 1207 ret = g_strdup(name);
1207 break; 1208 break;
1208 } 1209 }
1209 } 1210 }
1210 1211
1211 g_slist_free(buddies); 1212 g_slist_free(buddies);
1212 return ret; 1213 return ret;
1861 "msim_status: making new buddy for %s\n", username); 1862 "msim_status: making new buddy for %s\n", username);
1862 buddy = purple_buddy_new(session->account, username, NULL); 1863 buddy = purple_buddy_new(session->account, username, NULL);
1863 purple_blist_add_buddy(buddy, NULL, NULL, NULL); 1864 purple_blist_add_buddy(buddy, NULL, NULL, NULL);
1864 1865
1865 user = msim_get_user_from_buddy(buddy); 1866 user = msim_get_user_from_buddy(buddy);
1867 /* TODO: free user. memory leak? */
1866 1868
1867 /* All buddies on list should have 'uid' integer associated with them. */ 1869 /* All buddies on list should have 'uid' integer associated with them. */
1868 purple_blist_node_set_int(&buddy->node, "UserID", msim_msg_get_integer(msg, "f")); 1870 purple_blist_node_set_int(&buddy->node, "UserID", msim_msg_get_integer(msg, "f"));
1869 1871
1870 msim_store_user_info(session, msg, NULL); 1872 msim_store_user_info(session, msg, NULL);