bug fixes for faulty roster fetch and otr bug between two sc instances

This commit is contained in:
Daniel Gultsch 2014-02-22 18:18:51 +01:00
parent b8e85a2846
commit a5a39fa9af
3 changed files with 13 additions and 12 deletions

View File

@ -164,6 +164,7 @@ public class OtrEngine implements OtrEngineHost {
Element privateTag = new Element("private"); Element privateTag = new Element("private");
privateTag.setAttribute("xmlns","urn:xmpp:carbons:2"); privateTag.setAttribute("xmlns","urn:xmpp:carbons:2");
packet.addChild(privateTag); packet.addChild(privateTag);
packet.setType(MessagePacket.TYPE_CHAT);
account.getXmppConnection().sendMessagePacket(packet); account.getXmppConnection().sendMessagePacket(packet);
} }

View File

@ -464,17 +464,15 @@ public class XmppConnectionService extends Service {
mWhere.append("jid NOT IN("); mWhere.append("jid NOT IN(");
List<Element> items = roster.getChildren(); List<Element> items = roster.getChildren();
for(int i = 0; i < items.size(); ++i) { for(int i = 0; i < items.size(); ++i) {
mWhere.append("\"");
mWhere.append(DatabaseUtils.sqlEscapeString(items.get(i).getAttribute("jid"))); mWhere.append(DatabaseUtils.sqlEscapeString(items.get(i).getAttribute("jid")));
if (i != items.size() - 1) { if (i != items.size() - 1) {
mWhere.append("\","); mWhere.append(",");
} else {
mWhere.append("\"");
} }
} }
mWhere.append(") and accountUuid = \""); mWhere.append(") and accountUuid = \"");
mWhere.append(account.getUuid()); mWhere.append(account.getUuid());
mWhere.append("\""); mWhere.append("\"");
Log.d(LOGTAG,mWhere.toString());
List<Contact> contactsToDelete = databaseBackend.getContats(mWhere.toString()); List<Contact> contactsToDelete = databaseBackend.getContats(mWhere.toString());
for(Contact contact : contactsToDelete) { for(Contact contact : contactsToDelete) {
databaseBackend.deleteContact(contact); databaseBackend.deleteContact(contact);

View File

@ -232,18 +232,20 @@ public class ConversationFragment extends Fragment {
boolean showPhoneSelfContactPicture = sharedPref.getBoolean( boolean showPhoneSelfContactPicture = sharedPref.getBoolean(
"show_phone_selfcontact_picture", true); "show_phone_selfcontact_picture", true);
Bitmap self; Bitmap self = null;
if (showPhoneSelfContactPicture) { if (showPhoneSelfContactPicture) {
Uri selfiUri = PhoneHelper.getSefliUri(getActivity()); Uri selfiUri = PhoneHelper.getSefliUri(getActivity());
try { if (selfiUri!=null) {
self = BitmapFactory.decodeStream(getActivity() try {
.getContentResolver().openInputStream(selfiUri)); self = BitmapFactory.decodeStream(getActivity()
} catch (FileNotFoundException e) { .getContentResolver().openInputStream(selfiUri));
self = UIHelper.getUnknownContactPicture(conversation } catch (FileNotFoundException e) {
.getAccount().getJid(), 200); self = null;
}
} }
} else { }
if (self==null){
self = UIHelper.getUnknownContactPicture(conversation.getAccount() self = UIHelper.getUnknownContactPicture(conversation.getAccount()
.getJid(), 200); .getJid(), 200);
} }