From 163f5ae6229c99d72a73215ce1ba72827eefd93b Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Sat, 9 Feb 2019 15:22:29 +0100 Subject: use the term channel in destroy dialog and some other strings --- .../messenger/services/XmppConnectionService.java | 40 +++++++++------------- 1 file changed, 17 insertions(+), 23 deletions(-) (limited to 'src/main/java/de/pixart/messenger/services') diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 551ff7818..3f9ac5f99 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -3205,32 +3205,26 @@ public class XmppConnectionService extends Service { }); } - public void destroyRoom(final Conversation mSelectedConversation) { - destroyRoom(mSelectedConversation, new OnRoomDestroy() { - @Override - public void onRoomDestroySucceeded(int resId) { - Log.d(Config.LOGTAG, "Destroy succeed"); - showErrorToastInUi(resId); - } - + 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 onRoomDestroyFailed(int resId) { - Log.d(Config.LOGTAG, "Destroy failed"); - showErrorToastInUi(resId); + 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(); + } + } } }); } - public void destroyRoom(final Conversation conference, final OnRoomDestroy callback) { - IqPacket request = this.mIqGenerator.destroyRoom(conference); - sendIqPacket(conference.getAccount(), request, (account, packet) -> { - if (packet.getType() == IqPacket.TYPE.RESULT) { - callback.onRoomDestroySucceeded(R.string.destroy_muc_succeed); - } else { - callback.onRoomDestroyFailed(R.string.destroy_muc_failed); - } - }); - } private void disconnect(Account account, boolean force) { if ((account.getStatus() == Account.State.ONLINE) @@ -4719,9 +4713,9 @@ public class XmppConnectionService extends Service { } public interface OnRoomDestroy { - void onRoomDestroySucceeded(int resId); + void onRoomDestroySucceeded(); - void onRoomDestroyFailed(int resId); + void onRoomDestroyFailed(); } public interface OnConversationUpdate { -- cgit v1.2.3