fixed #254
This commit is contained in:
parent
22e504b8f9
commit
185c485fc6
|
@ -114,7 +114,7 @@ public class Conversation extends AbstractEntity {
|
||||||
this.messages.get(i).markRead();
|
this.messages.get(i).markRead();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String popLatestMarkableMessageId() {
|
public String popLatestMarkableMessageId() {
|
||||||
String id = this.latestMarkableMessageId;
|
String id = this.latestMarkableMessageId;
|
||||||
this.latestMarkableMessageId = null;
|
this.latestMarkableMessageId = null;
|
||||||
|
@ -141,7 +141,8 @@ public class Conversation extends AbstractEntity {
|
||||||
if ((getMode() == MODE_MULTI) && (getMucOptions().getSubject() != null)
|
if ((getMode() == MODE_MULTI) && (getMucOptions().getSubject() != null)
|
||||||
&& useSubject) {
|
&& useSubject) {
|
||||||
return getMucOptions().getSubject();
|
return getMucOptions().getSubject();
|
||||||
} else if (getMode() == MODE_MULTI && bookmark!=null && bookmark.getName() != null) {
|
} else if (getMode() == MODE_MULTI && bookmark != null
|
||||||
|
&& bookmark.getName() != null) {
|
||||||
return bookmark.getName();
|
return bookmark.getName();
|
||||||
} else {
|
} else {
|
||||||
return this.getContact().getDisplayName();
|
return this.getContact().getDisplayName();
|
||||||
|
@ -238,7 +239,7 @@ public class Conversation extends AbstractEntity {
|
||||||
this.otrSessionNeedsStarting = false;
|
this.otrSessionNeedsStarting = false;
|
||||||
return this.otrSession;
|
return this.otrSession;
|
||||||
} else {
|
} else {
|
||||||
this.otrSessionNeedsStarting = true;
|
this.otrSessionNeedsStarting = true;
|
||||||
}
|
}
|
||||||
return this.otrSession;
|
return this.otrSession;
|
||||||
} catch (OtrException e) {
|
} catch (OtrException e) {
|
||||||
|
@ -267,7 +268,7 @@ public class Conversation extends AbstractEntity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void endOtrIfNeeded() {
|
public void endOtrIfNeeded() {
|
||||||
if (this.otrSession != null) {
|
if (this.otrSession != null) {
|
||||||
if (this.otrSession.getSessionStatus() == SessionStatus.ENCRYPTED) {
|
if (this.otrSession.getSessionStatus() == SessionStatus.ENCRYPTED) {
|
||||||
|
@ -372,7 +373,7 @@ public class Conversation extends AbstractEntity {
|
||||||
public void setSymmetricKey(byte[] key) {
|
public void setSymmetricKey(byte[] key) {
|
||||||
this.symmetricKey = key;
|
this.symmetricKey = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getSymmetricKey() {
|
public byte[] getSymmetricKey() {
|
||||||
return this.symmetricKey;
|
return this.symmetricKey;
|
||||||
}
|
}
|
||||||
|
@ -381,7 +382,7 @@ public class Conversation extends AbstractEntity {
|
||||||
this.bookmark = bookmark;
|
this.bookmark = bookmark;
|
||||||
this.bookmark.setConversation(this);
|
this.bookmark.setConversation(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deregisterWithBookmark() {
|
public void deregisterWithBookmark() {
|
||||||
if (this.bookmark != null) {
|
if (this.bookmark != null) {
|
||||||
this.bookmark.setConversation(null);
|
this.bookmark.setConversation(null);
|
||||||
|
@ -391,4 +392,13 @@ public class Conversation extends AbstractEntity {
|
||||||
public Bookmark getBookmark() {
|
public Bookmark getBookmark() {
|
||||||
return this.bookmark;
|
return this.bookmark;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void failWaitingOtrMessages() {
|
||||||
|
for (Message message : this.messages) {
|
||||||
|
if (message.getEncryption() == Message.ENCRYPTION_OTR
|
||||||
|
&& message.getStatus() == Message.STATUS_WAITING) {
|
||||||
|
message.setStatus(Message.STATUS_SEND_FAILED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -532,11 +532,13 @@ public class XmppConnectionService extends Service {
|
||||||
}
|
}
|
||||||
} else if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
|
} else if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
|
||||||
message.getConversation().endOtrIfNeeded();
|
message.getConversation().endOtrIfNeeded();
|
||||||
|
message.getConversation().failWaitingOtrMessages();
|
||||||
packet = mMessageGenerator.generatePgpChat(message);
|
packet = mMessageGenerator.generatePgpChat(message);
|
||||||
message.setStatus(Message.STATUS_SEND);
|
message.setStatus(Message.STATUS_SEND);
|
||||||
send = true;
|
send = true;
|
||||||
} else {
|
} else {
|
||||||
message.getConversation().endOtrIfNeeded();
|
message.getConversation().endOtrIfNeeded();
|
||||||
|
message.getConversation().failWaitingOtrMessages();
|
||||||
if (message.getConversation().getMode() == Conversation.MODE_SINGLE) {
|
if (message.getConversation().getMode() == Conversation.MODE_SINGLE) {
|
||||||
message.setStatus(Message.STATUS_SEND);
|
message.setStatus(Message.STATUS_SEND);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue