Reworked the emote parsing to properly handle "wrapped" emotes. A
wrapped emote is one that is wrapped in colons or square braces (eg,
:Kappa: or [Kappa]). This allows emotes to be input without a space
between them, like is required with non-wrapped emotes.
A new configuration setting has been added to only allow parsing of
wrapped emotes: "WrappedEmotesOnly". This defaults to False as to not
break current configurations.
The emote autocompletion will only insert non-wrapped emotes. Setting
"WrappedEmotesOnly" configuration value to True will not change this.
Lastly, made the bare-word emote parsing a bit cleaner by removing a for
loop in favor of a map lookup with a check. This should in theory be
more efficient.
This change is in response to #111. The issue should not be considered
resolved until the autocompletion handles the new setting correctly.
Don't reload emotes directly into the global common.Emotes variable.
Instead, load them into a new variable and write that to common.Emotes
after the search for new emotes completes. Emotes should no longer
duplicate for each run of `/reloademotes`.
Also tweaked `/addemotes` to automatically reload emotes if nothing went
wrong downloading a new set.
This reworks how emotes are cached in relation to their physical
location on disk. Functionally, they should be the same from the user
perspective but it sets up some stuff that will make it easier to add
emotes from various sources.
Functions added:
- LogErrorf()
- LogErrorln()
- LogChatf()
- LogChatln()
- LogInfof()
- LogInfoln()
- LogDebugf()
- LogDebugln()
- LogDevf()
- LogDevln()
New settings configure the logging: LogLevel and LogFile. LogLevel can
be set to one of: error, chat, info, or debug and will default to
error. LogFile is an optional file to write to. Providing a file will
not prevent output in the console.
LogDevf() and LogDevln() only compile when the "dev" flag passed to
build. This will cause Travis-CI to fail the build if it finds any
calls to either function.
All emotes are set to have a height of 28px. This fixes the
auto-scroll on message when the message has emotes, but it also forces
all emotes to be 28px high.
Moved to common/utils.go:
- IsValidName() (function replaces direct calls to regexp.MatchString())
- RandomColor()
Moved to common/emotes.go:
- LoadEmotes()
Using this command will change the current user's nickname in chat.
It has an alias of /name.
An admin can force a name change by supplying the current name and a new
name. If a name has been changed by an admin, that user can no longer
change their name (similar to forced color change).
Resolves#42