ignore outgoing invite
outgoing, mediated invites are of type=normal and can end up in MAM. We want to ignore those if they get mirrored back to us
This commit is contained in:
parent
fda6693b6d
commit
063f30ded2
|
@ -194,8 +194,8 @@ public class MessageGenerator extends AbstractGenerator {
|
|||
return packet;
|
||||
}
|
||||
|
||||
public MessagePacket invite(Conversation conversation, Jid contact) {
|
||||
MessagePacket packet = new MessagePacket();
|
||||
public MessagePacket invite(final Conversation conversation, final Jid contact) {
|
||||
final MessagePacket packet = new MessagePacket();
|
||||
packet.setTo(conversation.getJid().asBareJid());
|
||||
packet.setFrom(conversation.getAccount().getJid());
|
||||
Element x = new Element("x");
|
||||
|
|
|
@ -170,14 +170,19 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
|||
return null;
|
||||
}
|
||||
|
||||
private Invite extractInvite(Element message) {
|
||||
private Invite extractInvite(final Element message) {
|
||||
final Element mucUser = message.findChild("x", Namespace.MUC_USER);
|
||||
if (mucUser != null) {
|
||||
Element invite = mucUser.findChild("invite");
|
||||
final Element invite = mucUser.findChild("invite");
|
||||
if (invite != null) {
|
||||
String password = mucUser.findChildContent("password");
|
||||
Jid from = InvalidJid.getNullForInvalid(invite.getAttributeAsJid("from"));
|
||||
Jid room = InvalidJid.getNullForInvalid(message.getAttributeAsJid("from"));
|
||||
final String password = mucUser.findChildContent("password");
|
||||
final Jid from = InvalidJid.getNullForInvalid(invite.getAttributeAsJid("from"));
|
||||
final Jid to = InvalidJid.getNullForInvalid(invite.getAttributeAsJid("to"));
|
||||
if (to != null && from == null) {
|
||||
Log.d(Config.LOGTAG,"do not parse outgoing mediated invite "+message);
|
||||
return null;
|
||||
}
|
||||
final Jid room = InvalidJid.getNullForInvalid(message.getAttributeAsJid("from"));
|
||||
if (room == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -454,8 +459,10 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
|||
|
||||
final Invite invite = extractInvite(packet);
|
||||
if (invite != null) {
|
||||
if (isTypeGroupChat) {
|
||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": ignoring invite to " + invite.jid + " because type=groupchat");
|
||||
if (invite.jid.asBareJid().equals(account.getJid().asBareJid())) {
|
||||
Log.d(Config.LOGTAG,account.getJid().asBareJid()+": ignore invite to "+invite.jid+" because it matches account");
|
||||
} else if (isTypeGroupChat) {
|
||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": ignoring invite to " + invite.jid + " because it was received as group chat");
|
||||
} else if (invite.direct && (mucUserElement != null || invite.inviter == null || mXmppConnectionService.isMuc(account, invite.inviter))) {
|
||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": ignoring direct invite to " + invite.jid + " because it was received in MUC");
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue