Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Commit

Permalink
make sure we only change status for the right session
Browse files Browse the repository at this point in the history
  • Loading branch information
n8fr8 committed Mar 13, 2018
1 parent f97e1c9 commit 8feca2b
Showing 1 changed file with 37 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,13 @@ public void onClick(DialogInterface dialog, int which) {
public boolean onIncomingMessage(IChatSession ses,
org.awesomeapp.messenger.model.Message msg) {

try {
if (getChatSession().getId() != ses.getId())
return false;
} catch (RemoteException e) {
e.printStackTrace();
}

return mIsSelected;
}

Expand All @@ -540,16 +547,34 @@ public void onContactLeft(IChatSession ses, Contact contact) {

@Override
public void onSendMessageError(IChatSession ses,

org.awesomeapp.messenger.model.Message msg, ImErrorInfo error) {


try {
if (getChatSession().getId() != ses.getId())
return;
}
catch (RemoteException re){}

}

@Override
public void onIncomingReceipt(IChatSession ses, String packetId) throws RemoteException {

if (getChatSession().getId() != ses.getId())
return;

scheduleRequery(DEFAULT_QUERY_INTERVAL);
}

@Override
public void onStatusChanged(IChatSession ses) throws RemoteException {


if (getChatSession().getId() != ses.getId())
return;

scheduleRequery(DEFAULT_QUERY_INTERVAL);

}
Expand Down Expand Up @@ -591,6 +616,7 @@ public void onIncomingFileTransferProgress(String file, int percent)
public void onIncomingFileTransferError(String file, String err) throws RemoteException {



android.os.Message message = android.os.Message.obtain(null, SHOW_DATA_ERROR, (int) (mProviderId >> 32),
(int) mProviderId, -1);
message.getData().putString("file", file);
Expand All @@ -606,7 +632,10 @@ public void onIncomingFileTransferError(String file, String err) throws RemoteEx
public void onContactTyping(IChatSession ses, Contact contact, boolean isTyping) throws RemoteException {
super.onContactTyping(ses, contact, isTyping);

if (contact.getPresence() != null) {
if (getChatSession().getId() != ses.getId())
return;

if (contact.getPresence() != null) {
mPresenceStatus = contact.getPresence().getStatus();
mLastSeen = contact.getPresence().getLastSeen();
}
Expand Down Expand Up @@ -738,15 +767,16 @@ public void onAllContactListsLoaded() {

public void onContactChange(int type, IContactList list, Contact contact) {

if (contact != null && contact.getPresence() != null) {
mPresenceStatus = contact.getPresence().getStatus();
if (contact.getAddress().getBareAddress().equals(mRemoteAddress)) {

}
mLastSeen = new Date();

mActivity.updateLastSeen(mLastSeen);
if (contact != null && contact.getPresence() != null) {
mPresenceStatus = contact.getPresence().getStatus();

}
mLastSeen = new Date();
mActivity.updateLastSeen(mLastSeen);

}
}

public void onContactError(int errorType, ImErrorInfo error, String listName,
Expand Down

0 comments on commit 8feca2b

Please sign in to comment.