MUC Light使用XMPPFramework

问题描述 投票:2回答:2

有没有人能够在ios上使用xmppframework实现mongooseim的muc light(xep-xxx)?到目前为止,我一直在努力创建一个房间但没有进展。每当我尝试发送创建muc灯的请求时,我都无法从mongooseim服务器收到任何响应。

我尝试过的代码是:

let roomTitle = "\(title)@muclight.hostname.co"
    print("Creating room: \(roomTitle)")
    let room = XMPPRoomLight(roomLightStorage: nil, jid: XMPPJID(string: roomTitle), roomname: "testroom", dispatchQueue: DispatchQueue.main)
    let delegate = UIApplication.shared.delegate as! AppDelegate
    room.addDelegate(self, delegateQueue: DispatchQueue.main)
    room.createRoomLight(withMembersJID: [(delegate.xmppStream?.myJID)!])
    room.activate(delegate.xmppStream)

上面的代码似乎不起作用,我无法在网上任何地方使用xmppframework找到如何做到这一点的演示。我通过取消注释该行在ejabberd.cfg中启用了mod_muc_light:

{mod_muc_light, [{host, "muclight.@HOST@"}]}
ios swift ejabberd xmppframework mongoose-im
2个回答
0
投票

请参阅此文档以按照分步配置制作MUC灯光室并聊天:

这适用于Mongoose IM,但大多数项目与ejabberd配置相同。只需读出条款即可获得一个想法。

主要来源:https://github.com/esl/MongooseIM

MUCLight:https://github.com/esl/MongooseIM/blob/master/doc/open-extensions/muc_light.md


0
投票

好像你需要为你的房间添加配置。

let query = DDXMLElement(name: "query", xmlns: "urn:xmpp:muclight:0#create")
    let configuraton = DDXMLElement(name: "configuration")
    configuraton.addChild(DDXMLElement(name: "roomname", stringValue: roomName))
    let occupants = DDXMLElement(name: "occupants")
    let users = DDXMLElement(name: "user", stringValue: (XMPPJID(string: "ijpxs3blss@localhost")?.bare)!)
    users.addAttribute(withName: "affiliation", stringValue: "member")
    occupants.addChild(users)
    query.addChild(configuraton)
    query.addChild(occupants)

并在最后通话

room.setconfiguration(query)
© www.soinside.com 2019 - 2024. All rights reserved.