Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When i terminate app MUC group chat members are getting removed #1212

Open
hasyapanchasara opened this issue Nov 25, 2021 · 3 comments
Open

Comments

@hasyapanchasara
Copy link

When i terminate app MUC group chat members are getting removed, i have to join them again while coming back to app from bookmarks? We do not want to rejoin again and again. Can someone please suggest way how to avoid rejoining.

In Android smack there is provision for auto-rejoin.

Even from Openfire back end we have managed code to do not remove.

So Android is working fine, iOS is removing users.

Please do suggest.

@hasyapanchasara
Copy link
Author

Any opinion on this?

@hasyapanchasara
Copy link
Author

@robbiehanson Can you please suggest us on this?

@smindia1988
Copy link

smindia1988 commented Dec 16, 2021

Instead of rejoining the room every time, do set the presence of the group when the user relaunches the app.

Set presence with below code function iterate through all your group's name and set presence:

for group in chatListModel ?? []{            
                if(group.opponent_type == "2"){
                    print("Group Name: \(group.opponent_uuid ?? "")")                
    XMPPGlobal.sharedIntanceXMPP.xmppController.updatePresence(roomJID: XMPPJID(string: "\(group.opponent_uuid ?? "")@\(groupServerName)"))
                }
            }

Define below function in your XMPPController class:

func updatePresence(roomJID : XMPPJID?) {
                           
           let presence = XMPPPresence(type: "presence")
           presence.addAttribute(withName: "from", stringValue: self.xmppStream.myJID?.user ?? "")
           presence.addAttribute(withName: "to", stringValue: "\(roomJID?.full ?? "")/\(self.xmppStream.myJID?.user ?? "")")
           
           let element = DDXMLElement.init(name: "x", xmlns: XMPPMUCNamespace)
           presence.addChild(element)
           self.xmppStream.send(presence)
           
       }

Hope it will works for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants