diff --git a/Network/XMPP.hs b/Network/XMPP.hs index f2d74eb..bea6cac 100644 --- a/Network/XMPP.hs +++ b/Network/XMPP.hs @@ -19,24 +19,22 @@ with Pontarius XMPP. If not, see . -} --- | Module: $Header$ --- Description: A minimalistic and easy-to-use XMPP library --- Copyright: Copyright © 2010-2011 Jon Kristensen --- License: LGPL-3 +-- | +-- Module: $Header$ +-- Description: Pontarius XMPP API +-- Copyright: Copyright © 2010-2011 Jon Kristensen +-- License: LGPL-3 -- --- Maintainer: info@pontarius.org --- Stability: unstable --- Portability: portable - --- Pontarius XMPP aims to be a secure, concurrent/event-based and easy-to-use --- XMPP library for Haskell. It is being actively developed. +-- Maintainer: info@pontarius.org +-- Stability: unstable +-- Portability: portable -- --- Note that we are not recommending anyone to use Pontarius XMPP at this time --- as it's still in an experimental stage and will have its API and data types --- modified frequently. See the project's web site at --- for more information. +-- This module will be documented soon. -- --- This module will be documented soon. +-- Note that we are not recommending anyone to use Pontarius XMPP at this time +-- as it's still in an experimental stage and will have its API and data types +-- modified frequently. See the project's web site at +-- for more information. module Network.XMPP ( -- Network.XMPP.JID Address (..) diff --git a/Network/XMPP/Address.hs b/Network/XMPP/Address.hs index 30fe94d..530c0e2 100644 --- a/Network/XMPP/Address.hs +++ b/Network/XMPP/Address.hs @@ -20,6 +20,8 @@ with Pontarius XMPP. If not, see . -} +{-# OPTIONS_HADDOCK hide #-} + -- TODO: Move away from stringprep for all three profiles. -- TODO: When no longer using stringprep, do appropriate testing. (Including @@ -28,16 +30,6 @@ with Pontarius XMPP. If not, see . -- TODO: Unicode 3.2 should be used. --- | --- Module: $Header$ --- Description: Data type and utility functions for XMPP addresses (JIDs) --- Copyright: Copyright © 2010-2011 Jon Kristensen --- License: LGPL-3 --- --- Maintainer: info@pontarius.org --- Stability: unstable --- Portability: portable --- -- This module deals with XMPP addresses (also known as JIDs and JabberIDs). For -- more information on XMPP addresses, see RFC 6122: XMPP: Address Format. -- diff --git a/Network/XMPP/SASL.hs b/Network/XMPP/SASL.hs index 8a1512e..77b9862 100644 --- a/Network/XMPP/SASL.hs +++ b/Network/XMPP/SASL.hs @@ -19,6 +19,9 @@ with Pontarius XMPP. If not, see . -} + +{-# OPTIONS_HADDOCK hide #-} + -- TODO: Make it possible to include host. -- TODO: Host is assumed to be ISO 8859-1; make list of assumptions. -- TODO: Can it contain newline characters? @@ -57,7 +60,7 @@ stringToList s' = let (next, rest) = break' s' ',' break' :: String -> Char -> (String, String) break' s' c = let (first, second) = break ((==) c) s' in (first, removeCharIfPresent second c) - + -- Removes the first character, if present; "=hello" with '=' becomes -- "hello". removeCharIfPresent :: String -> Char -> String @@ -114,11 +117,11 @@ replyToChallenge1 s h u p c = qop = lookupDirectiveWithDefault "qop" list "auth" charset = lookupDirectiveWithDefault "charset" list "utf-8" algorithm = lookupDirective "algorithm" list - + -- Verify that all necessary directives has been set. in case (nonce, qop, charset, algorithm) of (Just nonce', qop', charset', Just algorithm') -> - + -- Strip quotations of the directives that need it. let -- realm'' = stripQuotations realm' nonce'' = stripQuotations nonce' @@ -127,7 +130,7 @@ replyToChallenge1 s h u p c = -- -- Verify that the realm is the same as the Jabber host. -- case realm'' == h of -- True -> - + -- Verify that QOP is "auth", charset is "utf-8" and that -- the algorithm is "md5-sess". case qop'' == "auth" of @@ -136,10 +139,10 @@ replyToChallenge1 s h u p c = True -> case algorithm' == "md5-sess" of True -> - + -- All data is valid; generate the reply. Left (reply nonce'' qop'') - + -- Errors are caught and reported below. False -> Right C1UnsupportedAlgorithm False -> Right C1UnsupportedCharset @@ -150,7 +153,7 @@ replyToChallenge1 s h u p c = reply n q = let -- We start with what's in RFC 2831 is referred to as "A1", a 16 octet -- MD5 hash. - + -- If the username or password values are in ISO-8859-1, we convert -- them to ISO-8859-1 strings. username = case all isLatin1 u of @@ -159,10 +162,10 @@ replyToChallenge1 s h u p c = password = case all isLatin1 p of True -> DBL.pack $ map c2w p False -> DBLC.pack p - + nc = "00000001" digestUri = "xmpp/" ++ h - + -- Build the "{ username-value, ":", realm-value, ":", passwd }" -- bytestring, the rest of the bytestring and then join them. a1a = DBi.encode $ md5 $ DBLC.append @@ -173,24 +176,24 @@ replyToChallenge1 s h u p c = password) a1b = DBLC.pack (":" ++ n ++ ":" ++ c) a1 = DBLC.append a1a a1b - + -- Generate the "A2" value. a2 = DBLC.pack ("AUTHENTICATE:" ++ digestUri) - + -- Produce the responseValue. k = DBLC.pack (show $ md5 a1) colon = DBLC.pack ":" s0 = DBLC.pack (n ++ ":" ++ nc ++ ":" ++ c ++ ":" ++ q ++ ":") s1 = DBLC.pack $ show $ md5 a2 - + s_ = DBLC.append s0 s1 -- append k:d and 16 octet hash it kd = md5 (DBLC.append k (DBLC.append colon s_)) - + lol0 = DBLC.unpack s_ lol1 = show kd - + response = show kd in "username=\"" ++ u ++ "\",realm=\"" ++ h ++ "\",nonce=\"" ++ n ++ "\",cnonce=\"" ++ c ++ "\",nc=" ++ nc ++ ",digest-uri=\"" ++ diff --git a/Network/XMPP/Session.hs b/Network/XMPP/Session.hs index 2320dc6..0201252 100644 --- a/Network/XMPP/Session.hs +++ b/Network/XMPP/Session.hs @@ -19,11 +19,6 @@ with Pontarius XMPP. If not, see . -} --- TODO: Better functions and events for stanzas, IncomingIQ, OutgoingIQ, etc. (ClientSession, ClientStanza) - --- TODO: IO function to do everything related to the handle, instead of just connecting. - --- TODO: Enumerate in the same thread? Enumerate one element at the time, non-blocking? -- I believe we need to use the MultiParamTypeClasses extension to be able to -- work with arbitrary client states (solving the problem that the ClientState @@ -31,16 +26,8 @@ with Pontarius XMPP. If not, see . {-# LANGUAGE MultiParamTypeClasses #-} --- | --- Module: $Header$ --- Description: XMPP client session management module --- Copyright: Copyright © 2010-2011 Jon Kristensen --- License: LGPL-3 --- --- Maintainer: info@pontarius.org --- Stability: unstable --- Portability: portable --- +{-# OPTIONS_HADDOCK hide #-} + -- This module provides the functions used by XMPP clients to manage their XMPP -- sessions. -- @@ -55,6 +42,12 @@ with Pontarius XMPP. If not, see . -- -- For more information, see the Pontarius XMPP Manual. +-- TODO: Better functions and events for stanzas, IncomingIQ, OutgoingIQ, etc. (ClientSession, ClientStanza) + +-- TODO: IO function to do everything related to the handle, instead of just connecting. + +-- TODO: Enumerate in the same thread? Enumerate one element at the time, non-blocking? + module Network.XMPP.Session ( ClientHandler (..) , ClientState (..) , ConnectResult (..) diff --git a/Network/XMPP/Stanza.hs b/Network/XMPP/Stanza.hs index 00ca9af..70cc752 100644 --- a/Network/XMPP/Stanza.hs +++ b/Network/XMPP/Stanza.hs @@ -19,16 +19,9 @@ with Pontarius XMPP. If not, see . -} --- | --- Module: $Header$ --- Description: XMPP stanza types and utility functions --- Copyright: Copyright © 2010-2011 Jon Kristensen --- License: LGPL-3 --- --- Maintainer: info@pontarius.org --- Stability: unstable --- Portability: portable --- + +{-# OPTIONS_HADDOCK hide #-} + -- The stanza record types are generally pretty convenient to work with. -- However, due to the fact that an "IQ" can be both an "IQRequest" and an -- "IQResponse" we provide some helper functions in this module that work on @@ -37,7 +30,6 @@ with Pontarius XMPP. If not, see . -- We also provide functions to create a new stanza ID generator, and to -- generate new IDs. - module Network.XMPP.Stanza ( iqID, iqFrom, diff --git a/Network/XMPP/Stream.hs b/Network/XMPP/Stream.hs index 82477bb..f905103 100644 --- a/Network/XMPP/Stream.hs +++ b/Network/XMPP/Stream.hs @@ -1,16 +1,26 @@ ------------------------------------------------------------------------------ --- --- Module : Network.XMPP.Stream --- Copyright : Copyright © 2011, Jon Kristensen --- License : UnknownLicense "LGPL3" --- --- Maintainer : jon.kristensen@pontarius.org --- Stability : alpha --- Portability : --- --- | --- ------------------------------------------------------------------------------ +{- + +Copyright © 2010-2011 Jon Kristensen. + +This file is part of Pontarius XMPP. + +Pontarius XMPP is free software: you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the Free +Software Foundation, either version 3 of the License, or (at your option) any +later version. + +Pontarius XMPP is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +details. + +You should have received a copy of the GNU Lesser General Public License along +with Pontarius XMPP. If not, see . + +-} + + +{-# OPTIONS_HADDOCK hide #-} module Network.XMPP.Stream ( isTLSSecured, diff --git a/Network/XMPP/TLS.hs b/Network/XMPP/TLS.hs index 7dfee6a..ee569ef 100644 --- a/Network/XMPP/TLS.hs +++ b/Network/XMPP/TLS.hs @@ -1,16 +1,26 @@ ------------------------------------------------------------------------------ --- --- Module : Network.XMPP.TLS --- Copyright : Copyright © 2011, Jon Kristensen --- License : LGPL (Just (Version {versionBranch = [3], versionTags = []})) --- --- Maintainer : jon.kristensen@pontarius.org --- Stability : alpha --- Portability : --- --- | --- ------------------------------------------------------------------------------ +{- + +Copyright © 2010-2011 Jon Kristensen. + +This file is part of Pontarius XMPP. + +Pontarius XMPP is free software: you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the Free +Software Foundation, either version 3 of the License, or (at your option) any +later version. + +Pontarius XMPP is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +details. + +You should have received a copy of the GNU Lesser General Public License along +with Pontarius XMPP. If not, see . + +-} + + +{-# OPTIONS_HADDOCK hide #-} module Network.XMPP.TLS ( getTLSParams, diff --git a/Network/XMPP/Types.hs b/Network/XMPP/Types.hs index f6ca6c2..3662cf6 100644 --- a/Network/XMPP/Types.hs +++ b/Network/XMPP/Types.hs @@ -1,14 +1,26 @@ ------------------------------------------------------------------------------ --- --- Module : Types --- Copyright : Copyright © 2011, Jon Kristensen --- License : LGPL (Just (Version {versionBranch = [3], versionTags = []})) --- --- Maintainer : jon.kristensen@pontarius.org --- Stability : alpha --- Portability : --- ------------------------------------------------------------------------------ +{- + +Copyright © 2010-2011 Jon Kristensen. + +This file is part of Pontarius XMPP. + +Pontarius XMPP is free software: you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the Free +Software Foundation, either version 3 of the License, or (at your option) any +later version. + +Pontarius XMPP is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +details. + +You should have received a copy of the GNU Lesser General Public License along +with Pontarius XMPP. If not, see . + +-} + + +{-# OPTIONS_HADDOCK hide #-} {-# LANGUAGE MultiParamTypeClasses #-} diff --git a/Network/XMPP/Utilities.hs b/Network/XMPP/Utilities.hs index b494526..fc6eecf 100644 --- a/Network/XMPP/Utilities.hs +++ b/Network/XMPP/Utilities.hs @@ -19,18 +19,8 @@ with Pontarius XMPP. If not, see . -} --- | --- Module: $Header$ --- Description: Utility functions for Pontarius XMPP; currently only random ID --- generation functions --- Copyright: Copyright © 2010-2011 Jon Kristensen --- License: LGPL-3 --- --- Maintainer: info@pontarius.org --- Stability: unstable --- Portability: portable --- --- This module will be documented soon. + +{-# OPTIONS_HADDOCK hide #-} -- TODO: Document this module -- TODO: Make is possible to customize characters diff --git a/pontarius-xmpp.cabal b/pontarius-xmpp.cabal index 9ed3863..1ea3c49 100644 --- a/pontarius-xmpp.cabal +++ b/pontarius-xmpp.cabal @@ -25,10 +25,7 @@ Tested-With: GHC ==7.0.2 -- Extra-Tmp-Files: Library - Exposed-Modules: Network.XMPP, Network.XMPP.Address, Network.XMPP.SASL, - Network.XMPP.Session, Network.XMPP.Stanza, - Network.XMPP.Stream, Network.XMPP.TLS, Network.XMPP.Types, - Network.XMPP.Utilities + Exposed-Modules: Network.XMPP Exposed: True Build-Depends: base >= 2 && < 5, parsec, enumerator, crypto-api, base64-string, pureMD5, utf8-string, network, xml-types,