public JabberMessage parse(JabberMessageParser parser, Element msgTree) throws ParseException {
   // let the parent class parse out the normal core attributes
   super.parse(parser, msgTree);
   if (getType() == null) setType(TYPE_AVAILABLE);
   String prior = getDOM().getChildText("priority", XMLNS_PRESENCE);
   if (prior == null) priority = 0;
   else
     try {
       priority = Integer.parseInt(prior);
     } catch (NumberFormatException ex) {
       throw new ParseException(
           "<priority> inside <presence> element is not an integer as it should be");
     }
   return this;
 }
 /**
  * The method is overridden to conform properly with XMPP protocol standards. In XMPP, when a
  * presence is available, it should simply remove the type from being sent.
  *
  * @param type the type of presence (available, unavailable, dnd, etc)
  */
 public void setType(String type) {
   if (TYPE_AVAILABLE.equals(type)) super.setType(null);
   else super.setType(type);
 }