Index: imap.rb =================================================================== --- imap.rb (revision 47109) +++ imap.rb (working copy) @@ -788,6 +788,8 @@ # +attr+ is a list of attributes to fetch; see the documentation # for Net::IMAP::FetchData for a list of valid attributes. # + # +mod+ is a list of fetch modifiers. + # # The return value is an array of Net::IMAP::FetchData. For # example: # @@ -806,13 +808,13 @@ # #=> "12-Oct-2000 22:40:59 +0900" # p data.attr["UID"] # #=> 98 - def fetch(set, attr) - return fetch_internal("FETCH", set, attr) + def fetch(set, attr, mod = nil) + return fetch_internal("FETCH", set, attr, mod) end # Similar to #fetch(), but +set+ contains unique identifiers. - def uid_fetch(set, attr) - return fetch_internal("UID FETCH", set, attr) + def uid_fetch(set, attr, mod = nil) + return fetch_internal("UID FETCH", set, attr, mod) end # Sends a STORE command to alter data associated with messages @@ -1361,7 +1363,7 @@ end end - def fetch_internal(cmd, set, attr) + def fetch_internal(cmd, set, attr, mod = nil) case attr when String then attr = RawData.new(attr) @@ -1384,7 +1386,11 @@ end synchronize do @responses.delete("FETCH") - send_command(cmd, MessageSet.new(set), attr, flags) + if mod + send_command(cmd, MessageSet.new(set), attr, mod) + else + send_command(cmd, MessageSet.new(set), attr) + end return @responses.delete("FETCH") end end @@ -2252,6 +2258,8 @@ name, val = body_data when /\A(?:UID)\z/ni name, val = uid_data + when /\A(?:MODSEQ)\z/ni + name, val = modseq_data else parse_error("unknown attribute `%s' for {%d}", token.value, n) end @@ -2735,6 +2743,16 @@ return name, number end + def modseq_data + token = match(T_ATOM) + name = token.value.upcase + match(T_SPACE) + match(T_LPAR) + modseq = number + match(T_RPAR) + return name, modseq + end + def text_response token = match(T_ATOM) name = token.value.upcase