diff options
author | paweldomas <pawel.domas@jitsi.org> | 2014-09-01 09:57:33 +0200 |
---|---|---|
committer | paweldomas <pawel.domas@jitsi.org> | 2014-09-02 09:35:10 +0200 |
commit | e0597082be7ae20dd6e3e8bd8f9f32093bdad3a4 (patch) | |
tree | 418b9e9eeee574dd557d82fdfa4f1d8f3ba0a3b4 /src/net/java/sip/communicator | |
parent | 93305496ffc492b31dea5dd8d306db6df6487e64 (diff) | |
download | jitsi-e0597082be7ae20dd6e3e8bd8f9f32093bdad3a4.zip jitsi-e0597082be7ae20dd6e3e8bd8f9f32093bdad3a4.tar.gz jitsi-e0597082be7ae20dd6e3e8bd8f9f32093bdad3a4.tar.bz2 |
Adds the operation set used by SIP gateway to handle operations specific to Jitsi Meet conference.
Diffstat (limited to 'src/net/java/sip/communicator')
4 files changed, 138 insertions, 15 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java index ad895e7..5a9d061 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java @@ -1790,7 +1790,9 @@ public class ChatRoomJabberImpl = new ConferenceDescriptionPacketExtension(cd); if (lastPresenceSent != null) { - setConferenceDescriptionPacketExtension(lastPresenceSent, ext); + setPacketExtension( + lastPresenceSent, ext, + ConferenceDescriptionPacketExtension.NAMESPACE); provider.getConnection().sendPacket(lastPresenceSent); } else @@ -1820,28 +1822,66 @@ public class ChatRoomJabberImpl } /** - * Sets <tt>ext</tt> as the only - * <tt>ConferenceDescriptionPacketExtension</tt> of <tt>presence</tt>. + * Sets <tt>ext</tt> as the only <tt>PacketExtension</tt> that belongs to + * given <tt>namespace</tt> of the <tt>packet</tt>. * - * @param packet the <tt>Packet<tt> - * @param ext the <tt>ConferenceDescriptionPacketExtension<tt> to set, + * @param packet the <tt>Packet<tt> to be modified. + * @param extension the <tt>ConferenceDescriptionPacketExtension<tt> to set, * or <tt>null</tt> to not set one. + * @param namespace the namespace of <tt>PacketExtension</tt>. */ - private void setConferenceDescriptionPacketExtension( + private static void setPacketExtension( Packet packet, - ConferenceDescriptionPacketExtension ext) + PacketExtension extension, + String namespace) { + if (org.jitsi.util.StringUtils.isNullOrEmpty(namespace)) + { + return; + } + //clear previous announcements PacketExtension pe; - while (null != - (pe = packet.getExtension( - ConferenceDescriptionPacketExtension.NAMESPACE))) + while (null != (pe = packet.getExtension(namespace))) { packet.removeExtension(pe); } - if (ext != null) - packet.addExtension(ext); + if (extension != null) + { + packet.addExtension(extension); + } + } + + /** + * Publishes new status message in chat room presence. + * @param newStatus the new status message to be published in the MUC. + */ + public void publishPresenceStatus(String newStatus) + { + if (lastPresenceSent != null) + { + lastPresenceSent.setStatus(newStatus); + + provider.getConnection().sendPacket(lastPresenceSent); + } + } + + /** + * Adds given <tt>PacketExtension</tt> to the MUC presence and publishes it + * immediately. + * @param extension the <tt>PacketExtension</tt> to be included in MUC + * presence. + */ + public void sendPresenceExtension(PacketExtension extension) + { + if (lastPresenceSent != null) + { + setPacketExtension( + lastPresenceSent, extension, extension.getNamespace()); + + provider.getConnection().sendPacket(lastPresenceSent); + } } /** @@ -2972,9 +3012,10 @@ public class ChatRoomJabberImpl { if (packet instanceof Presence) { - setConferenceDescriptionPacketExtension( - packet, - publishedConferenceExt); + setPacketExtension( + packet, + publishedConferenceExt, + ConferenceDescriptionPacketExtension.NAMESPACE); lastPresenceSent = (Presence) packet; } diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetJitsiMeetToolsJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetJitsiMeetToolsJabberImpl.java new file mode 100644 index 0000000..ee78002 --- /dev/null +++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetJitsiMeetToolsJabberImpl.java @@ -0,0 +1,38 @@ +/* + * Jitsi, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package net.java.sip.communicator.impl.protocol.jabber; + +import net.java.sip.communicator.service.protocol.*; +import org.jivesoftware.smack.packet.*; + +/** + * Jabber protocol provider implementation of {@link OperationSetJitsiMeetTools} + * + * @author Pawel Domas + */ +public class OperationSetJitsiMeetToolsJabberImpl + implements OperationSetJitsiMeetTools +{ + /** + * {@inheritDoc} + */ + @Override + public void sendPresenceExtension(ChatRoom chatRoom, + PacketExtension extension) + { + ((ChatRoomJabberImpl)chatRoom).sendPresenceExtension(extension); + } + + /** + * {@inheritDoc} + */ + @Override + public void setPresenceStatus(ChatRoom chatRoom, String statusMessage) + { + ((ChatRoomJabberImpl)chatRoom).publishPresenceStatus(statusMessage); + } +} diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java index 3f185be..8f321b7 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java @@ -1694,6 +1694,10 @@ public class ProtocolProviderServiceJabberImpl new OperationSetMultiUserChatJabberImpl(this)); addSupportedOperationSet( + OperationSetJitsiMeetTools.class, + new OperationSetJitsiMeetToolsJabberImpl()); + + addSupportedOperationSet( OperationSetServerStoredContactInfo.class, new OperationSetServerStoredContactInfoJabberImpl( infoRetreiver)); diff --git a/src/net/java/sip/communicator/service/protocol/OperationSetJitsiMeetTools.java b/src/net/java/sip/communicator/service/protocol/OperationSetJitsiMeetTools.java new file mode 100644 index 0000000..9c5fc31 --- /dev/null +++ b/src/net/java/sip/communicator/service/protocol/OperationSetJitsiMeetTools.java @@ -0,0 +1,40 @@ +/* + * Jitsi, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package net.java.sip.communicator.service.protocol; + +import org.jivesoftware.smack.packet.*; + +/** + * The operation set provides functionality specific to Jitsi Meet WebRTC + * conference. + * + * @author Pawel Domas + */ +public interface OperationSetJitsiMeetTools + extends OperationSet +{ + /** + * Includes given <tt>PacketExtension</tt> in multi user chat presence and + * sends presence update packet to the chat room. + * @param chatRoom the <tt>ChatRoom</tt> for which the presence will be + * updated. + * @param extension the <tt>PacketExtension</tt> to be included in MUC + * presence. + */ + public void sendPresenceExtension(ChatRoom chatRoom, + PacketExtension extension); + + /** + * Sets the status message of our MUC presence and sends presence status + * update packet to the server. + * @param chatRoom the <tt>ChatRoom</tt> for which the presence status + * message will be changed. + * @param statusMessage the text that will be used as our presence status + * message in the MUC. + */ + public void setPresenceStatus(ChatRoom chatRoom, String statusMessage); +} |