@@ -79,13 +79,55 @@ module Net
79
79
#
80
80
# === Server capabilities and protocol extensions
81
81
#
82
- # Net::IMAP <em>does not modify its behavior</em> according to server
83
- # #capabilities. Users of the class must check for required capabilities
84
- # before issuing commands. Special care should be taken to follow all
85
- # #capabilities requirements for #starttls, #login, and #authenticate.
82
+ # Net::IMAP does not _currently_ modify its behaviour according to the
83
+ # server's advertised #capabilities. Users of this class must check that the
84
+ # server is #capable? of extension commands or command arguments before
85
+ # sending them. Special care should be taken to follow the #capabilities
86
+ # requirements for #starttls, #login, and #authenticate.
86
87
#
87
88
# See #capable?, #capabilities, and #capability for more information.
88
89
#
90
+ # ==== Caching +CAPABILITY+ responses
91
+ #
92
+ # When storing the result of #capability be careful to discard the cached
93
+ # result appropriately, especially following #starttls. To avoid calling
94
+ # #capability unnecessarily, call #capable?, #auth_capable?, or #capabilities
95
+ # to use Net::IMAP's automatic capability caching.
96
+ #
97
+ # The server may advertise its initial capabilities using the +CAPABILITY+
98
+ # ResponseCode in a +PREAUTH+ or +OK+ #greeting. When TLS has started
99
+ # (#starttls) and after authentication (#login or #authenticate), the server's
100
+ # capabilities may change and cached #capabilities are discarded. The server
101
+ # may send updated capabilities with an +OK+ TaggedResponse to #login or
102
+ # #authenticate, and these will be cached by Net::IMAP. But the
103
+ # TaggedResponse to #starttls MUST be ignored--it is sent before TLS starts
104
+ # and is unprotected.
105
+ #
106
+ # ==== Basic IMAP4rev1 capabilities
107
+ #
108
+ # IMAP4rev1 servers must advertise +IMAP4rev1+ in their capabilities list.
109
+ # IMAP4rev1 servers must _implement_ the +STARTTLS+, <tt>AUTH=PLAIN</tt>,
110
+ # and +LOGINDISABLED+ capabilities, and clients must respect their presence
111
+ # or absence. See the capabilities requirements on #starttls, #login, and
112
+ # #authenticate.
113
+ #
114
+ # ===== Using IMAP4rev1 extensions
115
+ #
116
+ # IMAP4rev1 servers must not activate behavior that is incompatible with the
117
+ # base specification until an explicit client action invokes a capability,
118
+ # e.g. sending a command or command argument specific to that capability.
119
+ # Servers may send data with backward compatible behavior, such as response
120
+ # codes or mailbox attributes, at any time without client action.
121
+ #
122
+ # Invoking capabilities which are unknown to Net::IMAP may cause unexpected
123
+ # behavior and errors. For example, ResponseParseError is raised when
124
+ # unknown response syntax is received. Invoking commands or command
125
+ # parameters that are unsupported by the server may raise NoResponseError,
126
+ # BadResponseError, or cause other unexpected behavior.
127
+ #
128
+ # Some capabilities must be explicitly activated using the #enable command.
129
+ # See #enable for more details.
130
+ #
89
131
# == Examples of Usage
90
132
#
91
133
# === List sender and subject of all recent messages in the default mailbox
@@ -827,15 +869,15 @@ def disconnected?
827
869
# ensure cache invalidation is handled correctly.
828
870
#
829
871
# >>>
830
- # <em>*NOTE*: Net::IMAP does not </em>currently<em> modify its behaviour
831
- # according to the capabilities of the server . It is up to the user of
832
- # the class to ensure that a certain capability is supported by a server
833
- # before using it .</em>
872
+ # <em>*NOTE:* Net::IMAP does not _currently_ modify its behaviour
873
+ # according to the server's advertised capabilities . Users of this class
874
+ # must check that the server is #capable? of extension commands or command
875
+ # arguments before sending them .</em>
834
876
#
835
877
# <em>Capability requirements—other than +IMAP4rev1+—are listed in the
836
878
# documentation for each command method.</em>
837
879
#
838
- # Related: #capable?, #capabilities , #enable
880
+ # Related: #capable?, #auth_capable?, #capability , #enable
839
881
#
840
882
def capability
841
883
synchronize do
@@ -853,40 +895,15 @@ def capability
853
895
# of all standard capabilities, and their reference RFCs.
854
896
#
855
897
# >>>
856
- # <em>*NOTE*: Net::IMAP does not </em>currently<em> modify its behaviour
857
- # according to the capabilities of the server . It is up to the user of
858
- # the class to ensure that a certain capability is supported by a server
859
- # before using it .</em>
898
+ # <em>*NOTE:* Net::IMAP does not _currently_ modify its behaviour
899
+ # according to the server's advertised capabilities . Users of this class
900
+ # must check that the server is #capable? of extension commands or command
901
+ # arguments before sending them .</em>
860
902
#
861
903
# <em>Capability requirements—other than +IMAP4rev1+—are listed in the
862
904
# documentation for each command method.</em>
863
905
#
864
- # Related: #capabilities, #capability, #enable
865
- #
866
- # ===== Basic IMAP4rev1 capabilities
867
- #
868
- # IMAP4rev1 servers must include +IMAP4rev1+ in their capabilities list.
869
- # IMAP4rev1 servers must _implement_ the +STARTTLS+, <tt>AUTH=PLAIN</tt>,
870
- # and +LOGINDISABLED+ capabilities, and clients must respect their presence
871
- # or absence. See the capabilities requirements on #starttls, #login, and
872
- # #authenticate.
873
- #
874
- # ===== Using IMAP4rev1 extensions
875
- #
876
- # IMAP4rev1 servers must not activate behavior that is incompatible with the
877
- # base specification until an explicit client action invokes a capability,
878
- # e.g. sending a command or command argument specific to that capability.
879
- # Servers may send data with backward compatible behavior, such as response
880
- # codes or mailbox attributes, at any time without client action.
881
- #
882
- # Invoking capabilities which are unknown to Net::IMAP may cause unexpected
883
- # behavior and errors. For example, ResponseParseError is raised when
884
- # unknown response syntax is received. Invoking commands or command
885
- # parameters that are unsupported by the server may raise NoResponseError,
886
- # BadResponseError, or cause other unexpected behavior.
887
- #
888
- # Some capabilities must be explicitly activated using the #enable command.
889
- # See #enable for more details.
906
+ # Related: #auth_capable?, #capabilities, #capability, #enable
890
907
#
891
908
# ===== Caching +CAPABILITY+ responses
892
909
#
@@ -902,7 +919,7 @@ def capable?(capability) capabilities.include? capability.to_s.upcase end
902
919
#
903
920
# To ensure case-insensitive capability comparison, use #capable? instead.
904
921
#
905
- # Related: #capable?, #capability
922
+ # Related: #capable?, #auth_capable?, # capability
906
923
def capabilities
907
924
@capabilities || capability
908
925
end
0 commit comments