Class: Rmsgen::IMAPPolnoteGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/rmsgen/imap_polnote_group.rb

Instance Method Summary collapse

Constructor Details

#initialize(imap, options = {}) ⇒ IMAPPolnoteGroup

Returns a new instance of IMAPPolnoteGroup.


5
6
7
8
9
# File 'lib/rmsgen/imap_polnote_group.rb', line 5

def initialize(imap, options={})
  @imap = imap
  @login  = options['imap_login']
  @password = options['imap_password']
end

Instance Method Details

#archive_polnote(id) ⇒ Object


28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/rmsgen/imap_polnote_group.rb', line 28

def archive_polnote(id)
  authenticate
  follow_inbox
  archived = false
  @imap.search(["FROM", 'rms@gnu.org']).each do |note_id|
    if note_id.to_i == id.to_i
      @imap.copy id.to_i, 'INBOX.old-messages' 
      @imap.store(id.to_i, "+FLAGS", [:Deleted])
      @imap.expunge
      archived = true
    end
  end
  archived
end

#fetch_notesObject


11
12
13
14
15
# File 'lib/rmsgen/imap_polnote_group.rb', line 11

def fetch_notes
  authenticate
  follow_inbox
  find_all_from_rms
end

#find(id) ⇒ Object


23
24
25
26
# File 'lib/rmsgen/imap_polnote_group.rb', line 23

def find(id)
  follow_inbox
  fetch_message_body(id)
end

#note_idsObject


17
18
19
20
21
# File 'lib/rmsgen/imap_polnote_group.rb', line 17

def note_ids
  authenticate
  follow_inbox
  @imap.search(["FROM", 'rms@gnu.org'])
end