use of org.jivesoftware.smackx.packet.RosterExchange in project ecf by eclipse.
the class RosterExchangeManager method send.
/**
* Sends a roster to userID. All the entries of the roster will be sent to the
* target user.
*
* @param roster the roster to send
* @param targetUserID the user that will receive the roster entries
*/
public void send(Roster roster, String targetUserID) {
// Create a new message to send the roster
Message msg = new Message(targetUserID);
// Create a RosterExchange Package and add it to the message
RosterExchange rosterExchange = new RosterExchange(roster);
msg.addExtension(rosterExchange);
// Send the message that contains the roster
con.sendPacket(msg);
}
use of org.jivesoftware.smackx.packet.RosterExchange in project ecf by eclipse.
the class RosterExchangeManager method send.
/**
* Sends a roster entry to userID.
*
* @param rosterEntry the roster entry to send
* @param targetUserID the user that will receive the roster entries
*/
public void send(RosterEntry rosterEntry, String targetUserID) {
// Create a new message to send the roster
Message msg = new Message(targetUserID);
// Create a RosterExchange Package and add it to the message
RosterExchange rosterExchange = new RosterExchange();
rosterExchange.addRosterEntry(rosterEntry);
msg.addExtension(rosterExchange);
// Send the message that contains the roster
con.sendPacket(msg);
}
use of org.jivesoftware.smackx.packet.RosterExchange in project ecf by eclipse.
the class RosterExchangeManager method init.
private void init() {
// Listens for all roster exchange packets and fire the roster exchange listeners.
packetListener = new PacketListener() {
public void processPacket(Packet packet) {
Message message = (Message) packet;
RosterExchange rosterExchange = (RosterExchange) message.getExtension("x", "jabber:x:roster");
// Fire event for roster exchange listeners
fireRosterExchangeListeners(message.getFrom(), rosterExchange.getRosterEntries());
}
};
con.addPacketListener(packetListener, packetFilter);
}
use of org.jivesoftware.smackx.packet.RosterExchange in project ecf by eclipse.
the class RosterExchangeManager method send.
/**
* Sends a roster group to userID. All the entries of the group will be sent to the
* target user.
*
* @param rosterGroup the roster group to send
* @param targetUserID the user that will receive the roster entries
*/
public void send(RosterGroup rosterGroup, String targetUserID) {
// Create a new message to send the roster
Message msg = new Message(targetUserID);
// Create a RosterExchange Package and add it to the message
RosterExchange rosterExchange = new RosterExchange();
for (RosterEntry entry : rosterGroup.getEntries()) {
rosterExchange.addRosterEntry(entry);
}
msg.addExtension(rosterExchange);
// Send the message that contains the roster
con.sendPacket(msg);
}
Aggregations