Mercurial > pidgin
comparison libpurple/protocols/msn/slplink.c @ 30870:d9ca3798faa5
Get rid of the Flags field in the SlpMessage in favor of the one in the Header.
author | masca@cpw.pidgin.im |
---|---|
date | Fri, 06 Aug 2010 00:07:39 +0000 |
parents | 5964f65c17ed |
children | 393e127b3d83 |
comparison
equal
deleted
inserted
replaced
30869:320c6eb04e11 | 30870:d9ca3798faa5 |
---|---|
294 /* Maybe we will want to create a new msg for this slpmsg instead of | 294 /* Maybe we will want to create a new msg for this slpmsg instead of |
295 * reusing the same one all the time. */ | 295 * reusing the same one all the time. */ |
296 part = msn_slpmsgpart_new(slpmsg->header, slpmsg->footer); | 296 part = msn_slpmsgpart_new(slpmsg->header, slpmsg->footer); |
297 part->ack_data = slpmsg; | 297 part->ack_data = slpmsg; |
298 | 298 |
299 real_size = (slpmsg->flags == P2P_ACK) ? 0 : slpmsg->size; | 299 real_size = (slpmsg->header->flags == P2P_ACK) ? 0 : slpmsg->size; |
300 | 300 |
301 if (slpmsg->header->offset < real_size) | 301 if (slpmsg->header->offset < real_size) |
302 { | 302 { |
303 if (slpmsg->slpcall && slpmsg->slpcall->xfer && purple_xfer_get_type(slpmsg->slpcall->xfer) == PURPLE_XFER_SEND && | 303 if (slpmsg->slpcall && slpmsg->slpcall->xfer && purple_xfer_get_type(slpmsg->slpcall->xfer) == PURPLE_XFER_SEND && |
304 purple_xfer_get_status(slpmsg->slpcall->xfer) == PURPLE_XFER_STATUS_STARTED) | 304 purple_xfer_get_status(slpmsg->slpcall->xfer) == PURPLE_XFER_STATUS_STARTED) |
331 | 331 |
332 slpmsg->parts = g_list_append(slpmsg->parts, part); | 332 slpmsg->parts = g_list_append(slpmsg->parts, part); |
333 msn_slplink_send_part(slplink, part); | 333 msn_slplink_send_part(slplink, part); |
334 | 334 |
335 | 335 |
336 if (msn_p2p_msg_is_data(slpmsg->flags) && | 336 if (msn_p2p_msg_is_data(slpmsg->header->flags) && |
337 (slpmsg->slpcall != NULL)) | 337 (slpmsg->slpcall != NULL)) |
338 { | 338 { |
339 slpmsg->slpcall->progress = TRUE; | 339 slpmsg->slpcall->progress = TRUE; |
340 | 340 |
341 if (slpmsg->slpcall->progress_cb != NULL) | 341 if (slpmsg->slpcall->progress_cb != NULL) |
352 msn_slplink_release_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) | 352 msn_slplink_release_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) |
353 { | 353 { |
354 slpmsg = slpmsg; | 354 slpmsg = slpmsg; |
355 slpmsg->footer = g_new0(MsnP2PFooter, 1); | 355 slpmsg->footer = g_new0(MsnP2PFooter, 1); |
356 | 356 |
357 if (slpmsg->flags == P2P_NO_FLAG) | 357 if (slpmsg->header->flags == P2P_NO_FLAG) |
358 { | 358 { |
359 slpmsg->header->ack_id = rand() % 0xFFFFFF00; | 359 slpmsg->header->ack_id = rand() % 0xFFFFFF00; |
360 } | 360 } |
361 else if (msn_p2p_msg_is_data(slpmsg->flags)) | 361 else if (msn_p2p_msg_is_data(slpmsg->header->flags)) |
362 { | 362 { |
363 MsnSlpCall *slpcall; | 363 MsnSlpCall *slpcall; |
364 slpcall = slpmsg->slpcall; | 364 slpcall = slpmsg->slpcall; |
365 | 365 |
366 g_return_if_fail(slpcall != NULL); | 366 g_return_if_fail(slpcall != NULL); |
368 slpmsg->footer->value = slpcall->app_id; | 368 slpmsg->footer->value = slpcall->app_id; |
369 slpmsg->header->ack_id = rand() % 0xFFFFFF00; | 369 slpmsg->header->ack_id = rand() % 0xFFFFFF00; |
370 } | 370 } |
371 | 371 |
372 slpmsg->header->id = slpmsg->id; | 372 slpmsg->header->id = slpmsg->id; |
373 slpmsg->header->flags = (guint32)slpmsg->flags; | |
374 | 373 |
375 slpmsg->header->total_size = slpmsg->size; | 374 slpmsg->header->total_size = slpmsg->size; |
376 | 375 |
377 msn_slplink_send_msgpart(slplink, slpmsg); | 376 msn_slplink_send_msgpart(slplink, slpmsg); |
378 } | 377 } |
450 | 449 |
451 slpmsg = msn_slpmsg_new(slplink); | 450 slpmsg = msn_slpmsg_new(slplink); |
452 slpmsg->id = header->id; | 451 slpmsg->id = header->id; |
453 slpmsg->header->session_id = header->session_id; | 452 slpmsg->header->session_id = header->session_id; |
454 slpmsg->size = header->total_size; | 453 slpmsg->size = header->total_size; |
455 slpmsg->flags = header->flags; | 454 slpmsg->header->flags = header->flags; |
456 | 455 |
457 if (slpmsg->header->session_id) | 456 if (slpmsg->header->session_id) |
458 { | 457 { |
459 slpmsg->slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->header->session_id); | 458 slpmsg->slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->header->session_id); |
460 if (slpmsg->slpcall != NULL) | 459 if (slpmsg->slpcall != NULL) |
461 { | 460 { |
462 if (msn_p2p_msg_is_data(slpmsg->flags)) | 461 if (msn_p2p_msg_is_data(header->flags)) |
463 { | 462 { |
464 PurpleXfer *xfer = slpmsg->slpcall->xfer; | 463 PurpleXfer *xfer = slpmsg->slpcall->xfer; |
465 if (xfer != NULL) | 464 if (xfer != NULL) |
466 { | 465 { |
467 slpmsg->ft = TRUE; | 466 slpmsg->ft = TRUE; |
507 return; | 506 return; |
508 } | 507 } |
509 | 508 |
510 purple_debug_info("msn", "msn_slplink_process_msg: slpmsg complete\n"); | 509 purple_debug_info("msn", "msn_slplink_process_msg: slpmsg complete\n"); |
511 | 510 |
512 if (/* !slpcall->wasted && */ slpmsg->flags == 0x100) | 511 if (/* !slpcall->wasted && */ slpmsg->header->flags == 0x100) |
513 { | 512 { |
514 #if 0 | 513 #if 0 |
515 MsnDirectConn *directconn; | 514 MsnDirectConn *directconn; |
516 | 515 |
517 directconn = slplink->directconn; | 516 directconn = slplink->directconn; |
518 if (!directconn->acked) | 517 if (!directconn->acked) |
519 msn_directconn_send_handshake(directconn); | 518 msn_directconn_send_handshake(directconn); |
520 #endif | 519 #endif |
521 } | 520 } |
522 else if (slpmsg->flags == P2P_NO_FLAG || slpmsg->flags == P2P_WML2009_COMP || | 521 else if (slpmsg->header->flags == P2P_NO_FLAG || slpmsg->header->flags == P2P_WML2009_COMP || |
523 msn_p2p_msg_is_data(slpmsg->flags)) | 522 msn_p2p_msg_is_data(slpmsg->header->flags)) |
524 { | 523 { |
525 /* Release all the messages and send the ACK */ | 524 /* Release all the messages and send the ACK */ |
526 | 525 |
527 if (slpcall->wait_for_socket) { | 526 if (slpcall->wait_for_socket) { |
528 /* | 527 /* |
604 } | 603 } |
605 | 604 |
606 slpmsg_add_part(slpmsg, part); | 605 slpmsg_add_part(slpmsg, part); |
607 | 606 |
608 | 607 |
609 if (msn_p2p_msg_is_data(slpmsg->flags) && | 608 if (msn_p2p_msg_is_data(slpmsg->header->flags) && |
610 (slpmsg->slpcall != NULL)) | 609 (slpmsg->slpcall != NULL)) |
611 { | 610 { |
612 slpmsg->slpcall->progress = TRUE; | 611 slpmsg->slpcall->progress = TRUE; |
613 | 612 |
614 if (slpmsg->slpcall->progress_cb != NULL) | 613 if (slpmsg->slpcall->progress_cb != NULL) |