diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-02-04 19:37:15 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-02-04 19:37:15 +0100 |
commit | 900ebbdd7c870c555f68f7a97edbf8078a442303 (patch) | |
tree | 39aec482fe4505b348767e560fe96f7838041413 /src/main/java/de/pixart | |
parent | 3eea84269d2ab7dc921236b24f334b1279e1f50f (diff) |
remove warning messages for kick after ban failing. on modern servers ban is enough to also kick
Diffstat (limited to '')
5 files changed, 12 insertions, 54 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 12d163203..e231b2f6c 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -3164,18 +3164,12 @@ public class XmppConnectionService extends Service { sendIqPacket(conference.getAccount(), request, mDefaultIqHandler); } - public void changeRoleInConference(final Conversation conference, final String nick, MucOptions.Role role, final OnRoleChanged callback) { + public void changeRoleInConference(final Conversation conference, final String nick, MucOptions.Role role) { IqPacket request = this.mIqGenerator.changeRole(conference, nick, role.toString()); Log.d(Config.LOGTAG, request.toString()); - sendIqPacket(conference.getAccount(), request, new OnIqPacketReceived() { - @Override - public void onIqPacketReceived(Account account, IqPacket packet) { - Log.d(Config.LOGTAG, packet.toString()); - if (packet.getType() == IqPacket.TYPE.RESULT) { - callback.onRoleChangedSuccessful(nick); - } else { - callback.onRoleChangeFailed(nick, R.string.could_not_change_role); - } + sendIqPacket(conference.getAccount(), request, (account, packet) -> { + if (packet.getType() != IqPacket.TYPE.RESULT) { + Log.d(Config.LOGTAG, account.getJid().asBareJid() + " unable to change role of " + nick); } }); } @@ -4693,12 +4687,6 @@ public class XmppConnectionService extends Service { void onAffiliationChangeFailed(Jid jid, int resId); } - public interface OnRoleChanged { - void onRoleChangedSuccessful(String nick); - - void onRoleChangeFailed(String nick, int resid); - } - public interface OnRoomDestroy { void onRoomDestroySucceeded(int resId); diff --git a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java index 8fb8b0c1d..02de197da 100644 --- a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java @@ -77,7 +77,7 @@ import static de.pixart.messenger.entities.Bookmark.printableValue; import static de.pixart.messenger.ui.SettingsActivity.USE_BUNDLED_EMOJIS; import static de.pixart.messenger.utils.StringUtils.changed; -public class ConferenceDetailsActivity extends XmppActivity implements OnConversationUpdate, OnMucRosterUpdate, XmppConnectionService.OnAffiliationChanged, XmppConnectionService.OnRoleChanged, XmppConnectionService.OnConfigurationPushed, TextWatcher, OnMediaLoaded { +public class ConferenceDetailsActivity extends XmppActivity implements OnConversationUpdate, OnMucRosterUpdate, XmppConnectionService.OnAffiliationChanged, XmppConnectionService.OnConfigurationPushed, TextWatcher, OnMediaLoaded { public static final String ACTION_VIEW_MUC = "view_muc"; private Conversation mConversation; private OnClickListener destroyListener = new OnClickListener() { @@ -704,16 +704,6 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers } @Override - public void onRoleChangedSuccessful(String nick) { - - } - - @Override - public void onRoleChangeFailed(String nick, int resId) { - displayToast(getString(resId, nick)); - } - - @Override public void onPushSucceeded() { displayToast(getString(R.string.modified_conference_options)); } diff --git a/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java index 807fdf94d..7d95c901b 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java @@ -98,7 +98,7 @@ import rocks.xmpp.addr.Jid; import static de.pixart.messenger.ui.ConversationFragment.REQUEST_DECRYPT_PGP; import static de.pixart.messenger.ui.SettingsActivity.USE_BUNDLED_EMOJIS; -public class ConversationsActivity extends XmppActivity implements OnConversationSelected, OnConversationArchived, OnConversationsListItemUpdated, OnConversationRead, XmppConnectionService.OnAccountUpdate, XmppConnectionService.OnConversationUpdate, XmppConnectionService.OnRosterUpdate, OnUpdateBlocklist, XmppConnectionService.OnShowErrorToast, XmppConnectionService.OnAffiliationChanged, XmppConnectionService.OnRoleChanged { +public class ConversationsActivity extends XmppActivity implements OnConversationSelected, OnConversationArchived, OnConversationsListItemUpdated, OnConversationRead, XmppConnectionService.OnAccountUpdate, XmppConnectionService.OnConversationUpdate, XmppConnectionService.OnRosterUpdate, OnUpdateBlocklist, XmppConnectionService.OnShowErrorToast, XmppConnectionService.OnAffiliationChanged { public static final String ACTION_VIEW_CONVERSATION = "de.pixart.messenger.VIEW"; public static final String EXTRA_CONVERSATION = "conversationUuid"; @@ -490,15 +490,6 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio displayToast(getString(resId, jid.asBareJid().toString())); } - @Override - public void onRoleChangedSuccessful(String nick) { - } - - @Override - public void onRoleChangeFailed(String nick, int resId) { - displayToast(getString(resId, nick)); - } - private void openConversation(Conversation conversation, Bundle extras) { ConversationFragment conversationFragment = (ConversationFragment) getFragmentManager().findFragmentById(R.id.secondary_fragment); final boolean mainNeedsRefresh; diff --git a/src/main/java/de/pixart/messenger/ui/MucUsersActivity.java b/src/main/java/de/pixart/messenger/ui/MucUsersActivity.java index b51da7635..9961e5512 100644 --- a/src/main/java/de/pixart/messenger/ui/MucUsersActivity.java +++ b/src/main/java/de/pixart/messenger/ui/MucUsersActivity.java @@ -19,7 +19,7 @@ import de.pixart.messenger.ui.adapter.UserAdapter; import de.pixart.messenger.ui.util.MucDetailsContextMenuHelper; import rocks.xmpp.addr.Jid; -public class MucUsersActivity extends XmppActivity implements XmppConnectionService.OnMucRosterUpdate, XmppConnectionService.OnAffiliationChanged, XmppConnectionService.OnRoleChanged { +public class MucUsersActivity extends XmppActivity implements XmppConnectionService.OnMucRosterUpdate, XmppConnectionService.OnAffiliationChanged { private UserAdapter userAdapter; @@ -84,14 +84,4 @@ public class MucUsersActivity extends XmppActivity implements XmppConnectionServ public void onAffiliationChangeFailed(Jid jid, int resId) { displayToast(getString(resId, jid.asBareJid().toString())); } - - @Override - public void onRoleChangedSuccessful(String nick) { - - } - - @Override - public void onRoleChangeFailed(String nick, int resId) { - displayToast(getString(resId, nick)); - } }
\ No newline at end of file diff --git a/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java b/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java index a33d7c5c3..448a9a478 100644 --- a/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java +++ b/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java @@ -113,7 +113,6 @@ public final class MucDetailsContextMenuHelper { public static boolean onContextItemSelected(MenuItem item, User user, XmppActivity activity, final String fingerprint) { final Conversation conversation = user.getConversation(); final XmppConnectionService.OnAffiliationChanged onAffiliationChanged = activity instanceof XmppConnectionService.OnAffiliationChanged ? (XmppConnectionService.OnAffiliationChanged) activity : null; - final XmppConnectionService.OnRoleChanged onRoleChanged = activity instanceof XmppConnectionService.OnRoleChanged ? (XmppConnectionService.OnRoleChanged) activity : null; Jid jid = user.getRealJid(); switch (item.getItemId()) { case R.id.action_contact_details: @@ -138,12 +137,12 @@ public final class MucDetailsContextMenuHelper { activity.xmppConnectionService.changeAffiliationInConference(conversation, jid, MucOptions.Affiliation.MEMBER, onAffiliationChanged); return true; case R.id.remove_from_room: - removeFromRoom(user, activity, onAffiliationChanged, onRoleChanged); + removeFromRoom(user, activity, onAffiliationChanged); return true; case R.id.ban_from_conference: activity.xmppConnectionService.changeAffiliationInConference(conversation, jid, MucOptions.Affiliation.OUTCAST, onAffiliationChanged); if (user.getRole() != MucOptions.Role.NONE) { - activity.xmppConnectionService.changeRoleInConference(conversation, user.getName(), MucOptions.Role.NONE, onRoleChanged); + activity.xmppConnectionService.changeRoleInConference(conversation, user.getName(), MucOptions.Role.NONE); } return true; case R.id.send_private_message: @@ -167,12 +166,12 @@ public final class MucDetailsContextMenuHelper { } } - private static void removeFromRoom(final User user, XmppActivity activity, XmppConnectionService.OnAffiliationChanged onAffiliationChanged, XmppConnectionService.OnRoleChanged onRoleChanged) { + private static void removeFromRoom(final User user, XmppActivity activity, XmppConnectionService.OnAffiliationChanged onAffiliationChanged) { final Conversation conversation = user.getConversation(); if (conversation.getMucOptions().membersOnly()) { activity.xmppConnectionService.changeAffiliationInConference(conversation, user.getRealJid(), MucOptions.Affiliation.NONE, onAffiliationChanged); if (user.getRole() != MucOptions.Role.NONE) { - activity.xmppConnectionService.changeRoleInConference(conversation, user.getName(), MucOptions.Role.NONE, onRoleChanged); + activity.xmppConnectionService.changeRoleInConference(conversation, user.getName(), MucOptions.Role.NONE); } } else { AlertDialog.Builder builder = new AlertDialog.Builder(activity); @@ -188,7 +187,7 @@ public final class MucDetailsContextMenuHelper { builder.setPositiveButton(R.string.ban_now, (dialog, which) -> { activity.xmppConnectionService.changeAffiliationInConference(conversation, user.getRealJid(), MucOptions.Affiliation.OUTCAST, onAffiliationChanged); if (user.getRole() != MucOptions.Role.NONE) { - activity.xmppConnectionService.changeRoleInConference(conversation, user.getName(), MucOptions.Role.NONE, onRoleChanged); + activity.xmppConnectionService.changeRoleInConference(conversation, user.getName(), MucOptions.Role.NONE); } }); builder.create().show(); |