mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/net/imap.rb: added new commands for managing folder quotas
and folder ACLs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0abedcd807
commit
67d433a5e6
2 changed files with 84 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
Mon Jul 30 11:12:14 2001 Amos Gouaux <amos+ruby@utdallas.edu>
|
||||
|
||||
* lib/net/imap.rb: added new commands for managing folder quotas
|
||||
and folder ACLs.
|
||||
|
||||
Fri Jul 27 18:07:27 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* eval.c (rb_provided): extension should be guessed using
|
||||
|
|
|
@ -796,6 +796,29 @@ module Net
|
|||
end
|
||||
end
|
||||
|
||||
def getquota(mailbox)
|
||||
synchronize do
|
||||
send_command("GETQUOTA", mailbox)
|
||||
return @responses.delete("QUOTA")
|
||||
end
|
||||
end
|
||||
|
||||
def setquota(mailbox, quota)
|
||||
data = '(STORAGE ' + quota.to_s + ')'
|
||||
send_command("SETQUOTA", mailbox, RawData.new(data))
|
||||
end
|
||||
|
||||
def setacl(mailbox, user, acl)
|
||||
send_command("SETACL", mailbox, user, acl)
|
||||
end
|
||||
|
||||
def getacl(mailbox)
|
||||
synchronize do
|
||||
send_command("GETACL", mailbox)
|
||||
return @responses.delete("ACL")[-1]
|
||||
end
|
||||
end
|
||||
|
||||
def lsub(refname, mailbox)
|
||||
synchronize do
|
||||
send_command("LSUB", refname, mailbox)
|
||||
|
@ -1237,6 +1260,7 @@ module Net
|
|||
ResponseText = Struct.new(:code, :text)
|
||||
ResponseCode = Struct.new(:name, :data)
|
||||
MailboxList = Struct.new(:attr, :delim, :name)
|
||||
MailboxQuota = Struct.new(:mailbox, :usage, :quota)
|
||||
StatusData = Struct.new(:mailbox, :attr)
|
||||
FetchData = Struct.new(:seqno, :attr)
|
||||
Envelope = Struct.new(:date, :subject, :from, :sender, :reply_to,
|
||||
|
@ -1418,6 +1442,10 @@ module Net
|
|||
return flags_response
|
||||
when /\A(?:LIST|LSUB)\z/ni
|
||||
return list_response
|
||||
when /\A(?:QUOTA)\z/ni
|
||||
return getquota_response
|
||||
when /\A(?:ACL)\z/ni
|
||||
return getacl_response
|
||||
when /\A(?:SEARCH|SORT)\z/ni
|
||||
return search_response
|
||||
when /\A(?:STATUS)\z/ni
|
||||
|
@ -1946,6 +1974,57 @@ module Net
|
|||
return MailboxList.new(attr, delim, name)
|
||||
end
|
||||
|
||||
def getquota_response
|
||||
# If no quota set, get back
|
||||
# `NO Quota root does not exist'.
|
||||
token = match(T_ATOM)
|
||||
name = token.value.upcase
|
||||
match(T_SPACE)
|
||||
token = match(T_ATOM)
|
||||
mailbox = token.value
|
||||
match(T_SPACE)
|
||||
match(T_LPAR)
|
||||
match(T_ATOM)
|
||||
match(T_SPACE)
|
||||
token = match(T_NUMBER)
|
||||
usage = token.value
|
||||
match(T_SPACE)
|
||||
token = match(T_NUMBER)
|
||||
quota = token.value
|
||||
match(T_RPAR)
|
||||
data = MailboxQuota.new(mailbox, usage, quota)
|
||||
return UntaggedResponse.new(name, data, @str)
|
||||
end
|
||||
|
||||
def getacl_response
|
||||
token = match(T_ATOM)
|
||||
name = token.value.upcase
|
||||
match(T_SPACE)
|
||||
token = match(T_ATOM)
|
||||
mailbox = token.value
|
||||
token = lookahead
|
||||
if token.symbol == T_SPACE
|
||||
shift_token
|
||||
data = []
|
||||
while true
|
||||
token = lookahead
|
||||
case token.symbol
|
||||
when T_CRLF
|
||||
break
|
||||
when T_SPACE
|
||||
shift_token
|
||||
end
|
||||
user = astring
|
||||
match(T_SPACE)
|
||||
acl = astring
|
||||
data.push([user, acl])
|
||||
end
|
||||
else
|
||||
data = []
|
||||
end
|
||||
return UntaggedResponse.new(name, data, @str)
|
||||
end
|
||||
|
||||
def search_response
|
||||
token = match(T_ATOM)
|
||||
name = token.value.upcase
|
||||
|
|
Loading…
Reference in a new issue