|
|
|
@ -720,18 +720,39 @@ langTagParser = do |
|
|
|
tagChars = ['a'..'z'] ++ ['A'..'Z'] |
|
|
|
tagChars = ['a'..'z'] ++ ['A'..'Z'] |
|
|
|
|
|
|
|
|
|
|
|
data StreamFeatures = StreamFeatures |
|
|
|
data StreamFeatures = StreamFeatures |
|
|
|
{ streamTls :: !(Maybe Bool) |
|
|
|
{ streamFeaturesTls :: !(Maybe Bool) |
|
|
|
, streamSaslMechanisms :: ![Text.Text] |
|
|
|
, streamFeaturesMechanisms :: ![Text.Text] |
|
|
|
, rosterVer :: !(Maybe Bool) -- ^ @Nothing@ for no roster |
|
|
|
, streamFeaturesRosterVer :: !(Maybe Bool) |
|
|
|
-- versioning, @Just False@ for |
|
|
|
-- ^ @Nothing@ for no roster versioning, @Just False@ for roster |
|
|
|
-- roster versioning and @Just True@ |
|
|
|
-- versioning and @Just True@ when the server sends the non-standard |
|
|
|
-- when the server sends the |
|
|
|
-- "optional" element (observed with prosody). |
|
|
|
-- non-standard "optional" element |
|
|
|
, streamFeaturesPreApproval :: !Bool -- ^ Does the server support pre-approval |
|
|
|
-- (observed with prosody). |
|
|
|
, streamFeaturesOther :: ![Element] |
|
|
|
, streamSubPreApproval :: !Bool -- ^ Does the server support pre-approval |
|
|
|
-- TODO: All feature elements instead? |
|
|
|
, streamOtherFeatures :: ![Element] -- TODO: All feature elements instead? |
|
|
|
|
|
|
|
} deriving (Eq, Show) |
|
|
|
} deriving (Eq, Show) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
instance Monoid StreamFeatures where |
|
|
|
|
|
|
|
mempty = StreamFeatures |
|
|
|
|
|
|
|
{ streamFeaturesTls = Nothing |
|
|
|
|
|
|
|
, streamFeaturesMechanisms = [] |
|
|
|
|
|
|
|
, streamFeaturesRosterVer = Nothing |
|
|
|
|
|
|
|
, streamFeaturesPreApproval = False |
|
|
|
|
|
|
|
, streamFeaturesOther = [] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
mappend sf1 sf2 = |
|
|
|
|
|
|
|
StreamFeatures |
|
|
|
|
|
|
|
{ streamFeaturesTls = mplusOn streamFeaturesTls |
|
|
|
|
|
|
|
, streamFeaturesMechanisms = mplusOn streamFeaturesMechanisms |
|
|
|
|
|
|
|
, streamFeaturesRosterVer = mplusOn streamFeaturesRosterVer |
|
|
|
|
|
|
|
, streamFeaturesPreApproval = |
|
|
|
|
|
|
|
streamFeaturesPreApproval sf1 |
|
|
|
|
|
|
|
|| streamFeaturesPreApproval sf2 |
|
|
|
|
|
|
|
, streamFeaturesOther = mplusOn streamFeaturesOther |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
where |
|
|
|
|
|
|
|
mplusOn f = f sf1 `mplus` f sf2 |
|
|
|
|
|
|
|
|
|
|
|
-- | Signals the state of the stream connection. |
|
|
|
-- | Signals the state of the stream connection. |
|
|
|
data ConnectionState |
|
|
|
data ConnectionState |
|
|
|
= Closed -- ^ Stream has not been established yet |
|
|
|
= Closed -- ^ Stream has not been established yet |
|
|
|
|