如何在swift 3

时间:2017-09-11 11:51:29

标签: ios swift3 xmpp

我正在开发iOS中的XMPP聊天应用程序。发送和接收功能正常工作。但我想在Chat中实现阻止用户功能。如何使用XMPPBlocking实现阻止用户并获取所有阻止用户列表?请在下面找到发送消息的代码。
let senderJID = XMPPJID.init(string:xmppClass.getXMPPJID(strJID:self.message.to_user_id))         让msg = XMPPMessage(输入:" chat",to:senderJID)

    let messageID = XMLElement(name: "message_id", stringValue: self.message.message_id)
    let isSend = XMLElement(name: "is_send", stringValue: "1")
    let isDelivered = XMLElement(name: "is_delivered", stringValue: "0")
    let isRead = XMLElement(name: "is_read", stringValue: "0")
    let from_user_id = XMLElement(name: "from_user_id", stringValue: self.message.from_user_id)
    let to_user_id = XMLElement(name: "to_user_id", stringValue: self.message.to_user_id)
    let message_type = XMLElement(name: "message_type", stringValue: "text")
    let media_id = XMLElement(name: "media_id", stringValue: "0")

    let mediaUrl = XMLElement(name: "media_url", stringValue: "")
    let thumbImage = XMLElement(name: "thumb_url", stringValue: "")

    let timestamp = XMLElement(name: "timestamp", stringValue: self.message.timestamp)
    let offline = XMLElement(name: "offline", stringValue: "Offline Message")

    msg?.addBody(self.message.message)
    msg?.addAttribute(withName: "id", stringValue: self.message.message_id)

    msg?.addChild(messageID)
    msg?.addChild(isSend)
    msg?.addChild(isDelivered)
    msg?.addChild(isRead)
    msg?.addChild(from_user_id)
    msg?.addChild(to_user_id)
    msg?.addChild(media_id)
    msg?.addChild(message_type)
    msg?.addChild(mediaUrl)
    msg?.addChild(thumbImage)
    msg?.addChild(timestamp)
    msg?.addChild(offline)                

    Global.appDelegate.xmppClassObj.xmppStream?.send(msg)


请帮助阻止并取消屏蔽用户XMPPBlockingXMPPBlockingDelegate

0 个答案:

没有答案