Commit Graph

33 Commits

Author SHA1 Message Date
Florian Schmaus d5b8647d9d Create smack-im subproject for XMPP-IM
Move Roster and Chat(Manager) code into their own packages within the
new smack-im subproject.

Apply Manager pattern to Roster.

Fixes SMACK-637.
2015-01-26 07:54:05 +01:00
Florian Schmaus 142f78c135 Rename Roster.getPresenceMapKey() to getMapKey()
since this method is not only used to determine the key for the
presence map, but also for the 'entries' map.

The logic is in both cases the same: If somehow an entry with an
resourcepart went into the roster (RFC 6121 does not explicity forbid
JIDs with an resourcepart in the roster), then use the full JID as
key, otherwise use the bare JID.

See also SMACK-19.
2015-01-20 12:43:18 +01:00
Florian Schmaus bf9fb7d2d9 Add Roster.isSubscribedToMyPresence(String) 2015-01-19 18:51:53 +01:00
Florian Schmaus b06c3e3607 Use getPresenceMapKey() in Roster.getEntry()
In order to use the bare JID as key for the entries Map if no entry for
the full JID exists already, otherwise use the full JID.
2015-01-19 18:51:47 +01:00
Florian Schmaus 1f59a755d8 Move variables into loop in Roster.waitUntilLoaded() 2015-01-19 16:11:12 +01:00
Florian Schmaus d099e7b16d Improve handling of InterruptedException
InterruptedExceptions should be treated as the users intention to
'cancel' the current thread's task. There is no such thing as a
spurious interrupt (not to be confused with "spurious wakeups").
2015-01-16 17:31:10 +01:00
Florian Schmaus bb8dcc9874 Add IQ request handler API
This also moves the logic to send error IQ replies from "when there is
no IQ provider registerd" to "when there is no IQ request handler
registered". Which has for example the advantage that IQ parsing no
longer asks for a connection instance.
2015-01-08 23:15:24 +01:00
Florian Schmaus e380872a41 Add 'resumed' bool ConnectionListener's authenticated()
It's important to know if the stream was resumed. authenticated() is the
ideal callback for Managers to reset their state (e.g. cached values of
the connection state). But if the stream was resumed, the cached values
don't have to be reset.
2015-01-07 21:11:09 +01:00
Florian Schmaus 82eb9b18dd Add and use AbstractConnectionClosedListener 2015-01-07 20:11:00 +01:00
Florian Schmaus 717090d272 Rework incoming packet listeners and Roster
Differentiate between asynchronous and synchronous ones. Asynchronous
are the ones where the invocation order may not be the same as the order
in which the stanzas arrived.

Since it's no longer guaranteed that when a unit test calls

processPacket(stanza)

the stanza will be completely processed when the call returns, it was
necessary to extend the unit tests (mostly Roster and ChatManager) with
a packet listener that waits for his invocation. Since we now also use
LinkedHashMaps as Map for the packet listeners (SMACK-531, SMACK-424),
adding a packet listeners as last also means that it will be called as
last. We exploit this behavior change now in the unit tests.

Rename 'recvListeners' to 'syncRecvListeners' in AbstractXMPPConnection.

Rename 'rosterInitialized' to 'loaded' in Roster.

Add Roster.isLoaded().

Reset 'loaded' to false in
Roster.setOfflinePresencesAndResetLoaded() (was setOfflinePresences()).

Fixes SMACK-583, SMACK-532, SMACK-424
2015-01-07 14:35:23 +01:00
Florian Schmaus 525fece291 Improved Roster(Push|Result)Listener 2015-01-07 14:35:23 +01:00
Florian Schmaus d7d4c8a4fd Use switch-case in Roster.hasValidSubscriptionType() 2015-01-07 14:35:23 +01:00
Florian Schmaus d27ec34fa3 Add Roster.get(All|Available)Presences(String) 2014-12-29 19:42:37 +01:00
Florian Schmaus 31e372bafd Remove duplicate code in Roster
By introducing getUserPresences(String) in PresencePacketListener.
2014-12-29 19:11:25 +01:00
Florian Schmaus c8631cf45c Use entries.containsKey in Roster 2014-12-29 18:20:11 +01:00
Florian Schmaus 7874daa59b Use switch-case for Presence.getType() 2014-12-22 16:17:18 +01:00
Daniele Ricci 00f5008794 Consider also unavailable presences when dealing with the roster
This is needed for checking <delay/> extensions in unavailable
presence stanzas.

Signed-off-by: Daniele Ricci <daniele.athome@gmail.com>
2014-12-09 21:30:28 +01:00
Florian Schmaus 252d5172e9 Return more specific types (e.g. Collection → List)
be generic as possible in what you accept, but more specific in what you
return.

Also tweak MultiuserChatManager methods a bit.
2014-11-29 13:41:49 +01:00
Florian Schmaus fe3dcba9b2 Fix javadoc warnings and deprecated methods 2014-11-02 12:12:56 +01:00
Florian Schmaus fc51f3df48 Add support for XEP-0198: Stream Management
- De-duplicate code by moving it into AbstractXMPPConnection
- Introduce TopLevelStreamElement as superclass for all XMPP stream elements.
- Add SynchronizationPoint, ParserUtils
- Add ParserUtils

Fixes SMACK-333 and SMACK-521
2014-09-11 09:49:16 +02:00
Florian Schmaus c84419a55e Create org.jivesoftware.smack.rosterstore package
and move RosterStore and DirectoryRosterStore into it.
2014-08-16 15:37:16 +02:00
Georg Lukas 2a05c3b707 Roster: merge the two registered ConnectionListeners 2014-07-23 08:29:46 +02:00
Júlio Cesar Bueno Cotta 9be0c480e3 Change IQ.Type to enum 2014-06-06 21:10:13 -03:00
Júlio Cesar Bueno Cotta 944ac37fc3 Remove getConfiguration() from XMPPConnection
interface definition.
2014-06-05 11:42:26 +02:00
Florian Schmaus f67d655fe7 Use jxmpp-core (0.1.0-alpha1-SNAPSHOT)
fixes also SMACK-570, since jxmpp-core's XmppStringUtil contains the fix
for SMACK-570.
2014-06-01 12:24:30 +02:00
Florian Schmaus 2a091debc1 Add FlexiblePacketTypeFilter
and make constructors of MessageTypeFilter and IQTypeFilter
private, because we now provide constants instead.
2014-05-29 17:45:32 +02:00
Florian Schmaus f1f7713513 Introduced unchangedEntries in Roster logic
If the connection has been reconnected, then we will receive entries
that have been unchanged since the last time we received a roster
result. Without this change, those entries ended up in 'toDelete' and
got deleted.

This change also inlines some roster methods.
2014-05-17 10:50:01 +02:00
Florian Schmaus 9a61c75ab0 Make Roster.hasValidSubscriptionType() static 2014-05-17 09:45:20 +02:00
Florian Schmaus fd532be9b6 Fix unfiledEntries not updating
If an roster push with a roster entry without any group is processed,
then the entry is not updated, because unfiledEntries.contains(entry)
would return true, as the RosterEntry.equals() method only compares the
name.

We simply fix it by always removing the entry first and then adding it
again.

Thanks to Christian Schudt for pointing this out.

SMACK-559
2014-04-29 15:26:48 +02:00
Florian Schmaus 10e82fae45 Add log statements to Roster 2014-04-29 15:26:48 +02:00
Florian Schmaus 6e12409b82 Make roster push and presence packet filter static final
Also remove the check of IQ.Type.SET in processPacket(). This is now
done with help of a PacketFilter.
2014-04-29 15:26:21 +02:00
Florian Schmaus 9fd0961c32 Simplified Roster
Removed some throw declarations from methods, so some try/catch blocks
could be removed.

Use switch/case instead of if/else if.

Make members final when possible.

Add logger statements in case of error IQ result and remove superfluous
check of instanceof IQ.
2014-04-29 15:24:10 +02:00
Florian Schmaus 91fd15ad86 Prefix subprojects with 'smack-'
instead of using the old baseName=smack appendix=project.name approach,
we are now going convention over configuration and renaming the
subprojects directories to the proper name.

Having a prefix is actually very helpful, because the resulting
libraries will be named like the subproject. And a core-4.0.0-rc1.jar is
not as explicit about what it actually *is* as a
smack-core-4.0.0-rc1.jar.

SMACK-265
2014-04-28 19:44:14 +02:00
Renamed from core/src/main/java/org/jivesoftware/smack/Roster.java (Browse further)