mirror of
https://github.com/igniterealtime/Spark.git
synced 2026-03-30 19:34:32 +00:00
@ -339,46 +339,46 @@ public class StringUtils {
|
||||
* with their HTML escape sequences.
|
||||
*/
|
||||
public static String escapeHTMLTags(String in) {
|
||||
if (in == null) {
|
||||
return null;
|
||||
}
|
||||
char ch;
|
||||
int i = 0;
|
||||
int last = 0;
|
||||
char[] input = in.toCharArray();
|
||||
int len = input.length;
|
||||
StringBuilder out = new StringBuilder((int) (len * 1.3));
|
||||
for (; i < len; i++) {
|
||||
ch = input[i];
|
||||
if (ch > '>') {
|
||||
// Nothing to do
|
||||
} else if (ch == '<') {
|
||||
if (i > last) {
|
||||
out.append(input, last, i - last);
|
||||
}
|
||||
last = i + 1;
|
||||
out.append(LT_ENCODE);
|
||||
} else if (ch == '>') {
|
||||
if (i > last) {
|
||||
out.append(input, last, i - last);
|
||||
}
|
||||
last = i + 1;
|
||||
out.append(GT_ENCODE);
|
||||
} else if (ch == '"') {
|
||||
if (i > last) {
|
||||
out.append(input, last, i - last);
|
||||
}
|
||||
last = i + 1;
|
||||
out.append(QUOTE_ENCODE);
|
||||
}
|
||||
}
|
||||
if (last == 0) {
|
||||
return in;
|
||||
}
|
||||
if (i > last) {
|
||||
out.append(input, last, i - last);
|
||||
}
|
||||
return out.toString();
|
||||
if (in == null) {
|
||||
return null;
|
||||
}
|
||||
char ch;
|
||||
int i = 0;
|
||||
int last = 0;
|
||||
char[] input = in.toCharArray();
|
||||
int len = input.length;
|
||||
StringBuilder out = new StringBuilder((int) (len * 1.3));
|
||||
for (; i < len; i++) {
|
||||
ch = input[i];
|
||||
if (ch <= '>') {
|
||||
if (ch == '<') {
|
||||
if (i > last) {
|
||||
out.append(input, last, i - last);
|
||||
}
|
||||
last = i + 1;
|
||||
out.append(LT_ENCODE);
|
||||
} else if (ch == '>') {
|
||||
if (i > last) {
|
||||
out.append(input, last, i - last);
|
||||
}
|
||||
last = i + 1;
|
||||
out.append(GT_ENCODE);
|
||||
} else if (ch == '"') {
|
||||
if (i > last) {
|
||||
out.append(input, last, i - last);
|
||||
}
|
||||
last = i + 1;
|
||||
out.append(QUOTE_ENCODE);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (last == 0) {
|
||||
return in;
|
||||
}
|
||||
if (i > last) {
|
||||
out.append(input, last, i - last);
|
||||
}
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1261,58 +1261,57 @@ public class StringUtils {
|
||||
* @return the string with appropriate characters escaped.
|
||||
*/
|
||||
public static String escapeForXML(String string) {
|
||||
if (string == null) {
|
||||
return null;
|
||||
}
|
||||
char ch;
|
||||
int i = 0;
|
||||
int last = 0;
|
||||
char[] input = string.toCharArray();
|
||||
int len = input.length;
|
||||
StringBuilder out = new StringBuilder((int) (len * 1.3));
|
||||
for (; i < len; i++) {
|
||||
ch = input[i];
|
||||
|
||||
if (ch > '>') {
|
||||
// Nothing to do
|
||||
} else if (ch == '<') {
|
||||
if (i > last) {
|
||||
out.append(input, last, i - last);
|
||||
}
|
||||
last = i + 1;
|
||||
out.append(LT_ENCODE);
|
||||
} else if (ch == '&') {
|
||||
if (i > last) {
|
||||
out.append(input, last, i - last);
|
||||
}
|
||||
last = i + 1;
|
||||
out.append(AMP_ENCODE);
|
||||
} else if (ch == '"') {
|
||||
if (i > last) {
|
||||
out.append(input, last, i - last);
|
||||
}
|
||||
last = i + 1;
|
||||
out.append(QUOTE_ENCODE);
|
||||
} else if (ch == 10 || ch == 13 || ch == 9) {
|
||||
// Nothing to do
|
||||
} else if (ch < 32) {
|
||||
// Disallow all ASCII control characters, except space,
|
||||
// enter characters and tabs:
|
||||
if (i > last) {
|
||||
out.append(input, last, i - last);
|
||||
}
|
||||
last = i + 1;
|
||||
}
|
||||
}
|
||||
if (last == 0) {
|
||||
// Return after escaping <![CDATA]]> end sequence "]]>"
|
||||
return string.replace("]]>", "]]&gt;");
|
||||
}
|
||||
if (i > last) {
|
||||
out.append(input, last, i - last);
|
||||
}
|
||||
// Return after escaping <![CDATA]]> end sequence "]]>"
|
||||
return out.toString().replace("]]>", "]]&gt;");
|
||||
if (string == null) {
|
||||
return null;
|
||||
}
|
||||
char ch;
|
||||
int i = 0;
|
||||
int last = 0;
|
||||
char[] input = string.toCharArray();
|
||||
int len = input.length;
|
||||
StringBuilder out = new StringBuilder((int) (len * 1.3));
|
||||
for (; i < len; i++) {
|
||||
ch = input[i];
|
||||
if (ch <= '>') {
|
||||
if (ch == '<') {
|
||||
if (i > last) {
|
||||
out.append(input, last, i - last);
|
||||
}
|
||||
last = i + 1;
|
||||
out.append(LT_ENCODE);
|
||||
} else if (ch == '&') {
|
||||
if (i > last) {
|
||||
out.append(input, last, i - last);
|
||||
}
|
||||
last = i + 1;
|
||||
out.append(AMP_ENCODE);
|
||||
} else if (ch == '"') {
|
||||
if (i > last) {
|
||||
out.append(input, last, i - last);
|
||||
}
|
||||
last = i + 1;
|
||||
out.append(QUOTE_ENCODE);
|
||||
} else if (ch != 10 && ch != 13 && ch != 9) {
|
||||
// Disallow all ASCII control characters, except space,
|
||||
// enter characters and tabs:
|
||||
if (ch < 32) {
|
||||
if (i > last) {
|
||||
out.append(input, last, i - last);
|
||||
}
|
||||
last = i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (last == 0) {
|
||||
// Return after escaping <![CDATA]]> end sequence "]]>"
|
||||
return string.replace("]]>", "]]&gt;");
|
||||
}
|
||||
if (i > last) {
|
||||
out.append(input, last, i - last);
|
||||
}
|
||||
// Return after escaping <![CDATA]]> end sequence "]]>"
|
||||
return out.toString().replace("]]>", "]]&gt;");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -22,7 +22,7 @@ import org.jivesoftware.sparkimpl.plugin.idle.IdleTime;
|
||||
public class LinuxIdleTime implements IdleTime {
|
||||
/** Definition (incomplete) of the Xext library. */
|
||||
interface Xss extends Library {
|
||||
Xss INSTANCE = Native.loadLibrary("Xss", Xss.class);
|
||||
Xss INSTANCE = Native.load("Xss", Xss.class);
|
||||
|
||||
class XScreenSaverInfo extends Structure {
|
||||
public X11.Window window; /* screen saver window */
|
||||
|
||||
@ -12,7 +12,7 @@ public class MacIdleTime implements IdleTime {
|
||||
|
||||
public interface ApplicationServices extends Library {
|
||||
|
||||
ApplicationServices INSTANCE = Native.loadLibrary("ApplicationServices", ApplicationServices.class);
|
||||
ApplicationServices INSTANCE = Native.load("ApplicationServices", ApplicationServices.class);
|
||||
|
||||
int kCGAnyInputEventType = ~0;
|
||||
int kCGEventSourceStatePrivate = -1;
|
||||
|
||||
@ -15,7 +15,7 @@ import java.util.List;
|
||||
*/
|
||||
public class Win32IdleTime implements IdleTime {
|
||||
public interface Kernel32 extends StdCallLibrary {
|
||||
Kernel32 INSTANCE = Native.loadLibrary("kernel32", Kernel32.class);
|
||||
Kernel32 INSTANCE = Native.load("kernel32", Kernel32.class);
|
||||
|
||||
/**
|
||||
* Retrieves the number of milliseconds that have elapsed since the system was started.
|
||||
@ -26,7 +26,7 @@ public class Win32IdleTime implements IdleTime {
|
||||
}
|
||||
|
||||
public interface User32 extends StdCallLibrary {
|
||||
User32 INSTANCE = Native.loadLibrary("user32", User32.class);
|
||||
User32 INSTANCE = Native.load("user32", User32.class);
|
||||
/**
|
||||
* Contains the time of the last input.
|
||||
* @see "http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputstructures/lastinputinfo.asp"
|
||||
|
||||
@ -49,7 +49,7 @@ public class AppleDock implements ActionListener {
|
||||
frame.add(menu);
|
||||
|
||||
// set dock menu
|
||||
Application app = new Application();
|
||||
Application app = Application.getApplication();
|
||||
app.setDockMenu(menu);
|
||||
|
||||
}
|
||||
|
||||
@ -216,8 +216,8 @@ public class Workpane {
|
||||
SparkManager.getChatManager().addInvitationListener(roomInviteListener);
|
||||
}
|
||||
|
||||
public Map getMetadata(String sessionID) {
|
||||
Map map = null;
|
||||
public Map<String, List<String>> getMetadata(String sessionID) {
|
||||
Map<String, List<String>> map = null;
|
||||
if (offerMap.get(sessionID) != null) {
|
||||
Offer offer = offerMap.get(sessionID);
|
||||
map = offer.getMetaData();
|
||||
@ -258,11 +258,10 @@ public class Workpane {
|
||||
}
|
||||
}
|
||||
|
||||
public void decorateRoom(ChatRoom room, Map metadata) {
|
||||
public void decorateRoom(ChatRoom room, Map<String, List<String>> metadata) {
|
||||
EntityBareJid roomName = room.getBareJid();
|
||||
Localpart sessionID =roomName.getLocalpart();
|
||||
|
||||
|
||||
RequestUtils utils = new RequestUtils(metadata);
|
||||
|
||||
addRoomInfo(sessionID, utils, room);
|
||||
@ -617,8 +616,10 @@ public class Workpane {
|
||||
else if (message != null) {
|
||||
MetaData metaDataExt = message.getExtension(MetaData.ELEMENT_NAME, MetaData.NAMESPACE);
|
||||
if (metaDataExt != null) {
|
||||
Map metadata = metaDataExt.getMetaData();
|
||||
metadata.put("sessionID", chat.getRoom().getLocalpart().toString());
|
||||
Map<String, List<String>> metadata = metaDataExt.getMetaData();
|
||||
List<String> values = new ArrayList<>();
|
||||
values.add(chat.getRoom().getLocalpart().toString());
|
||||
metadata.put("sessionID", values);
|
||||
|
||||
RequestUtils utils = new RequestUtils(metadata);
|
||||
inviteMap.put(utils.getSessionID(), metadata);
|
||||
@ -637,9 +638,11 @@ public class Workpane {
|
||||
* @param offer the <code>Offer</code>
|
||||
*/
|
||||
public void handleOfferInvite(final Offer offer) {
|
||||
Map metadata = offer.getMetaData();
|
||||
Map<String, List<String>> metadata = offer.getMetaData();
|
||||
String sessionID = offer.getSessionID();
|
||||
metadata.put("sessionID", sessionID);
|
||||
List<String> values = new ArrayList<>();
|
||||
values.add(sessionID);
|
||||
metadata.put("sessionID", values);
|
||||
|
||||
RequestUtils utils = new RequestUtils(metadata);
|
||||
inviteMap.put(sessionID, metadata);
|
||||
@ -704,36 +707,6 @@ public class Workpane {
|
||||
}
|
||||
}
|
||||
|
||||
private Message getMessage(String messageText, RequestUtils util, boolean transfer) {
|
||||
Map metadata = new HashMap();
|
||||
metadata.put("messageText", messageText);
|
||||
metadata.put("username", util.getUsername());
|
||||
metadata.put("userID", util.getUserID());
|
||||
metadata.put("transfer", Boolean.toString(transfer));
|
||||
metadata.put("question", util.getQuestion());
|
||||
metadata.put("email", util.getEmailAddress());
|
||||
metadata.put("workgroup", util.getWorkgroup());
|
||||
|
||||
if (ModelUtil.hasLength(util.getRequestLocation())) {
|
||||
metadata.put("Location", util.getRequestLocation());
|
||||
}
|
||||
|
||||
// Add Metadata as message extension
|
||||
final MetaData data = new MetaData(metadata);
|
||||
Message message = new Message();
|
||||
message.addExtension(data);
|
||||
return message;
|
||||
|
||||
}
|
||||
|
||||
private RequestUtils getRequestUtils(String sessionID) {
|
||||
Map map = getMetadata(sessionID);
|
||||
if (map != null) {
|
||||
return new RequestUtils(map);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void setupQueueViewer() {
|
||||
FastpathPlugin.getUI().getMainPanel().addTab(FpRes.getString("tab.queue.activity"), null, queueActivity);
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@ import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.KeyListener;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.Icon;
|
||||
@ -367,7 +368,7 @@ public class CoBrowser extends JPanel implements ActionListener, BrowserListener
|
||||
}
|
||||
|
||||
private String getStartLocation() {
|
||||
Map metadata = FastpathPlugin.getLitWorkspace().getMetadata(sessionID);
|
||||
Map<String, List<String>> metadata = FastpathPlugin.getLitWorkspace().getMetadata(sessionID);
|
||||
RequestUtils utils = new RequestUtils(metadata);
|
||||
String location = utils.getRequestLocation();
|
||||
if (location == null) {
|
||||
|
||||
@ -36,6 +36,7 @@ import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
@ -52,9 +53,9 @@ public class RoomInformation extends JPanel {
|
||||
|
||||
}
|
||||
|
||||
public void showAllInformation(Map map) {
|
||||
public void showAllInformation(Map<String, List<String>> map) {
|
||||
if (map == null) {
|
||||
map = new HashMap();
|
||||
map = new HashMap<>();
|
||||
}
|
||||
|
||||
LiveTitlePane titlePanel = new LiveTitlePane(FpRes.getString("title.request.information"), FastpathRes.getImageIcon(FastpathRes.FASTPATH_IMAGE_24x24));
|
||||
|
||||
@ -25,6 +25,7 @@ import java.awt.Insets;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
@ -88,7 +89,7 @@ public class ChatQueue extends JPanel {
|
||||
return;
|
||||
}
|
||||
|
||||
Map metadata = offer.getMetaData();
|
||||
Map<String, List<String>> metadata = offer.getMetaData();
|
||||
RoomInformation roomInformation = new RoomInformation();
|
||||
roomInformation.showAllInformation(metadata);
|
||||
roomInformation.showRoomInformation();
|
||||
|
||||
@ -65,7 +65,7 @@ import org.jxmpp.util.XmppStringUtils;
|
||||
|
||||
public class InvitationPane {
|
||||
|
||||
private Map metadata = null;
|
||||
private Map<String, List<String>> metadata = null;
|
||||
private GroupChatRoom chatRoom;
|
||||
|
||||
public InvitationPane(final RequestUtils request, final EntityBareJid room, final EntityBareJid inviter, String reason, final String password, final Message message) {
|
||||
|
||||
@ -73,7 +73,7 @@ import org.jxmpp.jid.util.JidUtil;
|
||||
*/
|
||||
public class UserInvitationPane {
|
||||
|
||||
private Map metadata;
|
||||
private Map<String, List<String>> metadata;
|
||||
private AcceptListener listener;
|
||||
|
||||
private Offer offer;
|
||||
|
||||
@ -25,13 +25,13 @@ import org.jxmpp.jid.impl.JidCreate;
|
||||
|
||||
|
||||
public class RequestUtils {
|
||||
private final Map metadata;
|
||||
private final Map<String, List<String>> metadata;
|
||||
|
||||
public RequestUtils(Map requestData) {
|
||||
public RequestUtils(Map<String, List<String>> requestData) {
|
||||
this.metadata = requestData;
|
||||
}
|
||||
|
||||
public Map getMetadata() {
|
||||
public Map<String, List<String>> getMetadata() {
|
||||
return metadata;
|
||||
}
|
||||
|
||||
@ -107,8 +107,8 @@ public class RequestUtils {
|
||||
return getMetadata() == null ? null : getFirstValue("sessionID");
|
||||
}
|
||||
|
||||
public Map getMap() {
|
||||
final Map returnMap = new HashMap(metadata);
|
||||
public Map<String, List<String>> getMap() {
|
||||
final Map<String, List<String>> returnMap = new HashMap<>(metadata);
|
||||
returnMap.remove("sessionID");
|
||||
returnMap.remove("transfer");
|
||||
returnMap.remove("workgroup");
|
||||
|
||||
@ -23,7 +23,7 @@ public class MacNotificationCenter {
|
||||
File dylib = new File(Spark.getPluginDirectory().getAbsolutePath()
|
||||
+ File.separator + "roar" + File.separator + "native" + File.separator + "NSUserNotificationsBridge.dylib" );
|
||||
|
||||
NSUserNotificationsBridge instance = Native.loadLibrary(dylib.getAbsolutePath(), NSUserNotificationsBridge.class);
|
||||
NSUserNotificationsBridge instance = Native.load(dylib.getAbsolutePath(), NSUserNotificationsBridge.class);
|
||||
|
||||
int sendNotification(String title, String subtitle, String text, int timeoffset, String sound);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user