diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-05-17 14:25:58 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-05-17 14:25:58 +0200 |
commit | 61726f4994dffad0407bbc9dc539874ce9f79171 (patch) | |
tree | 068cb980d598e201a5a67e4487a962231b56def8 /src/main/java/eu/siacs/conversations/services | |
parent | 14952ba5e5ffbbbda2d0453157f03779ffbdaffb (diff) |
refactored muc item parsing to also parse muc status messages
Diffstat (limited to 'src/main/java/eu/siacs/conversations/services')
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 6b01261c8..e8a98cdaf 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -83,6 +83,7 @@ import eu.siacs.conversations.generator.IqGenerator; import eu.siacs.conversations.generator.MessageGenerator; import eu.siacs.conversations.generator.PresenceGenerator; import eu.siacs.conversations.http.HttpConnectionManager; +import eu.siacs.conversations.parser.AbstractParser; import eu.siacs.conversations.parser.IqParser; import eu.siacs.conversations.parser.MessageParser; import eu.siacs.conversations.parser.PresenceParser; @@ -1902,22 +1903,11 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa Element query = packet.query("http://jabber.org/protocol/muc#admin"); if (packet.getType() == IqPacket.TYPE.RESULT && query != null) { - final String local = conversation.getJid().getLocalpart(); - final String domain = conversation.getJid().getDomainpart(); for(Element child : query.getChildren()) { if ("item".equals(child.getName())) { - String affiliation = child.getAttribute("affiliation"); - String role = child.getAttribute("role"); - String nick = child.getAttribute("nick"); - Jid fullJid; - try { - fullJid = nick != null ? Jid.fromParts(local, domain, nick) : null; - } catch (InvalidJidException e) { - fullJid = null; - } - Jid realJid = child.getAttributeAsJid("jid"); - if (realJid != null && !realJid.equals(account.getJid().toBareJid())) { - conversation.getMucOptions().putMember(fullJid, realJid, affiliation, role); + MucOptions.User user = AbstractParser.parseItem(conversation,child); + if (!user.realJidMatchesAccount()) { + conversation.getMucOptions().addUser(user); } } } |