1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-06-27 22:14:52 +02:00
Smack/core/src/integration-test/java/org/jivesoftware/smack/util/ConnectionUtils.java
Florian Schmaus 602a8fc812 Activate the jingle subproject and move integration tests
The jingle subproject builds now. This doesn't change that the code is
outdated with regard to the specification and unmaintained for
years. But hopefully this is the first step to change that. :)

The integration tests have been moved into SourceSets of 'core' and
'extensions'.
2014-02-19 10:38:30 +01:00

30 lines
963 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 {
private 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);
}
}
}
}