mirror of https://github.com/sipwise/jitsi.git
commit
e820f0a41d
Binary file not shown.
Binary file not shown.
@ -0,0 +1,241 @@
|
||||
/*
|
||||
* 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.msghistory;
|
||||
|
||||
import net.java.sip.communicator.service.contactsource.*;
|
||||
import net.java.sip.communicator.service.protocol.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
/**
|
||||
* The query which creates source contacts and uses the values stored in
|
||||
* <tt>MessageSourceService</tt>.
|
||||
*
|
||||
* @author Damian Minkov
|
||||
*/
|
||||
public class MessageSourceContactQuery
|
||||
extends AsyncContactQuery<MessageSourceService>
|
||||
{
|
||||
/**
|
||||
* Constructs.
|
||||
*
|
||||
* @param messageSourceService
|
||||
*/
|
||||
MessageSourceContactQuery(MessageSourceService messageSourceService)
|
||||
{
|
||||
super(messageSourceService,
|
||||
Pattern.compile("",
|
||||
Pattern.CASE_INSENSITIVE | Pattern.LITERAL),
|
||||
false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates <tt>MessageSourceContact</tt> for all currently cached
|
||||
* recent messages in the <tt>MessageSourceService</tt>.
|
||||
*/
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
getContactSource().updateRecentMessages();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates capabilities from <tt>EventObject</tt> for the found
|
||||
* <tt>MessageSourceContact</tt> equals to the <tt>Object</tt> supplied.
|
||||
* Note that Object may not be <tt>MessageSourceContact</tt>, but its
|
||||
* equals method can return true for message source contact instances.
|
||||
* @param srcObj used to search for <tt>MessageSourceContact</tt>
|
||||
* @param eventObj the values used for the update
|
||||
*/
|
||||
public void updateCapabilities(Object srcObj, EventObject eventObj)
|
||||
{
|
||||
for(SourceContact msc : getQueryResults())
|
||||
{
|
||||
if(srcObj.equals(msc)
|
||||
&& msc instanceof MessageSourceContact)
|
||||
{
|
||||
((MessageSourceContact)msc).initDetails(eventObj);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates capabilities from <tt>Contact</tt> for the found
|
||||
* <tt>MessageSourceContact</tt> equals to the <tt>Object</tt> supplied.
|
||||
* Note that Object may not be <tt>MessageSourceContact</tt>, but its
|
||||
* equals method can return true for message source contact instances.
|
||||
* @param srcObj used to search for <tt>MessageSourceContact</tt>
|
||||
* @param contact the values used for the update
|
||||
*/
|
||||
public void updateCapabilities(Object srcObj, Contact contact)
|
||||
{
|
||||
for(SourceContact msc : getQueryResults())
|
||||
{
|
||||
if(srcObj.equals(msc)
|
||||
&& msc instanceof MessageSourceContact)
|
||||
{
|
||||
((MessageSourceContact)msc).initDetails(false, contact);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies the <tt>ContactQueryListener</tt>s registered with this
|
||||
* <tt>ContactQuery</tt> that a <tt>SourceContact</tt> has been
|
||||
* changed.
|
||||
* Note that Object may not be <tt>MessageSourceContact</tt>, but its
|
||||
* equals method can return true for message source contact instances.
|
||||
*
|
||||
* @param srcObj the <tt>Object</tt> representing a recent message
|
||||
* which has been changed and corresponding <tt>SourceContact</tt>
|
||||
* which the registered <tt>ContactQueryListener</tt>s are to be
|
||||
* notified about
|
||||
*/
|
||||
public void updateContact(Object srcObj, EventObject eventObject)
|
||||
{
|
||||
for(SourceContact msc : getQueryResults())
|
||||
{
|
||||
if(srcObj.equals(msc)
|
||||
&& msc instanceof MessageSourceContact)
|
||||
{
|
||||
((MessageSourceContact)msc).update(eventObject);
|
||||
|
||||
super.fireContactChanged(msc);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies the <tt>ContactQueryListener</tt>s registered with this
|
||||
* <tt>ContactQuery</tt> that a <tt>SourceContact</tt> has been
|
||||
* changed.
|
||||
* Note that Object may not be <tt>MessageSourceContact</tt>, but its
|
||||
* equals method can return true for message source contact instances.
|
||||
*
|
||||
* @param srcObj the <tt>Object</tt> representing a recent message
|
||||
* which has been changed and corresponding <tt>SourceContact</tt>
|
||||
* which the registered <tt>ContactQueryListener</tt>s are to be
|
||||
* notified about
|
||||
*/
|
||||
public void fireContactChanged(Object srcObj)
|
||||
{
|
||||
for(SourceContact msc : getQueryResults())
|
||||
{
|
||||
if(srcObj.equals(msc)
|
||||
&& msc instanceof MessageSourceContact)
|
||||
{
|
||||
super.fireContactChanged(msc);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies the <tt>ContactQueryListener</tt>s registered with this
|
||||
* <tt>ContactQuery</tt> that a <tt>SourceContact</tt> has been
|
||||
* changed.
|
||||
* Note that Object may not be <tt>MessageSourceContact</tt>, but its
|
||||
* equals method can return true for message source contact instances.
|
||||
*
|
||||
* @param srcObj the <tt>Object</tt> representing a recent message
|
||||
* which has been changed and corresponding <tt>SourceContact</tt>
|
||||
* which the registered <tt>ContactQueryListener</tt>s are to be
|
||||
* notified about
|
||||
*/
|
||||
public void updateContactStatus(Object srcObj,
|
||||
PresenceStatus status)
|
||||
{
|
||||
for(SourceContact msc : getQueryResults())
|
||||
{
|
||||
if(srcObj.equals(msc)
|
||||
&& msc instanceof MessageSourceContact)
|
||||
{
|
||||
((MessageSourceContact)msc).setStatus(status);
|
||||
|
||||
super.fireContactChanged(msc);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies the <tt>ContactQueryListener</tt>s registered with this
|
||||
* <tt>ContactQuery</tt> that a <tt>SourceContact</tt> has been
|
||||
* changed.
|
||||
* Note that Object may not be <tt>MessageSourceContact</tt>, but its
|
||||
* equals method can return true for message source contact instances.
|
||||
*
|
||||
* @param srcObj the <tt>Object</tt> representing a recent message
|
||||
* which has been changed and corresponding <tt>SourceContact</tt>
|
||||
* which the registered <tt>ContactQueryListener</tt>s are to be
|
||||
* notified about
|
||||
*/
|
||||
public void updateContactDisplayName(Object srcObj,
|
||||
String newName)
|
||||
{
|
||||
for(SourceContact msc : getQueryResults())
|
||||
{
|
||||
if(srcObj.equals(msc)
|
||||
&& msc instanceof MessageSourceContact)
|
||||
{
|
||||
((MessageSourceContact)msc).setDisplayName(newName);
|
||||
|
||||
super.fireContactChanged(msc);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies the <tt>ContactQueryListener</tt>s registered with this
|
||||
* <tt>ContactQuery</tt> that a <tt>SourceContact</tt> has been
|
||||
* removed.
|
||||
* Note that Object may not be <tt>MessageSourceContact</tt>, but its
|
||||
* equals method can return true for message source contact instances.
|
||||
*
|
||||
* @param srcObj representing the message and its corresponding
|
||||
* <tt>SourceContact</tt> which has been removed and which the registered
|
||||
* <tt>ContactQueryListener</tt>s are to be notified about
|
||||
*/
|
||||
public void fireContactRemoved(Object srcObj)
|
||||
{
|
||||
for(SourceContact msc : getQueryResults())
|
||||
{
|
||||
if(srcObj.equals(msc))
|
||||
{
|
||||
super.fireContactRemoved(msc);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a specific <tt>SourceContact</tt> to the list of
|
||||
* <tt>SourceContact</tt>s to be returned by this <tt>ContactQuery</tt> in
|
||||
* response to {@link #getQueryResults()}.
|
||||
*
|
||||
* @param sourceContact the <tt>SourceContact</tt> to be added to the
|
||||
* <tt>queryResults</tt> of this <tt>ContactQuery</tt>
|
||||
* @return <tt>true</tt> if the <tt>queryResults</tt> of this
|
||||
* <tt>ContactQuery</tt> has changed in response to the call
|
||||
*/
|
||||
public boolean addQueryResult(SourceContact sourceContact)
|
||||
{
|
||||
return super.addQueryResult(sourceContact, false);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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.extensions.jingle;
|
||||
|
||||
import net.java.sip.communicator.impl.protocol.jabber.extensions.*;
|
||||
|
||||
/**
|
||||
* Packet extension that holds RTCP feedback types of the
|
||||
* {@link PayloadTypePacketExtension}. Defined in XEP-0293.
|
||||
*
|
||||
* @author Pawel Domas
|
||||
*/
|
||||
public class RtcpFbPacketExtension
|
||||
extends AbstractPacketExtension
|
||||
{
|
||||
/**
|
||||
* The name space for RTP feedback elements.
|
||||
*/
|
||||
public static final String NAMESPACE = "urn:xmpp:jingle:apps:rtp:rtcp-fb:0";
|
||||
|
||||
/**
|
||||
* The name of the RTCP feedback element.
|
||||
*/
|
||||
public static final String ELEMENT_NAME = "rtcp-fb";
|
||||
|
||||
/**
|
||||
* The name the attribute that holds the feedback type.
|
||||
*/
|
||||
public static final String TYPE_ATTR_NAME = "type";
|
||||
|
||||
/**
|
||||
* The name the attribute that holds the feedback subtype.
|
||||
*/
|
||||
public static final String SUBTYPE_ATTR_NAME = "subtype";
|
||||
|
||||
/**
|
||||
* Creates new empty instance of <tt>RtcpFbPacketExtension</tt>.
|
||||
*/
|
||||
public RtcpFbPacketExtension()
|
||||
{
|
||||
super(NAMESPACE, ELEMENT_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets RTCP feedback type attribute.
|
||||
* @param feedbackType the RTCP feedback type to set.
|
||||
*/
|
||||
public void setFeedbackType(String feedbackType)
|
||||
{
|
||||
setAttribute(TYPE_ATTR_NAME, feedbackType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns RTCP feedback type attribute value if already set
|
||||
* or <tt>null</tt> otherwise.
|
||||
*
|
||||
* @return RTCP feedback type attribute if already set or <tt>null</tt>
|
||||
* otherwise.
|
||||
*/
|
||||
public String getFeedbackType()
|
||||
{
|
||||
return getAttributeAsString(TYPE_ATTR_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets RTCP feedback subtype attribute.
|
||||
* @param feedbackSubType the RTCP feedback subtype to set.
|
||||
*/
|
||||
public void setFeedbackSubtype(String feedbackSubType)
|
||||
{
|
||||
setAttribute(SUBTYPE_ATTR_NAME, feedbackSubType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns RTCP feedback subtype attribute value if already set
|
||||
* or <tt>null</tt> otherwise.
|
||||
*
|
||||
* @return RTCP feedback subtype attribute if already set or <tt>null</tt>
|
||||
* otherwise.
|
||||
*/
|
||||
public String getFeedbackSubtype()
|
||||
{
|
||||
return getAttributeAsString(SUBTYPE_ATTR_NAME);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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.extensions.jingle;
|
||||
|
||||
import net.java.sip.communicator.impl.protocol.jabber.extensions.*;
|
||||
import net.java.sip.communicator.impl.protocol.jabber.extensions.colibri.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Represents <tt>ssrc-group</tt> elements described in XEP-0339.
|
||||
*
|
||||
* Created by gp on 07/08/14.
|
||||
*/
|
||||
public class SourceGroupPacketExtension
|
||||
extends AbstractPacketExtension
|
||||
{
|
||||
|
||||
/**
|
||||
* The name of the "ssrc-group" element.
|
||||
*/
|
||||
public static final String ELEMENT_NAME = "ssrc-group";
|
||||
|
||||
/**
|
||||
* The namespace for the "ssrc-group" element.
|
||||
*/
|
||||
public static final String NAMESPACE = "urn:xmpp:jingle:apps:rtp:ssma:0";
|
||||
|
||||
/**
|
||||
* The name of the payload <tt>id</tt> SDP argument.
|
||||
*/
|
||||
public static final String SEMANTICS_ATTR_NAME = "semantics";
|
||||
|
||||
/**
|
||||
* Creates a new {@link SourceGroupPacketExtension} instance with the proper
|
||||
* element name and namespace.
|
||||
*/
|
||||
public SourceGroupPacketExtension()
|
||||
{
|
||||
super(NAMESPACE, ELEMENT_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the semantics of this source group.
|
||||
*
|
||||
* @return the semantics of this source group.
|
||||
*/
|
||||
public String getSemantics()
|
||||
{
|
||||
return getAttributeAsString(SEMANTICS_ATTR_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the semantics of this source group.
|
||||
*/
|
||||
public void setSemantics(String semantics)
|
||||
{
|
||||
this.setAttribute(SEMANTICS_ATTR_NAME, semantics);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sources of this source group.
|
||||
*
|
||||
* @return the sources of this source group.
|
||||
*/
|
||||
public List<SourcePacketExtension> getSources()
|
||||
{
|
||||
return getChildExtensionsOfType(SourcePacketExtension.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the sources of this source group.
|
||||
*
|
||||
* @param sources the sources of this source group.
|
||||
*/
|
||||
public void addSources(List<SourcePacketExtension> sources)
|
||||
{
|
||||
if (sources != null && sources.size() != 0)
|
||||
{
|
||||
for (SourcePacketExtension source : sources)
|
||||
this.addChildExtension(source);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue