diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/mix/core/MixChannel.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/mix/core/MixChannel.java new file mode 100644 index 000000000..34d586d84 --- /dev/null +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/mix/core/MixChannel.java @@ -0,0 +1,5 @@ +package org.jivesoftware.smackx.mix.core; + +public class MixChannel { + +} diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/mix/core/MixParticipant.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/mix/core/MixParticipant.java new file mode 100644 index 000000000..730d85c2c --- /dev/null +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/mix/core/MixParticipant.java @@ -0,0 +1,26 @@ +package org.jivesoftware.smackx.mix.core; + +import org.jxmpp.jid.EntityBareJid; + +public class MixParticipant { + + private EntityBareJid jid; + private String nick; + + public MixParticipant(EntityBareJid jid) { + this(jid, null); + } + + public MixParticipant(EntityBareJid jid, String nick) { + this.jid = jid; + this.nick = nick; + } + + public EntityBareJid getJid() { + return jid; + } + + public String getNick() { + return nick; + } +} diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/mix/core/StableParticipantId.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/mix/core/StableParticipantId.java new file mode 100644 index 000000000..2a8ec187f --- /dev/null +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/mix/core/StableParticipantId.java @@ -0,0 +1,68 @@ +package org.jivesoftware.smackx.mix.core; + +import java.util.stream.IntStream; + +import org.jivesoftware.smack.util.StringUtils; + +public final class StableParticipantId implements CharSequence { + + private final String id; + + private StableParticipantId(String string) { + String id = StringUtils.requireNotNullNorEmpty(string.trim(), + "Stable Participant ID MUST NOT be null, nor empty."); + if (id.contains("#") || id.contains("/") || id.contains("@")) { + throw new IllegalArgumentException("Stable Participant ID MUST NOT contain the '#', '/' or '@' characters."); + } + this.id = id; + } + + @Override + public int length() { + return id.length(); + } + + @Override + public char charAt(int i) { + return id.charAt(i); + } + + @Override + public CharSequence subSequence(int i, int i1) { + return id.subSequence(i, i1); + } + + @Override + public IntStream chars() { + return id.chars(); + } + + @Override + public IntStream codePoints() { + return id.codePoints(); + } + + @Override + public int hashCode() { + return id.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (this == obj) { + return true; + } + if (!(obj instanceof StableParticipantId)) { + return false; + } + return toString().equals(((StableParticipantId) obj).toString()); + } + + @Override + public String toString() { + return id; + } +} diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/mix/core/provider/LeaveElementProviderTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/mix/core/provider/LeaveElementProviderTest.java index 24c2dcd27..51dca0315 100644 --- a/smack-experimental/src/test/java/org/jivesoftware/smackx/mix/core/provider/LeaveElementProviderTest.java +++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/mix/core/provider/LeaveElementProviderTest.java @@ -17,7 +17,6 @@ package org.jivesoftware.smackx.mix.core.provider; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; @@ -40,6 +39,5 @@ public class LeaveElementProviderTest { LeaveElement element = provider.parse(parser); assertNotNull(element); - assertTrue(element instanceof LeaveElement.V1); } }