From d8bbebf794301be2c544143ce506f5439e8c1af5 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Sun, 29 Nov 2015 16:30:12 -0500 Subject: [PATCH] Add owners to members only rooms during invite --- Main.hs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Main.hs b/Main.hs index 9e933bf..c7c2d64 100644 --- a/Main.hs +++ b/Main.hs @@ -533,6 +533,23 @@ processSMS db toVitelity toComponent componentHost conferenceServers tel txt = d Just Leave -> leaveRoom db toComponent componentHost tel "Typed /leave" Just (InviteCmd jid) | Just room <- existingRoom -> do + membersonly <- maybe False toEnum <$> TC.runTCM (TC.get db (T.unpack (bareTxt room) <> "\0muc_membersonly")) + when membersonly $ do + -- Try to add everyone we invite as an owner also + uuid <- (fmap.fmap) UUID.toString UUID.nextUUID + writeStanzaChan toComponent $ (emptyIQ IQSet) { + iqTo = Just room, + iqFrom = telToJid tel (fromString componentHost), + iqID = fmap fromString uuid, + iqPayload = Just $ Element (fromString "{http://jabber.org/protocol/muc#admin}admin") [] [ + NodeElement $ Element (fromString "{http://jabber.org/protocol/muc#admin}item") + [ + (fromString "{http://jabber.org/protocol/muc#admin}affiliation", [ContentText $ fromString "owner"]), + (fromString "{http://jabber.org/protocol/muc#admin}jid", [ContentText $ formatJID jid]) + ] [] + ] + } + writeStanzaChan toComponent $ (emptyMessage MessageNormal) { messageTo = Just room, messageFrom = telToJid tel (fromString componentHost), -- 2.38.5