File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1897,7 +1897,11 @@ def getquota(quota_root)
18971897 # Sends a {SETQUOTA command [RFC2087 §4.1]}[https://www.rfc-editor.org/rfc/rfc2087#section-4.1]
18981898 # along with the specified +quota_root+ and +storage_limit+. If
18991899 # +storage_limit+ is +nil+, resource limits are unset for that quota root.
1900- # Otherwise, it sets the +STORAGE+ resource limit.
1900+ # If +storage_limit+ is a number, it sets the +STORAGE+ resource limit.
1901+ #
1902+ # imap.setquota "#user/alice", 100
1903+ # imap.getquota "#user/alice"
1904+ # # => [#<struct Net::IMAP::MailboxQuota mailbox="#user/alice" usage=54 quota=100>]
19011905 #
19021906 # Typically one needs to be logged in as a server admin for this to work.
19031907 #
@@ -1913,11 +1917,11 @@ def getquota(quota_root)
19131917 # resource type.
19141918 def setquota ( quota_root , storage_limit )
19151919 if storage_limit . nil?
1916- list = '()'
1920+ list = [ ]
19171921 else
1918- list = '( STORAGE ' + storage_limit . to_s + ')'
1922+ list = [ " STORAGE" , Integer ( storage_limit ) ]
19191923 end
1920- send_command ( "SETQUOTA" , quota_root , RawData . new ( list ) )
1924+ send_command ( "SETQUOTA" , quota_root , list )
19211925 end
19221926
19231927 # 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 @@ -28,6 +28,10 @@ class IMAPQuotaTest < Net::IMAP::TestCase
2828 rcvd_cmd = server . commands . pop
2929 assert_equal "SETQUOTA" , rcvd_cmd . name
3030 assert_equal '"" ()' , rcvd_cmd . args
31+
32+ assert_raise_with_message ( ArgumentError , /invalid value for Integer/ ) do
33+ imap . setquota "INBOX" , "512 620"
34+ end
3135 end
3236 end
3337end
You canāt perform that action at this time.
0 commit comments