mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-28 11:42:15 -05:00
Unset all PGP signatures once
... so they will be redone to match the changed status.
This commit is contained in:
parent
02c6793ca9
commit
e5f154316c
@ -413,13 +413,13 @@ public class Account extends AbstractEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getPgpSignature() {
|
public String getPgpSignature() {
|
||||||
if (keys.has(KEY_PGP_SIGNATURE)) {
|
|
||||||
try {
|
try {
|
||||||
|
if (keys.has(KEY_PGP_SIGNATURE) && !"null".equals(keys.getString(KEY_PGP_SIGNATURE))) {
|
||||||
return keys.getString(KEY_PGP_SIGNATURE);
|
return keys.getString(KEY_PGP_SIGNATURE);
|
||||||
} catch (final JSONException e) {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else {
|
} catch (final JSONException e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -433,6 +433,15 @@ public class Account extends AbstractEntity {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean unsetPgpSignature() {
|
||||||
|
try {
|
||||||
|
keys.put(KEY_PGP_SIGNATURE, JSONObject.NULL);
|
||||||
|
} catch (JSONException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public long getPgpId() {
|
public long getPgpId() {
|
||||||
if (keys.has(KEY_PGP_ID)) {
|
if (keys.has(KEY_PGP_ID)) {
|
||||||
try {
|
try {
|
||||||
|
@ -43,7 +43,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
|||||||
private static DatabaseBackend instance = null;
|
private static DatabaseBackend instance = null;
|
||||||
|
|
||||||
private static final String DATABASE_NAME = "history";
|
private static final String DATABASE_NAME = "history";
|
||||||
private static final int DATABASE_VERSION = 20;
|
private static final int DATABASE_VERSION = 21;
|
||||||
|
|
||||||
private static String CREATE_CONTATCS_STATEMENT = "create table "
|
private static String CREATE_CONTATCS_STATEMENT = "create table "
|
||||||
+ Contact.TABLENAME + "(" + Contact.ACCOUNT + " TEXT, "
|
+ Contact.TABLENAME + "(" + Contact.ACCOUNT + " TEXT, "
|
||||||
@ -335,6 +335,15 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
|||||||
if (oldVersion < 18 && newVersion >= 18) {
|
if (oldVersion < 18 && newVersion >= 18) {
|
||||||
db.execSQL("ALTER TABLE " + Message.TABLENAME + " ADD COLUMN " + Message.READ + " NUMBER DEFAULT 1");
|
db.execSQL("ALTER TABLE " + Message.TABLENAME + " ADD COLUMN " + Message.READ + " NUMBER DEFAULT 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (oldVersion < 21 && newVersion >= 21) {
|
||||||
|
List<Account> accounts = getAccounts(db);
|
||||||
|
for (Account account : accounts) {
|
||||||
|
account.unsetPgpSignature();
|
||||||
|
db.update(Account.TABLENAME, account.getContentValues(), Account.UUID
|
||||||
|
+ "=?", new String[]{account.getUuid()});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized DatabaseBackend getInstance(Context context) {
|
public static synchronized DatabaseBackend getInstance(Context context) {
|
||||||
|
@ -1062,7 +1062,14 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
|||||||
final ConversationActivity activity = (ConversationActivity) getActivity();
|
final ConversationActivity activity = (ConversationActivity) getActivity();
|
||||||
final XmppConnectionService xmppService = activity.xmppConnectionService;
|
final XmppConnectionService xmppService = activity.xmppConnectionService;
|
||||||
final Contact contact = message.getConversation().getContact();
|
final Contact contact = message.getConversation().getContact();
|
||||||
if (activity.hasPgp()) {
|
if (!activity.hasPgp()) {
|
||||||
|
activity.showInstallPgpDialog();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (conversation.getAccount().getPgpSignature() == null) {
|
||||||
|
activity.announcePgp(conversation.getAccount(), conversation);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (conversation.getMode() == Conversation.MODE_SINGLE) {
|
if (conversation.getMode() == Conversation.MODE_SINGLE) {
|
||||||
if (contact.getPgpKeyId() != 0) {
|
if (contact.getPgpKeyId() != 0) {
|
||||||
xmppService.getPgpEngine().hasKey(contact,
|
xmppService.getPgpEngine().hasKey(contact,
|
||||||
@ -1084,7 +1091,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void error(int error, Contact contact) {
|
public void error(int error, Contact contact) {
|
||||||
|
System.out.println();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1135,9 +1142,6 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
activity.showInstallPgpDialog();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showNoPGPKeyDialog(boolean plural,
|
public void showNoPGPKeyDialog(boolean plural,
|
||||||
|
Loading…
Reference in New Issue
Block a user