Browse Source

clean up Types

master
Philipp Balzarek 14 years ago
parent
commit
3161404679
  1. 2
      source/Network/Xmpp/Bind.hs
  2. 39
      source/Network/Xmpp/Types.hs

2
source/Network/Xmpp/Bind.hs

@ -35,7 +35,7 @@ xmppBind rsrc = do
, Right jid <- unpickleElem jidP b , Right jid <- unpickleElem jidP b
-> return jid -> return jid
| otherwise -> throw $ StreamXMLError | otherwise -> throw $ StreamXMLError
"Bind could'nt unpickle JID" "Bind couldn't unpickle JID"
modify (\s -> s{sJid = Just jid}) modify (\s -> s{sJid = Just jid})
return jid return jid
where where

39
source/Network/Xmpp/Types.hs

@ -23,7 +23,6 @@ module Network.Xmpp.Types
, SaslError(..) , SaslError(..)
, SaslFailure(..) , SaslFailure(..)
, SaslMechanism (..) , SaslMechanism (..)
, SaslCredentials (..)
, ServerFeatures(..) , ServerFeatures(..)
, Stanza(..) , Stanza(..)
, StanzaError(..) , StanzaError(..)
@ -253,31 +252,6 @@ instance Read PresenceType where
readsPrec _ "probe" = [(Probe, "")] readsPrec _ "probe" = [(Probe, "")]
readsPrec _ _ = [] readsPrec _ _ = []
--data ShowType = Available
-- | Away
-- | FreeChat
-- | DND
-- | XAway
-- deriving Eq
--
--instance Show ShowType where
-- show Available = ""
-- show Away = "away"
-- show FreeChat = "chat"
-- show DND = "dnd"
-- show XAway = "xa"
--
--instance Read ShowType where
-- readsPrec _ "" = [( Available ,"")]
-- readsPrec _ "available" = [( Available ,"")]
-- readsPrec _ "away" = [( Away ,"")]
-- readsPrec _ "chat" = [( FreeChat ,"")]
-- readsPrec _ "dnd" = [( DND ,"")]
-- readsPrec _ "xa" = [( XAway ,"")]
-- readsPrec _ "invisible" = [( Available ,"")]
-- readsPrec _ _ = []
-- | All stanzas (IQ, message, presence) can cause errors, which in the Xmpp -- | All stanzas (IQ, message, presence) can cause errors, which in the Xmpp
-- stream looks like <stanza-kind to='sender' type='error'>. These errors are -- stream looks like <stanza-kind to='sender' type='error'>. These errors are
-- wrapped in the @StanzaError@ type. -- wrapped in the @StanzaError@ type.
@ -402,17 +376,6 @@ instance Read StanzaErrorCondition where
-- OTHER STUFF -- OTHER STUFF
-- ============================================================================= -- =============================================================================
data SaslCredentials = DigestMD5Credentials (Maybe Text) Text Text
| PlainCredentials (Maybe Text) Text Text
instance Show SaslCredentials where
show (DigestMD5Credentials authzid authcid _) = "DIGEST_MD5Credentials " ++
(Text.unpack $ fromMaybe "" authzid) ++ " " ++ (Text.unpack authcid) ++
" (password hidden)"
show (PlainCredentials authzid authcid _) = "PLAINCredentials " ++
(Text.unpack $ fromMaybe "" authzid) ++ " " ++ (Text.unpack authcid) ++
" (password hidden)"
data SaslMechanism = DigestMD5 deriving Show data SaslMechanism = DigestMD5 deriving Show
data SaslFailure = SaslFailure { saslFailureCondition :: SaslError data SaslFailure = SaslFailure { saslFailureCondition :: SaslError
@ -476,8 +439,6 @@ instance Read SaslError where
readsPrec _ "temporary-auth-failure" = [(SaslTemporaryAuthFailure , "")] readsPrec _ "temporary-auth-failure" = [(SaslTemporaryAuthFailure , "")]
readsPrec _ _ = [] readsPrec _ _ = []
-- data ServerAddress = ServerAddress N.HostName N.PortNumber deriving (Eq)
-- TODO: document the error cases -- TODO: document the error cases
data StreamErrorCondition data StreamErrorCondition
= StreamBadFormat = StreamBadFormat

Loading…
Cancel
Save