Browse Source

inserted Haddock comments to hide the non-Network.XMPP modules, fixed some Haddock problems

master
Jon Kristensen 15 years ago
parent
commit
4ac7e32dab
  1. 28
      Network/XMPP.hs
  2. 12
      Network/XMPP/Address.hs
  3. 31
      Network/XMPP/SASL.hs
  4. 23
      Network/XMPP/Session.hs
  5. 14
      Network/XMPP/Stanza.hs
  6. 36
      Network/XMPP/Stream.hs
  7. 36
      Network/XMPP/TLS.hs
  8. 34
      Network/XMPP/Types.hs
  9. 14
      Network/XMPP/Utilities.hs
  10. 5
      pontarius-xmpp.cabal

28
Network/XMPP.hs

@ -19,24 +19,22 @@ with Pontarius XMPP. If not, see <http://www.gnu.org/licenses/>.
-} -}
-- | Module: $Header$ -- |
-- Description: A minimalistic and easy-to-use XMPP library -- Module: $Header$
-- Copyright: Copyright © 2010-2011 Jon Kristensen -- Description: Pontarius XMPP API
-- License: LGPL-3 -- Copyright: Copyright © 2010-2011 Jon Kristensen
-- License: LGPL-3
-- --
-- Maintainer: info@pontarius.org -- Maintainer: info@pontarius.org
-- Stability: unstable -- Stability: unstable
-- Portability: portable -- 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.
-- --
-- Note that we are not recommending anyone to use Pontarius XMPP at this time -- This module will be documented soon.
-- 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
-- <http://www.pontarius.org/> for more information.
-- --
-- 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
-- <http://www.pontarius.org/> for more information.
module Network.XMPP ( -- Network.XMPP.JID module Network.XMPP ( -- Network.XMPP.JID
Address (..) Address (..)

12
Network/XMPP/Address.hs

@ -20,6 +20,8 @@ with Pontarius XMPP. If not, see <http://www.gnu.org/licenses/>.
-} -}
{-# OPTIONS_HADDOCK hide #-}
-- TODO: Move away from stringprep for all three profiles. -- TODO: Move away from stringprep for all three profiles.
-- TODO: When no longer using stringprep, do appropriate testing. (Including -- TODO: When no longer using stringprep, do appropriate testing. (Including
@ -28,16 +30,6 @@ with Pontarius XMPP. If not, see <http://www.gnu.org/licenses/>.
-- TODO: Unicode 3.2 should be used. -- 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 -- This module deals with XMPP addresses (also known as JIDs and JabberIDs). For
-- more information on XMPP addresses, see RFC 6122: XMPP: Address Format. -- more information on XMPP addresses, see RFC 6122: XMPP: Address Format.
-- --

31
Network/XMPP/SASL.hs

@ -19,6 +19,9 @@ with Pontarius XMPP. If not, see <http://www.gnu.org/licenses/>.
-} -}
{-# OPTIONS_HADDOCK hide #-}
-- TODO: Make it possible to include host. -- TODO: Make it possible to include host.
-- TODO: Host is assumed to be ISO 8859-1; make list of assumptions. -- TODO: Host is assumed to be ISO 8859-1; make list of assumptions.
-- TODO: Can it contain newline characters? -- TODO: Can it contain newline characters?
@ -57,7 +60,7 @@ stringToList s' = let (next, rest) = break' s' ','
break' :: String -> Char -> (String, String) break' :: String -> Char -> (String, String)
break' s' c = let (first, second) = break ((==) c) s' break' s' c = let (first, second) = break ((==) c) s'
in (first, removeCharIfPresent second c) in (first, removeCharIfPresent second c)
-- Removes the first character, if present; "=hello" with '=' becomes -- Removes the first character, if present; "=hello" with '=' becomes
-- "hello". -- "hello".
removeCharIfPresent :: String -> Char -> String removeCharIfPresent :: String -> Char -> String
@ -114,11 +117,11 @@ replyToChallenge1 s h u p c =
qop = lookupDirectiveWithDefault "qop" list "auth" qop = lookupDirectiveWithDefault "qop" list "auth"
charset = lookupDirectiveWithDefault "charset" list "utf-8" charset = lookupDirectiveWithDefault "charset" list "utf-8"
algorithm = lookupDirective "algorithm" list algorithm = lookupDirective "algorithm" list
-- Verify that all necessary directives has been set. -- Verify that all necessary directives has been set.
in case (nonce, qop, charset, algorithm) of in case (nonce, qop, charset, algorithm) of
(Just nonce', qop', charset', Just algorithm') -> (Just nonce', qop', charset', Just algorithm') ->
-- Strip quotations of the directives that need it. -- Strip quotations of the directives that need it.
let -- realm'' = stripQuotations realm' let -- realm'' = stripQuotations realm'
nonce'' = stripQuotations nonce' nonce'' = stripQuotations nonce'
@ -127,7 +130,7 @@ replyToChallenge1 s h u p c =
-- -- Verify that the realm is the same as the Jabber host. -- -- Verify that the realm is the same as the Jabber host.
-- case realm'' == h of -- case realm'' == h of
-- True -> -- True ->
-- Verify that QOP is "auth", charset is "utf-8" and that -- Verify that QOP is "auth", charset is "utf-8" and that
-- the algorithm is "md5-sess". -- the algorithm is "md5-sess".
case qop'' == "auth" of case qop'' == "auth" of
@ -136,10 +139,10 @@ replyToChallenge1 s h u p c =
True -> True ->
case algorithm' == "md5-sess" of case algorithm' == "md5-sess" of
True -> True ->
-- All data is valid; generate the reply. -- All data is valid; generate the reply.
Left (reply nonce'' qop'') Left (reply nonce'' qop'')
-- Errors are caught and reported below. -- Errors are caught and reported below.
False -> Right C1UnsupportedAlgorithm False -> Right C1UnsupportedAlgorithm
False -> Right C1UnsupportedCharset False -> Right C1UnsupportedCharset
@ -150,7 +153,7 @@ replyToChallenge1 s h u p c =
reply n q = reply n q =
let -- We start with what's in RFC 2831 is referred to as "A1", a 16 octet let -- We start with what's in RFC 2831 is referred to as "A1", a 16 octet
-- MD5 hash. -- MD5 hash.
-- If the username or password values are in ISO-8859-1, we convert -- If the username or password values are in ISO-8859-1, we convert
-- them to ISO-8859-1 strings. -- them to ISO-8859-1 strings.
username = case all isLatin1 u of username = case all isLatin1 u of
@ -159,10 +162,10 @@ replyToChallenge1 s h u p c =
password = case all isLatin1 p of password = case all isLatin1 p of
True -> DBL.pack $ map c2w p True -> DBL.pack $ map c2w p
False -> DBLC.pack p False -> DBLC.pack p
nc = "00000001" nc = "00000001"
digestUri = "xmpp/" ++ h digestUri = "xmpp/" ++ h
-- Build the "{ username-value, ":", realm-value, ":", passwd }" -- Build the "{ username-value, ":", realm-value, ":", passwd }"
-- bytestring, the rest of the bytestring and then join them. -- bytestring, the rest of the bytestring and then join them.
a1a = DBi.encode $ md5 $ DBLC.append a1a = DBi.encode $ md5 $ DBLC.append
@ -173,24 +176,24 @@ replyToChallenge1 s h u p c =
password) password)
a1b = DBLC.pack (":" ++ n ++ ":" ++ c) a1b = DBLC.pack (":" ++ n ++ ":" ++ c)
a1 = DBLC.append a1a a1b a1 = DBLC.append a1a a1b
-- Generate the "A2" value. -- Generate the "A2" value.
a2 = DBLC.pack ("AUTHENTICATE:" ++ digestUri) a2 = DBLC.pack ("AUTHENTICATE:" ++ digestUri)
-- Produce the responseValue. -- Produce the responseValue.
k = DBLC.pack (show $ md5 a1) k = DBLC.pack (show $ md5 a1)
colon = DBLC.pack ":" colon = DBLC.pack ":"
s0 = DBLC.pack (n ++ ":" ++ nc ++ ":" ++ c ++ ":" ++ s0 = DBLC.pack (n ++ ":" ++ nc ++ ":" ++ c ++ ":" ++
q ++ ":") q ++ ":")
s1 = DBLC.pack $ show $ md5 a2 s1 = DBLC.pack $ show $ md5 a2
s_ = DBLC.append s0 s1 s_ = DBLC.append s0 s1
-- append k:d and 16 octet hash it -- append k:d and 16 octet hash it
kd = md5 (DBLC.append k (DBLC.append colon s_)) kd = md5 (DBLC.append k (DBLC.append colon s_))
lol0 = DBLC.unpack s_ lol0 = DBLC.unpack s_
lol1 = show kd lol1 = show kd
response = show kd response = show kd
in "username=\"" ++ u ++ "\",realm=\"" ++ h ++ "\",nonce=\"" ++ n ++ in "username=\"" ++ u ++ "\",realm=\"" ++ h ++ "\",nonce=\"" ++ n ++
"\",cnonce=\"" ++ c ++ "\",nc=" ++ nc ++ ",digest-uri=\"" ++ "\",cnonce=\"" ++ c ++ "\",nc=" ++ nc ++ ",digest-uri=\"" ++

23
Network/XMPP/Session.hs

@ -19,11 +19,6 @@ with Pontarius XMPP. If not, see <http://www.gnu.org/licenses/>.
-} -}
-- 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 -- I believe we need to use the MultiParamTypeClasses extension to be able to
-- work with arbitrary client states (solving the problem that the ClientState -- work with arbitrary client states (solving the problem that the ClientState
@ -31,16 +26,8 @@ with Pontarius XMPP. If not, see <http://www.gnu.org/licenses/>.
{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE MultiParamTypeClasses #-}
-- | {-# OPTIONS_HADDOCK hide #-}
-- 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
--
-- This module provides the functions used by XMPP clients to manage their XMPP -- This module provides the functions used by XMPP clients to manage their XMPP
-- sessions. -- sessions.
-- --
@ -55,6 +42,12 @@ with Pontarius XMPP. If not, see <http://www.gnu.org/licenses/>.
-- --
-- For more information, see the Pontarius XMPP Manual. -- 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 (..) module Network.XMPP.Session ( ClientHandler (..)
, ClientState (..) , ClientState (..)
, ConnectResult (..) , ConnectResult (..)

14
Network/XMPP/Stanza.hs

@ -19,16 +19,9 @@ with Pontarius XMPP. If not, see <http://www.gnu.org/licenses/>.
-} -}
-- |
-- Module: $Header$ {-# OPTIONS_HADDOCK hide #-}
-- Description: XMPP stanza types and utility functions
-- Copyright: Copyright © 2010-2011 Jon Kristensen
-- License: LGPL-3
--
-- Maintainer: info@pontarius.org
-- Stability: unstable
-- Portability: portable
--
-- The stanza record types are generally pretty convenient to work with. -- 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 -- 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 -- "IQResponse" we provide some helper functions in this module that work on
@ -37,7 +30,6 @@ with Pontarius XMPP. If not, see <http://www.gnu.org/licenses/>.
-- We also provide functions to create a new stanza ID generator, and to -- We also provide functions to create a new stanza ID generator, and to
-- generate new IDs. -- generate new IDs.
module Network.XMPP.Stanza ( module Network.XMPP.Stanza (
iqID, iqID,
iqFrom, iqFrom,

36
Network/XMPP/Stream.hs

@ -1,16 +1,26 @@
----------------------------------------------------------------------------- {-
--
-- Module : Network.XMPP.Stream Copyright © 2010-2011 Jon Kristensen.
-- Copyright : Copyright © 2011, Jon Kristensen
-- License : UnknownLicense "LGPL3" This file is part of Pontarius XMPP.
--
-- Maintainer : jon.kristensen@pontarius.org Pontarius XMPP is free software: you can redistribute it and/or modify it under
-- Stability : alpha the terms of the GNU Lesser General Public License as published by the Free
-- Portability : 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 <http://www.gnu.org/licenses/>.
-}
{-# OPTIONS_HADDOCK hide #-}
module Network.XMPP.Stream ( module Network.XMPP.Stream (
isTLSSecured, isTLSSecured,

36
Network/XMPP/TLS.hs

@ -1,16 +1,26 @@
----------------------------------------------------------------------------- {-
--
-- Module : Network.XMPP.TLS Copyright © 2010-2011 Jon Kristensen.
-- Copyright : Copyright © 2011, Jon Kristensen
-- License : LGPL (Just (Version {versionBranch = [3], versionTags = []})) This file is part of Pontarius XMPP.
--
-- Maintainer : jon.kristensen@pontarius.org Pontarius XMPP is free software: you can redistribute it and/or modify it under
-- Stability : alpha the terms of the GNU Lesser General Public License as published by the Free
-- Portability : 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 <http://www.gnu.org/licenses/>.
-}
{-# OPTIONS_HADDOCK hide #-}
module Network.XMPP.TLS ( module Network.XMPP.TLS (
getTLSParams, getTLSParams,

34
Network/XMPP/Types.hs

@ -1,14 +1,26 @@
----------------------------------------------------------------------------- {-
--
-- Module : Types Copyright © 2010-2011 Jon Kristensen.
-- Copyright : Copyright © 2011, Jon Kristensen
-- License : LGPL (Just (Version {versionBranch = [3], versionTags = []})) This file is part of Pontarius XMPP.
--
-- Maintainer : jon.kristensen@pontarius.org Pontarius XMPP is free software: you can redistribute it and/or modify it under
-- Stability : alpha the terms of the GNU Lesser General Public License as published by the Free
-- Portability : 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 <http://www.gnu.org/licenses/>.
-}
{-# OPTIONS_HADDOCK hide #-}
{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE MultiParamTypeClasses #-}

14
Network/XMPP/Utilities.hs

@ -19,18 +19,8 @@ with Pontarius XMPP. If not, see <http://www.gnu.org/licenses/>.
-} -}
-- |
-- Module: $Header$ {-# OPTIONS_HADDOCK hide #-}
-- 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.
-- TODO: Document this module -- TODO: Document this module
-- TODO: Make is possible to customize characters -- TODO: Make is possible to customize characters

5
pontarius-xmpp.cabal

@ -25,10 +25,7 @@ Tested-With: GHC ==7.0.2
-- Extra-Tmp-Files: -- Extra-Tmp-Files:
Library Library
Exposed-Modules: Network.XMPP, Network.XMPP.Address, Network.XMPP.SASL, Exposed-Modules: Network.XMPP
Network.XMPP.Session, Network.XMPP.Stanza,
Network.XMPP.Stream, Network.XMPP.TLS, Network.XMPP.Types,
Network.XMPP.Utilities
Exposed: True Exposed: True
Build-Depends: base >= 2 && < 5, parsec, enumerator, crypto-api, Build-Depends: base >= 2 && < 5, parsec, enumerator, crypto-api,
base64-string, pureMD5, utf8-string, network, xml-types, base64-string, pureMD5, utf8-string, network, xml-types,

Loading…
Cancel
Save