docs: public Presence getPresence(Jid user) {
          Jid key = getPresenceMapKey(user);
          Map<Resourcepart, Presence> userPresences = presenceMap.get(key);
          if (userPresences == null) {
              Presence presence = new Presence(Presence.Type.unavailable);
              presence.setFrom(user);
              return presence;
          }
          else {
              // Find the resource with the highest priority
              // Might be changed to use the resource with the highest availability instead.
              Iterator<Resourcepart> it = userPresences.keySet().iterator();
              Presence p;
              Presence presence = null;
  
              while (it.hasNext()) {
                  p = userPresences.get(it.next());
                  if (presence == null) {
                      presence = p;
                  }
                  else {
                      if (p.getPriority() > presence.getPriority()) {
                          presence = p;
                      }
                  }
              }
              if (presence == null) {
                  presence = new Presence(Presence.Type.unavailable);
                  presence.setFrom(user);
                  return presence;
              }
              else {
                  return presence;
              }
          }
      }