diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-07 08:07:12 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-07 08:07:12 +0000 |
commit | fd019a5cbdb6c3dd3a96abe64c53f6918d07ff3a (patch) | |
tree | a16781bf952099e4c7a37b3c08d4d7fb9216b7ef /lib/net | |
parent | e806b0fed77d94ea426bfc0269ab3b01feaf218c (diff) | |
download | ruby-fd019a5cbdb6c3dd3a96abe64c53f6918d07ff3a.tar.gz |
* lib/net/imap.rb (xlist): supported the XLIST command, which is an
extension by Apple and Google. patch by Geoff Youngs.
[ruby-core:33521]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net')
-rw-r--r-- | lib/net/imap.rb | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/lib/net/imap.rb b/lib/net/imap.rb index c3dda46606..dd0d6b42b7 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -528,6 +528,38 @@ module Net end end + # Sends a XLIST command, and returns a subset of names from + # the complete set of all names available to the client. + # +refname+ provides a context (for instance, a base directory + # in a directory-based mailbox hierarchy). +mailbox+ specifies + # a mailbox or (via wildcards) mailboxes under that context. + # Two wildcards may be used in +mailbox+: '*', which matches + # all characters *including* the hierarchy delimiter (for instance, + # '/' on a UNIX-hosted directory-based mailbox hierarchy); and '%', + # which matches all characters *except* the hierarchy delimiter. + # + # If +refname+ is empty, +mailbox+ is used directly to determine + # which mailboxes to match. If +mailbox+ is empty, the root + # name of +refname+ and the hierarchy delimiter are returned. + # + # The XLIST command is like the LIST command except that the flags + # returned refer to the function of the folder/mailbox, e.g. :Sent + # + # The return value is an array of +Net::IMAP::MailboxList+. For example: + # + # imap.create("foo/bar") + # imap.create("foo/baz") + # p imap.xlist("", "foo/%") + # #=> [#<Net::IMAP::MailboxList attr=[:Noselect], delim="/", name="foo/">, \\ + # #<Net::IMAP::MailboxList attr=[:Noinferiors, :Marked], delim="/", name="foo/bar">, \\ + # #<Net::IMAP::MailboxList attr=[:Noinferiors], delim="/", name="foo/baz">] + def xlist(refname, mailbox) + synchronize do + send_command("XLIST", refname, mailbox) + return @responses.delete("XLIST") + end + end + # Sends the GETQUOTAROOT command along with specified +mailbox+. # This command is generally available to both admin and user. # If mailbox exists, returns an array containing objects of @@ -2071,7 +2103,7 @@ module Net return response_cond when /\A(?:FLAGS)\z/ni return flags_response - when /\A(?:LIST|LSUB)\z/ni + when /\A(?:LIST|LSUB|XLIST)\z/ni return list_response when /\A(?:QUOTA)\z/ni return getquota_response |