Esempio n. 1
0
 public static ExtensionElement parseExtensionElement(
     String str, String str2, XmlPullParser xmlPullParser)
     throws XmlPullParserException, IOException, SmackException {
   ParserUtils.assertAtStartTag(xmlPullParser);
   ExtensionElementProvider extensionProvider = ProviderManager.getExtensionProvider(str, str2);
   if (extensionProvider == null) {
     int depth = xmlPullParser.getDepth();
     ExtensionElement defaultExtensionElement = new DefaultExtensionElement(str, str2);
     while (true) {
       switch (xmlPullParser.next()) {
         case VideoSize.HVGA /*2*/:
           String name = xmlPullParser.getName();
           if (!xmlPullParser.isEmptyElementTag()) {
             if (xmlPullParser.next() != 4) {
               break;
             }
             defaultExtensionElement.setValue(name, xmlPullParser.getText());
             break;
           }
           defaultExtensionElement.setValue(name, "");
           break;
         case Version.API03_CUPCAKE_15 /*3*/:
           if (xmlPullParser.getDepth() != depth) {
             break;
           }
           return defaultExtensionElement;
         default:
           break;
       }
     }
   }
   return (ExtensionElement) extensionProvider.parse(xmlPullParser);
 }
Esempio n. 2
0
 public static Feature parseSessionFeature(XmlPullParser xmlPullParser)
     throws XmlPullParserException, IOException {
   boolean z;
   ParserUtils.assertAtStartTag(xmlPullParser);
   int depth = xmlPullParser.getDepth();
   if (xmlPullParser.isEmptyElementTag()) {
     z = $assertionsDisabled;
   } else {
     z = false;
     while (true) {
       switch (xmlPullParser.next()) {
         case VideoSize.HVGA /*2*/:
           String name = xmlPullParser.getName();
           Object obj = -1;
           switch (name.hashCode()) {
             case -79017120:
               if (name.equals(Feature.OPTIONAL_ELEMENT)) {
                 obj = null;
                 break;
               }
               break;
           }
           switch (obj) {
             case VideoSize.QCIF /*0*/:
               z = true;
               break;
             default:
               continue;
           }
         case Version.API03_CUPCAKE_15 /*3*/:
           if (xmlPullParser.getDepth() == depth) {
             break;
           }
           continue;
         default:
           continue;
       }
     }
   }
   return new Feature(z);
 }
Esempio n. 3
0
 public static Stanza parseStanza(XmlPullParser xmlPullParser)
     throws XmlPullParserException, IOException, SmackException {
   ParserUtils.assertAtStartTag(xmlPullParser);
   String name = xmlPullParser.getName();
   Object obj = -1;
   switch (name.hashCode()) {
     case -1276666629:
       if (name.equals(Presence.ELEMENT)) {
         obj = 2;
         break;
       }
       break;
     case 3368:
       if (name.equals(IQ.IQ_ELEMENT)) {
         obj = 1;
         break;
       }
       break;
     case 954925063:
       if (name.equals(Message.ELEMENT)) {
         obj = null;
         break;
       }
       break;
   }
   switch (obj) {
     case VideoSize.QCIF /*0*/:
       return parseMessage(xmlPullParser);
     case VideoSize.CIF /*1*/:
       return parseIQ(xmlPullParser);
     case VideoSize.HVGA /*2*/:
       return parsePresence(xmlPullParser);
     default:
       throw new IllegalArgumentException("Can only parse message, iq or presence, not " + name);
   }
 }
Esempio n. 4
0
 public static Presence parsePresence(XmlPullParser xmlPullParser)
     throws XmlPullParserException, IOException, SmackException {
   ParserUtils.assertAtStartTag(xmlPullParser);
   int depth = xmlPullParser.getDepth();
   Presence.Type type = Presence.Type.available;
   String attributeValue = xmlPullParser.getAttributeValue("", "type");
   if (!(attributeValue == null || attributeValue.equals(""))) {
     type = Presence.Type.fromString(attributeValue);
   }
   Stanza presence = new Presence(type);
   presence.setTo(xmlPullParser.getAttributeValue("", PrivacyItem.SUBSCRIPTION_TO));
   presence.setFrom(xmlPullParser.getAttributeValue("", PrivacyItem.SUBSCRIPTION_FROM));
   presence.setStanzaId(xmlPullParser.getAttributeValue("", "id"));
   String languageAttribute = getLanguageAttribute(xmlPullParser);
   if (!(languageAttribute == null || "".equals(languageAttribute.trim()))) {
     presence.setLanguage(languageAttribute);
   }
   while (true) {
     switch (xmlPullParser.next()) {
       case VideoSize.HVGA /*2*/:
         String name = xmlPullParser.getName();
         String namespace = xmlPullParser.getNamespace();
         Object obj = -1;
         switch (name.hashCode()) {
           case -1165461084:
             if (name.equals("priority")) {
               obj = 1;
               break;
             }
             break;
           case -892481550:
             if (name.equals(Status.ELEMENT)) {
               obj = null;
               break;
             }
             break;
           case 3529469:
             if (name.equals("show")) {
               obj = 2;
               break;
             }
             break;
           case 96784904:
             if (name.equals(XMPPError.ERROR)) {
               obj = 3;
               break;
             }
             break;
         }
         switch (obj) {
           case VideoSize.QCIF /*0*/:
             presence.setStatus(xmlPullParser.nextText());
             break;
           case VideoSize.CIF /*1*/:
             presence.setPriority(Integer.parseInt(xmlPullParser.nextText()));
             break;
           case VideoSize.HVGA /*2*/:
             obj = xmlPullParser.nextText();
             if (!StringUtils.isNotEmpty(obj)) {
               LOGGER.warning(
                   "Empty or null mode text in presence show element form "
                       + presence.getFrom()
                       + " with id '"
                       + presence.getStanzaId()
                       + "' which is invalid according to RFC6121 4.7.2.1");
               break;
             }
             presence.setMode(Mode.fromString(obj));
             break;
           case Version.API03_CUPCAKE_15 /*3*/:
             presence.setError(parseError(xmlPullParser));
             break;
           default:
             try {
               addExtensionElement(presence, xmlPullParser, name, namespace);
               break;
             } catch (Throwable e) {
               LOGGER.log(
                   Level.WARNING,
                   "Failed to parse extension packet in Presence packet. Attributes: from="
                       + presence.getFrom()
                       + " id="
                       + presence.getStanzaId(),
                   e);
               break;
             }
         }
       case Version.API03_CUPCAKE_15 /*3*/:
         if (xmlPullParser.getDepth() != depth) {
           break;
         }
         return presence;
       default:
         break;
     }
   }
 }
Esempio n. 5
0
 public static Message parseMessage(XmlPullParser xmlPullParser)
     throws XmlPullParserException, IOException, SmackException {
   ParserUtils.assertAtStartTag(xmlPullParser);
   if ($assertionsDisabled || xmlPullParser.getName().equals(Message.ELEMENT)) {
     int depth = xmlPullParser.getDepth();
     Stanza message = new Message();
     message.setStanzaId(xmlPullParser.getAttributeValue("", "id"));
     message.setTo(xmlPullParser.getAttributeValue("", PrivacyItem.SUBSCRIPTION_TO));
     message.setFrom(xmlPullParser.getAttributeValue("", PrivacyItem.SUBSCRIPTION_FROM));
     String attributeValue = xmlPullParser.getAttributeValue("", "type");
     if (attributeValue != null) {
       message.setType(Message.Type.fromString(attributeValue));
     }
     attributeValue = getLanguageAttribute(xmlPullParser);
     if (attributeValue == null || "".equals(attributeValue.trim())) {
       attributeValue = Stanza.getDefaultLanguage();
     } else {
       message.setLanguage(attributeValue);
     }
     String str = null;
     while (true) {
       switch (xmlPullParser.next()) {
         case VideoSize.HVGA /*2*/:
           String name = xmlPullParser.getName();
           String namespace = xmlPullParser.getNamespace();
           Object obj = -1;
           switch (name.hashCode()) {
             case -1867885268:
               if (name.equals("subject")) {
                 obj = null;
                 break;
               }
               break;
             case -874443254:
               if (name.equals("thread")) {
                 obj = 2;
                 break;
               }
               break;
             case 3029410:
               if (name.equals(Message.BODY)) {
                 obj = 1;
                 break;
               }
               break;
             case 96784904:
               if (name.equals(XMPPError.ERROR)) {
                 obj = 3;
                 break;
               }
               break;
           }
           String languageAttribute;
           switch (obj) {
             case VideoSize.QCIF /*0*/:
               languageAttribute = getLanguageAttribute(xmlPullParser);
               if (languageAttribute == null) {
                 languageAttribute = attributeValue;
               }
               name = parseElementText(xmlPullParser);
               if (message.getSubject(languageAttribute) != null) {
                 break;
               }
               message.addSubject(languageAttribute, name);
               break;
             case VideoSize.CIF /*1*/:
               languageAttribute = getLanguageAttribute(xmlPullParser);
               if (languageAttribute == null) {
                 languageAttribute = attributeValue;
               }
               name = parseElementText(xmlPullParser);
               if (message.getBody(languageAttribute) != null) {
                 break;
               }
               message.addBody(languageAttribute, name);
               break;
             case VideoSize.HVGA /*2*/:
               if (str != null) {
                 break;
               }
               str = xmlPullParser.nextText();
               break;
             case Version.API03_CUPCAKE_15 /*3*/:
               message.setError(parseError(xmlPullParser));
               break;
             default:
               addExtensionElement(message, xmlPullParser, name, namespace);
               break;
           }
         case Version.API03_CUPCAKE_15 /*3*/:
           if (xmlPullParser.getDepth() != depth) {
             break;
           }
           message.setThread(str);
           return message;
         default:
           break;
       }
     }
   }
   throw new AssertionError();
 }
Esempio n. 6
0
 public static IQ parseIQ(XmlPullParser xmlPullParser)
     throws XmlPullParserException, IOException, SmackException {
   XMPPError xMPPError = null;
   ParserUtils.assertAtStartTag(xmlPullParser);
   int depth = xmlPullParser.getDepth();
   String attributeValue = xmlPullParser.getAttributeValue("", "id");
   String attributeValue2 = xmlPullParser.getAttributeValue("", PrivacyItem.SUBSCRIPTION_TO);
   String attributeValue3 = xmlPullParser.getAttributeValue("", PrivacyItem.SUBSCRIPTION_FROM);
   Type fromString = Type.fromString(xmlPullParser.getAttributeValue("", "type"));
   IQ iq = null;
   while (true) {
     switch (xmlPullParser.next()) {
       case VideoSize.HVGA /*2*/:
         XMPPError parseError;
         IQ iq2;
         String name = xmlPullParser.getName();
         String namespace = xmlPullParser.getNamespace();
         Object obj = -1;
         switch (name.hashCode()) {
           case 96784904:
             if (name.equals(XMPPError.ERROR)) {
               obj = null;
               break;
             }
             break;
         }
         switch (obj) {
           case VideoSize.QCIF /*0*/:
             parseError = parseError(xmlPullParser);
             iq2 = iq;
             break;
           default:
             IQProvider iQProvider = ProviderManager.getIQProvider(name, namespace);
             XMPPError xMPPError2;
             if (iQProvider == null) {
               xMPPError2 = xMPPError;
               iq2 = new UnparsedIQ(name, namespace, parseElement(xmlPullParser));
               parseError = xMPPError2;
               break;
             }
             xMPPError2 = xMPPError;
             iq2 = (IQ) iQProvider.parse(xmlPullParser);
             parseError = xMPPError2;
             break;
         }
         iq = iq2;
         xMPPError = parseError;
         break;
       case Version.API03_CUPCAKE_15 /*3*/:
         if (xmlPullParser.getDepth() != depth) {
           break;
         }
         if (iq == null) {
           switch (C01861.$SwitchMap$org$jivesoftware$smack$packet$IQ$Type[fromString.ordinal()]) {
             case VideoSize.CIF /*1*/:
               iq = new ErrorIQ(xMPPError);
               break;
             case VideoSize.HVGA /*2*/:
               iq = new EmptyResultIQ();
               break;
           }
         }
         iq.setStanzaId(attributeValue);
         iq.setTo(attributeValue2);
         iq.setFrom(attributeValue3);
         iq.setType(fromString);
         iq.setError(xMPPError);
         return iq;
       default:
         break;
     }
   }
 }
Esempio n. 7
0
 public static void addExtensionElement(Stanza stanza, XmlPullParser xmlPullParser)
     throws XmlPullParserException, IOException, SmackException {
   ParserUtils.assertAtStartTag(xmlPullParser);
   addExtensionElement(
       stanza, xmlPullParser, xmlPullParser.getName(), xmlPullParser.getNamespace());
 }