Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Re: Can I split messages based on their size?
       [not found]   ` <hddoewi6g50.fsf@bacchus.pvv.ntnu.no>
@ 2003-10-15  9:56     ` Svend Tollak Munkejord
  2003-10-15 15:32       ` Jesper Harder
  0 siblings, 1 reply; 3+ messages in thread
From: Svend Tollak Munkejord @ 2003-10-15  9:56 UTC (permalink / raw)


I wrote:

> On 2003-10-12, Jesper Harder <harder@myrealbox.com> wrote:
>
>> Svend Tollak Munkejord <stm@bacchus.pvv.org> writes:
>>
>>> Using nnmail-split-fancy, can I somehow split messages based on
>>> their size?  My idea is that if they are sent to my "suspicious"
>>> e-mail address, and if they are larger than, say, 100 kb, then they
>>> are certainly spam.
>>
>> You can define your own function:
>>
>> (defun my-> (size group)
>> (when (> (buffer-size) size) group))
>
> Thanks -- this was elegant. However, it does not seem to take attachments
> into account, and those were the ones I was particularly aiming for. Do I
> need some further tricks?

OK. I only tried "B t" (trace respool), and not actually to respool ("B
r"). Respooling worked, and the complete message size seemed to be
accounted for. With the following extension, "B t" worked as well (Gnus
5.10.2).

(defun my-> (size group)
  "Return GROUP if message size is larger than SIZE."
  (save-excursion; necessary?
    (let ((buf (or (get-buffer nnmail-article-buffer); (" *nnmail incoming*") for email
		   (get-buffer " *nnfolder move*"); for respool
		   (get-buffer gnus-original-article-buffer)))); (" *Original Article*") for trace (B t),
      (if (not buf)
	  (progn (message "Oops, cannot find message buffer") nil)
	(set-buffer buf)    
	(when (> (buffer-size) size) group)))))

Is it a semi-bug that I had to set the buffer this way?

Regards,
-- 
Svend Tollak Munkejord 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Can I split messages based on their size?
  2003-10-15  9:56     ` Can I split messages based on their size? Svend Tollak Munkejord
@ 2003-10-15 15:32       ` Jesper Harder
  0 siblings, 0 replies; 3+ messages in thread
From: Jesper Harder @ 2003-10-15 15:32 UTC (permalink / raw)


Svend Tollak Munkejord <stm@bacchus.pvv.org> writes:

> OK. I only tried "B t" (trace respool), and not actually to respool
> ("B r"). Respooling worked, and the complete message size seemed to
> be accounted for. With the following extension, "B t" worked as well
> (Gnus 5.10.2).
>
> Is it a semi-bug that I had to set the buffer this way?

Yes, but it's fixed in CVS (I also noticed it when I tried `B t'):

diff -u gnus/lisp/gnus-sum.el:6.360 gnus/lisp/gnus-sum.el:6.361
--- gnus-sum.el:6.360	Thu Aug  7 04:00:45 2003
+++ gnus-sum.el	Sun Oct 12 22:45:23 2003
@@ -9476,15 +9476,13 @@
     (gnus-summary-select-article)
     (save-excursion
       (set-buffer gnus-original-article-buffer)
-      (save-restriction
-	(message-narrow-to-head)
-	(let ((groups (nnmail-article-group 'identity trace)))
-	  (unless silent
-	    (if groups
-		(message "This message would go to %s"
-			 (mapconcat 'car groups ", "))
-	      (message "This message would go to no groups"))
-	    groups))))))
+      (let ((groups (nnmail-article-group 'identity trace)))
+	(unless silent
+	  (if groups
+	      (message "This message would go to %s"
+		       (mapconcat 'car groups ", "))
+	    (message "This message would go to no groups"))
+	  groups)))))
 
 (defun gnus-summary-respool-trace ()
   "Trace where the respool algorithm would put this article.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Can I split messages based on their size?
       [not found]   ` <df73ae29.0310142359.2dabb32b@posting.google.com>
@ 2003-10-16 15:46     ` Jesper Harder
  0 siblings, 0 replies; 3+ messages in thread
From: Jesper Harder @ 2003-10-16 15:46 UTC (permalink / raw)


nurullah_akkaya@yahoo.com (Nurullah Akkaya) writes:

> Jesper Harder <harder@myrealbox.com> wrote:
>> 
>> You can define your own function:
>> 
>>    (defun my-> (size group)
>>      (when (> (buffer-size) size) group))
>> 
>> and then use element like
>> 
>>    (: my-> 100000 "too-big")
>
> thats realy intresting can u write a more complete function thx...

Do you mean how to use it in your splitting rules?  Here's an example:

(setq nnmail-split-methods 'nnmail-split-fancy)
(setq nnmail-split-fancy
      '(|
        (: my-> 100000 "too-big")
	("to"   "edri-news@edri.org" "edri-news")
        ("from" "bugzilla-daemon@mozilla.org" "Bugzilla")
        ;; etc.
	"other"))


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-10-16 15:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <hddd6d5tugn.fsf@bacchus.pvv.ntnu.no>
     [not found] ` <m37k3ai5og.fsf@defun.localdomain>
     [not found]   ` <hddoewi6g50.fsf@bacchus.pvv.ntnu.no>
2003-10-15  9:56     ` Can I split messages based on their size? Svend Tollak Munkejord
2003-10-15 15:32       ` Jesper Harder
     [not found]   ` <df73ae29.0310142359.2dabb32b@posting.google.com>
2003-10-16 15:46     ` Jesper Harder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).