Mercurial > pidgin
comparison src/protocols/msn/notification.c @ 19783:995aea35b05c
[gaim-migrate @ 16329]
change it to windows Live Messenger
Basic TWN authentication OK now
committer: Ethan Blanton <elb@pidgin.im>
author | Ma Yuan <mayuan2006@gmail.com> |
---|---|
date | Sat, 24 Jun 2006 12:04:32 +0000 |
parents | 967ef719cb62 |
children | bc30c6270d9f |
comparison
equal
deleted
inserted
replaced
13850:0e1e59770cb0 | 19783:995aea35b05c |
---|---|
100 cmdproc = servconn->cmdproc; | 100 cmdproc = servconn->cmdproc; |
101 session = servconn->session; | 101 session = servconn->session; |
102 account = session->account; | 102 account = session->account; |
103 | 103 |
104 /* Allocate an array for CVR0, NULL, and all the versions */ | 104 /* Allocate an array for CVR0, NULL, and all the versions */ |
105 a = c = g_new0(char *, session->protocol_ver - 8 + 3); | 105 a = c = g_new0(char *, session->protocol_ver - WLM_MIN_PROTOCOL + 3); |
106 | 106 |
107 for (i = session->protocol_ver; i >= 8; i--) | 107 for (i = session->protocol_ver; i >= WLM_MIN_PROTOCOL; i--) |
108 *c++ = g_strdup_printf("MSNP%d", i); | 108 *c++ = g_strdup_printf("MSNP%d", i); |
109 | 109 |
110 *c++ = g_strdup("CVR0"); | 110 *c++ = g_strdup("CVR0"); |
111 | 111 |
112 vers = g_strjoinv(" ", a); | 112 vers = g_strjoinv(" ", a); |
228 | 228 |
229 session = cmdproc->session; | 229 session = cmdproc->session; |
230 account = session->account; | 230 account = session->account; |
231 gc = gaim_account_get_connection(account); | 231 gc = gaim_account_get_connection(account); |
232 | 232 |
233 if (!g_ascii_strcasecmp(cmd->params[1], "OK")) | 233 if (!g_ascii_strcasecmp(cmd->params[1], "OK")){ |
234 { | 234 /* authenticate OK */ |
235 /* OK */ | |
236 const char *friendly = gaim_url_decode(cmd->params[3]); | 235 const char *friendly = gaim_url_decode(cmd->params[3]); |
237 | 236 |
238 gaim_connection_set_display_name(gc, friendly); | 237 gaim_connection_set_display_name(gc, friendly); |
239 | 238 |
240 msn_session_set_login_step(session, MSN_LOGIN_STEP_SYN); | 239 msn_session_set_login_step(session, MSN_LOGIN_STEP_SYN); |
241 | 240 |
242 msn_cmdproc_send(cmdproc, "SYN", "%s", "0"); | 241 msn_cmdproc_send(cmdproc, "SYN", "%s", "0"); |
243 } | 242 }else if (!g_ascii_strcasecmp(cmd->params[1], "TWN")){ |
244 else if (!g_ascii_strcasecmp(cmd->params[1], "TWN")) | |
245 { | |
246 /* Passport authentication */ | 243 /* Passport authentication */ |
247 char **elems, **cur, **tokens; | 244 char **elems, **cur, **tokens; |
248 | 245 |
249 session->nexus = msn_nexus_new(session); | 246 session->nexus = msn_nexus_new(session); |
250 | 247 |
251 /* Parse the challenge data. */ | 248 /* Parse the challenge data. */ |
252 | 249 |
253 elems = g_strsplit(cmd->params[3], ",", 0); | 250 elems = g_strsplit(cmd->params[3], ",", 0); |
254 | 251 |
255 for (cur = elems; *cur != NULL; cur++) | 252 for (cur = elems; *cur != NULL; cur++){ |
256 { | |
257 tokens = g_strsplit(*cur, "=", 2); | 253 tokens = g_strsplit(*cur, "=", 2); |
258 g_hash_table_insert(session->nexus->challenge_data, tokens[0], tokens[1]); | 254 g_hash_table_insert(session->nexus->challenge_data, tokens[0], tokens[1]); |
259 /* Don't free each of the tokens, only the array. */ | 255 /* Don't free each of the tokens, only the array. */ |
260 g_free(tokens); | 256 g_free(tokens); |
261 } | 257 } |
320 msn_session_set_error(session, MSN_ERROR_UNSUPPORTED_PROTOCOL, | 316 msn_session_set_error(session, MSN_ERROR_UNSUPPORTED_PROTOCOL, |
321 NULL); | 317 NULL); |
322 return; | 318 return; |
323 } | 319 } |
324 | 320 |
321 /* | |
322 * Windows Live Messenger 8.0 | |
323 * Notice :CVR String discriminate! | |
324 */ | |
325 msn_cmdproc_send(cmdproc, "CVR", | 325 msn_cmdproc_send(cmdproc, "CVR", |
326 "0x0409 winnt 5.1 i386 MSNMSGR 6.0.0602 MSMSGS %s", | 326 "0x0409 winnt 5.1 i386 MSG80BETA 8.0.0689 msmsgs %s", |
327 gaim_account_get_username(account)); | 327 gaim_account_get_username(account)); |
328 } | 328 } |
329 | 329 |
330 /************************************************************************** | 330 /************************************************************************** |
331 * Log out | 331 * Log out |
377 } | 377 } |
378 | 378 |
379 static void | 379 static void |
380 msg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) | 380 msg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
381 { | 381 { |
382 gaim_debug_info("MaYuan","Processing MSG... \n"); | |
383 if(cmd->payload_len == 0){ | |
384 return; | |
385 } | |
382 /* NOTE: cmd is not always cmdproc->last_cmd, sometimes cmd is a queued | 386 /* NOTE: cmd is not always cmdproc->last_cmd, sometimes cmd is a queued |
383 * command and we are processing it */ | 387 * command and we are processing it */ |
384 | 388 if (cmd->payload == NULL){ |
385 if (cmd->payload == NULL) | |
386 { | |
387 cmdproc->last_cmd->payload_cb = msg_cmd_post; | 389 cmdproc->last_cmd->payload_cb = msg_cmd_post; |
388 cmdproc->servconn->payload_len = atoi(cmd->params[2]); | 390 cmdproc->servconn->payload_len = atoi(cmd->params[2]); |
389 } | 391 }else{ |
390 else | |
391 { | |
392 g_return_if_fail(cmd->payload_cb != NULL); | 392 g_return_if_fail(cmd->payload_cb != NULL); |
393 | 393 |
394 cmd->payload_cb(cmdproc, cmd, cmd->payload, cmd->payload_len); | 394 cmd->payload_cb(cmdproc, cmd, cmd->payload, cmd->payload_len); |
395 } | 395 } |
396 } | 396 } |
1116 } | 1116 } |
1117 | 1117 |
1118 g_free(host); | 1118 g_free(host); |
1119 } | 1119 } |
1120 | 1120 |
1121 static void | |
1122 gcf_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) | |
1123 { | |
1124 gaim_debug_info("MaYuan","Processing GCF... \n"); | |
1125 if(cmd->payload_len == 0){ | |
1126 // cmd->payload_len = is_num(cmd->params[1]) ? atoi(cmd->params[1]) : 0; | |
1127 return; | |
1128 } | |
1129 /*get the payload content*/ | |
1130 } | |
1131 | |
1132 static void | |
1133 sbs_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) | |
1134 { | |
1135 gaim_debug_info("MaYuan","Processing SBS... \n"); | |
1136 if(cmd->payload_len == 0){ | |
1137 return; | |
1138 } | |
1139 /*get the payload content*/ | |
1140 } | |
1141 | |
1121 /************************************************************************** | 1142 /************************************************************************** |
1122 * Message Types | 1143 * Message Types |
1123 **************************************************************************/ | 1144 **************************************************************************/ |
1124 | 1145 |
1125 static void | 1146 static void |
1385 msn_table_add_cmd(cbs_table, "ADD", "ADD", add_cmd); | 1406 msn_table_add_cmd(cbs_table, "ADD", "ADD", add_cmd); |
1386 msn_table_add_cmd(cbs_table, "ADD", "ILN", iln_cmd); | 1407 msn_table_add_cmd(cbs_table, "ADD", "ILN", iln_cmd); |
1387 msn_table_add_cmd(cbs_table, "REM", "REM", rem_cmd); | 1408 msn_table_add_cmd(cbs_table, "REM", "REM", rem_cmd); |
1388 msn_table_add_cmd(cbs_table, "USR", "USR", usr_cmd); | 1409 msn_table_add_cmd(cbs_table, "USR", "USR", usr_cmd); |
1389 msn_table_add_cmd(cbs_table, "USR", "XFR", xfr_cmd); | 1410 msn_table_add_cmd(cbs_table, "USR", "XFR", xfr_cmd); |
1411 msn_table_add_cmd(cbs_table, "USR", "GCF", gcf_cmd); | |
1390 msn_table_add_cmd(cbs_table, "SYN", "SYN", syn_cmd); | 1412 msn_table_add_cmd(cbs_table, "SYN", "SYN", syn_cmd); |
1391 msn_table_add_cmd(cbs_table, "CVR", "CVR", cvr_cmd); | 1413 msn_table_add_cmd(cbs_table, "CVR", "CVR", cvr_cmd); |
1392 msn_table_add_cmd(cbs_table, "VER", "VER", ver_cmd); | 1414 msn_table_add_cmd(cbs_table, "VER", "VER", ver_cmd); |
1393 msn_table_add_cmd(cbs_table, "REA", "REA", rea_cmd); | 1415 msn_table_add_cmd(cbs_table, "REA", "REA", rea_cmd); |
1394 msn_table_add_cmd(cbs_table, "PRP", "PRP", prp_cmd); | 1416 msn_table_add_cmd(cbs_table, "PRP", "PRP", prp_cmd); |
1400 msn_table_add_cmd(cbs_table, "XFR", "XFR", xfr_cmd); | 1422 msn_table_add_cmd(cbs_table, "XFR", "XFR", xfr_cmd); |
1401 | 1423 |
1402 /* Asynchronous */ | 1424 /* Asynchronous */ |
1403 msn_table_add_cmd(cbs_table, NULL, "IPG", ipg_cmd); | 1425 msn_table_add_cmd(cbs_table, NULL, "IPG", ipg_cmd); |
1404 msn_table_add_cmd(cbs_table, NULL, "MSG", msg_cmd); | 1426 msn_table_add_cmd(cbs_table, NULL, "MSG", msg_cmd); |
1427 msn_table_add_cmd(cbs_table, NULL, "GCF", gcf_cmd); | |
1428 msn_table_add_cmd(cbs_table, NULL, "SBS", sbs_cmd); | |
1405 msn_table_add_cmd(cbs_table, NULL, "NOT", not_cmd); | 1429 msn_table_add_cmd(cbs_table, NULL, "NOT", not_cmd); |
1406 | 1430 |
1407 msn_table_add_cmd(cbs_table, NULL, "CHL", chl_cmd); | 1431 msn_table_add_cmd(cbs_table, NULL, "CHL", chl_cmd); |
1408 msn_table_add_cmd(cbs_table, NULL, "REM", rem_cmd); | 1432 msn_table_add_cmd(cbs_table, NULL, "REM", rem_cmd); |
1409 msn_table_add_cmd(cbs_table, NULL, "ADD", add_cmd); | 1433 msn_table_add_cmd(cbs_table, NULL, "ADD", add_cmd); |