mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
Merge pull request #748 from igniterealtime/pade-plugin-issue-434
Add Preferences Panel in SparkMeet
This commit is contained in:
@ -10,7 +10,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>meet</artifactId>
|
<artifactId>meet</artifactId>
|
||||||
<version>0.0.8</version>
|
<version>0.0.9</version>
|
||||||
|
|
||||||
<name>Pade Meetings Plugin</name>
|
<name>Pade Meetings Plugin</name>
|
||||||
<description>Adds support for Pade Meetings to the Spark IM client.</description>
|
<description>Adds support for Pade Meetings to the Spark IM client.</description>
|
||||||
|
|||||||
@ -7,3 +7,5 @@ It uses Electron instead of depending on Chrome installed and configured as the
|
|||||||
It is a much better user experience than opening a Chrome browser window out of context somewhere else.
|
It is a much better user experience than opening a Chrome browser window out of context somewhere else.
|
||||||
Screen sharing is not yet working. All Electron runtime platforms (windows, Linux & OSX) are supported. I have only tested it at home on my windows desktop.
|
Screen sharing is not yet working. All Electron runtime platforms (windows, Linux & OSX) are supported. I have only tested it at home on my windows desktop.
|
||||||
Feeback will be appreciated from Linux and OSX users.
|
Feeback will be appreciated from Linux and OSX users.
|
||||||
|
|
||||||
|

|
||||||
@ -31,14 +31,14 @@ public class ChatRoomDecorator
|
|||||||
{
|
{
|
||||||
public RolloverButton ofmeetButton;
|
public RolloverButton ofmeetButton;
|
||||||
public final ChatRoom room;
|
public final ChatRoom room;
|
||||||
|
public static String ICON_STRING = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAKDSURBVDhPXVM7axVBFP5m7maN5gFyJTdNEEVDUt3C/yAIKkRSidjEUsTKRyrtLSyi/gArSRfFOiBqY5UqICaRYDCvm7177+7Ozj7G70wSSJzlmzk75/WdmTMqLwq3ubKCcGQEOgjgBgKoYACq0YBrKGh+rqrh6gKqqFGVBVCUKJMexqenoba2t937qSmcu3QRmk5aN7yz4tfQGrVzkOG4ermuUBPdzT+4v7wMHYYhMg3k1JkaSJktyQyigwPsdfYRRV0keY7EWpiyRFpWMGJbVQjPDCLQSiGJe9Bxn2lI0VUYao1jcmYGDTJJow6+v3mH860xlkSGcNBOI4oPyBGgv0bKmpIiR7+wPmP7ziyuP37EWi2utK/hdZKgZwyyNEWaW29r8hJK84w0p5yRLBWWNAVRt4vVL9+w+OIlXt27i6+LHzC78BbR7i5y6gUZfRTZ0531EDlrt5VDQWS5Qd9knmJIbP1cg7HG6wViK0lFHwiDHQqms8eZTGqHDg9tdH8XG/y/PDmJG/PP8XC8hR5Pv087cfxLaEq8KEbkT8lAHpTjuIuxdhvzH5dw8+kTzDWb2NneQR3oU3aHh8hFAuQ8WSugbEjxx6fPeHbrNhbmHqDb6bA3gkM9IbapBOCtkYA7OgPeLyHBMpvD8r4HKQtN9qDXHcPbUsd7lxKopGjJR8BGRZJkiPsxqhP7/0MS0R/K9mN3dXgUY7JxNKQMqXGIOGzk04P++E382lgnQ7avZK25e4yA/0JfgggLjxN6gfhI+Srd33PDzQtoycbR4NPwmY9XGbIyl88u2CKi1VWosq5db30N4dkh35q+tRRfI7tMwImJ6MpsruZKyMussgzhxAT+AQRKd557vsR7AAAAAElFTkSuQmCC";
|
||||||
|
|
||||||
public ChatRoomDecorator(final ChatRoom room, final String url, final SparkMeetPlugin plugin)
|
public ChatRoomDecorator(final ChatRoom room, final SparkMeetPlugin plugin)
|
||||||
{
|
{
|
||||||
this.room = room;
|
this.room = room;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String imageString = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAKDSURBVDhPXVM7axVBFP5m7maN5gFyJTdNEEVDUt3C/yAIKkRSidjEUsTKRyrtLSyi/gArSRfFOiBqY5UqICaRYDCvm7177+7Ozj7G70wSSJzlmzk75/WdmTMqLwq3ubKCcGQEOgjgBgKoYACq0YBrKGh+rqrh6gKqqFGVBVCUKJMexqenoba2t937qSmcu3QRmk5aN7yz4tfQGrVzkOG4ermuUBPdzT+4v7wMHYYhMg3k1JkaSJktyQyigwPsdfYRRV0keY7EWpiyRFpWMGJbVQjPDCLQSiGJe9Bxn2lI0VUYao1jcmYGDTJJow6+v3mH860xlkSGcNBOI4oPyBGgv0bKmpIiR7+wPmP7ziyuP37EWi2utK/hdZKgZwyyNEWaW29r8hJK84w0p5yRLBWWNAVRt4vVL9+w+OIlXt27i6+LHzC78BbR7i5y6gUZfRTZ0531EDlrt5VDQWS5Qd9knmJIbP1cg7HG6wViK0lFHwiDHQqms8eZTGqHDg9tdH8XG/y/PDmJG/PP8XC8hR5Pv087cfxLaEq8KEbkT8lAHpTjuIuxdhvzH5dw8+kTzDWb2NneQR3oU3aHh8hFAuQ8WSugbEjxx6fPeHbrNhbmHqDb6bA3gkM9IbapBOCtkYA7OgPeLyHBMpvD8r4HKQtN9qDXHcPbUsd7lxKopGjJR8BGRZJkiPsxqhP7/0MS0R/K9mN3dXgUY7JxNKQMqXGIOGzk04P++E382lgnQ7avZK25e4yA/0JfgggLjxN6gfhI+Srd33PDzQtoycbR4NPwmY9XGbIyl88u2CKi1VWosq5db30N4dkh35q+tRRfI7tMwImJ6MpsruZKyMussgzhxAT+AQRKd557vsR7AAAAAElFTkSuQmCC";
|
byte[] imageByte = DatatypeConverter.parseBase64Binary(ICON_STRING);
|
||||||
byte[] imageByte = DatatypeConverter.parseBase64Binary(imageString);
|
|
||||||
ImageIcon ofmeetIcon = new ImageIcon(imageByte);
|
ImageIcon ofmeetIcon = new ImageIcon(imageByte);
|
||||||
ofmeetButton = new RolloverButton(SparkRes.getImageIcon("PADE_ICON"));
|
ofmeetButton = new RolloverButton(SparkRes.getImageIcon("PADE_ICON"));
|
||||||
ofmeetButton.setToolTipText(GraphicUtils.createToolTip("Pade Meetings"));
|
ofmeetButton.setToolTipText(GraphicUtils.createToolTip("Pade Meetings"));
|
||||||
@ -51,12 +51,12 @@ public class ChatRoomDecorator
|
|||||||
if ("groupchat".equals(room.getChatType().toString()))
|
if ("groupchat".equals(room.getChatType().toString()))
|
||||||
{
|
{
|
||||||
newRoomId = roomId + "-" + sessionID;
|
newRoomId = roomId + "-" + sessionID;
|
||||||
newUrl = url + newRoomId;
|
newUrl = plugin.url + newRoomId;
|
||||||
plugin.handleClick(newUrl, room, newUrl, Message.Type.groupchat);
|
plugin.handleClick(newUrl, room, newUrl, Message.Type.groupchat);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
newRoomId = sessionID;
|
newRoomId = sessionID;
|
||||||
newUrl = url + newRoomId;
|
newUrl = plugin.url + newRoomId;
|
||||||
plugin.handleClick(newUrl, room, newUrl, Message.Type.chat);
|
plugin.handleClick(newUrl, room, newUrl, Message.Type.chat);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -40,11 +40,13 @@ import org.jxmpp.jid.parts.*;
|
|||||||
|
|
||||||
public class SparkMeetPlugin implements Plugin, ChatRoomListener, GlobalMessageListener
|
public class SparkMeetPlugin implements Plugin, ChatRoomListener, GlobalMessageListener
|
||||||
{
|
{
|
||||||
|
public Properties props = props = new Properties();
|
||||||
|
public String url = null;
|
||||||
|
|
||||||
private org.jivesoftware.spark.ChatManager chatManager;
|
private org.jivesoftware.spark.ChatManager chatManager;
|
||||||
private String url = null;
|
private final File pluginsettings = new File( Spark.getLogDirectory().getParentFile() + System.getProperty("file.separator") + "ofmeet.properties");
|
||||||
|
|
||||||
private static final File pluginsettings = new File(System.getProperty("user.home") + System.getProperty("file.separator") + "Spark" + System.getProperty("file.separator") + "ofmeet.properties");
|
private final Map<String, ChatRoomDecorator> decorators = new HashMap<>();
|
||||||
private final Map<String, ChatRoomDecorator> decorators = new HashMap<>();
|
|
||||||
private String electronExePath = null;
|
private String electronExePath = null;
|
||||||
private String electronHomePath = null;
|
private String electronHomePath = null;
|
||||||
private XProcess electronThread = null;
|
private XProcess electronThread = null;
|
||||||
@ -54,14 +56,12 @@ public class SparkMeetPlugin implements Plugin, ChatRoomListener, GlobalMessageL
|
|||||||
{
|
{
|
||||||
checkNatives();
|
checkNatives();
|
||||||
|
|
||||||
chatManager = SparkManager.getChatManager();
|
chatManager = SparkManager.getChatManager();
|
||||||
|
|
||||||
String server = SparkManager.getSessionManager().getServerAddress().toString();
|
String server = SparkManager.getSessionManager().getServerAddress().toString();
|
||||||
String port = "7443";
|
String port = "7443";
|
||||||
url = "https://" + server + ":" + port + "/ofmeet/";
|
url = "https://" + server + ":" + port + "/ofmeet/";
|
||||||
|
|
||||||
Properties props = new Properties();
|
|
||||||
|
|
||||||
if (pluginsettings.exists())
|
if (pluginsettings.exists())
|
||||||
{
|
{
|
||||||
Log.warning("ofmeet-info: Properties-file does exist= " + pluginsettings.getPath());
|
Log.warning("ofmeet-info: Properties-file does exist= " + pluginsettings.getPath());
|
||||||
@ -85,8 +85,23 @@ public class SparkMeetPlugin implements Plugin, ChatRoomListener, GlobalMessageL
|
|||||||
|
|
||||||
chatManager.addChatRoomListener(this);
|
chatManager.addChatRoomListener(this);
|
||||||
chatManager.addGlobalMessageListener(this);
|
chatManager.addGlobalMessageListener(this);
|
||||||
|
|
||||||
|
SparkMeetPreference preference = new SparkMeetPreference(this);
|
||||||
|
SparkManager.getPreferenceManager().addPreference(preference);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void commit(String url) {
|
||||||
|
this.url = url;
|
||||||
|
props.setProperty("url", url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
FileOutputStream outputStream = new FileOutputStream(pluginsettings);
|
||||||
|
props.store(outputStream, "Properties");
|
||||||
|
outputStream.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.warning("ofmeet-Error:", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void shutdown()
|
public void shutdown()
|
||||||
{
|
{
|
||||||
@ -292,7 +307,7 @@ public class SparkMeetPlugin implements Plugin, ChatRoomListener, GlobalMessageL
|
|||||||
|
|
||||||
if (roomId.indexOf('/') == -1)
|
if (roomId.indexOf('/') == -1)
|
||||||
{
|
{
|
||||||
decorators.put(roomId, new ChatRoomDecorator(room, url, this));
|
decorators.put(roomId, new ChatRoomDecorator(room, this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,119 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2004-2011 Jive Software. All rights reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.jivesoftware.spark.plugin.ofmeet;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import javax.swing.border.*;
|
||||||
|
import javax.xml.bind.DatatypeConverter;
|
||||||
|
|
||||||
|
import org.jivesoftware.spark.preference.Preference;
|
||||||
|
import org.jivesoftware.spark.util.log.Log;
|
||||||
|
|
||||||
|
public class SparkMeetPreference implements Preference {
|
||||||
|
public static final String NAMESPACE = "ofmeet";
|
||||||
|
|
||||||
|
private SparkMeetPlugin plugin;
|
||||||
|
private final UrlPanel panel = new UrlPanel();
|
||||||
|
|
||||||
|
public SparkMeetPreference(SparkMeetPlugin plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void commit() {
|
||||||
|
plugin.commit(panel.getUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getData() {
|
||||||
|
return plugin.props;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getErrorMessage() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JComponent getGUI() {
|
||||||
|
panel.setUrl(plugin.props.getProperty("url"));
|
||||||
|
return panel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Icon getIcon() {
|
||||||
|
byte[] imageByte = DatatypeConverter.parseBase64Binary(ChatRoomDecorator.ICON_STRING);
|
||||||
|
return new ImageIcon(imageByte);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getListName() {
|
||||||
|
return "Pade Meetings";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getNamespace() {
|
||||||
|
return NAMESPACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTitle() {
|
||||||
|
return "Pade Meetings Settings";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTooltip() {
|
||||||
|
return "Set URL for Pade Meetingst";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDataValid() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void shutdown() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class UrlPanel extends JPanel {
|
||||||
|
private static final long serialVersionUID = -5992704440953686499L;
|
||||||
|
private final JTextArea txtMessage = new JTextArea(2, 0);
|
||||||
|
|
||||||
|
UrlPanel() {
|
||||||
|
txtMessage.setBorder(UIManager.getLookAndFeelDefaults().getBorder("TextField.border"));
|
||||||
|
setLayout(new BorderLayout());
|
||||||
|
setBorder(BorderFactory.createCompoundBorder(new TitledBorder("Jitsi Meet URL"), new EmptyBorder(2,4,4,4)));
|
||||||
|
add(txtMessage, BorderLayout.CENTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String message) {
|
||||||
|
txtMessage.setText(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return txtMessage.getText().trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user