From 8007aecb47333eb15d5cc5d66c9bcf0571baf5b6 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Sat, 28 Nov 2015 16:51:52 -0500 Subject: [PATCH] Initial help --- Main.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Main.hs b/Main.hs index 0c4f155..1940094 100644 --- a/Main.hs +++ b/Main.hs @@ -359,7 +359,7 @@ parseJIDrequireNode txt where jid = parseJID txt -data Command = Join JID | JoinInvited | Send Text | Leave | InviteCmd JID | SetNick Text | Whisper JID Text +data Command = Help | Join JID | JoinInvited | Send Text | Leave | InviteCmd JID | SetNick Text | Whisper JID Text deriving (Show, Eq) parseCommand txt room nick componentHost @@ -381,6 +381,7 @@ parseCommand txt room nick componentHost | txt == fromString "/join" = Just JoinInvited | txt == fromString "/leave" = Just Leave | txt == fromString "/part" = Just Leave + | txt == fromString "/help" = Just Help | otherwise = Just $ Send txt getMessage (ReceivedMessage m) = Just m @@ -474,6 +475,12 @@ processSMS db toVitelity toComponent componentHost tel txt = do | (fromString "(SMSSERVER) ") `T.isPrefixOf` msg -> return () -- bogus message from vitelity, ignore | Just room <- existingRoom -> sendToRoom toComponent componentHost tel room msg | otherwise -> writeStanzaChan toVitelity $ mkSMS tel (fromString "You are not joined to a room") + Just Help -> writeStanzaChan toVitelity $ mkSMS tel $ fromString $ mconcat [ + "/nick (desired name) - set nick\n", + "/invite (number or JID) - invite to group\n", + "/msg (user) - whisper to group member\n", + "/leave - leave group" + ] Nothing -> writeStanzaChan toVitelity $ mkSMS tel (fromString "You sent an invalid message") viteltiy db chunks toVitelity toComponent componentHost = do -- 2.45.2