Restore ability to skip smiley replacement in URLs.

cefexperiments
Danny van Heumen 11 years ago
parent 4dbf5cd1f8
commit f4481d74c4

@ -2374,10 +2374,6 @@ private void processReplacementService(final ReplacementService service,
int startMatchPosition = plainTextInHtmlMatcher.start(1);
int endMatchPosition = plainTextInHtmlMatcher.end(1);
// The pattern might find URL's too, however links have already
// been processed by now, so it will at most find the anchor
// text.
// don't process nothing
// or don't process already processed links content
if (!StringUtils.isNullOrEmpty(plainTextAsHtml))
@ -2388,7 +2384,15 @@ private void processReplacementService(final ReplacementService service,
final String plaintext =
StringEscapeUtils.unescapeHtml4(plainTextAsHtml);
processText(plaintext, buff, pattern, service);
// Test whether this piece of content (exactly) matches a
// URL pattern. We should find at most a full URL text if it
// exists, since links have already been processed, so any
// URL is already wrapped in A-tags.
final boolean isURL =
URL_PATTERN.matcher(plaintext).matches();
processText(plaintext, buff, pattern, service, isURL);
startPos = endMatchPosition;
}
@ -2406,12 +2410,13 @@ private void processReplacementService(final ReplacementService service,
* @param pattern the pattern for current replacement service, created
* earlier so we don't create it for every text we check.
* @param rService the replacement service.
* @param skipSmileys whether to skip processing smileys
* @param isURL whether this content matches the URL pattern
*/
private void processText(final String plainText,
final StringBuilder msgBuff,
final Pattern pattern,
final ReplacementService rService)
final ReplacementService rService,
final boolean isURL)
{
Matcher m = pattern.matcher(plainText);
@ -2442,7 +2447,7 @@ private void processText(final String plainText,
{
if (cfg.getBoolean(ReplacementProperty.
getPropertyName("SMILEY"),
true))
true) && !isURL)
{
msgBuff.append("<IMG SRC=\"");
msgBuff.append(temp);

@ -137,6 +137,8 @@ private static MessageIrcImpl newActionFromIRC(final String user,
final String message)
{
String text = Utils.parseIrcMessage(message);
// TODO consider returning message starting with "/me " and let Jitsi do
// the /me formatting.
text = Utils.styleAsAction(text, user);
return new MessageIrcImpl(text, HTML_MIME_TYPE, DEFAULT_MIME_ENCODING,
null);

Loading…
Cancel
Save