Merge lp:~ken-vandine/gwibber/lp_933694 into lp:gwibber

Proposed by Ken VanDine
Status: Merged
Merged at revision: 1308
Proposed branch: lp:~ken-vandine/gwibber/lp_933694
Merge into: lp:gwibber
Diff against target: 58 lines (+26/-7)
1 file modified
libgwibber/streams.vala (+26/-7)
To merge this branch: bzr merge lp:~ken-vandine/gwibber/lp_933694
Reviewer Review Type Date Requested Status
David Klasinc (community) Approve
Review via email: mp+96591@code.launchpad.net

Description of the change

Fix duplicate detection by falling back to comparing _html, _link_description, _image_url and _video_url (LP: #933694)

To post a comment you must log in.
Revision history for this message
David Klasinc (bigwhale) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'libgwibber/streams.vala'
--- libgwibber/streams.vala 2012-03-07 14:27:42 +0000
+++ libgwibber/streams.vala 2012-03-08 15:11:18 +0000
@@ -485,14 +485,8 @@
485 if (obj.has_member("text"))485 if (obj.has_member("text"))
486 _text = obj.get_string_member("text");486 _text = obj.get_string_member("text");
487487
488 string _textid = "";488 string _textid = gen_text_id (_text);
489 foreach (var x in _text.replace(".", "").split(" "))
490 if ((!x.has_prefix("http://")) && (!x.has_prefix("https://"))
491 && (!x.has_prefix("gwibber:/")) && (!x.has_prefix("#"))
492 && (!x.has_prefix("!")))
493 _textid += x + " ";
494489
495 _textid = _textid.strip();
496 // FIXME: the transient == 0 disables dupe checking for transients, we should fix that490 // FIXME: the transient == 0 disables dupe checking for transients, we should fix that
497 //string _icon = yield service.avatar_path(_sender_obj.get_string_member("image"));491 //string _icon = yield service.avatar_path(_sender_obj.get_string_member("image"));
498 if (_sender_obj.has_member("image"))492 if (_sender_obj.has_member("image"))
@@ -686,6 +680,16 @@
686 if (_link_description != null)680 if (_link_description != null)
687 _link_description = scrub (_link_description);681 _link_description = scrub (_link_description);
688682
683 /* If textid is empty, lets fallback to check some other fields */
684 if (_textid.length < 1 && _html != null)
685 _textid = gen_text_id (_html);
686 if (_textid.length < 1 && _link_description != null)
687 _textid = gen_text_id (_link_description);
688 if (_textid.length < 1 && _image_url != null)
689 _textid = _image_url.strip ();
690 if (_textid.length < 1 && _image_url != null)
691 _textid = _video_url.strip ();
692
689 string _t = utils.generate_time_string(_time);693 string _t = utils.generate_time_string(_time);
690694
691 if (seen.has_key(_textid) && transient == "0")695 if (seen.has_key(_textid) && transient == "0")
@@ -778,6 +782,21 @@
778 return res;782 return res;
779 }783 }
780784
785 private string gen_text_id (string t)
786 {
787 string id = "";
788 if (t.length > 0)
789 {
790 foreach (var x in t.replace(".", "").split(" "))
791 if ((!x.has_prefix("http://")) && (!x.has_prefix("https://"))
792 && (!x.has_prefix("gwibber:/")) && (!x.has_prefix("#"))
793 && (!x.has_prefix("!")))
794 id += x + " ";
795 id = id.strip();
796 }
797 return id;
798 }
799
781800
782801
783 /**802 /**