mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-19 10:32:05 +01:00
9123578ea5
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@13558 b35dd754-fafc-0310-a699-88a17e54d16e
27 lines
925 B
Java
27 lines
925 B
Java
package org.jivesoftware.smack.util;
|
|
|
|
import org.jivesoftware.smack.Connection;
|
|
import org.jivesoftware.smack.Roster;
|
|
import org.jivesoftware.smack.XMPPException;
|
|
|
|
public class ConnectionUtils {
|
|
|
|
public static void becomeFriends(Connection con0, Connection con1) throws XMPPException {
|
|
Roster r0 = con0.getRoster();
|
|
Roster r1 = con1.getRoster();
|
|
r0.setSubscriptionMode(Roster.SubscriptionMode.accept_all);
|
|
r1.setSubscriptionMode(Roster.SubscriptionMode.accept_all);
|
|
r0.createEntry(con1.getUser(), "u2", null);
|
|
r1.createEntry(con0.getUser(), "u1", null);
|
|
}
|
|
|
|
public static void letsAllBeFriends(Connection[] connections) throws XMPPException {
|
|
for (Connection c1 : connections) {
|
|
for (Connection c2 : connections) {
|
|
if (c1 == c2)
|
|
continue;
|
|
becomeFriends(c1, c2);
|
|
}
|
|
}
|
|
}
|
|
}
|