Example #1
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();
 }