Last Comment Bug 19402 - Ability to filter messages by size
: Ability to filter messages by size
Status: RESOLVED FIXED
:
Product: MailNews Core
Classification: Components
Component: Filters (show other bugs)
: Trunk
: All All
: P3 enhancement with 5 votes (vote)
: mozilla1.8alpha6
Assigned To: Mark Banner (:standard8, afk until Dec)
: Nobody; OK to take it and work on it
:
Mentors:
: 119661 163680 175384 188480 240583 (view as bug list)
Depends on:
Blocks: 66425 92074
  Show dependency treegraph
 
Reported: 1999-11-19 14:36 PST by revenant
Modified: 2011-08-05 22:36 PDT (History)
26 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Patch to implement filter and search by size. (12.54 KB, patch)
2004-10-18 14:28 PDT, Mark Banner (:standard8, afk until Dec)
no flags Details | Diff | Splinter Review
Patch for Search/Filter in KB (12.05 KB, patch)
2004-10-24 07:35 PDT, Mark Banner (:standard8, afk until Dec)
neil: review+
mozilla: superreview+
asa: approval‑aviary-
asa: approval1.7.5-
Details | Diff | Splinter Review
Search for Size on Imap (no whitespace changes) (10.66 KB, patch)
2004-11-17 14:04 PST, Mark Banner (:standard8, afk until Dec)
no flags Details | Diff | Splinter Review
Search/Filter for Imap (whitespace changes) (27.03 KB, patch)
2004-11-17 14:11 PST, Mark Banner (:standard8, afk until Dec)
no flags Details | Diff | Splinter Review
Revised search/filter for Imap patch (26.79 KB, patch)
2004-11-25 08:37 PST, Mark Banner (:standard8, afk until Dec)
neil: review+
Details | Diff | Splinter Review
Revised search/filter for Imap with no whitespace changes. (8.97 KB, patch)
2004-11-25 09:59 PST, Mark Banner (:standard8, afk until Dec)
standard8: review+
mozilla: superreview+
asa: approval‑aviary-
asa: approval1.7.5-
Details | Diff | Splinter Review

Description revenant 1999-11-19 14:36:34 PST
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.
Comment 1 Phil Peterson 1999-11-19 14:44:59 PST
Add to [help wanted] list
Comment 2 Sebastian Späth 2000-07-16 09:35:26 PDT
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.
Comment 3 lchiang 2001-11-02 09:32:35 PST
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!
Comment 4 Christopher Aillon (sabbatical, not receiving bugmail) 2002-01-12 09:27:45 PST
*** Bug 119661 has been marked as a duplicate of this bug. ***
Comment 5 jesse 2002-01-27 12:31:46 PST
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.
Comment 6 Alfonso Martinez 2002-08-20 11:53:24 PDT
*** Bug 163680 has been marked as a duplicate of this bug. ***
Comment 7 Daniel Wang 2002-12-02 14:13:30 PST
-> NEW
Comment 8 Jo Hermans 2003-01-10 04:12:14 PST
*** Bug 188480 has been marked as a duplicate of this bug. ***
Comment 9 Stuart Longland 2003-09-26 05:53:35 PDT
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.
Comment 10 Bogdan Stroe 2004-04-22 21:44:17 PDT
*** Bug 240583 has been marked as a duplicate of this bug. ***
Comment 11 Kelly Price 2004-06-06 11:11:28 PDT
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?
Comment 12 Mark Banner (:standard8, afk until Dec) 2004-10-18 14:28:45 PDT
Created attachment 162515 [details] [diff] [review]
Patch to implement filter and search by size.

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 13 Mark Banner (:standard8, afk until Dec) 2004-10-19 14:35:48 PDT
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.
Comment 14 Stuart Longland 2004-10-21 07:30:43 PDT
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 15 Mark Banner (:standard8, afk until Dec) 2004-10-24 04:18:55 PDT
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.
Comment 16 Mark Banner (:standard8, afk until Dec) 2004-10-24 07:35:53 PDT
Created attachment 163211 [details] [diff] [review]
Patch for Search/Filter in KB

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.
Comment 17 neil@parkwaycc.co.uk 2004-10-27 09:16:07 PDT
Comment on attachment 163211 [details] [diff] [review]
Patch for Search/Filter in KB

Looks good, at least for POP/Local accounts and filters.
Comment 18 Mark Banner (:standard8, afk until Dec) 2004-10-28 14:07:57 PDT
Assigning to self and removing helpwanted keyword for now.
Comment 19 Mark Banner (:standard8, afk until Dec) 2004-11-04 14:10:44 PST
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?
Comment 20 Mark Banner (:standard8, afk until Dec) 2004-11-17 14:04:25 PST
Created attachment 166264 [details] [diff] [review]
Search for Size on Imap (no whitespace changes)
Comment 21 Mark Banner (:standard8, afk until Dec) 2004-11-17 14:11:05 PST
Created attachment 166268 [details] [diff] [review]
Search/Filter for Imap (whitespace changes)

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.
Comment 22 neil@parkwaycc.co.uk 2004-11-17 16:34:15 PST
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...
Comment 23 Mark Banner (:standard8, afk until Dec) 2004-11-25 08:37:58 PST
Created attachment 167032 [details] [diff] [review]
Revised search/filter for Imap patch

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).
Comment 24 Mark Banner (:standard8, afk until Dec) 2004-11-25 08:46:27 PST
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.
Comment 25 neil@parkwaycc.co.uk 2004-11-25 09:31:49 PST
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.
Comment 26 Mark Banner (:standard8, afk until Dec) 2004-11-25 09:59:10 PST
Created attachment 167038 [details] [diff] [review]
Revised search/filter for Imap with no whitespace changes.
Comment 27 Mark Banner (:standard8, afk until Dec) 2004-11-25 10:01:50 PST
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.
Comment 28 Mark Banner (:standard8, afk until Dec) 2004-11-25 14:09:19 PST
Comment on attachment 163211 [details] [diff] [review]
Patch for Search/Filter in KB

Do aviary and thunderbird want this? Enables Search & Filter message size.
Comment 29 Mark Banner (:standard8, afk until Dec) 2004-11-25 14:13:17 PST
Patches checked into trunk by timeless at: 2004-11-25 13:05. Marking fixed.
Comment 30 Alan Dobkin 2004-11-25 19:55:33 PST
Regarding aviary and thunderbird, yes, definitely, as well as similar/related
bug 92075: "Search for Flag".
Comment 31 Asa Dotzler [:asa] 2004-12-04 20:01:59 PST
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.
Comment 32 WADA 2004-12-16 16:51:24 PST
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)
Comment 33 Ray Booysen 2006-02-23 02:54:33 PST
*** Bug 175384 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.