Philipp
2011-Oct-05 19:18 UTC
[sup-talk] Adding string to ''missing attachment detection''
Hi there, I sometimes need to write mails in German and need to attach some files to those mails. I also tend to send mails before attaching the files. I have the ''mentioned "attachment" but it''s missing''-option enabled, but it doesn''t help me in German mails. All I''d need is a way to add the word ''Anhang'' to that mechanism. Can you tell me where to do this? I tried a web search and looked through some source files but couldn''t find the right place so far. Regards, Philipp
Ben Walton
2011-Oct-06 00:00 UTC
[sup-talk] Adding string to ''missing attachment detection''
Excerpts from Philipp''s message of Wed Oct 05 15:18:49 -0400 2011: Hi Philipp,> All I''d need is a way to add the word ''Anhang'' to that mechanism. Can > you tell me where to do this? I tried a web search and looked through > some source files but couldn''t find the right place so far.You want to write a ''mentions-attachments'' hook. You''ll get the variables header, and body. Scan the body for whatever terms you want/need and return true/false as desired. HTH. -Ben -- Ben Walton Systems Programmer - CHASS University of Toronto C:416.407.5610 | W:416.978.4302
Philipp Überbacher
2011-Oct-06 07:04 UTC
[sup-talk] Adding string to ''missing attachment detection''
Excerpts from Ben Walton''s message of 2011-10-06 02:00:00 +0200:> Excerpts from Philipp''s message of Wed Oct 05 15:18:49 -0400 2011: > > Hi Philipp, > > > All I''d need is a way to add the word ''Anhang'' to that mechanism. Can > > you tell me where to do this? I tried a web search and looked through > > some source files but couldn''t find the right place so far. > > You want to write a ''mentions-attachments'' hook. You''ll get the > variables header, and body. Scan the body for whatever terms you > want/need and return true/false as desired. > > HTH. > -BenThanks, but sup does this already, it should be possible to add this single Word in the appropriate place and be done with this. After all, ruby is an interpreted language. The sup releases are infrequent, if another one follows at all, and thus modifying a file is no problem. I don''t have the time to dig deep enough into ruby and sup either. I see that http://sup.rubyforge.org/wiki/wiki.pl?Hooks lists such a hook but sadly no example. Guess I can live without that.
Tero Tilus
2011-Oct-06 12:17 UTC
[sup-talk] Adding string to ''missing attachment detection''
Philipp ?berbacher, 2011-10-06 10:04:> the time to dig deep enough into ruby and sup either. I see that > http://sup.rubyforge.org/wiki/wiki.pl?Hooks lists such a hook but sadly > no example.Oh my! Need to fix it. My ~/.sup/hooks/mentions-attachments looks like body.any? { |l| l =~ /^[^>]/ && l =~ /\b(attach|liite|liittee|ohessa|oheise|oheist)[^ ]*\b/i } Not pretty but works. -- Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/
Ben Walton
2011-Oct-06 12:55 UTC
[sup-talk] Adding string to ''missing attachment detection''
Excerpts from Philipp ?berbacher''s message of Thu Oct 06 03:04:27 -0400 2011:> but sup does this already, it should be possible to add this single Word > in the appropriate place and be done with this. After all, ruby is > anSure, lib/sup/modes/edit-message-mode.rb on line 473 (my version of sup is fairly old, but this should be close). The hook is cleaner, but if you want to hack it in directly, that''s where you''d do it. Thanks -Ben -- Ben Walton Systems Programmer - CHASS University of Toronto C:416.407.5610 | W:416.978.4302
Philipp Überbacher
2011-Oct-06 13:33 UTC
[sup-talk] Adding string to ''missing attachment detection''
Excerpts from Tero Tilus''s message of 2011-10-06 14:17:30 +0200:> Philipp ?berbacher, 2011-10-06 10:04: > > the time to dig deep enough into ruby and sup either. I see that > > http://sup.rubyforge.org/wiki/wiki.pl?Hooks lists such a hook but sadly > > no example. > > Oh my! Need to fix it. My ~/.sup/hooks/mentions-attachments looks like > > body.any? { |l| l =~ /^[^>]/ && l =~ /\b(attach|liite|liittee|ohessa|oheise|oheist)[^ ]*\b/i } > > Not pretty but works.Thanks, this works. I don''t understand what this line is doing but it looks very similar in the source and this line is simply easier to hack for me, so I go with this solution. Thanks for sharing, Philipp
Philipp Überbacher
2011-Oct-06 13:34 UTC
[sup-talk] Adding string to ''missing attachment detection''
Excerpts from Ben Walton''s message of 2011-10-06 14:55:07 +0200:> Excerpts from Philipp ?berbacher''s message of Thu Oct 06 03:04:27 -0400 2011: > > > but sup does this already, it should be possible to add this single Word > > in the appropriate place and be done with this. After all, ruby is > > an > > Sure, lib/sup/modes/edit-message-mode.rb on line 473 (my version of > sup is fairly old, but this should be close). > > The hook is cleaner, but if you want to hack it in directly, that''s > where you''d do it. > > Thanks > -Ben > -- > Ben Walton > Systems Programmer - CHASS > University of Toronto > C:416.407.5610 | W:416.978.4302Thanks, I looked it up, it looks similar to the suggested hook line, but the hook line was easier to modify without risking to mess stuff up. Thanks for your help. Regards, Philipp