Bug - Fixed KoLmafia Chat GUI does not show Pirate Bellow chat effect

Veracity

Developer
Staff member
Split from the thread that was discussing how to handle the Swagger Shop, the new pirate item in it, and the skill it gives you. Since all of those are New Content and are completely unrelated to a Bug in the Chat GUI relating to how it renders (or fails to render) the resulting chat effect, this is now its own Bug report.
 

Veracity

Developer
Staff member
I just tried this. It showed them just fine.

I have "modern" chat open in the Relay Browser and also KoLmafia's Chat GUI.
I typed "Yarr, matey!" into the relay chat.
We submitted this:

http://www.kingdomofloathing.com/submitnewchat.php?playerid=121572&graf=%2Ftalkie+Yarrr%2C+matey%21&j=1&pwd

Here is what KoL sent back:

Code:
{"msgs":[{"msg":"<b><img src=\"http:\/\/images.kingdomofloathing.com\/otherimages\/12x12skull.gif\" height=\"12\" width=\"12\" \/> Yarrr, matey! <img src=\"http:\/\/images.kingdomofloathing.com\/otherimages\/12x12skull.gif\" height=\"12\" width=\"12\" \/><\/b>","type":"public","mid":"1385992312","who":{"name":"Veracity","id":"121572","color":"black"},"format":"0","channel":"talkie","channelcolor":"green","time":"1410616748"}],"last":"1385992312","delay":3000}

And the KoLmafia Chat GUI showed the message, images and all.

I just ascended, so I can try this again, but obviously what I did worked fine, so that seems pointless - especially for a once-per-day test. What did you do differently?

- Did you have ONLY the KoLmafia chat GUI open?
- Therefore, did you bellow into that - or did somebody else bellow and it didn't render correctly?

For the moment, I'll mark this Waiting for Info, but until/unless I hear back, this will go to Cannot Reproduce.
 

Lxndr

Member
I had only the kolmafia chat GUI open, yes. Once I started using Kolmafia, I stopped using the native browser chat.

Someone else bellowed. I haven't gotten the skill yet.
 

lostcalpolydude

Developer
Staff member
I just verified that it works in older chat on KoL's end (at least for a message that you send), so that probably isn't the cause.
 

Lxndr

Member
Just downloaded the newest build.
Again, without having a duplicate chat open in the relay browser, the chat GUI is emboldening the messages, but not appending the jollies roger.
 

Ensiferum

Member
I just tried this. It showed them just fine.
- Did you have ONLY the KoLmafia chat GUI open?
- Therefore, did you bellow into that - or did somebody else bellow and it didn't render correctly?

As someone who uses ONLY KoLmafia chat GUI I can confirm that it doesn't render the symbols from incoming bellows.
 

Veracity

Developer
Staff member
OK. I'll start up a multi in clan chat with the KoLmafia GUI, will log my main into a vanilla browser and sent her to that clan, and will bellow with logging turned on. I'll see what we receive and will have what I need, I assume, to be able to test it at will.
 

Veracity

Developer
Staff member
Confirmed.

My multi received this:

Code:
<font color=green>[clan]</font> <b><a target=mainpane href="showplayer.php?who=121572"><font color=black>Veracity</font></b></a>: <b><img src="http://images.kingdomofloathing.com/otherimages/12x12skull.gif" height="12" width="12" /> Yarrr matey! <img src="http://images.kingdomofloathing.com/otherimages/12x12skull.gif" height="12" width="12" /></b><br><!--lastseen:1386005067-->
but displayed (in bold) simply "Yarrr matey!"
 

Lxndr

Member
I know that I don't have 12x12skull.gif in my local images folder.
Perhaps there's an issue with the chat gui handling image tags? Has there ever been a need before? (Gemelli's skill, I guess?)
 

Veracity

Developer
Staff member
When I used the effect in the tabbed chat in the relay browser, we echoed it to the chat GUI and the image showed up just fine
 

Lxndr

Member
Do you have the 12x12skull.gif? (in images\otherimages)

What happens if you don't have it, AND don't have the tabbed chat open?
 

Bale

Minion
Do you have the 12x12skull.gif? (in images\otherimages)

What happens if you don't have it, AND don't have the tabbed chat open?

It's obviously not a cache issue since Veracity confirmed that she sees the images on the character who sends the message, but does not see the images on a multi that receives that same message. Both characters have the image in images\otherimages. There are some small differences in the received html so that must be the cause, but it doesn't seem malformed to me. Does KoLmafia chat need all the slashes escaped with back-slashes?

Veracity, do I understand that properly?
 

Veracity

Developer
Staff member
You understood me correctly.

I'll poke at this today and see if I can figure out what's happening. The char GUI is new territory, for me.
 

Veracity

Developer
Staff member
OK. I see that ChatParser.parseLines (which is used to look at the "older" style messages, as used by the chat GUI) calls ChatFormatter.formatExternalMessage, which calls ChatFormatter.getNormalizedMessage. That last method explicitly removes images, using the following pattern:

Code:
	private static final Pattern IMAGE_PATTERN = Pattern.compile( "<img.*?>" );
...
		String noImageContent = ChatFormatter.IMAGE_PATTERN.matcher( originalContent ).replaceAll( "" );
Assuming that it's a good thing to strip out images (I hesitate to whack the chat GUI without understanding the decision), I expect that I can put in some sort of negative look-behind into that pattern to exclude the pirate gif from being excised
 

lostcalpolydude

Developer
Staff member
I can't think of any good reason to remove images, especially when the GUI can display them fine. There's also the image from SuperStar that people probably wouldn't mind seeing. Since I don't think anything besides cool KoL effects are capable of putting images into chat, filtering them out seems unnecessary and undesirable.
 

Veracity

Developer
Staff member
Heh. I have the following pattern:

Code:
	private static final Pattern IMAGE_PATTERN = Pattern.compile( "<img.*?/(.*?)(?<!12x12skull)\\.gif.*?>" );
which will exclude the pirate skull as an image to remove. It's easy to add additional "blessed" images to that pattern, but it's easier still to not bother filtering them out.
 

Veracity

Developer
Staff member
Revision 14639 no longer strips out images. I left the "fixed" Pattern, as given above, but don't use it. If we decide for some reason that we do want to have only a list of "allowed" images", it will be there for us.

Tested with the saved HTML from yesterday's bellow - and then, when that worked, with today's live bellow. Fortunately, it worked. :)
 
Top