Do not display messages with no displayable content + updated linphone

This commit is contained in:
Sylvain Berfini 2017-12-12 11:51:29 +01:00
parent d748d4e57c
commit d46f36d8d5
3 changed files with 27 additions and 1 deletions

View file

@ -99,6 +99,7 @@ import org.linphone.core.Core.LogCollectionUploadState;
import org.linphone.core.Core.RegistrationState;
import org.linphone.core.Core.ConfiguringState;
import org.linphone.core.CoreException;
import org.linphone.core.ErrorInfo;
import org.linphone.core.Factory;
import org.linphone.core.CoreListener;
import org.linphone.core.Event;
@ -1069,6 +1070,16 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
return;
}
if (message.getErrorInfo() != null && message.getErrorInfo().getReason() == Reason.UnsupportedContent) {
Log.w("Message received but content is unsupported, do not notify it");
return;
}
if (!message.hasTextContent() && message.getFileTransferInformation() == null) {
Log.w("Message has no text or file transfer information to display, ignoring it...");
return;
}
Address from = message.getFromAddress();
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(from);
String textMessage = (message.getFileTransferInformation() != null) ? getString(R.string.content_description_incoming_file) : message.getText();

View file

@ -64,6 +64,8 @@ import org.linphone.core.EventLog;
import org.linphone.core.Factory;
import org.linphone.core.Participant;
import org.linphone.contacts.ContactsUpdatedListener;
import org.linphone.core.Reason;
import org.linphone.mediastream.Log;
import org.linphone.ui.ListSelectionHelper;
import java.io.File;
@ -604,6 +606,19 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
cr.markAsRead();
LinphoneActivity.instance().updateMissedChatCount();
if (event.getType() == EventLog.Type.ConferenceChatMessage) {
ChatMessage message = event.getChatMessage();
if (message.getErrorInfo() != null && message.getErrorInfo().getReason() == Reason.UnsupportedContent) {
Log.w("Message received but content is unsupported, do not display it");
return;
}
if (!message.hasTextContent() && message.getFileTransferInformation() == null) {
Log.w("Message has no text or file transfer information to display, ignoring it...");
return;
}
}
ChatMessage msg = event.getChatMessage();
String externalBodyUrl = msg.getExternalBodyUrl();
Content fileTransferContent = msg.getFileTransferInformation();

@ -1 +1 @@
Subproject commit 4d277538b089fdaaaada694075fb33e3546c7fe2
Subproject commit d2fd296e8c8ba84c9f192dbb7b59e22e9080a8f6