This commit is contained in:
Daniel Gultsch 2014-04-25 23:14:43 +02:00
parent 6942840061
commit a55ddb889e
2 changed files with 3 additions and 2 deletions

View file

@ -118,11 +118,12 @@ public class PgpEngine {
return 0; return 0;
} }
public String generateSignature(String status) public String generateSignature(Account account, String status)
throws UserInputRequiredException { throws UserInputRequiredException {
Intent params = new Intent(); Intent params = new Intent();
params.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true); params.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
params.setAction(OpenPgpApi.ACTION_SIGN); params.setAction(OpenPgpApi.ACTION_SIGN);
params.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, account.getJid());
InputStream is = new ByteArrayInputStream(status.getBytes()); InputStream is = new ByteArrayInputStream(status.getBytes());
ByteArrayOutputStream os = new ByteArrayOutputStream(); ByteArrayOutputStream os = new ByteArrayOutputStream();
Intent result = api.executeApi(params, is, os); Intent result = api.executeApi(params, is, os);

View file

@ -1311,7 +1311,7 @@ public class XmppConnectionService extends Service {
public void generatePgpAnnouncement(Account account) public void generatePgpAnnouncement(Account account)
throws PgpEngine.UserInputRequiredException { throws PgpEngine.UserInputRequiredException {
if (account.getStatus() == Account.STATUS_ONLINE) { if (account.getStatus() == Account.STATUS_ONLINE) {
String signature = getPgpEngine().generateSignature("online"); String signature = getPgpEngine().generateSignature(account,"online");
account.setKey("pgp_signature", signature); account.setKey("pgp_signature", signature);
databaseBackend.updateAccount(account); databaseBackend.updateAccount(account);
sendPgpPresence(account, signature); sendPgpPresence(account, signature);