mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 17:19:39 +02:00
Bump jxmpp to 0.5.0-alpha4
This commit is contained in:
parent
8840236b72
commit
c125a3b055
49 changed files with 208 additions and 208 deletions
|
@ -21,7 +21,7 @@ import org.jivesoftware.smack.PacketCollector;
|
|||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
import org.jxmpp.jid.JidWithLocalpart;
|
||||
import org.jxmpp.jid.EntityJid;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.Collections;
|
||||
|
@ -41,7 +41,7 @@ public class Chat {
|
|||
|
||||
private ChatManager chatManager;
|
||||
private String threadID;
|
||||
private JidWithLocalpart participant;
|
||||
private EntityJid participant;
|
||||
private final Set<ChatMessageListener> listeners = new CopyOnWriteArraySet<ChatMessageListener>();
|
||||
|
||||
/**
|
||||
|
@ -51,7 +51,7 @@ public class Chat {
|
|||
* @param participant the user to chat with.
|
||||
* @param threadID the thread ID to use.
|
||||
*/
|
||||
Chat(ChatManager chatManager, JidWithLocalpart participant, String threadID) {
|
||||
Chat(ChatManager chatManager, EntityJid participant, String threadID) {
|
||||
if (StringUtils.isEmpty(threadID)) {
|
||||
throw new IllegalArgumentException("Thread ID must not be null");
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public class Chat {
|
|||
*
|
||||
* @return the name of the user the chat is occuring with.
|
||||
*/
|
||||
public JidWithLocalpart getParticipant() {
|
||||
public EntityJid getParticipant() {
|
||||
return participant;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,9 +42,9 @@ import org.jivesoftware.smack.filter.ThreadFilter;
|
|||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.packet.Message.Type;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jxmpp.jid.BareJid;
|
||||
import org.jxmpp.jid.EntityBareJid;
|
||||
import org.jxmpp.jid.Jid;
|
||||
import org.jxmpp.jid.JidWithLocalpart;
|
||||
import org.jxmpp.jid.EntityJid;
|
||||
|
||||
/**
|
||||
* The chat manager keeps track of references to all current chats. It will not hold any references
|
||||
|
@ -135,7 +135,7 @@ public final class ChatManager extends Manager{
|
|||
/**
|
||||
* Maps base jids to chats
|
||||
*/
|
||||
private Map<BareJid, Chat> baseJidChats = new ConcurrentHashMap<>();
|
||||
private Map<EntityBareJid, Chat> baseJidChats = new ConcurrentHashMap<>();
|
||||
|
||||
private Set<ChatManagerListener> chatManagerListeners
|
||||
= new CopyOnWriteArraySet<ChatManagerListener>();
|
||||
|
@ -217,7 +217,7 @@ public final class ChatManager extends Manager{
|
|||
* @param userJID the user this chat is with.
|
||||
* @return the created chat.
|
||||
*/
|
||||
public Chat createChat(JidWithLocalpart userJID) {
|
||||
public Chat createChat(EntityJid userJID) {
|
||||
return createChat(userJID, null);
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ public final class ChatManager extends Manager{
|
|||
* @param listener the optional listener which will listen for new messages from this chat.
|
||||
* @return the created chat.
|
||||
*/
|
||||
public Chat createChat(JidWithLocalpart userJID, ChatMessageListener listener) {
|
||||
public Chat createChat(EntityJid userJID, ChatMessageListener listener) {
|
||||
return createChat(userJID, null, listener);
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ public final class ChatManager extends Manager{
|
|||
* @param listener the optional listener to add to the chat
|
||||
* @return the created chat.
|
||||
*/
|
||||
public Chat createChat(JidWithLocalpart userJID, String thread, ChatMessageListener listener) {
|
||||
public Chat createChat(EntityJid userJID, String thread, ChatMessageListener listener) {
|
||||
if (thread == null) {
|
||||
thread = nextID();
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ public final class ChatManager extends Manager{
|
|||
return chat;
|
||||
}
|
||||
|
||||
private Chat createChat(JidWithLocalpart userJID, String threadID, boolean createdLocally) {
|
||||
private Chat createChat(EntityJid userJID, String threadID, boolean createdLocally) {
|
||||
Chat chat = new Chat(this, userJID, threadID);
|
||||
threadChats.put(threadID, chat);
|
||||
jidChats.put(userJID, chat);
|
||||
|
@ -268,7 +268,7 @@ public final class ChatManager extends Manager{
|
|||
|
||||
void closeChat(Chat chat) {
|
||||
threadChats.remove(chat.getThreadID());
|
||||
JidWithLocalpart userJID = chat.getParticipant();
|
||||
EntityJid userJID = chat.getParticipant();
|
||||
jidChats.remove(userJID);
|
||||
baseJidChats.remove(userJID.withoutResource());
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ public final class ChatManager extends Manager{
|
|||
return null;
|
||||
}
|
||||
|
||||
JidWithLocalpart userJID = from.asJidWithLocalpartIfPossible();
|
||||
EntityJid userJID = from.asEntityJidIfPossible();
|
||||
if (userJID == null) {
|
||||
LOGGER.warning("Message from JID without localpart: '" +message.toXML() + "'");
|
||||
return null;
|
||||
|
@ -322,7 +322,7 @@ public final class ChatManager extends Manager{
|
|||
Chat match = jidChats.get(userJID);
|
||||
|
||||
if (match == null && (matchMode == MatchMode.BARE_JID)) {
|
||||
match = baseJidChats.get(userJID.asBareJidIfPossible());
|
||||
match = baseJidChats.get(userJID.asEntityBareJidIfPossible());
|
||||
}
|
||||
return match;
|
||||
}
|
||||
|
|
|
@ -63,9 +63,9 @@ import org.jivesoftware.smack.roster.packet.RosterPacket.Item;
|
|||
import org.jivesoftware.smack.roster.packet.SubscriptionPreApproval;
|
||||
import org.jivesoftware.smack.roster.rosterstore.RosterStore;
|
||||
import org.jivesoftware.smack.util.Objects;
|
||||
import org.jxmpp.jid.BareJid;
|
||||
import org.jxmpp.jid.EntityBareJid;
|
||||
import org.jxmpp.jid.Jid;
|
||||
import org.jxmpp.jid.JidWithResource;
|
||||
import org.jxmpp.jid.FullJid;
|
||||
import org.jxmpp.jid.impl.JidCreate;
|
||||
import org.jxmpp.jid.parts.Resourcepart;
|
||||
|
||||
|
@ -847,7 +847,7 @@ public final class Roster extends Manager {
|
|||
* @return the user's current presence, or unavailable presence if the user is offline
|
||||
* or if no presence information is available.
|
||||
*/
|
||||
public Presence getPresenceResource(JidWithResource userWithResource) {
|
||||
public Presence getPresenceResource(FullJid userWithResource) {
|
||||
Jid key = getMapKey(userWithResource);
|
||||
Resourcepart resource = userWithResource.getResourcepart();
|
||||
Map<Resourcepart, Presence> userPresences = presenceMap.get(key);
|
||||
|
@ -1038,7 +1038,7 @@ public final class Roster extends Manager {
|
|||
if (entries.containsKey(user)) {
|
||||
return user;
|
||||
}
|
||||
BareJid bareJid = user.asBareJidIfPossible();
|
||||
EntityBareJid bareJid = user.asEntityBareJidIfPossible();
|
||||
if (bareJid != null) {
|
||||
return bareJid;
|
||||
}
|
||||
|
@ -1059,7 +1059,7 @@ public final class Roster extends Manager {
|
|||
if (resources != null) {
|
||||
for (Resourcepart resource : resources.keySet()) {
|
||||
packetUnavailable = new Presence(Presence.Type.unavailable);
|
||||
BareJid bareUserJid = user.asBareJidIfPossible();
|
||||
EntityBareJid bareUserJid = user.asEntityBareJidIfPossible();
|
||||
if (bareUserJid == null) {
|
||||
LOGGER.warning("Can not transform user JID to bare JID: '" + user + "'");
|
||||
continue;
|
||||
|
@ -1346,7 +1346,7 @@ public final class Roster extends Manager {
|
|||
// No need to act on error presences send without from, i.e.
|
||||
// directly send from the users XMPP service, or where the from
|
||||
// address is not a bare JID
|
||||
if (from == null || !from.isBareJid()) {
|
||||
if (from == null || !from.isEntityBareJid()) {
|
||||
break;
|
||||
}
|
||||
userPresences = getUserPresences(key);
|
||||
|
@ -1470,7 +1470,7 @@ public final class Roster extends Manager {
|
|||
|
||||
// Roster push (RFC 6121, 2.1.6)
|
||||
// A roster push with a non-empty from not matching our address MUST be ignored
|
||||
BareJid jid = connection.getUser().asBareJid();
|
||||
EntityBareJid jid = connection.getUser().asBareJid();
|
||||
Jid from = rosterPacket.getFrom();
|
||||
if (from != null && !from.equals(jid)) {
|
||||
LOGGER.warning("Ignoring roster push with a non matching 'from' ourJid='" + jid + "' from='" + from
|
||||
|
|
|
@ -82,7 +82,7 @@ public class ChatConnectionTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void validateDefaultSetMatchModeBareJid() {
|
||||
public void validateDefaultSetMatchModeEntityBareJid() {
|
||||
ChatManager.setDefaultMatchMode(MatchMode.BARE_JID);
|
||||
assertEquals(MatchMode.BARE_JID, ChatManager.getInstanceFor(new DummyConnection()).getMatchMode());
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ public class ChatConnectionTest {
|
|||
* id and the user is a full jid.
|
||||
*/
|
||||
@Test
|
||||
public void chatFoundWhenNoThreadFullJid() {
|
||||
public void chatFoundWhenNoThreadEntityFullJid() {
|
||||
Chat outgoing = cm.createChat(JidTestUtil.DUMMY_AT_EXAMPLE_ORG, null);
|
||||
|
||||
Stanza incomingChat = createChatPacket(null, true);
|
||||
|
@ -252,7 +252,7 @@ public class ChatConnectionTest {
|
|||
* and the user is a full jid.
|
||||
*/
|
||||
@Test
|
||||
public void chatFoundWithSameThreadFullJid() {
|
||||
public void chatFoundWithSameThreadEntityFullJid() {
|
||||
Chat outgoing = cm.createChat(JidTestUtil.DUMMY_AT_EXAMPLE_ORG, null);
|
||||
|
||||
Stanza incomingChat = createChatPacket(outgoing.getThreadID(), true);
|
||||
|
@ -300,7 +300,7 @@ public class ChatConnectionTest {
|
|||
* different id and the same base jid.
|
||||
*/
|
||||
@Test
|
||||
public void chatNotFoundWithDiffThreadFullJid() {
|
||||
public void chatNotFoundWithDiffThreadEntityFullJid() {
|
||||
Chat outgoing = cm.createChat(JidTestUtil.DUMMY_AT_EXAMPLE_ORG, null);
|
||||
|
||||
Stanza incomingChat = createChatPacket(outgoing.getThreadID() + "ff", true);
|
||||
|
@ -322,11 +322,11 @@ public class ChatConnectionTest {
|
|||
assertNull(listener.getNewChat());
|
||||
}
|
||||
|
||||
private static Message createChatPacket(final String threadId, final boolean isFullJid) {
|
||||
private static Message createChatPacket(final String threadId, final boolean isEntityFullJid) {
|
||||
Message chatMsg = new Message(JidTestUtil.BARE_JID_1, Message.Type.chat);
|
||||
chatMsg.setBody("the body message - " + System.currentTimeMillis());
|
||||
Jid jid;
|
||||
if (isFullJid) {
|
||||
if (isEntityFullJid) {
|
||||
jid = JidTestUtil.DUMMY_AT_EXAMPLE_ORG_SLASH_DUMMYRESOURCE;
|
||||
} else {
|
||||
jid = JidTestUtil.DUMMY_AT_EXAMPLE_ORG;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue