From 5880a1a802e17519c251fbc2c4952b450d30ce22 Mon Sep 17 00:00:00 2001 From: paweldomas Date: Wed, 17 Feb 2016 11:20:01 -0600 Subject: [PATCH 1/2] Adds HealthCheck IQ. --- .../extensions/colibri/ColibriIQProvider.java | 32 +++++++++++++ .../extensions/colibri/HealthCheckIQ.java | 48 +++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/HealthCheckIQ.java diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriIQProvider.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriIQProvider.java index cc6d0c9fb..fe2a24310 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriIQProvider.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriIQProvider.java @@ -912,6 +912,38 @@ else if (ColibriStatsExtension.Stat.ELEMENT_NAME } } } + else if (HealthCheckIQ.ELEMENT_NAME.equals(parser.getName()) + && HealthCheckIQ.NAMESPACE.equals(namespace)) + { + String rootElement = parser.getName(); + + iq = new HealthCheckIQ(); + + boolean done = false; + + while (!done) + { + switch (parser.next()) + { + case XmlPullParser.END_TAG: + { + String name = parser.getName(); + + if (rootElement.equals(name)) + { + done = true; + } + break; + } + + case XmlPullParser.TEXT: + { + // Parse some text here + break; + } + } + } + } else iq = null; diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/HealthCheckIQ.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/HealthCheckIQ.java new file mode 100644 index 000000000..1ce8a6f1c --- /dev/null +++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/HealthCheckIQ.java @@ -0,0 +1,48 @@ +/* + * Jitsi, the OpenSource Java VoIP and Instant Messaging client. + * + * Copyright @ 2015 Atlassian Pty Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package net.java.sip.communicator.impl.protocol.jabber.extensions.colibri; + +import org.jivesoftware.smack.packet.*; + +/** + * The health check IQ used to trigger health checks on the Jitsi Videobridge. + * + * @author Pawel Domas + */ +public class HealthCheckIQ + extends IQ +{ + /** + * Health check IQ element name. + */ + final static public String ELEMENT_NAME = "healthcheck"; + + /** + * XML namespace name for health check IQs. + */ + final static public String NAMESPACE = ColibriConferenceIQ.NAMESPACE; + + /** + * {@inheritDoc} + */ + @Override + public String getChildElementXML() + { + return "<" + ELEMENT_NAME + " xmlns='" + NAMESPACE + "' />"; + } +} From eecda70640791b035361fcda1cf15bbf57099e83 Mon Sep 17 00:00:00 2001 From: paweldomas Date: Wed, 17 Feb 2016 11:52:05 -0600 Subject: [PATCH 2/2] Removes unused case statements from ColibriIQ parsing code. --- .../extensions/colibri/ColibriIQProvider.java | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriIQProvider.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriIQProvider.java index fe2a24310..0507c1cdd 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriIQProvider.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriIQProvider.java @@ -837,12 +837,6 @@ else if (ShutdownIQ.NAMESPACE.equals(namespace) && } break; } - - case XmlPullParser.TEXT: - { - // Parse some text here - break; - } } } } @@ -903,12 +897,6 @@ else if (ColibriStatsExtension.Stat.ELEMENT_NAME } break; } - - case XmlPullParser.TEXT: - { - // Parse some text here - break; - } } } } @@ -935,12 +923,6 @@ else if (HealthCheckIQ.ELEMENT_NAME.equals(parser.getName()) } break; } - - case XmlPullParser.TEXT: - { - // Parse some text here - break; - } } } }