title: How do I know if an account exists in a XMPP server from the client?
body: <p>I'm developing an IM application using Smack library, and I'm facing some problems. </p>
  
  <p>I'd like to know if it's possible to check for the existence of a user by its username in the server. My application has to check if the people of the system contact list has an account opened in my server and they aren't in their friend list.</p>
  
  <p>So far I managed to add every contact in the system contact list to the server's contact list of my user -even if they haven't got an account beforehand-, but that's not what I'm looking for.</p>
  
  <p>Here is the code (Contact is like a wrapper class for Smack's RosterEntry):</p>
  
  <pre><code>public void addAllContactsIfExisting(Contact[] contactsAgenda) {
  
      for (Contact contact: contactsAgenda) {
          if (!isContactMyFriend(contact)) {
              try {
                  // I'd like to check for account existence here, being contact.getJid() the username as it'd be in the server
                  conn.getRoster().createEntry(contact.getJid(), contact.getName(), null);
              } catch (XMPPException e) {
                  e.printStackTrace();
              }
          }
      }
  }
  </code></pre>
  
  <p>If it helps, I'm currently using Openfire as server.</p>