Degenerate handling of voice requests
Stephen Paul Weber
created
At least show them as a private message from the room, implement full
form-in-message flow later
Change summary
src/main/java/eu/siacs/conversations/parser/MessageParser.java | 14 ++++
1 file changed, 14 insertions(+)
Detailed changes
@@ -53,6 +53,7 @@ import eu.siacs.conversations.xmpp.InvalidJid;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.OnMessagePacketReceived;
import eu.siacs.conversations.xmpp.chatstate.ChatState;
+import eu.siacs.conversations.xmpp.forms.Data;
import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager;
import eu.siacs.conversations.xmpp.jingle.JingleRtpConnection;
import eu.siacs.conversations.xmpp.pep.Avatar;
@@ -550,6 +551,19 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
mXmppConnectionService.updateConversationUi();
}
+ // Basic visibility for voice requests
+ if (body == null && html == null && pgpEncrypted == null && axolotlEncrypted == null && !isMucStatusMessage) {
+ final Element formEl = packet.findChild("x", "jabber:x:data");
+ if (formEl != null) {
+ final Data form = Data.parse(formEl);
+ final String role = form.getValue("muc#role");
+ final String nick = form.getValue("muc#roomnick");
+ if ("http://jabber.org/protocol/muc#request".equals(form.getFormType()) && "participant".equals(role)) {
+ body = new LocalizedContent("" + nick + " is requesting to speak", "en", 1);
+ }
+ }
+ }
+
if ((body != null || pgpEncrypted != null || (axolotlEncrypted != null && axolotlEncrypted.hasChild("payload")) || !attachments.isEmpty() || html != null) && !isMucStatusMessage) {
final Conversation conversation = mXmppConnectionService.findOrCreateConversation(account, counterpart.asBareJid(), conversationIsProbablyMuc, false, query, false);
final boolean conversationMultiMode = conversation.getMode() == Conversation.MODE_MULTI;