MCMrARM / revolution-irc

A modern Android IRC client. #revolutionirc on Libera.chat
GNU General Public License v3.0
542 stars 63 forks source link

Not support mIRC background color? #329

Open Mosesofmason opened 1 year ago

Mosesofmason commented 1 year ago

The mIRC background color does not display correctly.

e.g.

<CODE><COLOR>,<COLOR>

CODE is ASCII 0x03
COLOR is 00~99 IRC color characters
The first <COLOR> is the foreground, and the second <COLOR> is the background color (if sent).
kurahaupo commented 1 year ago

This seems odd to say the least. (I personally use revolution IRC every day, and it displays foreground and background colours just fine at least 99% of the time. I know there are occasional glitches, but they're almost always when sending, not receiving.)

(Without testing multiple colours, it's difficult to know whether the lack of change is simply because the selected colour is already the same as the default background. The colour codes for "black" and "white" are ambiguous because clients differ which way round they go and whether they change if you invert the colour scheme.)

Are you sure you're not in a channel that has mIRC attribute filtering turned on? (Sometimes the channel owners simply don't like coloured text.)

Can you give an example of a byte stream that does not display correctly, as recorded raw logs if possible? Can you provide a screenshot?

Mosesofmason commented 1 year ago

@kurahaupo Yes, it happens always in all channels. I just tested 0x03 5 8 , 6 6 <some random test words>, below is the screenshots comparison between mIRC and Revolution IRC

mIRC: image

Revolution IRC: image

kurahaupo commented 1 year ago

It appears that you're using a non-standard recent extension, as only colours for codes 00 through 15 are specified in any mIRC documentation I could find.

Revolution IRC takes a conservative approach to security, and - as a security measure - where a message contains any invalid attribute code, no interpretation of any attribute is performed on the displayed text. Accordingly the numeric codes 16 through 98 are treated as undefined attribute codes. This is enforced by a check for invalid colour codes.

I will review this policy with regard to colour codes, with a view to treating any undefined colours as "default" (equivalent to 99).

On the one hand the mirc.com website claims that codes 16 through 98 apply to "all IRC users" rather than "all mIRC users", but on the other hand, it fails to document the RGB values for these codes, making it difficult for other IRC clients to provide this supposedly universal behaviour.

If you can cite a reliable source for a table of RGB values for the colour codes 16 through 98 I will be more than happy to add them to Revolution IRC.

Mosesofmason commented 1 year ago

It seems the linked document has not been updated for a while and so is outdated. The mIRC can input 16~99 color codes by pressing Ctrl-K for years. I found another mIRC color document that addresses this issue,

For the RGB values of 16~98, I found a table that is based on a mIRC forums thread, which dates back to 2013. Hope this can help the development.

16-27   470000  472100  474700  324700  004700  00472c  004747  002747  000047  2e0047  470047  47002a
28-39   740000  743a00  747400  517400  007400  007449  007474  004074  000074  4b0074  740074  740045
40-51   b50000  b56300  b5b500  7db500  00b500  00b571  00b5b5  0063b5  0000b5  7500b5  b500b5  b5006b
52-63   ff0000  ff8c00  ffff00  b2ff00  00ff00  00ffa0  00ffff  008cff  0000ff  a500ff  ff00ff  ff0098
64-75   ff5959  ffb459  ffff71  cfff60  6fff6f  65ffc9  6dffff  59b4ff  5959ff  c459ff  ff66ff  ff59bc
76-87   ff9c9c  ffd39c  ffff9c  e2ff9c  9cff9c  9cffdb  9cffff  9cd3ff  9c9cff  dc9cff  ff9cff  ff94d3
88-98   000000  131313  282828  363636  4d4d4d  656565  818181  9f9f9f  bcbcbc  e2e2e2  ffffff
kurahaupo commented 1 year ago

Thanks for the table and the link to the forum. I will see about creating a pull request to add them shortly.

There's one error in the proposal: it refers to 99 as transparent. That certainly doesn't match the meaning ascribed to "transparent" in the CSS standard, nor in ordinary English, since the effect of 99 is different for the foreground and background colours. It would be more appropriate to say that 99 reverts to a default or initial colour.

There's also an error in the description where it says These colors are based on the VGA/XP/ANSI color table. Whilst it has the same range of colours, that's down to purely physical constraints. It's clearly not based on VGA or ANSI as the order of the table is quite different. (VGA & ANSI use bitwise chromatic mixing; the primary colours red, green & blue have codes 1, 2 & 4, "bright" has code 8, and the other colours have the appropriate bitwise sums of those numbers.)

Just for the sake of future readers, I note that the linked page references a proposal for an extension back in 2012. Wider adoption didn't occur until around 2017, and standardization is seemingly still pending. (But if anyone can point me at an RFC or other formal standard for the mIRC extended colours, I would much appreciate it.)

All that said, the mIRC colour encoding has always been ambiguous and fragile, and in hindsight the community would have been far better served by formally adopting ANSI-style escape sequences as the preferred colour encoding, as they are a proven technology, don't have weird ambiguities that conflate attributes and text, are readily extensible, and were already accepted by clients well before mIRC came along, and still are accepted by some including mIRC.

Skpij commented 1 year ago

Helo

kurahaupo commented 1 year ago

@Skpij I see that you're new to GitHub.

It's important to understand that this is not an interactive forum, and there will typically be days or even weeks between messages. You do not need to introduce yourself or "ask to be allowed to speak".

On the contrary, please skip any pleasantries and start directly by stating the problem you're having with RevolutionIRC (describe what you expect, and how it fails to do meet your expectations), and then any questions or suggestions.

If you don't have any interest in RevolutionIRC, and you're simply looking to learn about GitHub, then I suggest searching for software packages that you are using.

kurahaupo commented 1 year ago

I've submitted PR #332 to add support for mIRC extended colour codes, plus ANSI colour codes, and ANSI attributes (bold, italic, underline, inverse)

Mosesofmason commented 1 year ago

Hi, when will this change live in the store (Google Play or F-Droid)?

kurahaupo commented 1 year ago

Hi, when will this change live in the store (Google Play or F-Droid)?

We will need to prod @MCMrARM into acting on this, or handing the project over to a successor, or providing a transition package on Google Play that refers users to a new fork of the project.