fix-message-formatting 5285
Danny van Heumen 11 years ago
commit e820f0a41d

Binary file not shown.

@ -2,6 +2,7 @@ To create debian source package you need some other projects sources that
jitsi depends on. In the same folder where jitsi is checked out do: jitsi depends on. In the same folder where jitsi is checked out do:
git clone https://github.com/jitsi/otr4j.git git clone https://github.com/jitsi/otr4j.git
git clone https://github.com/jitsi/libsrc.git git clone https://github.com/jitsi/libsrc.git
svn checkout http://irc-api.googlecode.com/svn/trunk/ irc-api
And then in jitsi do: ant deb-src -Dlabel=4444 And then in jitsi do: ant deb-src -Dlabel=4444
This will create orig.tar.gz debian sources that can be used to debuild This will create orig.tar.gz debian sources that can be used to debuild
debian package. debian package.

@ -2458,9 +2458,6 @@
and libsrc and libsrc
--> -->
<unzip src="${sc.basedir}/../libsrc/libphonenumber-6.3-SNAPSHOT-sources.jar"
dest="${debian.src.dir}/lib/src/libphonenumber/src"/>
<!-- jdic_misc --> <!-- jdic_misc -->
<unzip src="${sc.basedir}/../libsrc/jdic_misc.zip" <unzip src="${sc.basedir}/../libsrc/jdic_misc.zip"
dest="${debian.src.dir}/lib/src/"> dest="${debian.src.dir}/lib/src/">
@ -2524,6 +2521,14 @@
</fileset> </fileset>
</copy> </copy>
<!-- irc-api -->
<copy todir="${debian.src.dir}/lib/src/irc-api">
<fileset dir="${sc.basedir}/../irc-api">
<include name="src/main/**"/>
<exclude name="**/.svn/**"/>
</fileset>
</copy>
<!-- myspell--> <!-- myspell-->
<unzip src="${sc.basedir}/../libsrc/jmyspell-core-src.zip" <unzip src="${sc.basedir}/../libsrc/jmyspell-core-src.zip"
dest="${debian.src.dir}/lib/src/jmyspell"/> dest="${debian.src.dir}/lib/src/jmyspell"/>
@ -2658,26 +2663,7 @@
<property name="debian.src.dir" <property name="debian.src.dir"
value="${debian.tmp.dir}/${package.name}-${sip-communicator.version}" /> value="${debian.tmp.dir}/${package.name}-${sip-communicator.version}" />
<!--TODO
<symlink resource="/usr/share/java/libphonenumber.jar" <symlink resource="/usr/share/java/libphonenumber.jar"
overwrite="true"
link="${debian.src.dir}/lib/installer-exclude/"/>
-->
<mkdir dir="${debian.src.dir}/lib/src/libphonenumber/classes"/>
<javac debug="true"
deprecation="true" destdir="${debian.src.dir}/lib/src/libphonenumber/classes"
nowarn="false"
source="1.6" target="1.6" fork="true">
<src path="${debian.src.dir}/lib/src/libphonenumber/src"/>
<include name="**/*.java" />
</javac>
<jar compress="true" destfile="${debian.src.dir}/lib/src/libphonenumber/libphonenumber.jar">
<zipfileset dir="${debian.src.dir}/lib/src/libphonenumber/classes"/>
<zipfileset dir="${debian.src.dir}/lib/src/libphonenumber/src">
<include name="com/google/i18n/phonenumbers/data/*"/>
</zipfileset>
</jar>
<symlink resource="${debian.src.dir}/lib/src/libphonenumber/libphonenumber.jar"
overwrite="true" overwrite="true"
link="${debian.src.dir}/lib/installer-exclude/libphonenumber-5.9.jar"/> link="${debian.src.dir}/lib/installer-exclude/libphonenumber-5.9.jar"/>
@ -2898,7 +2884,8 @@
<fileset dir="${debian.src.dir}/lib/src/otr4j/lib" includes="**/*.jar" /> <fileset dir="${debian.src.dir}/lib/src/otr4j/lib" includes="**/*.jar" />
</path> </path>
<mkdir dir="${debian.src.dir}/lib/src/otr4j/bin/classes" /> <mkdir dir="${debian.src.dir}/lib/src/otr4j/bin/classes" />
<javac target="1.6" srcdir="${debian.src.dir}/lib/src/otr4j/src" <javac target="1.6" source="1.6"
srcdir="${debian.src.dir}/lib/src/otr4j/src"
destdir="${debian.src.dir}/lib/src/otr4j/bin/classes" destdir="${debian.src.dir}/lib/src/otr4j/bin/classes"
classpathref="otr4j-classpath" classpathref="otr4j-classpath"
debug="On" /> debug="On" />
@ -2908,6 +2895,68 @@
overwrite="true" overwrite="true"
link="${debian.src.dir}/lib/installer-exclude"/> link="${debian.src.dir}/lib/installer-exclude"/>
<!-- irc-api -->
<path id="irc-api-classpath">
<fileset dir="/usr/share/java" includes="slf4j-api.jar" />
</path>
<mkdir dir="${debian.src.dir}/lib/src/irc-api/classes" />
<javac target="1.6" source="1.6"
srcdir="${debian.src.dir}/lib/src/irc-api/src"
destdir="${debian.src.dir}/lib/src/irc-api/classes"
classpathref="irc-api-classpath"
debug="On" />
<jar destfile="${debian.src.dir}/lib/src/irc-api/irc-api-1.0.jar"
basedir="${debian.src.dir}/lib/src/irc-api/classes">
<manifest>
<attribute name="Bundle-Name" value="IRC API"/>
<attribute name="Bundle-Description"
value="A Java implementation of the irc api"/>
<attribute name="Bundle-SymbolicName"
value="com.ircclouds.irc.api"/>
<attribute name="Bundle-Version" value="1.0.0.0015-SNAPSHOT"/>
<attribute name="Import-Package"
value="javax.net.ssl,org.slf4j"/>
<attribute name="Export-Package"
value="com.ircclouds.irc.api;uses:=&quot;com.ircclouds.irc.api.commands,
com.ircclouds.irc.api.comms,com.ircclouds.irc.api.ctcp,com.ircclouds.irc.api.domain,
com.ircclouds.irc.api.domain.messages.interfaces,com.ircclouds.irc.api.filters,
com.ircclouds.irc.api.listeners,com.ircclouds.irc.api.state&quot;;version=&quot;1.0.0&quot;,
com.ircclouds.irc.api.commands;uses:=&quot;com.ircclouds.irc.api,
com.ircclouds.irc.api.domain.messages&quot;version=&quot;1.0.0&quot;,
com.ircclouds.irc.api.comms;uses:=&quot;javax.net.ssl&quot;;version=&quot;1.0.0&quot;,
com.ircclouds.irc.api.ctcp;uses:=&quot;com.ircclouds.irc.api&quot;;version=&quot;1.0.0&quot;,
com.ircclouds.irc.api.domain;uses:=&quot;com.ircclouds.irc.api.domain.messages.interfaces,
javax.net.ssl&quot;;version=&quot;1.0.0&quot;,
com.ircclouds.irc.api.domain.messages;uses:=&quot;com.ircclouds.irc.api.domain,
com.ircclouds.irc.api.domain.messages.interfaces&quot;;version=&quot;1.0.0&quot;,
com.ircclouds.irc.api.domain.messages.interfaces;uses:=&quot;com.ircclouds.irc.api.domain&quot;;version=&quot;1.0.0&quot;,
com.ircclouds.irc.api.filters;uses:=&quot;com.ircclouds.irc.api.domain.messages.interfaces,
com.ircclouds.irc.api.listeners&quot;;version=&quot;1.0.0&quot;,
com.ircclouds.irc.api.listeners;uses:=&quot;com.ircclouds.irc.api,
com.ircclouds.irc.api.domain,com.ircclouds.irc.api.domain.messages,
com.ircclouds.irc.api.domain.messages.interfaces,
com.ircclouds.irc.api.state&quot;;version=&quot;1.0.0&quot;,
com.ircclouds.irc.api.om;uses:=&quot;com.ircclouds.irc.api.domain,
com.ircclouds.irc.api.domain.messages,
com.ircclouds.irc.api.domain.messages.interfaces&quot;;version=&quot;1.0.0&quot;,
com.ircclouds.irc.api.state;uses:=&quot;com.ircclouds.irc.api.domain,
com.ircclouds.irc.api.domain.messages,
com.ircclouds.irc.api.listeners&quot;;version=&quot;1.0.0&quot;,
com.ircclouds.irc.api.utils;uses:=&quot;com.ircclouds.irc.api.domain,
com.ircclouds.irc.api.domain.messages.interfaces&quot;;version=&quot;1.0.0&quot;"/>
</manifest>
</jar>
<symlink resource="../src/irc-api/irc-api-1.0.jar"
overwrite="true"
link="${debian.src.dir}/lib/installer-exclude"/>
<symlink resource="/usr/share/java/slf4j-api.jar"
overwrite="true"
link="${debian.src.dir}/lib/installer-exclude/slf4j-api-1.7.5.jar"/>
<symlink resource="/usr/share/java/slf4j-jdk14.jar"
overwrite="true"
link="${debian.src.dir}/lib/installer-exclude/slf4j-jdk14-1.7.5.jar"/>
<!-- jmyspell --> <!-- jmyspell -->
<mkdir dir="${debian.src.dir}/lib/src/jmyspell/classes"/> <mkdir dir="${debian.src.dir}/lib/src/jmyspell/classes"/>
<javac debug="true" <javac debug="true"
@ -3857,4 +3906,54 @@
<replacevalue>reference:file:/usr/share/jitsi-common/ui-service.jar</replacevalue> <replacevalue>reference:file:/usr/share/jitsi-common/ui-service.jar</replacevalue>
</replace> </replace>
</target> </target>
<target name="deb-bundle-slf4j">
<delete file="${debian.bundles.dest}/slf4j-api-1.7.5.jar" failonerror="false"/>
<mkdir dir="${debian.bundles.dest}/slf4j-api-1.7.5.jar/META-INF"/>
<symlink resource="../../../../share/java/slf4j-api.jar"
link="${debian.bundles.dest}/slf4j-api-1.7.5.jar/slf4j-api.jar"/>
<manifest
file="${debian.bundles.dest}/slf4j-api-1.7.5.jar/META-INF/MANIFEST.MF">
<attribute name="Bundle-Name"
value="slf4j-api"/>
<attribute name="Bundle-Description"
value="The slf4j API"/>
<attribute name="Bundle-SymbolicName"
value="slf4j.api"/>
<attribute name="Bundle-Version"
value="1.7.5"/>
<attribute name="System-Bundle"
value="yes"/>
<attribute name="Export-Package"
value="org.slf4j, org.slf4j.spi, org.slf4j.helpers"/>
<attribute name="Import-Package"
value="org.slf4j.impl"/>
<attribute name="Bundle-ClassPath"
value=".,slf4j-api.jar"/>
</manifest>
<delete file="${debian.bundles.dest}/slf4j-jdk14-1.7.5.jar" failonerror="false"/>
<mkdir dir="${debian.bundles.dest}/slf4j-jdk14-1.7.5.jar/META-INF"/>
<symlink resource="../../../../share/java/slf4j-jdk14.jar"
link="${debian.bundles.dest}/slf4j-jdk14-1.7.5.jar/slf4j-jdk14.jar"/>
<manifest
file="${debian.bundles.dest}/slf4j-jdk14-1.7.5.jar/META-INF/MANIFEST.MF">
<attribute name="Bundle-Name"
value="slf4j-jdk14"/>
<attribute name="Bundle-Description"
value="SLF4J JDK14 Binding"/>
<attribute name="Bundle-SymbolicName"
value="slf4j.jdk14"/>
<attribute name="Bundle-Version"
value="1.7.5"/>
<attribute name="System-Bundle"
value="yes"/>
<attribute name="Export-Package"
value="org.slf4j.impl"/>
<attribute name="Import-Package"
value="org.slf4j, org.slf4j.spi, org.slf4j.helpers"/>
<attribute name="Bundle-ClassPath"
value=".,slf4j-jdk14.jar"/>
</manifest>
</target>
</project> </project>

@ -48,7 +48,9 @@ Build-Depends: debhelper (>= 9), javahelper,
glassfish-activation, glassfish-activation,
glassfish-mail, glassfish-mail,
libbcpkix-java, libbcpkix-java,
libjcalendar-java libjcalendar-java,
libphonenumber6-java,
libslf4j-java
Standards-Version: 3.9.5 Standards-Version: 3.9.5
Package: _PACKAGE_NAME_ Package: _PACKAGE_NAME_
@ -80,7 +82,9 @@ Depends: ${misc:Depends},
libguava-java, libguava-java,
libhsqldb-java, libhsqldb-java,
libjson-simple-java (>= 1.1.1), libjson-simple-java (>= 1.1.1),
libjcalendar-java libjcalendar-java,
libphonenumber6-java,
libslf4j-java
Recommends: ${java:Recommends} Recommends: ${java:Recommends}
Description: VoIP and Instant Messaging client Description: VoIP and Instant Messaging client
_APP_NAME_ is an application that allows you to do audio/video _APP_NAME_ is an application that allows you to do audio/video

@ -21,7 +21,7 @@ override_dh_install-indep:
# make and install the debian specific bundles # make and install the debian specific bundles
# use the prebuild and installed bundles to extract/modify and use the # use the prebuild and installed bundles to extract/modify and use the
# exising debian java packages # exising debian java packages
$(ANT) -file build.xml -Ddebian.bundles.dest=debian/$(PACKAGE_NAME)/usr/share/$(PACKAGE_NAME)/sc-bundles -Ddebian.bundles.common.dest=debian/$(PACKAGE_NAME)-common/usr/share/$(PACKAGE_NAME)-common deb-bundle-jna deb-bundle-util deb-bundle-sysactivitynotifications deb-bundle-swing-ui deb-bundle-json deb-bundle-smacklib deb-bundle-jmdnslib deb-bundle-desktoputil deb-bundle-bouncycastle deb-bundle-plugin-accountinfo deb-bundle-commons-lang deb-bundle-hsqldb deb-libjitsi-deps deb-bundle-httpmime deb-bundle-common $(ANT) -file build.xml -Ddebian.bundles.dest=debian/$(PACKAGE_NAME)/usr/share/$(PACKAGE_NAME)/sc-bundles -Ddebian.bundles.common.dest=debian/$(PACKAGE_NAME)-common/usr/share/$(PACKAGE_NAME)-common deb-bundle-jna deb-bundle-util deb-bundle-sysactivitynotifications deb-bundle-swing-ui deb-bundle-json deb-bundle-smacklib deb-bundle-jmdnslib deb-bundle-desktoputil deb-bundle-bouncycastle deb-bundle-plugin-accountinfo deb-bundle-commons-lang deb-bundle-hsqldb deb-libjitsi-deps deb-bundle-httpmime deb-bundle-common deb-bundle-slf4j
override_dh_install-arch: override_dh_install-arch:
ifeq ($(DEB_HOST_ARCH),amd64) ifeq ($(DEB_HOST_ARCH),amd64)

@ -228,7 +228,7 @@ private void refreshValue()
propertyListener); propertyListener);
if(value == null) if(value == null)
value = MUCService.OPEN_ON_IMPORTANT_MESSAGE; value = MUCService.DEFAULT_AUTO_OPEN_BEHAVIOUR;
if(value.equals(MUCService.OPEN_ON_ACTIVITY)) if(value.equals(MUCService.OPEN_ON_ACTIVITY))
{ {

@ -24,9 +24,8 @@
import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.Logger; import net.java.sip.communicator.util.Logger;
import org.jitsi.util.*;
import org.jdesktop.swingworker.SwingWorker; import org.jdesktop.swingworker.SwingWorker;
import org.jitsi.util.*;
import org.osgi.framework.*; import org.osgi.framework.*;
/** /**
@ -214,7 +213,7 @@ public void messageReceived(ChatRoomMessageReceivedEvent evt)
sourceChatRoom.getParentProvider(), sourceChatRoom.getParentProvider(),
sourceChatRoom.getIdentifier()); sourceChatRoom.getIdentifier());
if(autoOpenConfig == null) if(autoOpenConfig == null)
autoOpenConfig = MUCService.OPEN_ON_IMPORTANT_MESSAGE; autoOpenConfig = MUCService.DEFAULT_AUTO_OPEN_BEHAVIOUR;
if(autoOpenConfig.equals(MUCService.OPEN_ON_ACTIVITY) if(autoOpenConfig.equals(MUCService.OPEN_ON_ACTIVITY)
|| (autoOpenConfig.equals(MUCService.OPEN_ON_MESSAGE) || (autoOpenConfig.equals(MUCService.OPEN_ON_MESSAGE)
@ -307,7 +306,7 @@ else if(o instanceof ChatRoomMessageReceivedEvent)
null); null);
if(createWindow) if(createWindow)
chatWindowManager.openChat(chatPanel, true); chatWindowManager.openChat(chatPanel, false);
} }
/** /**

@ -89,11 +89,11 @@ private void initItems()
.getPreferredContactDetail(OperationSetBasicTelephony.class); .getPreferredContactDetail(OperationSetBasicTelephony.class);
// Call menu. // Call menu.
if (cDetail != null if (cDetail != null)
&& sourceContact.getContactSource().getType()
!= ContactSourceService.RECENT_MESSAGES_TYPE)
{ {
add(initCallMenu()); Component c = initCallMenu();
if(c != null)
add(c);
} }
// Only create the menu if the add contact functionality is enabled. // Only create the menu if the add contact functionality is enabled.
@ -181,6 +181,10 @@ else if (providersCount > 1)
contains(OperationSetBasicTelephony.class)); contains(OperationSetBasicTelephony.class));
callContactMenu.add(callContactItem); callContactMenu.add(callContactItem);
} }
if(callContactMenu.getMenuComponentCount() == 0)
return null;
return callContactMenu; return callContactMenu;
} }

@ -1139,6 +1139,8 @@ private void loadRecentMessages()
messageSourceServiceReg = bundleContext.registerService( messageSourceServiceReg = bundleContext.registerService(
ContactSourceService.class.getName(), ContactSourceService.class.getName(),
messageSourceService, null); messageSourceService, null);
MessageHistoryActivator.getContactListService()
.addMetaContactListListener(this.messageSourceService);
} }
/** /**
@ -1148,6 +1150,9 @@ private void stopRecentMessages()
{ {
if(messageSourceServiceReg != null) if(messageSourceServiceReg != null)
{ {
MessageHistoryActivator.getContactListService()
.removeMetaContactListListener(this.messageSourceService);
messageSourceServiceReg.unregister(); messageSourceServiceReg.unregister();
messageSourceServiceReg = null; messageSourceServiceReg = null;

@ -6,6 +6,7 @@
*/ */
package net.java.sip.communicator.impl.msghistory; package net.java.sip.communicator.impl.msghistory;
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.contactsource.*; import net.java.sip.communicator.service.contactsource.*;
import net.java.sip.communicator.service.msghistory.*; import net.java.sip.communicator.service.msghistory.*;
import net.java.sip.communicator.service.muc.*; import net.java.sip.communicator.service.muc.*;
@ -175,7 +176,7 @@ void update(EventObject source)
this.contact = e.getDestinationContact(); this.contact = e.getDestinationContact();
this.address = contact.getAddress(); this.address = contact.getAddress();
this.displayName = contact.getDisplayName(); this.updateDisplayName();
this.ppService = contact.getProtocolProvider(); this.ppService = contact.getProtocolProvider();
this.image = contact.getImage(); this.image = contact.getImage();
this.status = contact.getPresenceStatus(); this.status = contact.getPresenceStatus();
@ -189,7 +190,7 @@ else if(source instanceof MessageReceivedEvent)
this.contact = e.getSourceContact(); this.contact = e.getSourceContact();
this.address = contact.getAddress(); this.address = contact.getAddress();
this.displayName = contact.getDisplayName(); this.updateDisplayName();
this.ppService = contact.getProtocolProvider(); this.ppService = contact.getProtocolProvider();
this.image = contact.getImage(); this.image = contact.getImage();
this.status = contact.getPresenceStatus(); this.status = contact.getPresenceStatus();
@ -279,6 +280,9 @@ else if(source instanceof ChatRoomMessageDeliveredEvent
*/ */
void initDetails(boolean isChatRoom, Contact contact) void initDetails(boolean isChatRoom, Contact contact)
{ {
if(!isChatRoom && contact != null)
this.updateDisplayName();
ContactDetail contactDetail = ContactDetail contactDetail =
new ContactDetail( new ContactDetail(
this.address, this.address,
@ -334,6 +338,7 @@ void initDetails(boolean isChatRoom, Contact contact)
contactDetail.setSupportedOpSets(supportedOpSets); contactDetail.setSupportedOpSets(supportedOpSets);
} }
contactDetails.clear();
contactDetails.add(contactDetail); contactDetails.add(contactDetail);
} }
@ -506,6 +511,24 @@ public void setDisplayName(String displayName)
this.displayName = displayName; this.displayName = displayName;
} }
/**
* Updates display name if contact is not null.
*/
private void updateDisplayName()
{
if(this.contact == null)
return;
MetaContact metaContact
= MessageHistoryActivator.getContactListService()
.findMetaContactByContact(contact);
if(metaContact == null)
return;
this.displayName = metaContact.getDisplayName();
}
/** /**
* Compares two MessageSourceContacts. * Compares two MessageSourceContacts.
* @param o the object to compare with * @param o the object to compare with

@ -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);
}
}

@ -12,6 +12,7 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.service.history.event, net.java.sip.communicator.service.history.event,
net.java.sip.communicator.service.msghistory, net.java.sip.communicator.service.msghistory,
net.java.sip.communicator.service.contactlist, net.java.sip.communicator.service.contactlist,
net.java.sip.communicator.service.contactlist.event,
net.java.sip.communicator.service.contactsource, net.java.sip.communicator.service.contactsource,
net.java.sip.communicator.service.history.records, net.java.sip.communicator.service.history.records,
net.java.sip.communicator.service.muc, net.java.sip.communicator.service.muc,

@ -8,8 +8,6 @@
import java.util.*; import java.util.*;
import org.jitsi.service.resources.*;
import net.java.sip.communicator.plugin.desktoputil.chat.*; import net.java.sip.communicator.plugin.desktoputil.chat.*;
import net.java.sip.communicator.service.contactsource.*; import net.java.sip.communicator.service.contactsource.*;
import net.java.sip.communicator.service.customcontactactions.*; import net.java.sip.communicator.service.customcontactactions.*;
@ -17,6 +15,8 @@
import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.*;
import org.jitsi.service.resources.*;
/** /**
* Implements <tt>CustomContactActionsService</tt> for MUC contact source. * Implements <tt>CustomContactActionsService</tt> for MUC contact source.
* *
@ -643,7 +643,7 @@ public String getText(SourceContact actionSource)
((ChatRoomSourceContact)actionSource).getProvider(), ((ChatRoomSourceContact)actionSource).getProvider(),
((ChatRoomSourceContact)actionSource).getChatRoomID()); ((ChatRoomSourceContact)actionSource).getChatRoomID());
if(openAutomaticallyValue == null) if(openAutomaticallyValue == null)
openAutomaticallyValue = MUCService.OPEN_ON_IMPORTANT_MESSAGE; openAutomaticallyValue = MUCService.DEFAULT_AUTO_OPEN_BEHAVIOUR;
String openAutomaticallyKey = MUCService.autoOpenConfigValuesTexts String openAutomaticallyKey = MUCService.autoOpenConfigValuesTexts
.get(openAutomaticallyValue); .get(openAutomaticallyValue);
return "<html>" + text + "...<br><font size=\"2\"><center> (" return "<html>" + text + "...<br><font size=\"2\"><center> ("

@ -85,9 +85,12 @@ public abstract void modifyVideoContent()
*/ */
public T getPeer(String sid) public T getPeer(String sid)
{ {
if (sid == null)
return null;
for(T peer : getCallPeerList()) for(T peer : getCallPeerList())
{ {
if (peer.getSID() != null && peer.getSID().equals(sid)) if (sid.equals(peer.getSID()))
return peer; return peer;
} }
return null; return null;
@ -118,9 +121,12 @@ public boolean containsSID(String sid)
*/ */
public T getPeerBySessInitPacketID(String id) public T getPeerBySessInitPacketID(String id)
{ {
if (id == null)
return null;
for(T peer : getCallPeerList()) for(T peer : getCallPeerList())
{ {
if (peer.getSessInitID().equals(id)) if (id.equals(peer.getSessInitID()))
return peer; return peer;
} }
return null; return null;

@ -40,6 +40,11 @@ public ColibriIQProvider()
SourcePacketExtension.NAMESPACE, SourcePacketExtension.NAMESPACE,
new DefaultPacketExtensionProvider<SourcePacketExtension>( new DefaultPacketExtensionProvider<SourcePacketExtension>(
SourcePacketExtension.class)); SourcePacketExtension.class));
providerManager.addExtensionProvider(
SourceGroupPacketExtension.ELEMENT_NAME,
SourceGroupPacketExtension.NAMESPACE,
new DefaultPacketExtensionProvider<SourceGroupPacketExtension>(
SourceGroupPacketExtension.class));
PacketExtensionProvider parameterProvider PacketExtensionProvider parameterProvider
= new DefaultPacketExtensionProvider<ParameterPacketExtension>( = new DefaultPacketExtensionProvider<ParameterPacketExtension>(
@ -84,6 +89,13 @@ else if (childExtension instanceof IceUdpTransportPacketExtension)
channel.setTransport(transport); channel.setTransport(transport);
} }
else if (childExtension instanceof SourceGroupPacketExtension)
{
SourceGroupPacketExtension sourceGroup
= (SourceGroupPacketExtension)childExtension;
channel.addSourceGroup(sourceGroup);
}
} }
private void addChildExtension( private void addChildExtension(
@ -187,7 +199,9 @@ else if (ColibriConferenceIQ.Channel.ELEMENT_NAME.equals(
else if (ColibriConferenceIQ.SctpConnection.ELEMENT_NAME else if (ColibriConferenceIQ.SctpConnection.ELEMENT_NAME
.equals(name)) .equals(name))
{ {
content.addSctpConnection(sctpConnection); if (sctpConnection != null)
content.addSctpConnection(sctpConnection);
sctpConnection = null; sctpConnection = null;
} }
else if (ColibriConferenceIQ.Endpoint.ELEMENT_NAME else if (ColibriConferenceIQ.Endpoint.ELEMENT_NAME
@ -327,6 +341,18 @@ else if (ColibriConferenceIQ.Recording.ELEMENT_NAME.equals(
if ((lastN != null) && (lastN.length() != 0)) if ((lastN != null) && (lastN.length() != 0))
channel.setLastN(Integer.parseInt(lastN)); channel.setLastN(Integer.parseInt(lastN));
// receiving simulcast layer
String receivingSimulcastLayer
= parser.getAttributeValue(
"",
ColibriConferenceIQ.Channel
.RECEIVING_SIMULCAST_LAYER);
if ((receivingSimulcastLayer != null)
&& (receivingSimulcastLayer.length() != 0))
channel.setReceivingSimulcastLayer(
Integer.parseInt(receivingSimulcastLayer));
// rtcpPort // rtcpPort
String rtcpPort String rtcpPort
= parser.getAttributeValue( = parser.getAttributeValue(
@ -426,20 +452,28 @@ else if (ColibriConferenceIQ.SctpConnection.ELEMENT_NAME
ColibriConferenceIQ. ColibriConferenceIQ.
SctpConnection.ENDPOINT_ATTR_NAME); SctpConnection.ENDPOINT_ATTR_NAME);
if(!StringUtils.isNullOrEmpty(endpoint)) // id
{ String connID
sctpConnection = parser.getAttributeValue(
= new ColibriConferenceIQ.SctpConnection(); "",
} ColibriConferenceIQ.
else ChannelCommon.ID_ATTR_NAME);
if(StringUtils.isNullOrEmpty(connID)
&& StringUtils.isNullOrEmpty(endpoint))
{ {
throw new RuntimeException( sctpConnection = null;
"Endpoint is mandatory attribute" continue;
+ " for SCTP connection"
);
} }
sctpConnection.setEndpoint(endpoint); sctpConnection
= new ColibriConferenceIQ.SctpConnection();
if (!StringUtils.isNullOrEmpty(connID))
sctpConnection.setID(connID);
if (!StringUtils.isNullOrEmpty(endpoint))
sctpConnection.setEndpoint(endpoint);
// port // port
String port String port
@ -538,7 +572,14 @@ else if (SourcePacketExtension.ELEMENT_NAME.equals(name)
peName = name; peName = name;
peNamespace = SourcePacketExtension.NAMESPACE; peNamespace = SourcePacketExtension.NAMESPACE;
} }
else if (SourceGroupPacketExtension.ELEMENT_NAME
.equals(name)
&& SourceGroupPacketExtension.NAMESPACE
.equals(parser.getNamespace()))
{
peName = name;
peNamespace = SourceGroupPacketExtension.NAMESPACE;
}
if (peName == null) if (peName == null)
{ {
throwAway(parser, name); throwAway(parser, name);

@ -157,6 +157,13 @@ public JingleIQProvider()
new DefaultPacketExtensionProvider<CallIdPacketExtension>( new DefaultPacketExtensionProvider<CallIdPacketExtension>(
CallIdPacketExtension.class)); CallIdPacketExtension.class));
//rtcp-fb
providerManager.addExtensionProvider(
RtcpFbPacketExtension.ELEMENT_NAME,
RtcpFbPacketExtension.NAMESPACE,
new DefaultPacketExtensionProvider<RtcpFbPacketExtension>(
RtcpFbPacketExtension.class));
//rtcp-mux //rtcp-mux
providerManager.addExtensionProvider( providerManager.addExtensionProvider(
RtcpmuxPacketExtension.ELEMENT_NAME, RtcpmuxPacketExtension.ELEMENT_NAME,

@ -217,4 +217,27 @@ public List<ParameterPacketExtension> getParameters()
{ {
return getChildExtensionsOfType(ParameterPacketExtension.class); return getChildExtensionsOfType(ParameterPacketExtension.class);
} }
/**
* Adds an RTCP feedback type to the list that we already have registered
* for this payload type.
*
* @param rtcpFbPacketExtension RTCP feedback type for this encoding.
*/
public void addRtcpFeedbackType(RtcpFbPacketExtension rtcpFbPacketExtension)
{
addChildExtension(rtcpFbPacketExtension);
}
/**
* Returns the list of RTCP feedback types currently registered for this
* payload type.
*
* @return the list of RTCP feedback types currently registered for this
* payload type.
*/
public List<RtcpFbPacketExtension> getRtcpFeedbackTypeList()
{
return getChildExtensionsOfType(RtcpFbPacketExtension.class);
}
} }

@ -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);
}
}
}

@ -26,6 +26,20 @@
public class UriHandlerSipImpl public class UriHandlerSipImpl
implements UriHandler, ServiceListener, AccountManagerListener implements UriHandler, ServiceListener, AccountManagerListener
{ {
/**
* Property to set the amount of time to wait for SIP registration
* to complete before trying to dial a URI from the command line.
* (value in milliseconds).
*/
public static final String INITIAL_REGISTRATION_TIMEOUT_PROP
= "net.java.sip.communicator.impl.protocol.sip.call.INITIAL_REGISTRATION_TIMEOUT";
/**
* Default value for INITIAL_REGISTRATION_TIMEOUT (milliseconds)
*/
public static final long DEFAULT_INITIAL_REGISTRATION_TIMEOUT
= 5000;
/** /**
* The <tt>Logger</tt> used by the <tt>UriHandlerSipImpl</tt> class and its * The <tt>Logger</tt> used by the <tt>UriHandlerSipImpl</tt> class and its
* instances for logging output. * instances for logging output.
@ -254,12 +268,11 @@ public String getProtocol()
} }
/** /**
* Parses the specified URI and creates a call with the currently active * Parses the specified URI and tries to create a call when online.
* telephony operation set.
* *
* @param uri the SIP URI that we have to call. * @param uri the SIP URI that we have to call.
*/ */
public void handleUri(String uri) public void handleUri(final String uri)
{ {
/* /*
* TODO If the requirement to register the factory service after * TODO If the requirement to register the factory service after
@ -278,7 +291,7 @@ public void handleUri(String uri)
} }
} }
ProtocolProviderService provider; final ProtocolProviderService provider;
try try
{ {
provider = selectHandlingProvider(uri); provider = selectHandlingProvider(uri);
@ -301,6 +314,73 @@ public void handleUri(String uri)
return; return;
} }
if(provider.getRegistrationState() == RegistrationState.REGISTERED)
{
handleUri(uri, provider);
}
else
{
// Allow a grace period for the provider to register in case
// we have just started up
long initialRegistrationTimeout =
SipActivator.getConfigurationService()
.getLong(INITIAL_REGISTRATION_TIMEOUT_PROP,
DEFAULT_INITIAL_REGISTRATION_TIMEOUT);
final DelayRegistrationStateChangeListener listener =
new DelayRegistrationStateChangeListener(uri, provider);
provider.addRegistrationStateChangeListener(listener);
new Timer().schedule(new TimerTask()
{
@Override
public void run()
{
provider.removeRegistrationStateChangeListener(listener);
// Even if not registered after the timeout, try the call
// anyway and the error popup will appear to ask the
// user if they want to register
handleUri(uri, provider);
}
}, initialRegistrationTimeout);
}
}
/**
* Listener on provider state changes that handles the passed URI if the
* provider becomes registered.
*/
private class DelayRegistrationStateChangeListener
implements RegistrationStateChangeListener
{
private String uri;
private ProtocolProviderService provider;
private boolean handled = false;
public DelayRegistrationStateChangeListener(String uri,
ProtocolProviderService provider)
{
this.uri = uri;
this.provider = provider;
}
@Override
public void registrationStateChanged(RegistrationStateChangeEvent evt)
{
if (evt.getNewState() == RegistrationState.REGISTERED && !handled)
{
provider.removeRegistrationStateChangeListener(this);
handled = true;
handleUri(uri, provider);
}
}
}
/**
* Creates a call with the currently active telephony operation set.
*
* @param uri the SIP URI that we have to call.
*/
protected void handleUri(String uri, ProtocolProviderService provider)
{
//handle "sip://" URIs as "sip:" //handle "sip://" URIs as "sip:"
if(uri != null) if(uri != null)
uri = uri.replace("sip://", "sip:"); uri = uri.replace("sip://", "sip:");

@ -26,6 +26,11 @@ public abstract class MUCService
public static final String DISABLED_PROPERTY public static final String DISABLED_PROPERTY
= "net.java.sip.communicator.impl.muc.MUC_SERVICE_DISABLED"; = "net.java.sip.communicator.impl.muc.MUC_SERVICE_DISABLED";
/**
* Key for auto-open configuration entry.
*/
private static String AUTO_OPEN_CONFIG_KEY = "openAutomatically";
/** /**
* The value for chat room configuration property to open automatically on * The value for chat room configuration property to open automatically on
* activity * activity
@ -44,6 +49,11 @@ public abstract class MUCService
*/ */
public static String OPEN_ON_IMPORTANT_MESSAGE = "on_important_message"; public static String OPEN_ON_IMPORTANT_MESSAGE = "on_important_message";
/**
* The default for chat room auto-open behaviour.
*/
public static String DEFAULT_AUTO_OPEN_BEHAVIOUR = OPEN_ON_MESSAGE;
/** /**
* Map for the auto open configuration values and their text representation * Map for the auto open configuration values and their text representation
*/ */
@ -73,7 +83,7 @@ public static void setChatRoomAutoOpenOption(
{ {
ConfigurationUtils.updateChatRoomProperty( ConfigurationUtils.updateChatRoomProperty(
pps, pps,
chatRoomId, "openAutomatically", value); chatRoomId, AUTO_OPEN_CONFIG_KEY, value);
} }
/** /**
@ -88,7 +98,7 @@ public static String getChatRoomAutoOpenOption(
{ {
return ConfigurationUtils.getChatRoomProperty( return ConfigurationUtils.getChatRoomProperty(
pps, pps,
chatRoomId, "openAutomatically"); chatRoomId, AUTO_OPEN_CONFIG_KEY);
} }
/** /**

Loading…
Cancel
Save