Skip to content

Commit

Permalink
Move flags to net/imap/flags
Browse files Browse the repository at this point in the history
Partially implements #10.
  • Loading branch information
nevans committed May 5, 2021
1 parent 0d43c5e commit 2a9afa8
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 48 deletions.
49 changes: 1 addition & 48 deletions lib/net/imap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

require_relative "imap/command_data"
require_relative "imap/data_encoding"
require_relative "imap/flags"
require_relative "imap/response_data"
require_relative "imap/response_parser"

Expand Down Expand Up @@ -238,43 +239,6 @@ class IMAP < Protocol
# 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
Expand All @@ -285,16 +249,6 @@ def self.debug=(val)
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
Expand Down Expand Up @@ -1062,7 +1016,6 @@ def idle_done
SSL_PORT = 993 # :nodoc:

@@debug = false
@@max_flag_count = 10000

# :call-seq:
# Net::IMAP.new(host, options = {})
Expand Down
56 changes: 56 additions & 0 deletions lib/net/imap/flags.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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

0 comments on commit 2a9afa8

Please sign in to comment.