Revision b0da6fb3
Added by Marc Dequènes almost 11 years ago
data/cyborghood/schema/global.yaml | ||
---|---|---|
"flags":
|
||
type: seq
|
||
sequence:
|
||
- {type: str, enum: [debug_nomaildeletion, debug_ignorereplay, debug_imapverbose]}
|
||
- {type: str, enum: [nomaildeletion, ignorereplay, imapverbose]}
|
||
"contact":
|
||
type: map
|
||
mapping:
|
lib/cyborghood/imap.rb | ||
---|---|---|
@available_mails = 0
|
||
@available_mails_mutex = Mutex.new
|
||
|
||
if @config.debug.flags.include?('debug_imapverbose')
|
||
if @config.debug.flags.include?('imapverbose')
|
||
Net::IMAP.debug = true
|
||
end
|
||
end
|
||
... | ... | |
end
|
||
|
||
def delete
|
||
if not @config.debug.flags.include?('debug_nomaildeletion')
|
||
if not @config.debug.flags.include?('nomaildeletion')
|
||
@imap.store(@message_id, "+FLAGS", [:Deleted])
|
||
end
|
||
end
|
||
... | ... | |
|
||
def listen_to_events
|
||
@imap.add_response_handler do |resp|
|
||
logger.debug "IMAP event: " + resp.inspect if @config.debug.flags.include?('debug_imapverbose')
|
||
logger.debug "IMAP event: " + resp.inspect if @config.debug.flags.include?('imapverbose')
|
||
if resp.kind_of?(Net::IMAP::UntaggedResponse)
|
||
case resp.name
|
||
when "EXISTS"
|
||
... | ... | |
begin
|
||
check_inbox(&message_handler)
|
||
# don't loop forever
|
||
return if @config.debug.flags.include?('debug_nomaildeletion')
|
||
return if @config.debug.flags.include?('nomaildeletion')
|
||
end while waiting_mails?
|
||
|
||
if self.capabilities.include?("IDLE")
|
lib/cyborghood/mail.rb | ||
---|---|---|
|
||
def process
|
||
if is_marked?
|
||
if @config.debug.flags.include?('debug_ignorereplay')
|
||
if @config.debug.flags.include?('ignorereplay')
|
||
logger.warn "Debug: ignoring replay"
|
||
else
|
||
return MailReport.new(:error => _("Replay detected."))
|
Also available in: Unified diff
[evol] removed useless 'debug_' prefix in debug flags