comparison src/protocols/msn/notification.c @ 19738:bc30c6270d9f

[gaim-migrate @ 16473] add the Framework of SOAP request Now can retrieve the Contact via SOAP Request. so many bug still exist! commited by MaYuan<mayuan2006@gmail.com> committer: Ethan Blanton <elb@pidgin.im>
author Ma Yuan <mayuan2006@gmail.com>
date Sun, 09 Jul 2006 16:48:25 +0000
parents 995aea35b05c
children 852b32710df0
comparison
equal deleted inserted replaced
19737:995aea35b05c 19738:bc30c6270d9f
236 236
237 gaim_connection_set_display_name(gc, friendly); 237 gaim_connection_set_display_name(gc, friendly);
238 238
239 msn_session_set_login_step(session, MSN_LOGIN_STEP_SYN); 239 msn_session_set_login_step(session, MSN_LOGIN_STEP_SYN);
240 240
241 msn_cmdproc_send(cmdproc, "SYN", "%s", "0"); 241 // msn_cmdproc_send(cmdproc, "SYN", "%s", "0");
242 //TODO we should use SOAP contact to fetch contact list
242 }else if (!g_ascii_strcasecmp(cmd->params[1], "TWN")){ 243 }else if (!g_ascii_strcasecmp(cmd->params[1], "TWN")){
243 /* Passport authentication */ 244 /* Passport authentication */
244 char **elems, **cur, **tokens; 245 char **elems, **cur, **tokens;
245 246
246 session->nexus = msn_nexus_new(session); 247 session->nexus = msn_nexus_new(session);
395 } 396 }
396 } 397 }
397 398
398 /************************************************************************** 399 /**************************************************************************
399 * Challenges 400 * Challenges
401 * we use MD5 to caculate the Chanllenges
400 **************************************************************************/ 402 **************************************************************************/
401
402 static void 403 static void
403 chl_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) 404 chl_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
404 { 405 {
405 MsnTransaction *trans; 406 MsnTransaction *trans;
406 char buf[33]; 407 char buf[33];
414 context = gaim_cipher_context_new(cipher, NULL); 415 context = gaim_cipher_context_new(cipher, NULL);
415 416
416 gaim_cipher_context_append(context, (const guchar *)cmd->params[1], 417 gaim_cipher_context_append(context, (const guchar *)cmd->params[1],
417 strlen(cmd->params[1])); 418 strlen(cmd->params[1]));
418 419
419 challenge_resp = "VT6PX?UQTM4WM%YR"; 420 challenge_resp = MSNP13_WLM_PRODUCT_KEY;
420 421
421 gaim_cipher_context_append(context, (const guchar *)challenge_resp, 422 gaim_cipher_context_append(context, (const guchar *)challenge_resp,
422 strlen(challenge_resp)); 423 strlen(challenge_resp));
423 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL); 424 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL);
424 gaim_cipher_context_destroy(context); 425 gaim_cipher_context_destroy(context);
425 426
426 for (i = 0; i < 16; i++) 427 for (i = 0; i < 16; i++)
427 g_snprintf(buf + (i*2), 3, "%02x", digest[i]); 428 g_snprintf(buf + (i*2), 3, "%02x", digest[i]);
428 429
429 trans = msn_transaction_new(cmdproc, "QRY", "%s 32", "PROD0038W!61ZTF9"); 430 trans = msn_transaction_new(cmdproc, "QRY", "%s 32", MSNP13_WLM_PRODUCT_ID);
430 431
431 msn_transaction_set_payload(trans, buf, 32); 432 msn_transaction_set_payload(trans, buf, 32);
432 433
433 msn_cmdproc_send_trans(cmdproc, trans); 434 msn_cmdproc_send_trans(cmdproc, trans);
434 } 435 }
435 436
436 /************************************************************************** 437 /**************************************************************************
437 * Buddy Lists 438 * Buddy Lists
438 **************************************************************************/ 439 **************************************************************************/
439
440 static void 440 static void
441 add_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) 441 add_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
442 { 442 {
443 MsnSession *session; 443 MsnSession *session;
444 MsnUser *user; 444 MsnUser *user;
550 } 550 }
551 551
552 g_free(reason); 552 g_free(reason);
553 553
554 g_strfreev(params); 554 g_strfreev(params);
555 }
556
557 static void adl_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
558 {
555 } 559 }
556 560
557 static void 561 static void
558 adg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) 562 adg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
559 { 563 {
1098 return; 1102 return;
1099 } 1103 }
1100 1104
1101 msn_parse_socket(cmd->params[2], &host, &port); 1105 msn_parse_socket(cmd->params[2], &host, &port);
1102 1106
1103 if (!strcmp(cmd->params[1], "SB")) 1107 if (!strcmp(cmd->params[1], "SB")){
1104 {
1105 gaim_debug_error("msn", "This shouldn't be handled here.\n"); 1108 gaim_debug_error("msn", "This shouldn't be handled here.\n");
1106 } 1109 }else if (!strcmp(cmd->params[1], "NS")){
1107 else if (!strcmp(cmd->params[1], "NS"))
1108 {
1109 MsnSession *session; 1110 MsnSession *session;
1110 1111
1111 session = cmdproc->session; 1112 session = cmdproc->session;
1112 1113
1113 msn_session_set_login_step(session, MSN_LOGIN_STEP_TRANSFER); 1114 msn_session_set_login_step(session, MSN_LOGIN_STEP_TRANSFER);
1121 static void 1122 static void
1122 gcf_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) 1123 gcf_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
1123 { 1124 {
1124 gaim_debug_info("MaYuan","Processing GCF... \n"); 1125 gaim_debug_info("MaYuan","Processing GCF... \n");
1125 if(cmd->payload_len == 0){ 1126 if(cmd->payload_len == 0){
1126 // cmd->payload_len = is_num(cmd->params[1]) ? atoi(cmd->params[1]) : 0;
1127 return; 1127 return;
1128 } 1128 }
1129 /*get the payload content*/ 1129 /*get the payload content*/
1130 } 1130 }
1131 1131
1147 profile_msg(MsnCmdProc *cmdproc, MsnMessage *msg) 1147 profile_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
1148 { 1148 {
1149 MsnSession *session; 1149 MsnSession *session;
1150 const char *value; 1150 const char *value;
1151 1151
1152 gaim_debug_info("MaYuan","profile_msg... \n");
1152 session = cmdproc->session; 1153 session = cmdproc->session;
1153 1154
1154 if (strcmp(msg->remote_user, "Hotmail")) 1155 if (strcmp(msg->remote_user, "Hotmail"))
1155 /* This isn't an official message. */ 1156 /* This isn't an official message. */
1156 return; 1157 return;
1157 1158
1158 if ((value = msn_message_get_attr(msg, "kv")) != NULL) 1159 if ((value = msn_message_get_attr(msg, "kv")) != NULL){
1159 {
1160 if (session->passport_info.kv != NULL) 1160 if (session->passport_info.kv != NULL)
1161 g_free(session->passport_info.kv); 1161 g_free(session->passport_info.kv);
1162 1162
1163 session->passport_info.kv = g_strdup(value); 1163 session->passport_info.kv = g_strdup(value);
1164 } 1164 }
1165 1165
1166 if ((value = msn_message_get_attr(msg, "sid")) != NULL) 1166 if ((value = msn_message_get_attr(msg, "sid")) != NULL){
1167 {
1168 if (session->passport_info.sid != NULL) 1167 if (session->passport_info.sid != NULL)
1169 g_free(session->passport_info.sid); 1168 g_free(session->passport_info.sid);
1170 1169
1171 session->passport_info.sid = g_strdup(value); 1170 session->passport_info.sid = g_strdup(value);
1172 } 1171 }
1173 1172
1174 if ((value = msn_message_get_attr(msg, "MSPAuth")) != NULL) 1173 if ((value = msn_message_get_attr(msg, "MSPAuth")) != NULL){
1175 {
1176 if (session->passport_info.mspauth != NULL) 1174 if (session->passport_info.mspauth != NULL)
1177 g_free(session->passport_info.mspauth); 1175 g_free(session->passport_info.mspauth);
1178 1176
1177 gaim_debug_info("MaYuan","MSPAuth:%s\n",value);
1179 session->passport_info.mspauth = g_strdup(value); 1178 session->passport_info.mspauth = g_strdup(value);
1180 } 1179 }
1181 1180
1182 if ((value = msn_message_get_attr(msg, "ClientIP")) != NULL) 1181 if ((value = msn_message_get_attr(msg, "ClientIP")) != NULL){
1183 {
1184 if (session->passport_info.client_ip != NULL) 1182 if (session->passport_info.client_ip != NULL)
1185 g_free(session->passport_info.client_ip); 1183 g_free(session->passport_info.client_ip);
1186 1184
1187 session->passport_info.client_ip = g_strdup(value); 1185 session->passport_info.client_ip = g_strdup(value);
1188 } 1186 }
1189 1187
1190 if ((value = msn_message_get_attr(msg, "ClientPort")) != NULL) 1188 if ((value = msn_message_get_attr(msg, "ClientPort")) != NULL){
1191 session->passport_info.client_port = ntohs(atoi(value)); 1189 session->passport_info.client_port = ntohs(atoi(value));
1190 }
1192 1191
1193 if ((value = msn_message_get_attr(msg, "LoginTime")) != NULL) 1192 if ((value = msn_message_get_attr(msg, "LoginTime")) != NULL)
1194 session->passport_info.sl = atol(value); 1193 session->passport_info.sl = atol(value);
1194
1195 /*starting retrieve the contact list*/
1196 session->contact = msn_contact_new(session);
1197 msn_contact_connect(session->contact);
1198
1195 } 1199 }
1196 1200
1197 static void 1201 static void
1198 initial_email_msg(MsnCmdProc *cmdproc, MsnMessage *msg) 1202 initial_email_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
1199 { 1203 {