Esempio n. 1
0
 private void removeSubContact(String resource) {
   for (int i = subContacts.size() - 1; i >= 0; --i) {
     SubContact c = (SubContact) subContacts.elementAt(i);
     if (c.resource.equals(resource)) {
       c.status = StatusInfo.STATUS_OFFLINE;
       c.statusText = null;
       subContacts.removeElementAt(i);
       return;
     }
   }
 }
Esempio n. 2
0
  public void __setStatus(String resource, int priority, byte index, String statusText) {
    if (StatusInfo.STATUS_OFFLINE == index) {
      resource = StringUtils.notNull(resource);
      if (resource.equals(currentResource)) {
        currentResource = null;
      }
      removeSubContact(resource);
      if (0 == subContacts.size()) {
        setOfflineStatus();
      }

    } else {
      SubContact c = getSubContact(resource);
      c.priority = (byte) Math.min(127, Math.max(priority, -127));
      c.status = index;
      c.statusText = statusText;
    }
  }