include pgp signature only in non anonymous mucs

This commit is contained in:
Daniel Gultsch 2016-10-19 12:31:11 +02:00
parent dce8149aae
commit c3423d6ffe
2 changed files with 7 additions and 3 deletions

View File

@ -38,13 +38,17 @@ public class PresenceGenerator extends AbstractGenerator {
}
public PresencePacket selfPresence(Account account, Presence.Status status) {
return selfPresence(account, status, true);
}
public PresencePacket selfPresence(Account account, Presence.Status status, boolean includePgpAnnouncement) {
PresencePacket packet = new PresencePacket();
if(status.toShowString() != null) {
packet.addChild("show").setContent(status.toShowString());
}
packet.setFrom(account.getJid());
String sig = account.getPgpSignature();
if (sig != null && mXmppConnectionService.getPgpEngine() != null) {
if (includePgpAnnouncement && sig != null && mXmppConnectionService.getPgpEngine() != null) {
packet.addChild("x", "jabber:x:signed").setContent(sig);
}
String capHash = getCapHash();

View File

@ -2037,11 +2037,11 @@ public class XmppConnectionService extends Service {
final MucOptions mucOptions = conversation.getMucOptions();
final Jid joinJid = mucOptions.getSelf().getFullJid();
Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": joining conversation " + joinJid.toString());
PresencePacket packet = mPresenceGenerator.selfPresence(account, Presence.Status.ONLINE);
PresencePacket packet = mPresenceGenerator.selfPresence(account, Presence.Status.ONLINE, mucOptions.nonanonymous());
packet.setTo(joinJid);
Element x = packet.addChild("x", "http://jabber.org/protocol/muc");
if (conversation.getMucOptions().getPassword() != null) {
x.addChild("password").setContent(conversation.getMucOptions().getPassword());
x.addChild("password").setContent(mucOptions.getPassword());
}
if (mucOptions.mamSupport()) {