Example #1
0
 private static RosterItem.AskType getAskStatus(org.xmpp.packet.Roster.Item item) {
   if (item.getAsk() == org.xmpp.packet.Roster.Ask.subscribe) {
     return RosterItem.ASK_SUBSCRIBE;
   } else if (item.getAsk() == org.xmpp.packet.Roster.Ask.unsubscribe) {
     return RosterItem.ASK_UNSUBSCRIBE;
   } else {
     return RosterItem.ASK_NONE;
   }
 }
Example #2
0
 /**
  * Create a roster item from the data in another one.
  *
  * @param item Item that contains the info of the roster item.
  */
 public RosterItem(org.xmpp.packet.Roster.Item item) {
   this(
       item.getJID(),
       getSubType(item),
       getAskStatus(item),
       RosterItem.RECV_NONE,
       item.getName(),
       new LinkedList<String>(item.getGroups()));
 }
Example #3
0
 private static RosterItem.SubType getSubType(org.xmpp.packet.Roster.Item item) {
   if (item.getSubscription() == org.xmpp.packet.Roster.Subscription.to) {
     return RosterItem.SUB_TO;
   } else if (item.getSubscription() == org.xmpp.packet.Roster.Subscription.from) {
     return RosterItem.SUB_FROM;
   } else if (item.getSubscription() == org.xmpp.packet.Roster.Subscription.both) {
     return RosterItem.SUB_BOTH;
   } else if (item.getSubscription() == org.xmpp.packet.Roster.Subscription.remove) {
     return RosterItem.SUB_REMOVE;
   } else {
     return RosterItem.SUB_NONE;
   }
 }
Example #4
0
 /**
  * Update the cached item as a copy of the given item.
  *
  * <p>
  *
  * <p>A convenience for getting the item and setting each attribute.
  *
  * @param item The item who's settings will be copied into the cached copy
  * @throws org.jivesoftware.openfire.SharedGroupException if trying to remove shared group.
  */
 public void setAsCopyOf(org.xmpp.packet.Roster.Item item) throws SharedGroupException {
   setGroups(new LinkedList<String>(item.getGroups()));
   setNickname(item.getName());
 }