leaving mucs works

This commit is contained in:
Daniel Gultsch 2014-03-04 04:36:19 +01:00
parent 6f86638341
commit 79ec8b2e81
1 changed files with 6 additions and 1 deletions

View File

@ -194,8 +194,8 @@ public class XmppConnectionService extends Service {
PresencePacket packet) { PresencePacket packet) {
if (packet.hasChild("x")&&(packet.findChild("x").getAttribute("xmlns").startsWith("http://jabber.org/protocol/muc"))) { if (packet.hasChild("x")&&(packet.findChild("x").getAttribute("xmlns").startsWith("http://jabber.org/protocol/muc"))) {
Conversation muc = findMuc(packet.getAttribute("from").split("/")[0]); Conversation muc = findMuc(packet.getAttribute("from").split("/")[0]);
int error = muc.getMucOptions().getError();
if (muc!=null) { if (muc!=null) {
int error = muc.getMucOptions().getError();
muc.getMucOptions().processPacket(packet); muc.getMucOptions().processPacket(packet);
if ((muc.getMucOptions().getError()!=error)&&(convChangedListener!=null)) { if ((muc.getMucOptions().getError()!=error)&&(convChangedListener!=null)) {
Log.d(LOGTAG,"muc error status changed"); Log.d(LOGTAG,"muc error status changed");
@ -901,6 +901,11 @@ public class XmppConnectionService extends Service {
} }
public void leaveMuc(Conversation conversation) { public void leaveMuc(Conversation conversation) {
PresencePacket packet = new PresencePacket();
packet.setAttribute("to", conversation.getContactJid());
packet.setAttribute("from", conversation.getAccount().getFullJid());
packet.setAttribute("type","unavailable");
conversation.getAccount().getXmppConnection().sendPresencePacket(packet);
conversation.getMucOptions().setOffline(); conversation.getMucOptions().setOffline();
} }