pidgin: dcfb8d24: Hide some offset occurrences and define ...
qulogic at pidgin.im
qulogic at pidgin.im
Tue May 10 00:16:27 EDT 2011
----------------------------------------------------------------------
Revision: dcfb8d243dcbbbb6aaa60ac65d28ac944408b4ab
Parent: d949803a9ceebd4012c772fbba53c34e7e28fb2f
Author: qulogic at pidgin.im
Date: 05/09/11 23:09:47
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/dcfb8d243dcbbbb6aaa60ac65d28ac944408b4ab
Changelog:
Hide some offset occurrences and define a couple of abstractions in
the v2 case.
Changes against parent d949803a9ceebd4012c772fbba53c34e7e28fb2f
patched libpurple/protocols/msn/p2p.c
patched libpurple/protocols/msn/p2p.h
patched libpurple/protocols/msn/slpcall.h
patched libpurple/protocols/msn/slplink.c
-------------- next part --------------
============================================================
--- libpurple/protocols/msn/slpcall.h 4b60f24627c058623286be0dd0e6bba479eda67d
+++ libpurple/protocols/msn/slpcall.h 8db0d1e640dc48ae80be57c73d61fb0c3d8027b2
@@ -65,7 +65,7 @@ struct _MsnSlpCall
gboolean wait_for_socket;
void (*progress_cb)(MsnSlpCall *slpcall,
- gsize total_length, gsize len, gsize offset);
+ gsize total_length, gsize len);
void (*session_init_cb)(MsnSlpCall *slpcall);
/* Can be checksum, or smile */
============================================================
--- libpurple/protocols/msn/slplink.c d0f752cce6ae97b6a3f5ae2b51fa6d878f039af3
+++ libpurple/protocols/msn/slplink.c 50b0eaf0d91d344af8f71eb71216e4b8c55d54c7
@@ -344,7 +344,7 @@ msn_slplink_send_msgpart(MsnSlpLink *slp
if (slpmsg->slpcall->progress_cb != NULL)
{
slpmsg->slpcall->progress_cb(slpmsg->slpcall, slpmsg->size,
- len, offset);
+ len);
}
}
@@ -561,7 +561,6 @@ msn_slplink_process_msg(MsnSlpLink *slpl
{
MsnSlpMessage *slpmsg;
MsnP2PInfo *info;
- guint64 offset;
info = part->info;
@@ -574,9 +573,7 @@ msn_slplink_process_msg(MsnSlpLink *slpl
return;
}
- offset = msn_p2p_info_get_offset(info);
-
- if (offset == 0)
+ if (msn_p2p_info_is_first(info))
slpmsg = init_first_msg(slplink, info);
else {
guint32 session_id, id;
@@ -600,7 +597,7 @@ msn_slplink_process_msg(MsnSlpLink *slpl
if (slpmsg->slpcall->progress_cb != NULL)
{
slpmsg->slpcall->progress_cb(slpmsg->slpcall, slpmsg->size,
- part->size, offset);
+ part->size);
}
}
============================================================
--- libpurple/protocols/msn/p2p.h 328dca8e62d91266353c6b895669171d24c476e2
+++ libpurple/protocols/msn/p2p.h a791fdfd347b33449912a909167d6fa25412b945
@@ -189,6 +189,9 @@ gboolean
msn_p2p_info_is_valid(MsnP2PInfo *info);
gboolean
+msn_p2p_info_is_first(MsnP2PInfo *info);
+
+gboolean
msn_p2p_info_is_final(MsnP2PInfo *info);
void
============================================================
--- libpurple/protocols/msn/p2p.c b3b5b955c9e79fe0f120c1a5f6ccb627e488d230
+++ libpurple/protocols/msn/p2p.c 817354bed676863f02e1f978390839f2fed67303
@@ -349,6 +349,7 @@ msn_p2p_info_is_valid(MsnP2PInfo *info)
case MSN_P2P_VERSION_TWO:
/* Nothing to do! */
+ valid = TRUE;
break;
default:
@@ -359,6 +360,28 @@ gboolean
}
gboolean
+msn_p2p_info_is_first(MsnP2PInfo *info)
+{
+ gboolean first = FALSE;
+
+ switch (info->version) {
+ case MSN_P2P_VERSION_ONE:
+ first = info->header.v1.offset == 0;
+ break;
+
+ case MSN_P2P_VERSION_TWO:
+ /* Nothing to do! */
+ first = info->header.v2.data_tf & TF_FIRST;
+ break;
+
+ default:
+ purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->version);
+ }
+
+ return first;
+}
+
+gboolean
msn_p2p_info_is_final(MsnP2PInfo *info)
{
gboolean final = FALSE;
@@ -369,7 +392,7 @@ msn_p2p_info_is_final(MsnP2PInfo *info)
break;
case MSN_P2P_VERSION_TWO:
- /* Nothing to do! */
+ final = msn_tlv_gettlv(info->header.v2.data_tlv, 0x01, 1) == NULL;
break;
default:
More information about the Commits
mailing list