fixed users profile picture

This commit is contained in:
Daniel Gultsch 2014-03-21 14:58:33 +01:00
parent b6ea028a9d
commit 36dccb9f77
4 changed files with 15 additions and 10 deletions

View file

@ -161,7 +161,7 @@ public class OtrEngine implements OtrEngineHost {
packet.addChild("private","urn:xmpp:carbons:2"); packet.addChild("private","urn:xmpp:carbons:2");
packet.addChild("no-copy","urn:xmpp:hints"); packet.addChild("no-copy","urn:xmpp:hints");
packet.setType(MessagePacket.TYPE_CHAT); packet.setType(MessagePacket.TYPE_CHAT);
Log.d(LOGTAG,packet.toString()); //Log.d(LOGTAG,packet.toString());
account.getXmppConnection().sendMessagePacket(packet); account.getXmppConnection().sendMessagePacket(packet);
} }

View file

@ -219,7 +219,6 @@ public class Conversation extends AbstractEntity {
} }
public void startOtrSession(Context context, String presence) { public void startOtrSession(Context context, String presence) {
Log.d("xmppService", "starting otr session with " + presence);
SessionID sessionId = new SessionID(this.getContactJid(), presence, SessionID sessionId = new SessionID(this.getContactJid(), presence,
"xmpp"); "xmpp");
this.otrSession = new SessionImpl(sessionId, getAccount().getOtrEngine( this.otrSession = new SessionImpl(sessionId, getAccount().getOtrEngine(

View file

@ -37,6 +37,7 @@ public class MessageParser {
String body = packet.getBody(); String body = packet.getBody();
if (!conversation.hasValidOtrSession()) { if (!conversation.hasValidOtrSession()) {
if (properlyAddressed) { 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]); conversation.startOtrSession(service.getApplicationContext(), fromParts[1]);
} else { } else {
Log.d("xmppService",account.getJid()+": ignoring otr session with "+fromParts[0]); Log.d("xmppService",account.getJid()+": ignoring otr session with "+fromParts[0]);
@ -47,6 +48,7 @@ public class MessageParser {
if (!foreignPresence.equals(fromParts[1])) { if (!foreignPresence.equals(fromParts[1])) {
conversation.resetOtrSession(); conversation.resetOtrSession();
if (properlyAddressed) { if (properlyAddressed) {
Log.d("xmppService","replacing otr session with "+packet.getFrom());
conversation.startOtrSession(service.getApplicationContext(), fromParts[1]); conversation.startOtrSession(service.getApplicationContext(), fromParts[1]);
} else { } else {
return null; return null;

View file

@ -305,15 +305,19 @@ public class UIHelper {
} }
public static Bitmap getSelfContactPicture(Account account, int size, boolean showPhoneSelfContactPicture, Activity activity) { public static Bitmap getSelfContactPicture(Account account, int size, boolean showPhoneSelfContactPicture, Activity activity) {
Uri selfiUri = PhoneHelper.getSefliUri(activity); if (showPhoneSelfContactPicture) {
if (selfiUri != null) { Uri selfiUri = PhoneHelper.getSefliUri(activity);
try { if (selfiUri != null) {
return BitmapFactory.decodeStream(activity try {
.getContentResolver().openInputStream(selfiUri)); return BitmapFactory.decodeStream(activity
} catch (FileNotFoundException e) { .getContentResolver().openInputStream(selfiUri));
return getUnknownContactPicture(account.getJid(), size); } catch (FileNotFoundException e) {
return getUnknownContactPicture(account.getJid(), size);
}
} }
return getUnknownContactPicture(account.getJid(), size);
} else {
return getUnknownContactPicture(account.getJid(), size);
} }
return getUnknownContactPicture(account.getJid(), size);
} }
} }