Commit Graph

33 Commits

Author SHA1 Message Date
Florian Schmaus 86ea027301 Add StringUtils.requireNotNullOrEmpty and Objects.requireNonNull
and use this in a few places.
2015-01-26 20:47:09 +01:00
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 6bf9498904 Add note about getMultiUserChat in MUC's javadoc 2015-01-19 08:38:11 +01:00
Florian Schmaus eb6b8df7c5 Add MultiUserChat.requestVoice() 2015-01-13 13:31:45 +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 e6593cb200 Use createMessage() where possible in MultiUserChat 2014-12-30 12:13:58 +01:00
Florian Schmaus cba681a967 Add MultiUserChat.toString() 2014-12-30 12:10:12 +01:00
Florian Schmaus 0293ca2bcd Add MultiUserChat.createOrJoin(String,String,DiscussionHistory,long) 2014-12-26 18:22:06 +01:00
Florian Schmaus 7874daa59b Use switch-case for Presence.getType() 2014-12-22 16:17:18 +01:00
Florian Schmaus b5328d38fa MUC: Establish callbacks before sending the presence 2014-10-14 09:41:48 +02:00
Florian Schmaus b54d133b36 Add MultiUserChatManager
apply the Manager pattern to 'muc'. This prevents the user creating
multiple MultiUserChat instances for the same MUC.

Move the static method from MultiUserChat to MultiUserChatManager.

Also add AbstractNodeInformationProvider.
2014-10-13 22:32:34 +02:00
Florian Schmaus c674808a4a Improve MultiUserChat
Use CopyOnWriteArraySet for listeners, remove the old reflection based
listener invocation approach.

Remove unnecessary casts.

Return List instead of Collection where possible.

sendMessage(Message) now set's the MUC as 'to' and the message type to
groupchat.
2014-10-13 16:39:17 +02:00
Florian Schmaus 365c71db79 Rework MultiUserChat
remove PacketMultiplexListener, RoomListenerMultiplexor and
ConnectionDetachedPacketCollector(Test), which was a bunch of
(in same cases redundant) code that formed a complex construct that
presumably tried to make MultiUserChat instances easily garbage
collect-able.

Now, MultiUserChat should be eligible for gc if the userHashLeft() is
invoked before the reference to the instance is dropped, which should be
the case in the most scenarios. Otherwise the connection may references
the MultiUserChat instance over Packet(Listener|Interceptor)s preventing
the gc.
2014-10-13 11:10:30 +02:00
Florian Schmaus 98a3c46e9a Add XMPPConnection.createPacketcollectorAndSend(PacketFilter, Packet)
Using

createPacketCollector(filter);
sendPacket(packet);

was error prone, i.e. the PacketCollector could leak if sendPacket()
would throw an exception and the user forgot to call
PacketCollector.cancel(). For cases where
createPacketCollectorAndSend(IQ) is not sufficient (because we don't
send IQs), createPacketCollectorAndSend(PacketFilter, Packet) is now
used, which does take care that the PacketCollector does not leak if
sendPacket() throws an Exception.
2014-10-13 10:45:00 +02:00
Florian Schmaus 8ce474b0df Improve MUC Presence interceptors
Use PresenceListener as intercepting callback interface.

Remove the for-each loops in MultiUserChat by using the interception
facilities of the XMPPConnection.

Add ToFilter.
2014-10-12 19:34:14 +02:00
Florian Schmaus 63d52f6eaa Replace PacketInterceptor with PacketListener
both serve the same purpose: As callback for Packets. There is no need
to have both, so remace PacketInterceptor and let PacketListener take
its place. Some classes like ChatStateManager can now use
MessageListener as interceptor callback, which is more convenient.
2014-10-12 19:19:44 +02:00
Florian Schmaus fd7b747987 Remove init() in MultiUserChat
and mark more members 'final'

Also use CopyOnWriteArraySet for presenceInterceptors.
2014-10-12 18:53:19 +02:00
Florian Schmaus e835df5641 Improve MUC message and presence listeners
instead of using a PacketListener, which means that the user has to
downcast the Packet to Message, we now use a Listener which callback
parameter is already Message/Presence.

It is necessary to introduce MessageListener and PresenceListener, which
are interfaces that have a callback for Message/Presence instead of
Packet. The 'old' MessageListener is renamed to ChatMessageListener.

Use Generics in ConnectionDetachedPacketCollector.
2014-10-12 18:11:02 +02:00
Florian Schmaus 38582eed84 Make getServiceNames() return List
instead of Collection. Return types should always be as specific as
possible. Because e.g. Collection does not allow 'get(0)', but List
does.
2014-10-12 16:54:21 +02:00
Florian Schmaus 5f06234149 Use CopyOnWriteArraySet in InvitationsMonitor 2014-10-05 12:46:51 +02:00
Florian Schmaus f7517ab6cc Apply Manager pattern to InvitationsMonitor
Don't remove listeners on disconnect (SMACK-571).
2014-10-05 12:04:46 +02:00
Florian Schmaus a0fe337bcd Use Collections.emptyList() in MultiUserChat 2014-10-05 12:04:46 +02:00
Florian Schmaus 8529d1463f Use from(Packet) instead of getFrom(Packet) in MultiUserChat 2014-10-05 12:04:45 +02:00
Florian Schmaus 46a4402a69 Add StreamFeatureProvider
so that AccountManager and the CapsExtension can be moved to
smack-extensions, where they belong.
2014-09-11 23:58:07 +02:00
Florian Schmaus afd7c67bf9 Add support for multiple status codes to MUCUser
Fixes SMACK-604
2014-09-05 11:45:06 +02:00
Florian Schmaus e19cfa4d83 Introduce MUCRole and MUCAffiliation enums
Also rework MUCItem and parseItem to follow current coding guidelines.
2014-08-24 18:30:18 +02:00
Florian Schmaus 754bdada18 MultiUserChat grant/revoke Admin must use #admin namepsace
SMACK-371
2014-08-24 17:49:08 +02:00
Florian Schmaus 7b3331dda0 Add API to find services for a given feature
It's a common pattern to look for all services hosted under the users
service that provide a given feature. Let's provide an API for that and
use that API in the methods that benefit from it.
2014-07-26 07:14:42 +02:00
Florian Schmaus e6aa2416e4 Improve MUC code
Removes a ton of duplicate code, mostly related to MUCItem being
duplicated in MUCOwner and MUCAdmin, but also some other duplicate code.

Make MUC code use XmlStringBuilder.

Add ELEMENT and NAMESPACE constants to the appropriate places. Also add
"static <MUCPacketExtension> getFrom(Packet)" methods.

Make some MUC classes implement Element.
2014-07-14 19:22:02 +02:00
Júlio Cesar Bueno Cotta 9be0c480e3 Change IQ.Type to enum 2014-06-06 21:10:13 -03: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 beecb8a675 Make XMPPConnection an interface
create AbstractXMPPConnection.
2014-05-28 08:18:41 +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 extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java (Browse further)