title: Smack Presence Doesn't Work
body: <p>Actually I programming a IM service (inherited google chat) by using smack API. But when i want to print buddy list and their presences, the compile mode show all presences unavailable, but in the debug mode it shows the real availability!</p>
  
  <p>My code is ...</p>
  
  <p>1- create connection</p>
  
  <pre><code>public boolean openConnection() {
      ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration("talk.google.com", 5222, "mail.google.com");
      this.connection = new XMPPConnection(connectionConfiguration);
      try {
          this.connection.connect();
      } catch (XMPPException e) {
          // TODO: Send Error Information To Programmer's Email Address
      }
      if(this.connection.isConnected()) {
          this.roster = this.connection.getRoster();
          this.roster.addRosterListener(new RosterListener() {
              public void entriesAdded(Collection&lt;String&gt; addresses) {}
              public void entriesDeleted(Collection&lt;String&gt; addresses) {}
              public void entriesUpdated(Collection&lt;String&gt; addresses) {}
              public void presenceChanged(Presence presence) {}
          });
          return true;
      }
      return false;
  }
  </code></pre>
  
  <p>2- login</p>
  
  <pre><code>public boolean login(String jid, String password) {
      try { 
          this.connection.login(jid, password, "smack");
      } catch (XMPPException e) {
          // TODO: Send Error Information To Programmer's Email Address
      }
      if(this.connection.isAuthenticated()) return true;
      return false;
  }
  </code></pre>
  
  <p>3- buddy list</p>
  
  <pre><code>public void buddiesList() {
      Collection&lt;RosterEntry&gt; rosterEntries = this.roster.getEntries();
      for(RosterEntry rosterEntry: rosterEntries) {
          System.out.println(rosterEntry.username() + " === " + this.roster.getPresence(rosterEntry.getUser()));
      }
  }
  </code></pre>
  
  <p>4- implementation</p>
  
  <pre><code>public static void main(String args[]) {
      IMService imService = new IMService();
      imService.openConnection();
      imService.login("google account", "password");
      imService.buddiesList();
  }
  </code></pre>