File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -786,6 +786,15 @@ def expunge
786
786
end
787
787
end
788
788
789
+ # Similar to #expunge, but takes a set of unique identifiers as
790
+ # argument.
791
+ def uid_expunge ( set )
792
+ synchronize do
793
+ send_command ( "UID EXPUNGE" , MessageSet . new ( set ) )
794
+ return @responses . delete ( "EXPUNGE" )
795
+ end
796
+ end
797
+
789
798
# Sends a SEARCH command to search the mailbox for messages that
790
799
# match the given searching criteria, and returns message sequence
791
800
# numbers. +keys+ can either be a string holding the entire
Original file line number Diff line number Diff line change @@ -775,6 +775,39 @@ def test_id
775
775
end
776
776
end
777
777
778
+ def test_uid_expunge
779
+ server = create_tcp_server
780
+ port = server . addr [ 1 ]
781
+ requests = [ ]
782
+ start_server do
783
+ sock = server . accept
784
+ begin
785
+ sock . print ( "* OK test server\r \n " )
786
+ requests . push ( sock . gets )
787
+ sock . print ( "* 1 EXPUNGE\r \n " )
788
+ sock . print ( "* 1 EXPUNGE\r \n " )
789
+ sock . print ( "* 1 EXPUNGE\r \n " )
790
+ sock . print ( "RUBY0001 OK UID EXPUNGE completed\r \n " )
791
+ sock . gets
792
+ sock . print ( "* BYE terminating connection\r \n " )
793
+ sock . print ( "RUBY0002 OK LOGOUT completed\r \n " )
794
+ ensure
795
+ sock . close
796
+ server . close
797
+ end
798
+ end
799
+
800
+ begin
801
+ imap = Net ::IMAP . new ( server_addr , :port => port )
802
+ response = imap . uid_expunge ( 1000 ..1003 )
803
+ assert_equal ( "RUBY0001 UID EXPUNGE 1000:1003\r \n " , requests . pop )
804
+ assert_equal ( response . length , 3 )
805
+ imap . logout
806
+ ensure
807
+ imap . disconnect if imap
808
+ end
809
+ end
810
+
778
811
private
779
812
780
813
def imaps_test
You can’t perform that action at this time.
0 commit comments