Commit 2075538c authored by Grigory Fedorov's avatar Grigory Fedorov

RegularChat: empty messages dropped as service messages.

parent ec27bb55
...@@ -14,14 +14,6 @@ ...@@ -14,14 +14,6 @@
*/ */
package com.xabber.android.data.message; package com.xabber.android.data.message;
import net.java.otr4j.OtrException;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Message.Type;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smackx.packet.MUCUser;
import com.xabber.android.data.LogManager; import com.xabber.android.data.LogManager;
import com.xabber.android.data.NetworkException; import com.xabber.android.data.NetworkException;
import com.xabber.android.data.SettingsManager; import com.xabber.android.data.SettingsManager;
...@@ -35,6 +27,14 @@ import com.xabber.xmpp.archive.SaveMode; ...@@ -35,6 +27,14 @@ import com.xabber.xmpp.archive.SaveMode;
import com.xabber.xmpp.delay.Delay; import com.xabber.xmpp.delay.Delay;
import com.xabber.xmpp.muc.MUC; import com.xabber.xmpp.muc.MUC;
import net.java.otr4j.OtrException;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Message.Type;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smackx.packet.MUCUser;
/** /**
* Represents normal chat. * Represents normal chat.
* *
...@@ -141,8 +141,7 @@ public class RegularChat extends AbstractChat { ...@@ -141,8 +141,7 @@ public class RegularChat extends AbstractChat {
updateThreadId(thread); updateThreadId(thread);
boolean unencrypted = false; boolean unencrypted = false;
try { try {
text = OTRManager.getInstance().transformReceiving(account, text = OTRManager.getInstance().transformReceiving(account, user, text);
user, text);
} catch (OtrException e) { } catch (OtrException e) {
if (e.getCause() instanceof OTRUnencryptedException) { if (e.getCause() instanceof OTRUnencryptedException) {
text = ((OTRUnencryptedException) e.getCause()).getText(); text = ((OTRUnencryptedException) e.getCause()).getText();
...@@ -154,7 +153,7 @@ public class RegularChat extends AbstractChat { ...@@ -154,7 +153,7 @@ public class RegularChat extends AbstractChat {
} }
} }
// System message received. // System message received.
if (text == null) if (text == null || text.trim().equals(""))
return true; return true;
if (!"".equals(resource)) if (!"".equals(resource))
this.resource = resource; this.resource = resource;
......
...@@ -23,6 +23,7 @@ import android.widget.ImageView; ...@@ -23,6 +23,7 @@ import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.xabber.android.R; import com.xabber.android.R;
import com.xabber.android.data.LogManager;
import com.xabber.android.data.SettingsManager; import com.xabber.android.data.SettingsManager;
import com.xabber.android.data.account.AccountItem; import com.xabber.android.data.account.AccountItem;
import com.xabber.android.data.account.AccountManager; import com.xabber.android.data.account.AccountManager;
...@@ -139,6 +140,7 @@ public class ChatMessageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo ...@@ -139,6 +140,7 @@ public class ChatMessageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
incomingMessage.messageBalloon.setVisibility(View.GONE); incomingMessage.messageBalloon.setVisibility(View.GONE);
incomingMessage.messageTime.setVisibility(View.GONE); incomingMessage.messageTime.setVisibility(View.GONE);
incomingMessage.avatar.setVisibility(View.GONE); incomingMessage.avatar.setVisibility(View.GONE);
LogManager.w(this, "Empty message! Hidden, but need to correct");
} else { } else {
incomingMessage.messageBalloon.setVisibility(View.VISIBLE); incomingMessage.messageBalloon.setVisibility(View.VISIBLE);
incomingMessage.messageTime.setVisibility(View.VISIBLE); incomingMessage.messageTime.setVisibility(View.VISIBLE);
...@@ -285,7 +287,7 @@ public class ChatMessageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo ...@@ -285,7 +287,7 @@ public class ChatMessageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
return null; return null;
} }
public static class BasicMessage extends RecyclerView.ViewHolder { public static class BasicMessage extends RecyclerView.ViewHolder {
public TextView messageText; public TextView messageText;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment