Go to the correct basic chat room if you have multiple with the same remote address but different local addresses

This commit is contained in:
Sylvain Berfini 2019-02-13 15:48:43 +01:00
parent 8b2a46922d
commit 1a42eb7802
14 changed files with 160 additions and 74 deletions

View file

@ -701,7 +701,8 @@ public class LinphoneActivity extends LinphoneGenericActivity
}
private void displayChat(
String sipUri,
String localSipUri,
String remoteSipUri,
String message,
String fileUri,
String pictureUri,
@ -709,17 +710,18 @@ public class LinphoneActivity extends LinphoneGenericActivity
String displayName,
Address lAddress) {
Bundle extras = new Bundle();
extras.putString("SipUri", sipUri);
extras.putString("LocalSipUri", localSipUri);
extras.putString("RemoteSipUri", remoteSipUri);
if (message != null) extras.putString("messageDraft", message);
if (fileUri != null) extras.putString("fileSharedUri", fileUri);
if (sipUri != null && lAddress.getDisplayName() != null) {
if (remoteSipUri != null && lAddress.getDisplayName() != null) {
extras.putString("DisplayName", displayName);
extras.putString("PictureUri", pictureUri);
extras.putString("ThumbnailUri", thumbnailUri);
}
if (sipUri == null) {
if (remoteSipUri == null) {
changeCurrentFragment(FragmentsAvailable.CREATE_CHAT, extras);
} else {
changeCurrentFragment(FragmentsAvailable.GROUP_CHAT, extras);
@ -755,9 +757,10 @@ public class LinphoneActivity extends LinphoneGenericActivity
changeCurrentFragment(FragmentsAvailable.CREATE_CHAT, extras);
}
public void goToChat(String sipUri, Bundle shareInfos) {
public void goToChat(String localSipUri, String remoteSipUri, Bundle shareInfos) {
Bundle extras = new Bundle();
extras.putString("SipUri", sipUri);
extras.putString("LocalSipUri", localSipUri);
extras.putString("RemoteSipUri", remoteSipUri);
if (shareInfos != null) {
if (shareInfos.getString("fileSharedUri") != null)
@ -773,7 +776,7 @@ public class LinphoneActivity extends LinphoneGenericActivity
&& mCurrentFragment == FragmentsAvailable.GROUP_CHAT
&& !mEmptyFragment) {
ChatMessagesFragment chatFragment = (ChatMessagesFragment) fragment2;
chatFragment.changeDisplayedChat(sipUri);
chatFragment.changeDisplayedChat(localSipUri, remoteSipUri);
} else {
changeCurrentFragment(FragmentsAvailable.GROUP_CHAT, extras);
}
@ -781,7 +784,7 @@ public class LinphoneActivity extends LinphoneGenericActivity
changeCurrentFragment(FragmentsAvailable.GROUP_CHAT, extras);
}
LinphoneManager.getInstance().updateUnreadCountForChatRoom(sipUri, 0);
LinphoneManager.getInstance().updateUnreadCountForChatRoom(localSipUri, remoteSipUri, 0);
displayMissedChats(LinphoneManager.getInstance().getUnreadMessageCount());
}
@ -814,15 +817,18 @@ public class LinphoneActivity extends LinphoneGenericActivity
changeCurrentFragment(FragmentsAvailable.INFO_GROUP_CHAT, extras);
}
public void goToContactDevicesInfos(String sipUri) {
public void goToContactDevicesInfos(String localSipUri, String remoteSipUri) {
Bundle extras = new Bundle();
extras.putSerializable("SipUri", sipUri);
extras.putSerializable("LocalSipUri", localSipUri);
extras.putSerializable("RemoteSipUri", remoteSipUri);
changeCurrentFragment(FragmentsAvailable.CONTACT_DEVICES, extras);
}
public void goToChatMessageImdnInfos(String sipUri, String messageId) {
public void goToChatMessageImdnInfos(
String localSipUri, String remoteSipUri, String messageId) {
Bundle extras = new Bundle();
extras.putSerializable("SipUri", sipUri);
extras.putSerializable("LocalSipUri", localSipUri);
extras.putSerializable("RemoteSipUri", remoteSipUri);
extras.putString("MessageId", messageId);
changeCurrentFragment(FragmentsAvailable.MESSAGE_IMDN, extras);
}
@ -831,7 +837,8 @@ public class LinphoneActivity extends LinphoneGenericActivity
changeCurrentFragment(FragmentsAvailable.CHAT_LIST, null);
}
public void displayChat(String sipUri, String message, String fileUri) {
public void displayChat(
String localSipUri, String remoteSipUri, String message, String fileUri) {
if (getResources().getBoolean(R.bool.disable_chat)) {
return;
}
@ -841,8 +848,8 @@ public class LinphoneActivity extends LinphoneGenericActivity
String displayName = null;
Address lAddress = null;
if (sipUri != null) {
lAddress = LinphoneManager.getLc().interpretUrl(sipUri);
if (remoteSipUri != null) {
lAddress = LinphoneManager.getLc().interpretUrl(remoteSipUri);
if (lAddress == null) return;
LinphoneContact contact =
ContactsManager.getInstance().findContactFromAddress(lAddress);
@ -862,21 +869,35 @@ public class LinphoneActivity extends LinphoneGenericActivity
&& mCurrentFragment == FragmentsAvailable.GROUP_CHAT
&& !mEmptyFragment) {
ChatMessagesFragment chatFragment = (ChatMessagesFragment) fragment2;
chatFragment.changeDisplayedChat(sipUri);
chatFragment.changeDisplayedChat(localSipUri, remoteSipUri);
} else {
displayChat(
sipUri, message, fileUri, pictureUri, thumbnailUri, displayName, lAddress);
localSipUri,
remoteSipUri,
message,
fileUri,
pictureUri,
thumbnailUri,
displayName,
lAddress);
}
} else {
if (isTablet()) {
changeCurrentFragment(FragmentsAvailable.CHAT_LIST, null);
} else {
displayChat(
sipUri, message, fileUri, pictureUri, thumbnailUri, displayName, lAddress);
localSipUri,
remoteSipUri,
message,
fileUri,
pictureUri,
thumbnailUri,
displayName,
lAddress);
}
}
LinphoneManager.getInstance().updateUnreadCountForChatRoom(sipUri, 0);
LinphoneManager.getInstance().updateUnreadCountForChatRoom(localSipUri, remoteSipUri, 0);
displayMissedChats(LinphoneManager.getInstance().getUnreadMessageCount());
}
@ -1536,12 +1557,12 @@ public class LinphoneActivity extends LinphoneGenericActivity
Intent intent = getIntent();
if (intent.getStringExtra("msgShared") != null) {
displayChat(null, intent.getStringExtra("msgShared"), null);
displayChat(null, null, intent.getStringExtra("msgShared"), null);
intent.putExtra("msgShared", "");
}
if (intent.getStringExtra("fileShared") != null
&& !intent.getStringExtra("fileShared").equals("")) {
displayChat(null, null, intent.getStringExtra("fileShared"));
displayChat(null, null, null, intent.getStringExtra("fileShared"));
intent.putExtra("fileShared", "");
}
mIsOnBackground = false;
@ -1592,12 +1613,13 @@ public class LinphoneActivity extends LinphoneGenericActivity
}
Bundle extras = intent.getExtras();
if (extras != null && extras.getBoolean("GoToChat", false)) {
String sipUri = extras.getString("ChatContactSipUri");
String localSipUri = extras.getString("LocalSipUri");
String remoteSipUri = extras.getString("ChatContactSipUri");
intent.putExtra("DoNotGoToCallActivity", true);
if (sipUri == null) {
if (remoteSipUri == null) {
goToChatList();
} else {
goToChat(sipUri, extras);
goToChat(localSipUri, remoteSipUri, extras);
}
} else if (extras != null && extras.getBoolean("GoToHistory", false)) {
intent.putExtra("DoNotGoToCallActivity", true);

View file

@ -165,10 +165,10 @@ public class LinphoneLauncherActivity extends Activity {
&& (stringFileShared != null || fileUri != null)) {
if (stringFileShared != null) {
LinphoneActivity.instance()
.displayChat(null, stringFileShared, null);
.displayChat(null, null, stringFileShared, null);
} else if (fileUri != null) {
LinphoneActivity.instance()
.displayChat(null, null, stringUriFileShared);
.displayChat(null, null, null, stringUriFileShared);
}
}
}

View file

@ -1938,17 +1938,22 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
return count;
}
public void updateUnreadCountForChatRoom(String key, Integer value) {
public void updateUnreadCountForChatRoom(
String localSipUri, String remoteSipUri, Integer value) {
String key = localSipUri + "//" + remoteSipUri;
mUnreadChatsPerRoom.put(key, value);
}
public void updateUnreadCountForChatRoom(ChatRoom cr, Integer value) {
String key = cr.getPeerAddress().asStringUriOnly();
updateUnreadCountForChatRoom(key, value);
String localSipUri = cr.getLocalAddress().asStringUriOnly();
String remoteSipUri = cr.getPeerAddress().asStringUriOnly();
updateUnreadCountForChatRoom(localSipUri, remoteSipUri, value);
}
private void increaseUnreadCountForChatRoom(ChatRoom cr) {
String key = cr.getPeerAddress().asStringUriOnly();
String localSipUri = cr.getLocalAddress().asStringUriOnly();
String remoteSipUri = cr.getPeerAddress().asStringUriOnly();
String key = localSipUri + "//" + remoteSipUri;
if (mUnreadChatsPerRoom.containsKey(key)) {
mUnreadChatsPerRoom.put(key, mUnreadChatsPerRoom.get(key) + 1);
} else {

View file

@ -113,8 +113,8 @@ public class ChatMessagesFragment extends Fragment
private Uri mImageToUploadUri;
private ChatMessagesAdapter mEventsAdapter;
private ChatMessagesOldAdapter mOldEventsAdapter;
private String mRemoteSipUri;
private Address mRemoteSipAddress, mRemoteParticipantAddress;
private String mLocalSipUri, mRemoteSipUri;
private Address mLocalSipAddress, mRemoteSipAddress, mRemoteParticipantAddress;
private ChatRoom mChatRoom;
private ArrayList<LinphoneContact> mParticipants;
private LinearLayoutManager layoutManager;
@ -131,8 +131,12 @@ public class ChatMessagesFragment extends Fragment
setRetainInstance(true);
if (getArguments() != null) {
if (getArguments().getString("SipUri") != null) {
mRemoteSipUri = getArguments().getString("SipUri");
if (getArguments().getString("LocalSipUri") != null) {
mLocalSipUri = getArguments().getString("LocalSipUri");
mLocalSipAddress = LinphoneManager.getLc().createAddress(mLocalSipUri);
}
if (getArguments().getString("RemoteSipUri") != null) {
mRemoteSipUri = getArguments().getString("RemoteSipUri");
mRemoteSipAddress = LinphoneManager.getLc().createAddress(mRemoteSipUri);
}
}
@ -166,7 +170,7 @@ public class ChatMessagesFragment extends Fragment
CallManager.getInstance().inviteAddress(device.getAddress());
} else {
LinphoneActivity.instance()
.goToContactDevicesInfos(getRemoteSipUri());
.goToContactDevicesInfos(mLocalSipUri, mRemoteSipUri);
}
}
}
@ -368,8 +372,10 @@ public class ChatMessagesFragment extends Fragment
LinphoneManager.getInstance().setCurrentChatRoomAddress(mRemoteSipAddress);
}
public void changeDisplayedChat(String sipUri) {
mRemoteSipUri = sipUri;
public void changeDisplayedChat(String localSipUri, String remoteSipUri) {
mLocalSipUri = localSipUri;
mLocalSipAddress = LinphoneManager.getLc().createAddress(mLocalSipUri);
mRemoteSipUri = remoteSipUri;
mRemoteSipAddress = LinphoneManager.getLc().createAddress(mRemoteSipUri);
initChatRoom();
@ -539,7 +545,8 @@ public class ChatMessagesFragment extends Fragment
return true;
}
if (item.getItemId() == R.id.imdn_infos) {
LinphoneActivity.instance().goToChatMessageImdnInfos(getRemoteSipUri(), messageId);
LinphoneActivity.instance()
.goToChatMessageImdnInfos(mLocalSipUri, mRemoteSipUri, messageId);
return true;
}
if (item.getItemId() == R.id.copy_text) {
@ -708,7 +715,11 @@ public class ChatMessagesFragment extends Fragment
return;
}
if (mLocalSipAddress != null) {
mChatRoom = core.getChatRoom(mRemoteSipAddress, mLocalSipAddress);
} else {
mChatRoom = core.getChatRoomFromUri(mRemoteSipAddress.asStringUriOnly());
}
mChatRoom.addListener(this);
mChatRoom.markAsRead();
LinphoneManager.getInstance().updateUnreadCountForChatRoom(mChatRoom, 0);
@ -864,7 +875,8 @@ public class ChatMessagesFragment extends Fragment
mChatRoom.getParticipants()[0].getDevices()[0];
CallManager.getInstance().inviteAddress(device.getAddress());
} else {
LinphoneActivity.instance().goToContactDevicesInfos(getRemoteSipUri());
LinphoneActivity.instance()
.goToContactDevicesInfos(mLocalSipUri, mRemoteSipUri);
}
dialog.dismiss();
@ -888,10 +900,6 @@ public class ChatMessagesFragment extends Fragment
mChatEventsList.getLayoutManager().scrollToPosition(0);
}
private String getRemoteSipUri() {
return mRemoteSipUri;
}
@Override
public void onItemClicked(int position) {
if (mSelectionHelper.getAdapter().isEditionEnabled()) {

View file

@ -237,7 +237,10 @@ public class ChatRoomCreationFragment extends Fragment
if (newState == ChatRoom.State.Created) {
mWaitLayout.setVisibility(View.GONE);
LinphoneActivity.instance()
.goToChat(cr.getPeerAddress().asStringUriOnly(), mShareInfos);
.goToChat(
cr.getLocalAddress().asStringUriOnly(),
cr.getPeerAddress().asStringUriOnly(),
mShareInfos);
} else if (newState == ChatRoom.State.CreationFailed) {
mWaitLayout.setVisibility(View.GONE);
LinphoneActivity.instance().displayChatRoomError();
@ -548,7 +551,10 @@ public class ChatRoomCreationFragment extends Fragment
mChatRoom = lc.findOneToOneChatRoom(lpc.getIdentityAddress(), address, true);
if (mChatRoom != null) {
LinphoneActivity.instance()
.goToChat(mChatRoom.getPeerAddress().asStringUriOnly(), mShareInfos);
.goToChat(
mChatRoom.getLocalAddress().asStringUriOnly(),
mChatRoom.getPeerAddress().asStringUriOnly(),
mShareInfos);
} else {
mChatRoom =
lc.createClientGroupChatRoom(
@ -577,12 +583,17 @@ public class ChatRoomCreationFragment extends Fragment
} else {
LinphoneActivity.instance()
.goToChat(
mChatRoom.getPeerAddress().asStringUriOnly(), mShareInfos);
mChatRoom.getLocalAddress().asStringUriOnly(),
mChatRoom.getPeerAddress().asStringUriOnly(),
mShareInfos);
}
} else {
ChatRoom chatRoom = lc.getChatRoom(address);
LinphoneActivity.instance()
.goToChat(chatRoom.getPeerAddress().asStringUriOnly(), mShareInfos);
.goToChat(
chatRoom.getLocalAddress().asStringUriOnly(),
chatRoom.getPeerAddress().asStringUriOnly(),
mShareInfos);
}
}
} else {

View file

@ -182,7 +182,11 @@ public class ChatRoomsFragment extends Fragment
mChatRoomsAdapter.toggleSelection(position);
} else {
ChatRoom room = (ChatRoom) mChatRoomsAdapter.getItem(position);
LinphoneActivity.instance().goToChat(room.getPeerAddress().asString(), null);
LinphoneActivity.instance()
.goToChat(
room.getLocalAddress().asStringUriOnly(),
room.getPeerAddress().asString(),
null);
}
}
@ -205,7 +209,11 @@ public class ChatRoomsFragment extends Fragment
ChatRoomsAdapter adapter = (ChatRoomsAdapter) mChatRoomsList.getAdapter();
if (adapter != null && adapter.getItemCount() > 0) {
ChatRoom room = (ChatRoom) adapter.getItem(0);
LinphoneActivity.instance().goToChat(room.getPeerAddress().asStringUriOnly(), null);
LinphoneActivity.instance()
.goToChat(
room.getLocalAddress().asStringUriOnly(),
room.getPeerAddress().asStringUriOnly(),
null);
} else {
LinphoneActivity.instance().displayEmptyFragment();
}

View file

@ -50,8 +50,8 @@ public class DevicesFragment extends Fragment {
private ExpandableListView mExpandableList;
private DevicesAdapter mAdapter;
private String mRoomUri;
private Address mRoomAddr;
private String mLocalSipUri, mRoomUri;
private Address mLocalSipAddr, mRoomAddr;
private ChatRoom mRoom;
private boolean mOnlyDisplayChilds;
@ -62,7 +62,9 @@ public class DevicesFragment extends Fragment {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mRoomUri = getArguments().getString("SipUri");
mLocalSipUri = getArguments().getString("LocalSipUri");
mLocalSipAddr = LinphoneManager.getLc().createAddress(mLocalSipUri);
mRoomUri = getArguments().getString("RemoteSipUri");
mRoomAddr = LinphoneManager.getLc().createAddress(mRoomUri);
}
@ -117,7 +119,7 @@ public class DevicesFragment extends Fragment {
@Override
public void onClick(View view) {
if (LinphoneActivity.instance().isTablet()) {
LinphoneActivity.instance().goToChat(mRoomUri, null);
LinphoneActivity.instance().goToChat(mLocalSipUri, mRoomUri, null);
} else {
LinphoneActivity.instance().onBackPressed();
}

View file

@ -159,6 +159,7 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
if (LinphoneActivity.instance().isTablet()) {
LinphoneActivity.instance()
.goToChat(
null,
mGroupChatRoomAddress.asStringUriOnly(),
mShareInfos);
} else {
@ -200,7 +201,9 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
mChatRoom.leave();
LinphoneActivity.instance()
.goToChat(
mGroupChatRoomAddress.asString(), null);
null,
mGroupChatRoomAddress.asString(),
null);
} else {
Log.e(
"Can't leave, chatRoom for address "
@ -297,7 +300,10 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
getFragmentManager().popBackStack();
getFragmentManager().popBackStack();
LinphoneActivity.instance()
.goToChat(cr.getPeerAddress().asStringUriOnly(), mShareInfos);
.goToChat(
cr.getLocalAddress().asStringUriOnly(),
cr.getPeerAddress().asStringUriOnly(),
mShareInfos);
} else if (newState == ChatRoom.State.CreationFailed) {
mWaitLayout.setVisibility(View.GONE);
LinphoneActivity.instance().displayChatRoomError();
@ -378,7 +384,7 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
mChatRoom.addParticipants(participantsToAdd);
LinphoneActivity.instance()
.goToChat(mGroupChatRoomAddress.asString(), null);
.goToChat(null, mGroupChatRoomAddress.asString(), null);
}
}
});

View file

@ -57,8 +57,8 @@ public class ImdnFragment extends Fragment {
private ChatMessageViewHolder mBubble;
private ViewGroup mContainer;
private String mRoomUri, mMessageId;
private Address mRoomAddr;
private String mLocalSipuri, mRoomUri, mMessageId;
private Address mLocalSipAddr, mRoomAddr;
private ChatRoom mRoom;
private ChatMessage mMessage;
private ChatMessageListenerStub mListener;
@ -70,13 +70,15 @@ public class ImdnFragment extends Fragment {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mRoomUri = getArguments().getString("SipUri");
mLocalSipuri = getArguments().getString("LocalSipUri");
mLocalSipAddr = LinphoneManager.getLc().createAddress(mLocalSipuri);
mRoomUri = getArguments().getString("RemoteSipUri");
mRoomAddr = LinphoneManager.getLc().createAddress(mRoomUri);
mMessageId = getArguments().getString("MessageId");
}
Core core = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
mRoom = core.getChatRoomFromUri(mRoomAddr.asStringUriOnly());
mRoom = core.getChatRoom(mRoomAddr, mLocalSipAddr);
mInflater = inflater;
mContainer = container;
@ -88,7 +90,7 @@ public class ImdnFragment extends Fragment {
@Override
public void onClick(View view) {
if (LinphoneActivity.instance().isTablet()) {
LinphoneActivity.instance().goToChat(mRoomUri, null);
LinphoneActivity.instance().goToChat(mLocalSipuri, mRoomUri, null);
} else {
LinphoneActivity.instance().onBackPressed();
}

View file

@ -62,8 +62,8 @@ public class ImdnOldFragment extends Fragment {
private ChatMessageOldViewHolder mBubble;
private ViewGroup mContainer;
private String mRoomUri, mMessageId;
private Address mRoomAddr;
private String mLocalSipUri, mRoomUri, mMessageId;
private Address mLocalAddr, mRoomAddr;
private ChatRoom mRoom;
private ChatMessage mMessage;
private ChatMessageListenerStub mListener;
@ -75,13 +75,15 @@ public class ImdnOldFragment extends Fragment {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mRoomUri = getArguments().getString("SipUri");
mLocalSipUri = getArguments().getString("LocalSipUri");
mLocalAddr = LinphoneManager.getLc().createAddress(mLocalSipUri);
mRoomUri = getArguments().getString("RemoteSipUri");
mRoomAddr = LinphoneManager.getLc().createAddress(mRoomUri);
mMessageId = getArguments().getString("MessageId");
}
Core core = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
mRoom = core.getChatRoomFromUri(mRoomAddr.asStringUriOnly());
mRoom = core.getChatRoom(mRoomAddr, mLocalAddr);
mInflater = inflater;
mContainer = container;
@ -93,7 +95,7 @@ public class ImdnOldFragment extends Fragment {
@Override
public void onClick(View view) {
if (LinphoneActivity.instance().isTablet()) {
LinphoneActivity.instance().goToChat(mRoomUri, null);
LinphoneActivity.instance().goToChat(mLocalSipUri, mRoomUri, null);
} else {
LinphoneActivity.instance().onBackPressed();
}

View file

@ -95,7 +95,10 @@ public class ContactDetailsFragment extends Fragment
isSecured);
if (room != null) {
LinphoneActivity.instance()
.goToChat(room.getPeerAddress().asStringUriOnly(), null);
.goToChat(
room.getLocalAddress().asStringUriOnly(),
room.getPeerAddress().asStringUriOnly(),
null);
} else {
if (defaultProxyConfig.getConferenceFactoryUri() != null
&& (isSecured
@ -115,7 +118,9 @@ public class ContactDetailsFragment extends Fragment
room = lc.getChatRoom(participant);
LinphoneActivity.instance()
.goToChat(
room.getPeerAddress().asStringUriOnly(), null);
room.getLocalAddress().asStringUriOnly(),
room.getPeerAddress().asStringUriOnly(),
null);
}
}
}
@ -166,7 +171,10 @@ public class ContactDetailsFragment extends Fragment
if (newState == ChatRoom.State.Created) {
mWaitLayout.setVisibility(View.GONE);
LinphoneActivity.instance()
.goToChat(cr.getPeerAddress().asStringUriOnly(), null);
.goToChat(
cr.getLocalAddress().asStringUriOnly(),
cr.getPeerAddress().asStringUriOnly(),
null);
} else if (newState == ChatRoom.State.CreationFailed) {
mWaitLayout.setVisibility(View.GONE);
LinphoneActivity.instance().displayChatRoomError();

View file

@ -110,7 +110,10 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
if (newState == ChatRoom.State.Created) {
mWaitLayout.setVisibility(View.GONE);
LinphoneActivity.instance()
.goToChat(cr.getPeerAddress().asStringUriOnly(), null);
.goToChat(
cr.getLocalAddress().asStringUriOnly(),
cr.getPeerAddress().asStringUriOnly(),
null);
} else if (newState == ChatRoom.State.CreationFailed) {
mWaitLayout.setVisibility(View.GONE);
LinphoneActivity.instance().displayChatRoomError();
@ -217,7 +220,11 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
lc.findOneToOneChatRoom(
lc.getDefaultProxyConfig().getContact(), participant, false);
if (room != null) {
LinphoneActivity.instance().goToChat(room.getPeerAddress().asStringUriOnly(), null);
LinphoneActivity.instance()
.goToChat(
room.getLocalAddress().asStringUriOnly(),
room.getPeerAddress().asStringUriOnly(),
null);
} else {
ProxyConfig lpc = lc.getDefaultProxyConfig();
if (lpc != null
@ -232,7 +239,10 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
} else {
room = lc.getChatRoom(participant);
LinphoneActivity.instance()
.goToChat(room.getPeerAddress().asStringUriOnly(), null);
.goToChat(
room.getLocalAddress().asStringUriOnly(),
room.getPeerAddress().asStringUriOnly(),
null);
}
}
} else if (id == R.id.add_contact) {

View file

@ -76,7 +76,7 @@ public class NotificationBroadcastReceiver extends BroadcastReceiver {
return;
}
ChatRoom room = core.findChatRoom(remoteAddr, localAddr);
ChatRoom room = core.getChatRoom(remoteAddr, localAddr);
if (room == null) {
Log.e(
"[Notification Broadcast Receiver] Couldn't find chat room for remote address "

View file

@ -154,6 +154,7 @@ public class NotificationsManager {
Intent notifIntent = new Intent(mContext, LinphoneActivity.class);
notifIntent.putExtra("GoToChat", true);
notifIntent.putExtra("ChatContactSipUri", conferenceAddress);
notifIntent.putExtra("LocalSipUri", localIdentity.asStringUriOnly());
PendingIntent pendingIntent =
PendingIntent.getActivity(
mContext, 0, notifIntent, PendingIntent.FLAG_UPDATE_CURRENT);
@ -200,6 +201,7 @@ public class NotificationsManager {
Intent notifIntent = new Intent(mContext, LinphoneActivity.class);
notifIntent.putExtra("GoToChat", true);
notifIntent.putExtra("ChatContactSipUri", fromSipUri);
notifIntent.putExtra("LocalSipUri", localIdentity.asStringUriOnly());
PendingIntent pendingIntent =
PendingIntent.getActivity(
mContext, 0, notifIntent, PendingIntent.FLAG_UPDATE_CURRENT);