     
     
 }
+
+extension CWGroupServic: XMPPMUCLightDelegate {
+    func xmppMUCLight(_ sender: XMPPMUCLight, didDiscoverRooms rooms: [DDXMLElement], forServiceNamed serviceName: String) {
+        log.debug(serviceName)
+        log.debug(rooms)
+    }
+}

    
    func fetchJoinGroups() {
        
        let queryElement = DDXMLElement(name: "query", xmlns: "http://jabber.org/protocol/disco#items")
        
        let iqElement = DDXMLElement(name: "iq")
        iqElement.addAttribute(withName: "type", stringValue: "get")
        let chatClient = CWChatClient.share
        
        iqElement.addAttribute(withName: "from", stringValue: "chenwei@hellochatim.p1.im")
        iqElement.addAttribute(withName: "to", stringValue: "conference.hellochatim.p1.im")
        iqElement.addAttribute(withName: "id", stringValue: "getexistroomid")

        iqElement.addChild(queryElement!)
        log.debug(iqElement)
        CWChatXMPPManager.share.xmppStream.send(iqElement)
    }
    
    


class CWGroupServic: XMPPModule {
    
    lazy var mucLight: XMPPMUCLight = {
        let mucLight = XMPPMUCLight(dispatchQueue: self.moduleQueue)
        mucLight?.activate(CWChatXMPPManager.share.xmppStream)
        return mucLight!
    }()
    
    override init!(dispatchQueue queue: DispatchQueue!) {
        super.init(dispatchQueue: queue)
        self.mucLight.addDelegate(self, delegateQueue: self.moduleQueue)
    }
    
}
