File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1811,7 +1811,11 @@ def getquota(quota_root)
18111811 # Sends a {SETQUOTA command [RFC2087 §4.1]}[https://www.rfc-editor.org/rfc/rfc2087#section-4.1]
18121812 # along with the specified +quota_root+ and +storage_limit+. If
18131813 # +storage_limit+ is +nil+, resource limits are unset for that quota root.
1814- # Otherwise, it sets the +STORAGE+ resource limit.
1814+ # If +storage_limit+ is a number, it sets the +STORAGE+ resource limit.
1815+ #
1816+ # imap.setquota "#user/alice", 100
1817+ # imap.getquota "#user/alice"
1818+ # # => [#<struct Net::IMAP::MailboxQuota mailbox="#user/alice" usage=54 quota=100>]
18151819 #
18161820 # Typically one needs to be logged in as a server admin for this to work.
18171821 #
@@ -1827,11 +1831,11 @@ def getquota(quota_root)
18271831 # for each supported resource type.
18281832 def setquota ( quota_root , storage_limit )
18291833 if storage_limit . nil?
1830- list = '()'
1834+ list = [ ]
18311835 else
1832- list = '( STORAGE ' + storage_limit . to_s + ')'
1836+ list = [ " STORAGE" , Integer ( storage_limit ) ]
18331837 end
1834- send_command ( "SETQUOTA" , quota_root , RawData . new ( list ) )
1838+ send_command ( "SETQUOTA" , quota_root , list )
18351839 end
18361840
18371841 # Sends a {SETACL command [RFC4314 §3.1]}[https://www.rfc-editor.org/rfc/rfc4314#section-3.1]
Original file line number Diff line number Diff line change @@ -43,6 +43,10 @@ def teardown
4343 rcvd_cmd = server . commands . pop
4444 assert_equal "SETQUOTA" , rcvd_cmd . name
4545 assert_equal '"" ()' , rcvd_cmd . args
46+
47+ assert_raise_with_message ( ArgumentError , /invalid value for Integer/ ) do
48+ imap . setquota "INBOX" , "512 620"
49+ end
4650 end
4751 end
4852end
You canāt perform that action at this time.
0 commit comments