/** * Creates a forwarded removal packet. * * @param from The sender address to use * @param to The recipient address to use * @return The forwarded packet generated */ private Packet createRemoveForward(JID from, JID to) { org.xmpp.packet.Roster response = new org.xmpp.packet.Roster(IQ.Type.set); response.setFrom(from); response.setTo(to); response.addItem(from, org.xmpp.packet.Roster.Subscription.remove); return response; }
roster.addItem(item.getJid(), item.getNickname(), ask, sub, groups);
org.xmpp.packet.Roster.Item item = roster.addItem(user, nickname, null, org.xmpp.packet.Roster.Subscription.none, groups);
roster.addItem(item.getJid(), item.getNickname(), getAskStatus(item.getAskStatus()), org.xmpp.packet.Roster.Subscription.valueOf(item.getSubStatus().getName()),
roster.addItem(user, org.xmpp.packet.Roster.Subscription.remove); broadcast(roster);
/** * Adds a new item to the roster. The name and groups are set to <tt>null</tt> * If the roster packet already contains an item using the same JID, the * information in the existing item will be overwritten with the new information.<p> * * The XMPP specification recommends that if the roster item is associated with another * instant messaging user (human), that the JID be in bare form (e.g. user@domain). * Use the {@link JID#toBareJID() toBareJID()} method for a bare JID. * * @param jid the JID. * @param subscription the subscription type. * @return the newly created item. */ public Item addItem(JID jid, Subscription subscription) { if (getType() != IQ.Type.result && getType() != IQ.Type.set) { throw new IllegalStateException("IQ type must be 'result' or 'set'"); } if (jid == null) { throw new NullPointerException("JID cannot be null"); } return addItem(jid, null, null, subscription, null); }
/** * Adds a new item to the roster. The name and groups are set to <tt>null</tt> * If the roster packet already contains an item using the same JID, the * information in the existing item will be overwritten with the new information.<p> * * The XMPP specification recommends that if the roster item is associated with another * instant messaging user (human), that the JID be in bare form (e.g. user@domain). * Use the {@link JID#toBareJID() toBareJID()} method for a bare JID. * * @param jid the JID. * @param subscription the subscription type. * @return the newly created item. */ public Item addItem(String jid, Subscription subscription) { if (getType() == IQ.Type.get || getType() == IQ.Type.error) { throw new IllegalStateException("IQ type must be 'result' or 'set'"); } if (jid == null) { throw new NullPointerException("JID cannot be null"); } return addItem(new JID(jid), null, null, subscription, null); }
/** * Creates a forwarded removal packet. * * @param from The sender address to use * @param to The recipient address to use * @return The forwarded packet generated */ private Packet createRemoveForward(JID from, JID to) { org.xmpp.packet.Roster response = new org.xmpp.packet.Roster(IQ.Type.set); response.setFrom(from); response.setTo(to); response.addItem(from, org.xmpp.packet.Roster.Subscription.remove); return response; }
roster.addItem(item.getJid(), item.getNickname(), ask, sub, groups);
org.xmpp.packet.Roster.Item item = roster.addItem(user, nickname, null, org.xmpp.packet.Roster.Subscription.none, groups);
roster.addItem(item.getJid(), item.getNickname(), getAskStatus(item.getAskStatus()), org.xmpp.packet.Roster.Subscription.valueOf(item.getSubStatus().getName()),
roster.addItem(user, org.xmpp.packet.Roster.Subscription.remove); broadcast(roster);