m textHas: 'X-Mailer: Celeste'
|Göran Hultgren (email@example.com) whipped this up to check who's been a good little Celesteer and who's not. It shamed me (Bijan) into making the full time switch!|
m participantHas: 'firstname.lastname@example.org'
|Very simple filter. The only thing interesting about it is the #patricipantHas checks the from:, to:, and cc: fields. --BJP|
m participantHas: 'email@example.com'
|Look for messages that explicitly name you in the header. Such messages are usually of personal interest.|
Time now hours < 12
ifTrue: [m participantHas: 'firstname.lastname@example.org']
ifFalse: [m subjectHas: '[BUG]']
|Filters are just Squeak code! This filter has a different effect in the morning and in the evening (morning for goofing off reading the Squeak list and the afternoon for those serious bug reports). Remember, the filter must return 'true' or 'false' for each message!--BJP|
(m subjectHas: #(music go protest)
ifFalse: [Transcript cr; show: 'Rejecting note from ', m from.
|Kinda pointless, but it does demontrate two interesting filter features: 1) the "helper" methods (i.e., fooHas:) can take arrays as arguments, and will coerce the items to strings (this makes "or" searchs way more compact), 2) your filters are just Squeak code and can have interesting side effects. --BJP|
(m fromHas: #('[ENH]' '[BUG]' '[FIX]')
ifTrue: [self catgeory = 'new'
ifTrue: [self queueMessageWithText: m rawText.
mailDB file: m msgID inCategory: 'BugList'.
mailDB remove: m msgID fromCategory: 'new']
|This one pushes things to the limit :) and requires a minor change to Celeste>>makeFilterFor: (which I'll submit to the Squeak list), to wit
This lets you send stuff to your
current Celeste and access its instance variables. Ooops! Wrong-o! I don't know if it's a recent change or just an error on my part, but this is a *class* method (why?) and thus "self" refers to the class. Boo hoo bah! So, *three* changes. Change as above. Move it instance side. Alter editFilterNamed:filterExpr: to call the instance side method. And that lets you do such things as have category sensitive filters, and filters that generate responses (both of these things done in this sample). One tricky bit: the browser lists won't be properly updated. Of course, this was the easy way out. I suppose I could turn filters into a two argument block. But then you wouldn't have access to the instance variables, which is key for doing all sorts of thing. That fact is, I think, a flaw in the programmatic interfact to Celeste. (Although a simple #mailDB accessor would solve most of the problems.) --BJP
'[ :m | ' , filterExpr , ']'