Revision 125a6103
Added by Marc Dequènes almost 16 years ago
- ID 125a6103388becb6a55f69c534942e3eba3f42fd
postman | ||
---|---|---|
logger.log_to_file(@config.log.file) unless @config.log.file.nil?
|
||
end
|
||
|
||
@stop_asap = false
|
||
|
||
logger.info "Bot '#{self.human_name}' loaded"
|
||
end
|
||
|
||
def run
|
||
imap = IMAP.new(@config.imap)
|
||
imap.check_mail do |msg|
|
||
if @stop_asap
|
||
logger.info "Bot was asked to stop..."
|
||
break
|
||
end
|
||
|
||
mail = Mail.new(msg)
|
||
logger.info "Mail #{mail.message_id}: #{mail.from_addrs} -> #{mail.to_addrs} (#{mail.subject})"
|
||
|
||
... | ... | |
end
|
||
|
||
def ask_to_stop
|
||
@stop_asap = true
|
||
end
|
||
end
|
||
end
|
Also available in: Unified diff
[evol] implemented bot stop trigger