packages feed

hsendxmpp 0.1.2.6 → 0.1.3

raw patch · 2 files changed

+11/−3 lines, 2 filesdep +tls

Dependencies added: tls

Files

Main.hs view
@@ -7,6 +7,7 @@ import Data.Maybe import qualified Data.String.Class as S import qualified Data.Text.IO as T+import Network.TLS import Network.Xmpp import Network.Xmpp.Internal hiding (priority, status) import Network.Xmpp.Extras.MUC@@ -24,6 +25,7 @@ 	, oResource :: String 	, oMessageType :: MessageType 	, oVerbose :: Bool+	, oNoTLSVerify :: Bool 	} deriving (Eq, Show)  defaultOptions = Options@@ -33,6 +35,7 @@ 	, oResource = "hsendxmpp" 	, oMessageType = Chat 	, oVerbose = False+	, oNoTLSVerify = False 	}  options :: [OptDescr (Options -> Options)]@@ -43,6 +46,7 @@ 	, Option ['r']	["resource"]	(ReqArg	(\str o -> o { oResource = str }) "res")	"Use resource res for the sender [default: 'hsendxmpp']" 	, Option ['c']	["chatroom"]	(NoArg	(\o -> o { oMessageType = GroupChat }))		"Send the message to a chatroom (MUC)" 	, Option ['v']	["verbose"]	(NoArg	(\o -> o { oVerbose = True }))			"Be verbose on what's happening on the wire"+	, Option ['n']	["no-tls-verify"]	(NoArg	(\o -> o { oNoTLSVerify = True }))	"Accept TLS certificates without verification" 	]  getOpts :: IO (Options, [String])@@ -63,7 +67,10 @@ 	let passWord = if null justEnvPassWord then oPassWord opts else justEnvPassWord  	let authData = Just (fst $ fromJust (simpleAuth (S.toText $ oUserName opts) (S.toText passWord)), if null $ oResource opts then Nothing else Just $ S.toText $ oResource opts) :: AuthData-	eSess <- session (oServer opts) authData def+	let sessionConfiguration = if oNoTLSVerify opts+		then def { sessionStreamConfiguration = def { tlsParams = xmppDefaultParams { clientHooks = def { onServerCertificate = \_ _ _ _ -> pure [] } } } }+		else def+	eSess <- session (oServer opts) authData sessionConfiguration 	let sess = either (error . show) id $ eSess 	sendPresence presenceOnline sess 	mapM_ (\tjid -> do
hsendxmpp.cabal view
@@ -1,6 +1,6 @@ cabal-version:       3.0 name:                hsendxmpp-version:             0.1.2.6+version:             0.1.3 synopsis:            sendxmpp clone, sending XMPP messages via CLI description:         It aims to be a drop-in replacement regarding the CLI flags. It is user-friendlier, handles errors better and, unlike sendxmpp, it supports modern authentication and encryption schemes. license:             AGPL-3.0-only@@ -18,7 +18,7 @@ Source-repository this   type:              git   location:          https://github.com/l29ah/hsendxmpp.git-  tag:               0.1.2.6+  tag:               0.1.3  executable hsendxmpp   main-is:             Main.hs@@ -31,5 +31,6 @@                        hslogger >= 1.2.8 && < 1.4,                        string-class >= 0.1.7.0 && < 0.2,                        text ^>= 1.2.4.1,+                       tls ^>= 1.5.5,   -- hs-source-dirs:   default-language:    Haskell2010