[前][次][番号順一覧][スレッド一覧]

ruby-changes:66073

From: nicholas <ko1@a...>
Date: Thu, 6 May 2021 15:20:58 +0900 (JST)
Subject: [ruby-changes:66073] deae61e939 (master): [ruby/net-imap] Move flags to net/imap/flags

https://git.ruby-lang.org/ruby.git/commit/?id=deae61e939

From deae61e939fee9e24bace3ee99334e841f663114 Mon Sep 17 00:00:00 2001
From: "nicholas a. evans" <nicholas.evans@g...>
Date: Tue, 4 May 2021 15:33:21 -0400
Subject: [ruby/net-imap] Move flags to net/imap/flags

Partially implements #10.

https://github.com/ruby/net-imap/commit/2a9afa83bf
---
 lib/net/imap.rb       | 49 +-------------------------------------------
 lib/net/imap/flags.rb | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+), 48 deletions(-)
 create mode 100644 lib/net/imap/flags.rb

diff --git a/lib/net/imap.rb b/lib/net/imap.rb
index 862b10e..59cc71a 100644
--- a/lib/net/imap.rb
+++ b/lib/net/imap.rb
@@ -24,6 +24,7 @@ end https://github.com/ruby/ruby/blob/trunk/lib/net/imap.rb#L24
 
 require_relative "imap/command_data"
 require_relative "imap/data_encoding"
+require_relative "imap/flags"
 require_relative "imap/response_data"
 require_relative "imap/response_parser"
 
@@ -238,43 +239,6 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/imap.rb#L239
     # The thread to receive exceptions.
     attr_accessor :client_thread
 
-    # Flag indicating a message has been seen.
-    SEEN = :Seen
-
-    # Flag indicating a message has been answered.
-    ANSWERED = :Answered
-
-    # Flag indicating a message has been flagged for special or urgent
-    # attention.
-    FLAGGED = :Flagged
-
-    # Flag indicating a message has been marked for deletion.  This
-    # will occur when the mailbox is closed or expunged.
-    DELETED = :Deleted
-
-    # Flag indicating a message is only a draft or work-in-progress version.
-    DRAFT = :Draft
-
-    # Flag indicating that the message is "recent," meaning that this
-    # session is the first session in which the client has been notified
-    # of this message.
-    RECENT = :Recent
-
-    # Flag indicating that a mailbox context name cannot contain
-    # children.
-    NOINFERIORS = :Noinferiors
-
-    # Flag indicating that a mailbox is not selected.
-    NOSELECT = :Noselect
-
-    # Flag indicating that a mailbox has been marked "interesting" by
-    # the server; this commonly indicates that the mailbox contains
-    # new messages.
-    MARKED = :Marked
-
-    # Flag indicating that the mailbox does not contains new messages.
-    UNMARKED = :Unmarked
-
     # Returns the debug mode.
     def self.debug
       return @@debug
@@ -285,16 +249,6 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/imap.rb#L249
       return @@debug = val
     end
 
-    # Returns the max number of flags interned to symbols.
-    def self.max_flag_count
-      return @@max_flag_count
-    end
-
-    # Sets the max number of flags interned to symbols.
-    def self.max_flag_count=(count)
-      @@max_flag_count = count
-    end
-
     # The default port for IMAP connections, port 143
     def self.default_port
       return PORT
@@ -1062,7 +1016,6 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/imap.rb#L1016
     SSL_PORT = 993   # :nodoc:
 
     @@debug = false
-    @@max_flag_count = 10000
 
     # :call-seq:
     #    Net::IMAP.new(host, options = {})
diff --git a/lib/net/imap/flags.rb b/lib/net/imap/flags.rb
new file mode 100644
index 0000000..118e41f
--- /dev/null
+++ b/lib/net/imap/flags.rb
@@ -0,0 +1,56 @@ https://github.com/ruby/ruby/blob/trunk/lib/net/imap/flags.rb#L1
+# frozen_string_literal: true
+
+module Net
+  class IMAP < Protocol
+
+    # Flag indicating a message has been seen.
+    SEEN = :Seen
+
+    # Flag indicating a message has been answered.
+    ANSWERED = :Answered
+
+    # Flag indicating a message has been flagged for special or urgent
+    # attention.
+    FLAGGED = :Flagged
+
+    # Flag indicating a message has been marked for deletion.  This
+    # will occur when the mailbox is closed or expunged.
+    DELETED = :Deleted
+
+    # Flag indicating a message is only a draft or work-in-progress version.
+    DRAFT = :Draft
+
+    # Flag indicating that the message is "recent," meaning that this
+    # session is the first session in which the client has been notified
+    # of this message.
+    RECENT = :Recent
+
+    # Flag indicating that a mailbox context name cannot contain
+    # children.
+    NOINFERIORS = :Noinferiors
+
+    # Flag indicating that a mailbox is not selected.
+    NOSELECT = :Noselect
+
+    # Flag indicating that a mailbox has been marked "interesting" by
+    # the server; this commonly indicates that the mailbox contains
+    # new messages.
+    MARKED = :Marked
+
+    # Flag indicating that the mailbox does not contains new messages.
+    UNMARKED = :Unmarked
+
+    @@max_flag_count = 10000
+
+    # Returns the max number of flags interned to symbols.
+    def self.max_flag_count
+      return @@max_flag_count
+    end
+
+    # Sets the max number of flags interned to symbols.
+    def self.max_flag_count=(count)
+      @@max_flag_count = count
+    end
+
+  end
+end
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]