mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
SPARK-829 XMPP URI not working in some cases.
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@8990 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
@ -23,8 +23,8 @@
|
||||
<property file="${basedir}/build/build.properties"/>
|
||||
<property name="version.major" value="2"/>
|
||||
<property name="version.minor" value="5"/>
|
||||
<property name="version.revision" value="6"/>
|
||||
<property name="version.extra" value=""/>
|
||||
<property name="version.revision" value="7"/>
|
||||
<property name="version.extra" value="beta1"/>
|
||||
<!-- For 'beta' or 'alpha' -->
|
||||
|
||||
<!-- Setup the full version property correctly -->
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<install4j version="4.0.5" transformSequenceNumber="1">
|
||||
<directoryPresets config="../../target/classes/org/jivesoftware/launcher" />
|
||||
<install4j version="4.0.6" transformSequenceNumber="1">
|
||||
<directoryPresets config="../../target/build/lib" />
|
||||
<application name="${compiler:APP_NAME}" distributionSourceDir="" applicationId="3057-7228-2063-7466" mediaDir="../../../../.." mediaFilePattern="spark_${compiler:sys.version}" compression="9" lzmaCompression="true" pack200Compression="false" excludeSignedFromPacking="true" keepModificationTimes="false" shortName="${compiler:APP_SHORT_NAME}" publisher="${compiler:PUBLISHER}" publisherWeb="${compiler:PUBLISHER_URL}" version="${compiler:VERSION_MAJOR}.${compiler:VERSION_MINOR}.${compiler:VERSION_REVISION}" allPathsRelative="true" backupOnSave="false" autoSave="false" convertDotsToUnderscores="true" macSignature="????" javaMinVersion="1.5" javaMaxVersion="1.6" allowBetaVM="false">
|
||||
<languages skipLanguageSelection="false">
|
||||
<principalLanguage id="en" customLocalizationFile="" />
|
||||
@ -93,7 +93,9 @@
|
||||
</launcher>
|
||||
</launchers>
|
||||
<installerGui installerType="1" suggestPreviousProgramGroup="true" addOnAppId="" suggestPreviousLocations="true" allowUnattended="true" allowConsole="true" useCustomInstallerHeaderImage="true" customInstallerHeaderImage="../../src/resources/images/spark-60x60.png" useCustomUninstallerHeaderImage="true" customUninstallerHeaderImage="../../src/resources/images/spark-60x60.png" customSize="false" customWidth="500" customHeight="390" useCustomIcon="true" customIcnsFile="../../src/resources/images/message.icns" customPngIcon16File="../../src/resources/images/spark-16x16.png" customPngIcon32File="../../src/resources/images/spark-32x32.png" customIcoFile="../../src/resources/images/spark.ico" vmParameters="" watermark="false" resizable="true" suppressProgressDialog="false">
|
||||
<customCode useInstalledFiles="false" />
|
||||
<customCode useInstalledFiles="false">
|
||||
<archive location="../../target/build/lib/startup.jar" />
|
||||
</customCode>
|
||||
<installerScreens>
|
||||
<screen name="" id="22" beanClass="com.install4j.runtime.beans.screens.WelcomeScreen" rollbackBarrier="false" backButton="2" finishScreen="false">
|
||||
<serializedBean>
|
||||
@ -263,27 +265,6 @@
|
||||
<condition />
|
||||
<validation />
|
||||
<actions>
|
||||
<action name="" id="72" beanClass="com.install4j.runtime.beans.actions.registry.SetRegistryValueAction" rollbackBarrier="false" multiExec="false" failureStrategy="1" errorMessage="">
|
||||
<serializedBean>
|
||||
<java class="java.beans.XMLDecoder">
|
||||
<object class="com.install4j.runtime.beans.actions.registry.SetRegistryValueAction">
|
||||
<void property="keyName">
|
||||
<string>Software\\Microsoft\\Windows\\CurrentVersion\\Run</string>
|
||||
</void>
|
||||
<void property="registryRoot">
|
||||
<object class="com.install4j.api.windows.RegistryRoot" field="HKEY_CURRENT_USER" />
|
||||
</void>
|
||||
<void property="value">
|
||||
<string>${installer:sys.installationDir}${compiler:APP_SHORT_NAME}</string>
|
||||
</void>
|
||||
<void property="valueName">
|
||||
<string>Spark</string>
|
||||
</void>
|
||||
</object>
|
||||
</java>
|
||||
</serializedBean>
|
||||
<condition />
|
||||
</action>
|
||||
<action name="" id="41" beanClass="com.install4j.runtime.beans.actions.finish.ExecuteLauncherAction" rollbackBarrier="false" multiExec="false" failureStrategy="1" errorMessage="">
|
||||
<serializedBean>
|
||||
<java class="java.beans.XMLDecoder">
|
||||
@ -296,6 +277,14 @@
|
||||
</serializedBean>
|
||||
<condition>context.getBooleanVariable("executeLauncherAction") && (!context.isUnattended())</condition>
|
||||
</action>
|
||||
<action name="" id="83" beanClass="org.jivesoftware.launcher.Installer" rollbackBarrier="false" multiExec="false" failureStrategy="1" errorMessage="">
|
||||
<serializedBean>
|
||||
<java class="java.beans.XMLDecoder">
|
||||
<object class="org.jivesoftware.launcher.Installer" />
|
||||
</java>
|
||||
</serializedBean>
|
||||
<condition />
|
||||
</action>
|
||||
</actions>
|
||||
<formComponents>
|
||||
<formComponent name="Execute launcher" id="42" beanClass="com.install4j.runtime.beans.formcomponents.CheckboxComponent" insetTop="" insetLeft="" insetBottom="" insetRight="" resetInitOnPrevious="false">
|
||||
|
||||
@ -13,7 +13,6 @@ package org.jivesoftware;
|
||||
import de.javasoft.plaf.synthetica.SyntheticaBlueMoonLookAndFeel;
|
||||
import de.javasoft.plaf.synthetica.SyntheticaLookAndFeel;
|
||||
import org.jivesoftware.resource.Default;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.spark.util.log.Log;
|
||||
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
|
||||
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
||||
@ -42,7 +41,7 @@ public final class Spark {
|
||||
|
||||
private static final String USER_SPARK_HOME = System.getProperties().getProperty("user.home") + "/" + getUserConf();
|
||||
|
||||
private static String argument;
|
||||
public static String ARGUMENTS;
|
||||
|
||||
private static File RESOURCE_DIRECTORY;
|
||||
private static File BIN_DIRECTORY;
|
||||
@ -214,18 +213,18 @@ public final class Spark {
|
||||
* will be returned.
|
||||
*/
|
||||
public static String getArgumentValue(String argumentName) {
|
||||
if (argument == null) {
|
||||
if (ARGUMENTS == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String arg = argumentName + "=";
|
||||
|
||||
int index = argument.indexOf(arg);
|
||||
int index = ARGUMENTS.indexOf(arg);
|
||||
if (index == -1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String value = argument.substring(index + arg.length());
|
||||
String value = ARGUMENTS.substring(index + arg.length());
|
||||
int index2 = value.indexOf("&");
|
||||
if (index2 != -1) {
|
||||
// Must be the last argument
|
||||
@ -237,7 +236,7 @@ public final class Spark {
|
||||
}
|
||||
|
||||
public void setArgument(String arguments) {
|
||||
argument = arguments;
|
||||
ARGUMENTS = arguments;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -10,14 +10,8 @@
|
||||
|
||||
package org.jivesoftware;
|
||||
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.spark.ChatManager;
|
||||
import org.jivesoftware.spark.SparkManager;
|
||||
import org.jivesoftware.spark.UserManager;
|
||||
import org.jivesoftware.spark.ui.ChatRoom;
|
||||
import org.jivesoftware.spark.ui.conferences.ConferenceUtils;
|
||||
import org.jivesoftware.spark.util.StringUtils;
|
||||
import org.jivesoftware.spark.util.log.Log;
|
||||
|
||||
/**
|
||||
* Uses the Windows registry to perform URI XMPP mappings.
|
||||
@ -26,98 +20,10 @@ import org.jivesoftware.spark.util.log.Log;
|
||||
*/
|
||||
public class SparkStartupListener implements com.install4j.api.launcher.StartupNotification.Listener {
|
||||
|
||||
public void startupPerformed(String string) {
|
||||
if (string.indexOf("xmpp") == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.indexOf("?message") != -1) {
|
||||
try {
|
||||
handleJID(string);
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.error(e);
|
||||
}
|
||||
}
|
||||
else if (string.indexOf("?join") != -1) {
|
||||
try {
|
||||
handleConference(string);
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.error(e);
|
||||
}
|
||||
}
|
||||
else if (string.indexOf("?") == -1) {
|
||||
// Then use the direct jid
|
||||
int index = string.indexOf(":");
|
||||
if (index != -1) {
|
||||
String jid = string.substring(index + 1);
|
||||
|
||||
UserManager userManager = SparkManager.getUserManager();
|
||||
String nickname = userManager.getUserNicknameFromJID(jid);
|
||||
if (nickname == null) {
|
||||
nickname = jid;
|
||||
}
|
||||
|
||||
ChatManager chatManager = SparkManager.getChatManager();
|
||||
ChatRoom chatRoom = chatManager.createChatRoom(jid, nickname, nickname);
|
||||
chatManager.getChatContainer().activateChatRoom(chatRoom);
|
||||
}
|
||||
}
|
||||
|
||||
public void startupPerformed(String arguments) {
|
||||
final ChatManager chatManager = SparkManager.getChatManager();
|
||||
chatManager.handleURIMapping(arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method to handle different types of URI Mappings.
|
||||
*
|
||||
* @param uriMapping the uri mapping string.
|
||||
*/
|
||||
public void handleJID(String uriMapping) {
|
||||
int index = uriMapping.indexOf("xmpp:");
|
||||
int messageIndex = uriMapping.indexOf("?message");
|
||||
|
||||
int bodyIndex = uriMapping.indexOf("body=");
|
||||
|
||||
String jid = uriMapping.substring(index + 5, messageIndex);
|
||||
String body = null;
|
||||
|
||||
// Find body
|
||||
if (bodyIndex != -1) {
|
||||
body = uriMapping.substring(bodyIndex + 5);
|
||||
}
|
||||
|
||||
body = StringUtils.unescapeFromXML(body);
|
||||
body = StringUtils.replace(body, "%20", " ");
|
||||
|
||||
UserManager userManager = SparkManager.getUserManager();
|
||||
String nickname = userManager.getUserNicknameFromJID(jid);
|
||||
if (nickname == null) {
|
||||
nickname = jid;
|
||||
}
|
||||
|
||||
ChatManager chatManager = SparkManager.getChatManager();
|
||||
ChatRoom chatRoom = chatManager.createChatRoom(jid, nickname, nickname);
|
||||
if (body != null) {
|
||||
Message message = new Message();
|
||||
message.setBody(body);
|
||||
chatRoom.sendMessage(message);
|
||||
}
|
||||
|
||||
chatManager.getChatContainer().activateChatRoom(chatRoom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the URI Mapping to join a conference room.
|
||||
*
|
||||
* @param uriMapping the uri mapping.
|
||||
* @throws Exception thrown if the conference cannot be joined.
|
||||
*/
|
||||
public void handleConference(String uriMapping) {
|
||||
int index = uriMapping.indexOf("xmpp:");
|
||||
int join = uriMapping.indexOf("?join");
|
||||
|
||||
String conference = uriMapping.substring(index + 5, join);
|
||||
ConferenceUtils.joinConferenceOnSeperateThread(conference, conference, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -20,6 +20,8 @@ import com.install4j.api.windows.WinRegistry;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
/**
|
||||
* The installer class is used by the Install4j Installer to setup registry entries
|
||||
* during the setup process.
|
||||
@ -49,9 +51,7 @@ public class Installer implements InstallAction {
|
||||
final File sparkDirectory;
|
||||
String sparkPath = "";
|
||||
try {
|
||||
String executable = installerContext.getMediaName();
|
||||
|
||||
sparkDirectory = new File(installerContext.getInstallationDirectory(), executable);
|
||||
sparkDirectory = new File(installerContext.getInstallationDirectory(), "Spark.exe");
|
||||
sparkPath = sparkDirectory.getCanonicalPath();
|
||||
|
||||
}
|
||||
|
||||
@ -33,6 +33,7 @@ import org.jivesoftware.spark.ui.GlobalMessageListener;
|
||||
import org.jivesoftware.spark.ui.MessageFilter;
|
||||
import org.jivesoftware.spark.ui.SparkTabHandler;
|
||||
import org.jivesoftware.spark.ui.TranscriptWindowInterceptor;
|
||||
import org.jivesoftware.spark.ui.conferences.ConferenceUtils;
|
||||
import org.jivesoftware.spark.ui.conferences.RoomInvitationListener;
|
||||
import org.jivesoftware.spark.ui.rooms.ChatRoomImpl;
|
||||
import org.jivesoftware.spark.ui.rooms.GroupChatRoom;
|
||||
@ -42,10 +43,6 @@ import org.jivesoftware.spark.util.log.Log;
|
||||
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
|
||||
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
||||
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.util.ArrayList;
|
||||
@ -57,6 +54,10 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
/**
|
||||
* Handles the Chat Management of each individual <code>Workspace</code>. The ChatManager is responsible
|
||||
* for creation and removal of chat rooms, transcripts, and transfers and room invitations.
|
||||
@ -73,10 +74,10 @@ public class ChatManager implements MessageEventNotificationListener {
|
||||
public static Color ERROR_COLOR = (Color)UIManager.get("Error.foreground");
|
||||
|
||||
public static Color[] COLORS = {Color.red, Color.blue, Color.gray, Color.magenta, new Color(238, 153, 247), new Color(128, 128, 0), new Color(173, 205, 50),
|
||||
new Color(181, 0, 0), new Color(0, 100, 0), new Color(237, 150, 122), new Color(0, 139, 139), new Color(218, 14, 0), new Color(147, 112, 219),
|
||||
new Color(205, 133, 63), new Color(163, 142, 35), new Color(72, 160, 237), new Color(255, 140, 0), new Color(106, 90, 205), new Color(224, 165, 32),
|
||||
new Color(255, 69, 0), new Color(255, 99, 72), new Color(109, 130, 180), new Color(233, 0, 0), new Color(139, 69, 19), new Color(255, 127, 80),
|
||||
new Color(140, 105, 225)};
|
||||
new Color(181, 0, 0), new Color(0, 100, 0), new Color(237, 150, 122), new Color(0, 139, 139), new Color(218, 14, 0), new Color(147, 112, 219),
|
||||
new Color(205, 133, 63), new Color(163, 142, 35), new Color(72, 160, 237), new Color(255, 140, 0), new Color(106, 90, 205), new Color(224, 165, 32),
|
||||
new Color(255, 69, 0), new Color(255, 99, 72), new Color(109, 130, 180), new Color(233, 0, 0), new Color(139, 69, 19), new Color(255, 127, 80),
|
||||
new Color(140, 105, 225)};
|
||||
|
||||
private List<MessageFilter> messageFilters = new ArrayList<MessageFilter>();
|
||||
|
||||
@ -129,9 +130,9 @@ public class ChatManager implements MessageEventNotificationListener {
|
||||
SparkManager.getMessageEventManager().addMessageEventNotificationListener(this);
|
||||
// Add message event request listener
|
||||
MessageEventRequestListener messageEventRequestListener =
|
||||
new ChatMessageEventRequestListener();
|
||||
new ChatMessageEventRequestListener();
|
||||
SparkManager.getMessageEventManager().
|
||||
addMessageEventRequestListener(messageEventRequestListener);
|
||||
addMessageEventRequestListener(messageEventRequestListener);
|
||||
|
||||
// Add Default Chat Room Decorator
|
||||
addSparkTabHandler(new DefaultTabHandler());
|
||||
@ -793,4 +794,103 @@ public class ChatManager implements MessageEventNotificationListener {
|
||||
final ContactList contactList = SparkManager.getWorkspace().getContactList();
|
||||
return contactList.getSelectedUsers();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles XMPP URI Mappings.
|
||||
*
|
||||
* @param arguments the arguments passed into Spark.
|
||||
*/
|
||||
public void handleURIMapping(String arguments) {
|
||||
if (arguments.indexOf("xmpp") == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (arguments.indexOf("?message") != -1) {
|
||||
try {
|
||||
handleJID(arguments);
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.error(e);
|
||||
}
|
||||
}
|
||||
else if (arguments.indexOf("?join") != -1) {
|
||||
try {
|
||||
handleConference(arguments);
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.error(e);
|
||||
}
|
||||
}
|
||||
else if (arguments.indexOf("?") == -1) {
|
||||
// Then use the direct jid
|
||||
int index = arguments.indexOf(":");
|
||||
if (index != -1) {
|
||||
String jid = arguments.substring(index + 1);
|
||||
|
||||
UserManager userManager = SparkManager.getUserManager();
|
||||
String nickname = userManager.getUserNicknameFromJID(jid);
|
||||
if (nickname == null) {
|
||||
nickname = jid;
|
||||
}
|
||||
|
||||
ChatManager chatManager = SparkManager.getChatManager();
|
||||
ChatRoom chatRoom = chatManager.createChatRoom(jid, nickname, nickname);
|
||||
chatManager.getChatContainer().activateChatRoom(chatRoom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method to handle different types of URI Mappings.
|
||||
*
|
||||
* @param uriMapping the uri mapping string.
|
||||
*/
|
||||
private void handleJID(String uriMapping) {
|
||||
int index = uriMapping.indexOf("xmpp:");
|
||||
int messageIndex = uriMapping.indexOf("?message");
|
||||
|
||||
int bodyIndex = uriMapping.indexOf("body=");
|
||||
|
||||
String jid = uriMapping.substring(index + 5, messageIndex);
|
||||
String body = null;
|
||||
|
||||
// Find body
|
||||
if (bodyIndex != -1) {
|
||||
body = uriMapping.substring(bodyIndex + 5);
|
||||
}
|
||||
|
||||
body = org.jivesoftware.spark.util.StringUtils.unescapeFromXML(body);
|
||||
body = org.jivesoftware.spark.util.StringUtils.replace(body, "%20", " ");
|
||||
|
||||
UserManager userManager = SparkManager.getUserManager();
|
||||
String nickname = userManager.getUserNicknameFromJID(jid);
|
||||
if (nickname == null) {
|
||||
nickname = jid;
|
||||
}
|
||||
|
||||
ChatManager chatManager = SparkManager.getChatManager();
|
||||
ChatRoom chatRoom = chatManager.createChatRoom(jid, nickname, nickname);
|
||||
if (body != null) {
|
||||
Message message = new Message();
|
||||
message.setBody(body);
|
||||
chatRoom.sendMessage(message);
|
||||
}
|
||||
|
||||
chatManager.getChatContainer().activateChatRoom(chatRoom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the URI Mapping to join a conference room.
|
||||
*
|
||||
* @param uriMapping the uri mapping.
|
||||
* @throws Exception thrown if the conference cannot be joined.
|
||||
*/
|
||||
private void handleConference(String uriMapping) {
|
||||
int index = uriMapping.indexOf("xmpp:");
|
||||
int join = uriMapping.indexOf("?join");
|
||||
|
||||
String conference = uriMapping.substring(index + 5, join);
|
||||
ConferenceUtils.joinConferenceOnSeperateThread(conference, conference, null);
|
||||
}
|
||||
|
||||
}
|
||||
@ -12,6 +12,7 @@ package org.jivesoftware.spark;
|
||||
|
||||
import org.jivesoftware.MainWindow;
|
||||
import org.jivesoftware.MainWindowListener;
|
||||
import org.jivesoftware.Spark;
|
||||
import org.jivesoftware.smack.PacketListener;
|
||||
import org.jivesoftware.smack.Roster;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
@ -24,7 +25,6 @@ import org.jivesoftware.smackx.debugger.EnhancedDebuggerWindow;
|
||||
import org.jivesoftware.smackx.packet.DelayInformation;
|
||||
import org.jivesoftware.spark.component.tabbedPane.SparkTabbedPane;
|
||||
import org.jivesoftware.spark.filetransfer.SparkTransferManager;
|
||||
import org.jivesoftware.spark.phone.PhoneManager;
|
||||
import org.jivesoftware.spark.search.SearchManager;
|
||||
import org.jivesoftware.spark.ui.ChatContainer;
|
||||
import org.jivesoftware.spark.ui.ChatRoom;
|
||||
@ -277,6 +277,9 @@ public class Workspace extends JPanel implements PacketListener {
|
||||
};
|
||||
|
||||
TaskEngine.getInstance().schedule(offlineTask, 10000);
|
||||
|
||||
// Check URI Mappings
|
||||
SparkManager.getChatManager().handleURIMapping(Spark.ARGUMENTS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -17,11 +17,11 @@ public class JiveInfo {
|
||||
}
|
||||
|
||||
public static String getVersion() {
|
||||
return "2.5.6";
|
||||
return "2.5.7.beta1";
|
||||
}
|
||||
|
||||
public static String getBuildNumber() {
|
||||
return "2.5.6";
|
||||
return "2.5.7.beta1";
|
||||
}
|
||||
|
||||
public static String getOS() {
|
||||
|
||||
Reference in New Issue
Block a user