Ability to filter messages by size

RESOLVED FIXED in mozilla1.8alpha6

Status

enhancement
P3
normal
RESOLVED FIXED
20 years ago
8 years ago

People

(Reporter: revenant, Assigned: standard8)

Tracking

Trunk
mozilla1.8alpha6
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 4 obsolete attachments)

I have Communicator 4.6, so please forgive me if 4.7 has already addressed
this.

It would be very useful to be able to filter mail, and especially newsgroup,
messages by size.  This is a highly effective way of filtering spam from
binaries newsgroups.

Thank you.
Assignee: phil → nobody
Summary: RFE: Ability to filter messages by size → [HELP WANTED] Ability to filter messages by size
Whiteboard: [HELP WANTED]
Add to [help wanted] list
Keywords: helpwanted
Summary: [HELP WANTED] Ability to filter messages by size → Ability to filter messages by size
Whiteboard: [HELP WANTED]
From n.p.m.wishlist:
"In the same way I want to be able to set a limit on the size of the mails that 
I get home, I should get a question if I want to take it home, leave it on the
server or delete it. But then I want to have the subject of the mail too, which
gives me a hint if I want to get that one or not. (check YAM for this feature)"

I think in addition to filter mail on size it should be possible to delete 
messages bigger than a specified size on the mail server, ideally returning an 
automatic mail to the sender telling him so. 
Dial up will be very thankful for that feature.
OS: Windows 98 → All
Hardware: PC → All
Blocks: 66425
Status: NEW → ASSIGNED
Received an email from kieran@breen.net who wanted to help out on this bug and
have it assigned to him/her.  

Kieran - if you want to work on this enhancement, pls feel free to assign to you
(since it's a helpwanted bug assigned to "nobody@mozilla.org").  You can ask
questions in the mail/news newsgroup for assistance.  Thanks!
*** Bug 119661 has been marked as a duplicate of this bug. ***
Component: Mail Window Front End → Filters
This feature should be included along with a gui for bug 105169 (filter by
attachment file extension).  In fact, it would be really neat if someone
released self installing filter packages that searched the file extension and
file size that you could download to prevent virus emails from entering your inbox.
*** Bug 163680 has been marked as a duplicate of this bug. ***
Summary: Ability to filter messages by size → [RFE] Ability to filter messages by size
-> NEW
Status: ASSIGNED → NEW
*** Bug 188480 has been marked as a duplicate of this bug. ***
QA Contact: lchiang → nobody
I'd like this as a measure to be able to reject some of the viruses that have
been flying around of late.  It's rare for me to receive an email > 50KB in
size, especially a "bounce" message.

I might have a look and see if I can make a head & a tail of the Filtering code,
see if I can come up with a patch, but otherwise, if someone out there (who
knows what they're doing with the Mozilla source) is willing, I'd love to have
this feature in Mozilla.
*** Bug 240583 has been marked as a duplicate of this bug. ***
Hmmm, sound like something intresing to look into.  I'll love to have some
binaries sent to a seperate folder (as they're rare if outside a mailing list).

Is MailNews in XUL, or can it be extended via XUL?
I've formulated this as a possible beginning patch - some of the code for the
size matching already seemed to be in place.

Currently I know of three problems I have seen with this patch applied but
haven't fully confirmed yet if they are just because of this patch.

1) looks like bug 242600
2) looks like it could be a bug with doing multiple searches in the mailnews
search dialog, mozilla crashes with a "Gdk-ERROR **: BadPixmap" when closing
the search dialog.
3) The filter by size doesn't appear to work, although the search by size does.


I will keep looking at this, but if anyone can have a quick look and pass back
comments (especially related to the crashes) it would be useful. Thanks.
Comment on attachment 162515 [details] [diff] [review]
Patch to implement filter and search by size.

The two bugs I found exist in the raw trunk and aren't to do with my patch (the
second of those bugs is now logged as bug 265148).

I think this patch is basically ready, but should we be searching in bytes or
kilobytes?

Requesting review for the bytes version. If you think it should be kilobytes,
please note and I'll find a way of updating the patch to do it.
Attachment #162515 - Attachment description: Possible beginning patch → Patch to implement filter and search by size.
Attachment #162515 - Flags: review?(neil.parkwaycc.co.uk)
Given that the message list shows the size of emails in kB, the searching should
reflect this.  Perhaps it could be configurable?

Mind you, it isn't that difficult to pull out a calculator and divide by 1024
(or multiply for that matter :-D)
Comment on attachment 162515 [details] [diff] [review]
Patch to implement filter and search by size.

Cancelling review for the time being. To search in KB would make more sense at
the moment with the message display as it is. Will add new patch soon.
Attachment #162515 - Flags: review?(neil.parkwaycc.co.uk)
Revised the previous patch to search/filter with size parameter as KB as that
is what the user sees in the message pane.

Also tidied a couple of bits from the previous patch.

Note: I'm also going to be suggesting a seperate patch for adding size column
to the search results pane under the existing bug 222639.
Attachment #162515 - Attachment is obsolete: true
Attachment #163211 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 163211 [details] [diff] [review]
Patch for Search/Filter in KB

Looks good, at least for POP/Local accounts and filters.
Attachment #163211 - Flags: review?(neil.parkwaycc.co.uk) → review+
Attachment #163211 - Flags: superreview?(mscott)
Assignee: nobody → mark
Assigning to self and removing helpwanted keyword for now.
Status: NEW → ASSIGNED
Keywords: helpwanted
Summary: [RFE] Ability to filter messages by size → Ability to filter messages by size
Comment on attachment 163211 [details] [diff] [review]
Patch for Search/Filter in KB

mscott seems to be busy on other things, David will you consider sr for this
please?
Attachment #163211 - Flags: superreview?(mscott) → superreview?(bienvenu)
Ok, two patches that both implement search/filter for size ability for IMAP
accounts. One of these will need to be applied after the original patch
attachment 163211 [details] [diff] [review]). 

I know we don't normally change the whitespace, but nsMsgSearchAdapter.cpp was
seemed to me pretty hard to work out where the various parts of the switch/case
statements were and what they related to.

Anyway, I've included both for clarity, but will be requesting the whitespace
one gets checked in.
Attachment #166268 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 166268 [details] [diff] [review]
Search/Filter for Imap (whitespace changes)

>+      // If we are doing a less than search, we must subtract 1 now,
>+      // as otherwise we get a 67KB size message returned for a
>+      // less than 67KB search.
>+      if (nsMsgSearchOp::IsLessThan)
>+        sizeValue -= 1;
>+
>+      // Multiply by 1024 to get into kb resolution
>+      sizeValue *= 1024;
Firstly, if (nsMsgSearchOp::IsLessThan) doesn't seem to do what you want,
you're not comparing anything. Secondly, to match up with local search, you
probably want "greater than N" to translate as "LARGER <N*1024+1023>" and "less
than N" to translate as "SMALLER <N*1024>". At least with my mail server,
SMALLER really means SMALLER. Of course, "less than 1" never returns any
matches for your local search...
Attachment #166268 - Flags: review?(neil.parkwaycc.co.uk)
Product: MailNews → Core
This patch fixes the size issues that Neil mentioned & also stops "is" being a
possible option for matching on in imap filtering (it had crept in before
somehow).
Attachment #166264 - Attachment is obsolete: true
Attachment #166268 - Attachment is obsolete: true
Comment on attachment 167032 [details] [diff] [review]
Revised search/filter for Imap patch

Neil, revised and works ok, now that I have a working imap server ;-)

I did both the searching algorithms based on the fact of getting the displayed
values matching what you are searching for. Hence, less than 1 won't return
anything because we never display messages with a size of less than 1. We could
change it if you want, but I think it makes sense as it is.
Attachment #167032 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 167032 [details] [diff] [review]
Revised search/filter for Imap patch

Ideally you shouldn't reformat the entire function's whitespace just to add a
few lines... also you wrapped a useless pair of braces around the if
(IsStringAttribute(attrib)) block. r=me for the relevant bits only.
Attachment #167032 - Flags: review?(neil.parkwaycc.co.uk) → review+
Comment on attachment 167038 [details] [diff] [review]
Revised search/filter for Imap with no whitespace changes.

Using neil's r for the patch as only whitespace removed.

Requesting Superreview - David can you sr the other patch on this bug as well
please if it's ok.

Thanks.
Attachment #167038 - Flags: superreview?(bienvenu)
Attachment #167038 - Flags: review+
Attachment #167038 - Flags: superreview?(bienvenu) → superreview+
Attachment #163211 - Flags: superreview?(bienvenu) → superreview+
Comment on attachment 163211 [details] [diff] [review]
Patch for Search/Filter in KB

Do aviary and thunderbird want this? Enables Search & Filter message size.
Attachment #163211 - Flags: approval1.7.5?
Attachment #163211 - Flags: approval-aviary?
Attachment #167038 - Flags: approval1.7.5?
Attachment #167038 - Flags: approval-aviary?
Patches checked into trunk by timeless at: 2004-11-25 13:05. Marking fixed.
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.8alpha6
Regarding aviary and thunderbird, yes, definitely, as well as similar/related
bug 92075: "Search for Flag".
Comment on attachment 167038 [details] [diff] [review]
Revised search/filter for Imap with no whitespace changes.

1.0 has wrapped and we're looking to the trunk for future releases.
Attachment #167038 - Flags: approval-aviary? → approval-aviary-
Attachment #167038 - Flags: approval1.7.5? → approval1.7.5-
Attachment #163211 - Flags: approval1.7.5?
Attachment #163211 - Flags: approval1.7.5-
Attachment #163211 - Flags: approval-aviary?
Attachment #163211 - Flags: approval-aviary-
Question on the "Size".
Which size is passed when partially downloaded mail - whole mail size or size of
already downloaded portion?
("Header only" or "Download size limitation" on POP3)
*** Bug 175384 has been marked as a duplicate of this bug. ***
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.