diff --git a/README.md b/README.md index ae4bb98..bfdbafd 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,7 @@ Welcome to Pontarius XMPP! ========================== Pontarius XMPP is an active work in progress to build a Haskell XMPP library -that implements the client capabilities of [RFC 6120 ("XMPP -Core")](http://tools.ietf.org/html/rfc6120). +that implements the client capabilities of [RFC 6120](http://tools.ietf.org/html/rfc6120). Getting started --------------- @@ -34,7 +33,7 @@ When this is done, a Session object can be acquired by calling result <- session "example.com" def - (Just ([scramSha1 "user" Nothing "Password"], Nothing)) + (Just ([scramSha1 "username" Nothing "password"], Nothing)) _Tip:_ Note that the first parameter actually is a Text value. Import Data.Text and use the OverloadedStrings LANGUAGE pragma. @@ -47,14 +46,13 @@ with TLS, authenticate, establish a concurrent interface for interacting with the stream, and return the Session object. The return type of session is IO (Either XmppFailure -(Session, Maybe AuthFailure)). As XmppFailure is an +Session). As XmppFailure is an Control.Monad.Error instance, you can utilize the ErrorT monad transformer for error handling. A more simple way of doing it could be doing something like this: sess <- case result of - Right (s, Nothing) -> return s - Right (_s, e) -> error $ "AuthFailure: " ++ (show e) + Right s -> return s Left e -> error $ "XmppFailure: " ++ (show e) Next, let us set our status to Online. diff --git a/examples/echoclient/Main.hs b/examples/echoclient/Main.hs index e3f65dc..2e3ab90 100644 --- a/examples/echoclient/Main.hs +++ b/examples/echoclient/Main.hs @@ -21,10 +21,9 @@ main = do result <- session "example.com" def - (Just ([scramSha1 "user" Nothing "Password"], Nothing)) + (Just ([scramSha1 "username" Nothing "password"], Nothing)) sess <- case result of - Right (s, Nothing) -> return s - Right (_s, e) -> error $ "AuthFailure: " ++ (show e) + Right s -> return s Left e -> error $ "XmppFailure: " ++ (show e) sendPresence (Presence Nothing Nothing Nothing Nothing Nothing []) sess forever $ do