aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: filtered-off comments still affect rating  (Read 3536 times)

magicamule

  • Newbie
  • Karma: 0
  • Offline Offline
  • Posts: 3
filtered-off comments still affect rating
« on: March 12, 2008, 03:51:51 AM »

[amule SVN 20080309]

* find a file with a single comment, with rating
* filter the comment off (preferences -> message filter -> comments)
* the comment correctly disappears, but the file rating remains!

This bug defeats the purpose of comment filtering. Spam comment (like "download *&^%$#@! - fastest eMule ever!!!") use random ratings anyway, so keeping them is not useful.
Logged

wuischke

  • Developer
  • Hero Member
  • *****
  • Karma: 183
  • Offline Offline
  • Posts: 4292
Re: filtered-off comments still affect rating
« Reply #1 on: March 12, 2008, 09:57:10 PM »

Could you please try the following patch and report back?
Code: [Select]
Index: src/PartFile.cpp
===================================================================
--- src/PartFile.cpp (revision 8224)
+++ src/PartFile.cpp (working copy)
@@ -3233,7 +3233,7 @@
  }
 
  uint8 rating = cur_src->GetFileRating();
- if (rating) {
+ if ((rating) && (m_hasComment) && (!thePrefs::IsCommentFiltered(cur_src->GetFileComment()))) {
  wxASSERT(rating <= 5);
 
  ratingCount++;
Logged

magicamule

  • Newbie
  • Karma: 0
  • Offline Offline
  • Posts: 3
Re: filtered-off comments still affect rating
« Reply #2 on: March 13, 2008, 04:56:03 AM »

Thank you for your prompt answer. With the above patch, filtered-off comments do not affect the rating, but there remains a problem: the file still gets a (unrated) comment icon. Also, the patch seems to discard all ratings with empty comments, which I guess to be unintended.

A slightly modified version seems to work better:
Code: [Select]
diff -ur amule-2.2.0~20080309/src/PartFile.cpp amule/src/PartFile.cpp
--- amule-2.2.0~20080309/src/PartFile.cpp 2008-02-24 21:25:22.000000000 +0100
+++ amule/src/PartFile.cpp 2008-03-13 02:24:03.473742425 +0100
@@ -3229,6 +3229,10 @@
  CUpDownClient* cur_src = *it;
 
  if (!cur_src->GetFileComment().IsEmpty()) {
+ if (thePrefs::IsCommentFiltered(cur_src->GetFileComment())) {
+ continue;
+ }
+
  m_hasComment = true;
  }
 
Logged

wuischke

  • Developer
  • Hero Member
  • *****
  • Karma: 183
  • Offline Offline
  • Posts: 4292
Re: filtered-off comments still affect rating
« Reply #3 on: March 13, 2008, 01:57:29 PM »

Now please test your patch combined with the removal of my old "do-not-display-filtered-comments"-code and you've got yourself an entry in the Changelog. Thanks a lot for your help!

Code: [Select]
Index: src/PartFile.cpp
===================================================================
--- src/PartFile.cpp (revision 8224)
+++ src/PartFile.cpp (working copy)
@@ -3229,6 +3229,9 @@
  CUpDownClient* cur_src = *it;
 
  if (!cur_src->GetFileComment().IsEmpty()) {
+ if (thePrefs::IsCommentFiltered(cur_src->GetFileComment())) {
+ continue;
+ }
  m_hasComment = true;
  }
 
Index: src/CommentDialogLst.cpp
===================================================================
--- src/CommentDialogLst.cpp (revision 8224)
+++ src/CommentDialogLst.cpp (working copy)
@@ -87,14 +87,12 @@
 
  const FileRatingList &list = m_file->GetRatingAndComments();
  for (FileRatingList::const_iterator it = list.begin(); it != list.end(); ++it) {
- if (!thePrefs::IsCommentFiltered(it->Comment)) {
  m_list->InsertItem(count, it->UserName);
  m_list->SetItem(count, 1, it->FileName);
  m_list->SetItem(count, 2, (it->Rating != -1) ? GetRateString(it->Rating) : wxString(wxT("on")));
  m_list->SetItem(count, 3, it->Comment);
  m_list->SetItemPtrData(count, reinterpret_cast<wxUIntPtr>(new SFileRating(*it)));
  ++count;
- }
  }
 
  wxString info;
Logged

kuanto

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 31
Re: filtered-off comments still affect rating
« Reply #4 on: May 04, 2008, 11:01:26 PM »

up

I think you forgot to commit this to SVN ;)
Logged

wuischke

  • Developer
  • Hero Member
  • *****
  • Karma: 183
  • Offline Offline
  • Posts: 4292
Re: filtered-off comments still affect rating
« Reply #5 on: May 05, 2008, 12:03:49 AM »

Have you tested the patch? I can't test it myself, so I wait for your feedback before committing the patch.
Logged

kuanto

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 31
Re: filtered-off comments still affect rating
« Reply #6 on: May 05, 2008, 12:19:41 AM »

Have you tested the patch? I can't test it myself, so I wait for your feedback before committing the patch.

I have tested magicamule's patch, and it works perfectly.

I see your patch have some extra modifications regarding CommentDialogLst.cpp file. I haven't tested yours. I 'm going to try it, and i will tell you.


EDIT: mmm, with your patch, filtered comments appear in the comments dialog. I don't understand what was the purpose behind modifying CommentDialogLst.cpp file, but the result doesn't seem to be correct. IMHO, magicamule's patch is the right choice  ;)
« Last Edit: May 05, 2008, 12:35:57 AM by kuanto »
Logged

wuischke

  • Developer
  • Hero Member
  • *****
  • Karma: 183
  • Offline Offline
  • Posts: 4292
Re: filtered-off comments still affect rating
« Reply #7 on: May 05, 2008, 01:36:36 PM »

Thinking error on my side, you're correct. You'll find the patch and a changelog entry in tomorrow's tarball. Many thanks to you, too!
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: filtered-off comments still affect rating
« Reply #8 on: May 05, 2008, 11:49:56 PM »

Works fine.  :D
Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon