package org.jivesoftware.smack.provider;

import java.io.IOException;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.packet.Bind;
import org.jxmpp.jid.FullJid;
import org.jxmpp.jid.impl.JidCreate;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

public class BindIQProvider extends IQProvider<Bind> {
   public Bind parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException {
      Bind bind = null;

      label37:
      do {
         while(true) {
            int eventType = parser.next();
            switch(eventType) {
            case 2:
               String name = parser.getName();
               byte var7 = -1;
               switch(name.hashCode()) {
               case -341064690:
                  if (name.equals("resource")) {
                     var7 = 0;
                  }
                  break;
               case 105221:
                  if (name.equals("jid")) {
                     var7 = 1;
                  }
               }

               switch(var7) {
               case 0:
                  bind = Bind.newSet(parser.nextText());
                  continue;
               case 1:
                  FullJid fullJid = JidCreate.fullFrom(parser.nextText());
                  bind = Bind.newResult(fullJid);
               default:
                  continue;
               }
            case 3:
               continue label37;
            }
         }
      } while(parser.getDepth() != initialDepth);

      return bind;
   }
}
