lib/gmail/mailbox.rb in gmail-0.3.4 vs lib/gmail/mailbox.rb in gmail-0.4.0
- old
+ new
@@ -15,13 +15,15 @@
:draft => ['DRAFT'],
:undrafted => ['UNDRAFT']
}
attr_reader :name
+ attr_reader :external_name
def initialize(gmail, name="INBOX")
@name = name
+ @external_name = Net::IMAP.decode_utf7(name)
@gmail = gmail
end
# Returns list of emails which meets given criteria.
#
@@ -51,12 +53,14 @@
opts[:from] and search.concat ['FROM', opts[:from]]
opts[:to] and search.concat ['TO', opts[:to]]
opts[:subject] and search.concat ['SUBJECT', opts[:subject]]
opts[:label] and search.concat ['LABEL', opts[:label]]
opts[:attachment] and search.concat ['HAS', 'attachment']
- opts[:search] and search.concat [opts[:search]]
-
+ opts[:search] and search.concat ['BODY', opts[:search]]
+ opts[:body] and search.concat ['BODY', opts[:body]]
+ opts[:query] and search.concat opts[:query]
+
@gmail.mailbox(name) do
@gmail.conn.uid_search(search).collect do |uid|
message = (messages[uid] ||= Message.new(self, uid))
block.call(message) if block_given?
message
@@ -95,10 +99,10 @@
def messages
@messages ||= {}
end
def inspect
- "#<Gmail::Mailbox#{'0x%04x' % (object_id << 1)} name=#{@name}>"
+ "#<Gmail::Mailbox#{'0x%04x' % (object_id << 1)} name=#{external_name}>"
end
def to_s
name
end