From 58c32639b5921dc2b3a7c9c686938b7382d3f30f Mon Sep 17 00:00:00 2001 From: vanitasvitae Date: Thu, 6 Jul 2017 16:55:12 +0200 Subject: [PATCH] Allow parsing of JingleReason.AlternativeSession The JingleReasonProvider was faulty and ignored the element. --- .../jivesoftware/smackx/jingle/element/JingleReason.java | 4 ++++ .../smackx/jingle/provider/JingleProvider.java | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleReason.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleReason.java index b91eb758b..29ef9aa71 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleReason.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleReason.java @@ -156,5 +156,9 @@ public class JingleReason implements NamedElement { xml.closeElement(this); return xml; } + + public String getAlternativeSessionId() { + return sessionId; + } } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleProvider.java index f843a4126..b920f4a35 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleProvider.java @@ -69,7 +69,14 @@ public class JingleProvider extends IQProvider { case JingleReason.ELEMENT: parser.next(); String reasonString = parser.getName(); - Reason reason = Reason.fromString(reasonString); + JingleReason reason; + if (reasonString.equals("alternative-session")) { + parser.next(); + String sid = parser.nextText(); + reason = new JingleReason.AlternativeSession(sid); + } else { + reason = new JingleReason(Reason.fromString(reasonString)); + } builder.setReason(reason); break; default: