How can I block xmpp user in swift 3

I am working on an XMPP Chat application on iOS. The send and receive functions work fine. But I want to implement the block user function in the chat. How can I implement user blocking using XMPPBlocking and fetching all user block lists? Please find the code to send the message.
let senderJID = XMPPJID.init (string: xmppClass.getXMPPJID (strJID: self.message.to_user_id)) let msg = XMPPMessage (type: "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) 


Please help lock and unlock user XMPPBlocking , XMPPBlockingDelegate

+2
source share

All Articles