<URL: http://bugs.freeciv.org/Ticket/Display.html?id=11533 >
> [dmarks - Sun Dec 02 06:40:47 2007]:
> > [wsimpson - Sun Jun 24 18:31:37 2007]:
> > While searching for color reports, found these two and linked
> > http://bugs.freeciv.org/Ticket/Display.html?id=2771
> > I'm replying on the more recent one, currently client-gtk-2.0, the
> older is
> > currently client (generic).
> > Surely, it's time to resolve this very old issue?
> I agree. IIRC, warclient has this feature, so we could take a look at
> implementation. Since their development is very multiplayer-centric,
> they might
> have an efficient solution.
If by efficient you mean "gratuitously overdone", then
yes, we have the solution for you :) (I speak only about
coloring in the chatline; coloring in the "Messages"
window might be nice too, and rather more easily done,
but nobody ever felt the need for it. Thus when I refer
to "messages" below, I mean chat messages). The only
good point about my implementation is that if you have
the brain to understand it, you can make it do whatever
you want. Obviously this is no good for users that are
not also avid programmers (you can take a look at the
monstrosity in client/gui-gtk2.0/chatline.c; it is after
the chat-link code, which is rather bloated in itself,
but that is mostly due to the gtk api).
The problem with doing client-side coloring based
on pattern matching for anything other than trivial
check-the-first-character type methods is that changes in
server messages or servers running in different locales
potentially break the patterns (and the user has to then
annoyingly change/add patterns). Thus an alternative is to
have the server colorize the messages, e.g. in the manner
of IRC or certain FPS games: use an escape character
followed by one or two numbers that indicate that the
following text should be colored accordingly. To avoid
exposing poor, older version freeciv users to messages
besprinkled with ugly escape sequences, the server can
strip them away right before sending based on a capability
e.g. "chatcolors". Unforunately this solution removes all
control from the users; they have to take what the server
gives, and like it!
So it seems a simple solution that makes everyone happy
is not so obvious. I suggest that in addition to giving
clients the capability to colorize messages based on escape
sequences, the server should send additional information
with chat messages indicating what the message is about
(similar to IRC messages codes) that the client can then
use, along with some configurable regular expression rules
(a toned-down more efficient version of my "tag patterns"
code), to transform messages as desired.
Or you could just embed lua in the client too and have
hooks to do chat coloring :).
Well, those are just some ideas. Take what you will...
Freeciv-dev mailing list