aMule Forum
English => en_Bugs => Topic started by: magicamule 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.
-
Could you please try the following patch and report back?
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++;
-
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: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;
}
-
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!
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;
-
up
I think you forgot to commit this to SVN ;)
-
Have you tested the patch? I can't test it myself, so I wait for your feedback before committing the patch.
-
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 ;)
-
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!
-
Works fine. :D