mirror of
https://codeberg.org/monocles/monocles_chat.git
synced 2025-01-30 16:51:42 +01:00
catch exception while destroying rooms
This commit is contained in:
parent
43208fa088
commit
2836ac669c
2 changed files with 26 additions and 19 deletions
|
@ -3639,26 +3639,29 @@ public class XmppConnectionService extends Service {
|
|||
}
|
||||
|
||||
public void destroyRoom(final Conversation conversation, final OnRoomDestroy callback) {
|
||||
IqPacket request = new IqPacket(IqPacket.TYPE.SET);
|
||||
request.setTo(conversation.getJid().asBareJid());
|
||||
request.query("http://jabber.org/protocol/muc#owner").addChild("destroy");
|
||||
sendIqPacket(conversation.getAccount(), request, new OnIqPacketReceived() {
|
||||
@Override
|
||||
public void onIqPacketReceived(Account account, IqPacket packet) {
|
||||
if (packet.getType() == IqPacket.TYPE.RESULT) {
|
||||
if (callback != null) {
|
||||
callback.onRoomDestroySucceeded();
|
||||
}
|
||||
} else if (packet.getType() == IqPacket.TYPE.ERROR) {
|
||||
if (callback != null) {
|
||||
callback.onRoomDestroyFailed();
|
||||
try {
|
||||
IqPacket request = new IqPacket(IqPacket.TYPE.SET);
|
||||
request.setTo(conversation.getJid().asBareJid());
|
||||
request.query("http://jabber.org/protocol/muc#owner").addChild("destroy");
|
||||
sendIqPacket(conversation.getAccount(), request, new OnIqPacketReceived() {
|
||||
@Override
|
||||
public void onIqPacketReceived(Account account, IqPacket packet) {
|
||||
if (packet.getType() == IqPacket.TYPE.RESULT) {
|
||||
if (callback != null) {
|
||||
callback.onRoomDestroySucceeded();
|
||||
}
|
||||
} else if (packet.getType() == IqPacket.TYPE.ERROR) {
|
||||
if (callback != null) {
|
||||
callback.onRoomDestroyFailed();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void disconnect(Account account, boolean force) {
|
||||
if ((account.getStatus() == Account.State.ONLINE)
|
||||
|| (account.getStatus() == Account.State.DISABLED)) {
|
||||
|
|
|
@ -648,9 +648,13 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
|
|||
if (extras != null && extras.containsKey("MUC_UUID")) {
|
||||
Log.d(Config.LOGTAG, "Get " + intent.getAction() + " intent for " + extras.getString("MUC_UUID"));
|
||||
Conversation conversation = xmppConnectionService.findConversationByUuid(extras.getString("MUC_UUID"));
|
||||
ConversationsActivity.this.xmppConnectionService.clearConversationHistory(conversation);
|
||||
xmppConnectionService.destroyRoom(conversation, ConversationsActivity.this);
|
||||
endConversation(conversation);
|
||||
try {
|
||||
ConversationsActivity.this.xmppConnectionService.clearConversationHistory(conversation);
|
||||
xmppConnectionService.destroyRoom(conversation, ConversationsActivity.this);
|
||||
endConversation(conversation);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
setIntent(createLauncherIntent(this));
|
||||
|
|
Loading…
Add table
Reference in a new issue