Mercurial > pidgin
comparison libpurple/protocols/msn/slplink.c @ 30868:5964f65c17ed
Avoid duplicated code using a util function to check the flags.
author | masca@cpw.pidgin.im |
---|---|
date | Thu, 05 Aug 2010 23:42:42 +0000 |
parents | 6b73ff4fcc69 |
children | d9ca3798faa5 |
comparison
equal
deleted
inserted
replaced
30867:6b73ff4fcc69 | 30868:5964f65c17ed |
---|---|
330 #endif | 330 #endif |
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 if ((slpmsg->flags == P2P_MSN_OBJ_DATA || | 335 |
336 slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) || | 336 if (msn_p2p_msg_is_data(slpmsg->flags) && |
337 slpmsg->flags == P2P_FILE_DATA) && | |
338 (slpmsg->slpcall != NULL)) | 337 (slpmsg->slpcall != NULL)) |
339 { | 338 { |
340 slpmsg->slpcall->progress = TRUE; | 339 slpmsg->slpcall->progress = TRUE; |
341 | 340 |
342 if (slpmsg->slpcall->progress_cb != NULL) | 341 if (slpmsg->slpcall->progress_cb != NULL) |
357 | 356 |
358 if (slpmsg->flags == P2P_NO_FLAG) | 357 if (slpmsg->flags == P2P_NO_FLAG) |
359 { | 358 { |
360 slpmsg->header->ack_id = rand() % 0xFFFFFF00; | 359 slpmsg->header->ack_id = rand() % 0xFFFFFF00; |
361 } | 360 } |
362 else if (slpmsg->flags == P2P_MSN_OBJ_DATA || | 361 else if (msn_p2p_msg_is_data(slpmsg->flags)) |
363 slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) || | |
364 slpmsg->flags == P2P_FILE_DATA) | |
365 { | 362 { |
366 MsnSlpCall *slpcall; | 363 MsnSlpCall *slpcall; |
367 slpcall = slpmsg->slpcall; | 364 slpcall = slpmsg->slpcall; |
368 | 365 |
369 g_return_if_fail(slpcall != NULL); | 366 g_return_if_fail(slpcall != NULL); |
460 if (slpmsg->header->session_id) | 457 if (slpmsg->header->session_id) |
461 { | 458 { |
462 slpmsg->slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->header->session_id); | 459 slpmsg->slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->header->session_id); |
463 if (slpmsg->slpcall != NULL) | 460 if (slpmsg->slpcall != NULL) |
464 { | 461 { |
465 if (slpmsg->flags == P2P_MSN_OBJ_DATA || | 462 if (msn_p2p_msg_is_data(slpmsg->flags)) |
466 slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) || | |
467 slpmsg->flags == P2P_FILE_DATA) | |
468 { | 463 { |
469 PurpleXfer *xfer = slpmsg->slpcall->xfer; | 464 PurpleXfer *xfer = slpmsg->slpcall->xfer; |
470 if (xfer != NULL) | 465 if (xfer != NULL) |
471 { | 466 { |
472 slpmsg->ft = TRUE; | 467 slpmsg->ft = TRUE; |
523 if (!directconn->acked) | 518 if (!directconn->acked) |
524 msn_directconn_send_handshake(directconn); | 519 msn_directconn_send_handshake(directconn); |
525 #endif | 520 #endif |
526 } | 521 } |
527 else if (slpmsg->flags == P2P_NO_FLAG || slpmsg->flags == P2P_WML2009_COMP || | 522 else if (slpmsg->flags == P2P_NO_FLAG || slpmsg->flags == P2P_WML2009_COMP || |
528 slpmsg->flags == P2P_MSN_OBJ_DATA || | 523 msn_p2p_msg_is_data(slpmsg->flags)) |
529 slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) || | |
530 slpmsg->flags == P2P_FILE_DATA) | |
531 { | 524 { |
532 /* Release all the messages and send the ACK */ | 525 /* Release all the messages and send the ACK */ |
533 | 526 |
534 if (slpcall->wait_for_socket) { | 527 if (slpcall->wait_for_socket) { |
535 /* | 528 /* |
610 } | 603 } |
611 } | 604 } |
612 | 605 |
613 slpmsg_add_part(slpmsg, part); | 606 slpmsg_add_part(slpmsg, part); |
614 | 607 |
615 if ((slpmsg->flags == P2P_MSN_OBJ_DATA || | 608 |
616 slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) || | 609 if (msn_p2p_msg_is_data(slpmsg->flags) && |
617 slpmsg->flags == P2P_FILE_DATA) && | |
618 (slpmsg->slpcall != NULL)) | 610 (slpmsg->slpcall != NULL)) |
619 { | 611 { |
620 slpmsg->slpcall->progress = TRUE; | 612 slpmsg->slpcall->progress = TRUE; |
621 | 613 |
622 if (slpmsg->slpcall->progress_cb != NULL) | 614 if (slpmsg->slpcall->progress_cb != NULL) |