soc.2010.msn-tlc: fd6eabc9: Avoid duplicated code using a util funct...
masca at cpw.pidgin.im
masca at cpw.pidgin.im
Thu Aug 5 22:01:23 EDT 2010
----------------------------------------------------------------------
Revision: fd6eabc91bdfaede81d9918d78f9657bb9734afa
Parent: ddf2ac024b480ecf6e8ec9eeb9ff8b03841dd47d
Author: masca at cpw.pidgin.im
Date: 08/05/10 19:42:42
Branch: im.pidgin.soc.2010.msn-tlc
URL: http://d.pidgin.im/viewmtn/revision/info/fd6eabc91bdfaede81d9918d78f9657bb9734afa
Changelog:
Avoid duplicated code using a util function to check the flags.
Changes against parent ddf2ac024b480ecf6e8ec9eeb9ff8b03841dd47d
patched libpurple/protocols/msn/p2p.c
patched libpurple/protocols/msn/p2p.h
patched libpurple/protocols/msn/slpcall.c
patched libpurple/protocols/msn/slplink.c
-------------- next part --------------
============================================================
--- libpurple/protocols/msn/slpcall.c 6c9cf6c3990540e68a119ada39221311735aa81e
+++ libpurple/protocols/msn/slpcall.c 68639cfd8c34b6c2a744728b7d97bd078a944d05
@@ -1123,9 +1123,7 @@ msn_slp_process_msg(MsnSlpLink *slplink,
}
g_free(body_str);
}
- else if (slpmsg->flags == P2P_MSN_OBJ_DATA ||
- slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) ||
- slpmsg->flags == P2P_FILE_DATA)
+ else if (msn_p2p_msg_is_data(slpmsg->flags))
{
slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->header->session_id);
============================================================
--- libpurple/protocols/msn/slplink.c 9134e1854ae4b065c5e68f97ff3bf057952b0775
+++ libpurple/protocols/msn/slplink.c d3e59485e8ab646cd06b660950d5c5ff6f610e88
@@ -332,9 +332,8 @@ msn_slplink_send_msgpart(MsnSlpLink *slp
slpmsg->parts = g_list_append(slpmsg->parts, part);
msn_slplink_send_part(slplink, part);
- if ((slpmsg->flags == P2P_MSN_OBJ_DATA ||
- slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) ||
- slpmsg->flags == P2P_FILE_DATA) &&
+
+ if (msn_p2p_msg_is_data(slpmsg->flags) &&
(slpmsg->slpcall != NULL))
{
slpmsg->slpcall->progress = TRUE;
@@ -359,9 +358,7 @@ msn_slplink_release_slpmsg(MsnSlpLink *s
{
slpmsg->header->ack_id = rand() % 0xFFFFFF00;
}
- else if (slpmsg->flags == P2P_MSN_OBJ_DATA ||
- slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) ||
- slpmsg->flags == P2P_FILE_DATA)
+ else if (msn_p2p_msg_is_data(slpmsg->flags))
{
MsnSlpCall *slpcall;
slpcall = slpmsg->slpcall;
@@ -462,9 +459,7 @@ init_first_msg(MsnSlpLink *slplink, MsnP
slpmsg->slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->header->session_id);
if (slpmsg->slpcall != NULL)
{
- if (slpmsg->flags == P2P_MSN_OBJ_DATA ||
- slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) ||
- slpmsg->flags == P2P_FILE_DATA)
+ if (msn_p2p_msg_is_data(slpmsg->flags))
{
PurpleXfer *xfer = slpmsg->slpcall->xfer;
if (xfer != NULL)
@@ -525,9 +520,7 @@ process_complete_msg(MsnSlpLink *slplink
#endif
}
else if (slpmsg->flags == P2P_NO_FLAG || slpmsg->flags == P2P_WML2009_COMP ||
- slpmsg->flags == P2P_MSN_OBJ_DATA ||
- slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) ||
- slpmsg->flags == P2P_FILE_DATA)
+ msn_p2p_msg_is_data(slpmsg->flags))
{
/* Release all the messages and send the ACK */
@@ -612,9 +605,8 @@ msn_slplink_process_msg(MsnSlpLink *slpl
slpmsg_add_part(slpmsg, part);
- if ((slpmsg->flags == P2P_MSN_OBJ_DATA ||
- slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) ||
- slpmsg->flags == P2P_FILE_DATA) &&
+
+ if (msn_p2p_msg_is_data(slpmsg->flags) &&
(slpmsg->slpcall != NULL))
{
slpmsg->slpcall->progress = TRUE;
============================================================
--- libpurple/protocols/msn/p2p.h ad6bcb4c567f1c537418cc2197b90d44b259207a
+++ libpurple/protocols/msn/p2p.h d565d717d3a257cf80c67cdb63df119e038f19f0
@@ -82,4 +82,7 @@ msn_p2p_footer_to_wire(MsnP2PFooter *foo
MsnP2PFooter *
msn_p2p_footer_to_wire(MsnP2PFooter *footer);
+gboolean
+msn_p2p_msg_is_data(const MsnP2PHeaderFlag flags);
+
#endif /* MSN_P2P_H */
============================================================
--- libpurple/protocols/msn/p2p.c f2aeb70f2342054a2655a620d9f3f4e7cd967f0a
+++ libpurple/protocols/msn/p2p.c 852156041dc892ec783df78af9b4fdbfc123ea41
@@ -67,3 +67,10 @@ msn_p2p_footer_to_wire(MsnP2PFooter *foo
return wire;
}
+gboolean
+msn_p2p_msg_is_data(const MsnP2PHeaderFlag flags)
+{
+ return (flags == P2P_MSN_OBJ_DATA ||
+ flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) ||
+ flags == P2P_FILE_DATA);
+}
More information about the Commits
mailing list