From 36dccb9f77c4f21d231ab907e21c03903cc263f4 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 21 Mar 2014 14:58:33 +0100 Subject: [PATCH] fixed users profile picture --- .../siacs/conversations/crypto/OtrEngine.java | 2 +- .../conversations/entities/Conversation.java | 1 - .../conversations/utils/MessageParser.java | 2 ++ .../siacs/conversations/utils/UIHelper.java | 20 +++++++++++-------- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/eu/siacs/conversations/crypto/OtrEngine.java b/src/eu/siacs/conversations/crypto/OtrEngine.java index 8efa21ebc..74e6036d1 100644 --- a/src/eu/siacs/conversations/crypto/OtrEngine.java +++ b/src/eu/siacs/conversations/crypto/OtrEngine.java @@ -161,7 +161,7 @@ public class OtrEngine implements OtrEngineHost { packet.addChild("private","urn:xmpp:carbons:2"); packet.addChild("no-copy","urn:xmpp:hints"); packet.setType(MessagePacket.TYPE_CHAT); - Log.d(LOGTAG,packet.toString()); + //Log.d(LOGTAG,packet.toString()); account.getXmppConnection().sendMessagePacket(packet); } diff --git a/src/eu/siacs/conversations/entities/Conversation.java b/src/eu/siacs/conversations/entities/Conversation.java index b4ec210c2..a13d4ea67 100644 --- a/src/eu/siacs/conversations/entities/Conversation.java +++ b/src/eu/siacs/conversations/entities/Conversation.java @@ -219,7 +219,6 @@ public class Conversation extends AbstractEntity { } public void startOtrSession(Context context, String presence) { - Log.d("xmppService", "starting otr session with " + presence); SessionID sessionId = new SessionID(this.getContactJid(), presence, "xmpp"); this.otrSession = new SessionImpl(sessionId, getAccount().getOtrEngine( diff --git a/src/eu/siacs/conversations/utils/MessageParser.java b/src/eu/siacs/conversations/utils/MessageParser.java index de8f4de88..1e1ec46f0 100644 --- a/src/eu/siacs/conversations/utils/MessageParser.java +++ b/src/eu/siacs/conversations/utils/MessageParser.java @@ -37,6 +37,7 @@ public class MessageParser { String body = packet.getBody(); if (!conversation.hasValidOtrSession()) { if (properlyAddressed) { + Log.d("xmppService","starting new otr session with "+packet.getFrom()+" because no valid otr session has been found"); conversation.startOtrSession(service.getApplicationContext(), fromParts[1]); } else { Log.d("xmppService",account.getJid()+": ignoring otr session with "+fromParts[0]); @@ -47,6 +48,7 @@ public class MessageParser { if (!foreignPresence.equals(fromParts[1])) { conversation.resetOtrSession(); if (properlyAddressed) { + Log.d("xmppService","replacing otr session with "+packet.getFrom()); conversation.startOtrSession(service.getApplicationContext(), fromParts[1]); } else { return null; diff --git a/src/eu/siacs/conversations/utils/UIHelper.java b/src/eu/siacs/conversations/utils/UIHelper.java index 5d879714e..96d628fa5 100644 --- a/src/eu/siacs/conversations/utils/UIHelper.java +++ b/src/eu/siacs/conversations/utils/UIHelper.java @@ -305,15 +305,19 @@ public class UIHelper { } public static Bitmap getSelfContactPicture(Account account, int size, boolean showPhoneSelfContactPicture, Activity activity) { - Uri selfiUri = PhoneHelper.getSefliUri(activity); - if (selfiUri != null) { - try { - return BitmapFactory.decodeStream(activity - .getContentResolver().openInputStream(selfiUri)); - } catch (FileNotFoundException e) { - return getUnknownContactPicture(account.getJid(), size); + if (showPhoneSelfContactPicture) { + Uri selfiUri = PhoneHelper.getSefliUri(activity); + if (selfiUri != null) { + try { + return BitmapFactory.decodeStream(activity + .getContentResolver().openInputStream(selfiUri)); + } catch (FileNotFoundException e) { + return getUnknownContactPicture(account.getJid(), size); + } } + return getUnknownContactPicture(account.getJid(), size); + } else { + return getUnknownContactPicture(account.getJid(), size); } - return getUnknownContactPicture(account.getJid(), size); } }