diff options
author | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-03-21 22:14:52 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-03-21 22:14:52 +0100 |
commit | a9e34d34926d7df3fb01143d6733b481c31c292d (patch) | |
tree | 964a4baba3106f775692d4aec7c674f04be38cfb /src/eu/siacs/conversations/ui | |
parent | 079712060c2a61515867e97ffb98c7c4e88e0d5a (diff) |
tryed to fix more otr bugs. new resource setting
Diffstat (limited to 'src/eu/siacs/conversations/ui')
-rw-r--r-- | src/eu/siacs/conversations/ui/ConversationFragment.java | 84 |
1 files changed, 43 insertions, 41 deletions
diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java index 4ae85dc2..6e5105f5 100644 --- a/src/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/eu/siacs/conversations/ui/ConversationFragment.java @@ -388,52 +388,54 @@ public class ConversationFragment extends Fragment { public void updateMessages() { ConversationActivity activity = (ConversationActivity) getActivity(); - List<Message> encryptedMessages = new LinkedList<Message>(); - for (Message message : this.conversation.getMessages()) { - if (message.getEncryption() == Message.ENCRYPTION_PGP) { - encryptedMessages.add(message); - } - } - if (encryptedMessages.size() > 0) { - DecryptMessage task = new DecryptMessage(); - Message[] msgs = new Message[encryptedMessages.size()]; - task.execute(encryptedMessages.toArray(msgs)); - } - this.messageList.clear(); - this.messageList.addAll(this.conversation.getMessages()); - this.messageListAdapter.notifyDataSetChanged(); - if (conversation.getMode() == Conversation.MODE_SINGLE) { - if (messageList.size() >= 1) { - int latestEncryption = this.conversation.getLatestMessage() - .getEncryption(); - if (latestEncryption == Message.ENCRYPTION_DECRYPTED) { - conversation.nextMessageEncryption = Message.ENCRYPTION_PGP; - } else { - conversation.nextMessageEncryption = latestEncryption; + if (this.conversation != null) { + List<Message> encryptedMessages = new LinkedList<Message>(); + for (Message message : this.conversation.getMessages()) { + if (message.getEncryption() == Message.ENCRYPTION_PGP) { + encryptedMessages.add(message); } - makeFingerprintWarning(latestEncryption); } - } else { - if (conversation.getMucOptions().getError() != 0) { - mucError.setVisibility(View.VISIBLE); - if (conversation.getMucOptions().getError() == MucOptions.ERROR_NICK_IN_USE) { - mucErrorText.setText(getString(R.string.nick_in_use)); + if (encryptedMessages.size() > 0) { + DecryptMessage task = new DecryptMessage(); + Message[] msgs = new Message[encryptedMessages.size()]; + task.execute(encryptedMessages.toArray(msgs)); + } + this.messageList.clear(); + this.messageList.addAll(this.conversation.getMessages()); + this.messageListAdapter.notifyDataSetChanged(); + if (conversation.getMode() == Conversation.MODE_SINGLE) { + if (messageList.size() >= 1) { + int latestEncryption = this.conversation.getLatestMessage() + .getEncryption(); + if (latestEncryption == Message.ENCRYPTION_DECRYPTED) { + conversation.nextMessageEncryption = Message.ENCRYPTION_PGP; + } else { + conversation.nextMessageEncryption = latestEncryption; + } + makeFingerprintWarning(latestEncryption); } } else { - mucError.setVisibility(View.GONE); + if (conversation.getMucOptions().getError() != 0) { + mucError.setVisibility(View.VISIBLE); + if (conversation.getMucOptions().getError() == MucOptions.ERROR_NICK_IN_USE) { + mucErrorText.setText(getString(R.string.nick_in_use)); + } + } else { + mucError.setVisibility(View.GONE); + } + } + getActivity().invalidateOptionsMenu(); + updateChatMsgHint(); + int size = this.messageList.size(); + if (size >= 1) + messagesView.setSelection(size - 1); + if (!activity.shouldPaneBeOpen()) { + conversation.markRead(); + // TODO update notifications + UIHelper.updateNotification(getActivity(), + activity.getConversationList(), null, false); + activity.updateConversationList(); } - } - getActivity().invalidateOptionsMenu(); - updateChatMsgHint(); - int size = this.messageList.size(); - if (size >= 1) - messagesView.setSelection(size - 1); - if (!activity.shouldPaneBeOpen()) { - conversation.markRead(); - // TODO update notifications - UIHelper.updateNotification(getActivity(), - activity.getConversationList(), null, false); - activity.updateConversationList(); } } |