Project

General

Profile

Actions

Bug #5218

closed

In C# API, when using random nick extended colors, User.RgbNickColor property is always empty string

Added by Jonathan Kay over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Plugin
Target version:
Start date:
01/28/2021
Due date:
% Done:

0%

Estimated time:
Operative System:
All
Regression:
No

Description

(You can workaround this issue by using the evaluated color line below, reporting for completeness.)

When using Nick Colors, 'Use random nick colors' and 'Use extended color list' options, the RgbNickColor property appears to always return empty string.

For example, for the following code:

        private void PluginHost_OnChannelNormalMessage(AdiIRCAPIv2.Arguments.ChannelMessages.ChannelNormalMessageArgs argument)
        {
            string color = argument.Channel.Evaluate($"$rgb($nick({argument.Channel.Name},{argument.User.Nick}).rgbcolor).hex", "");
            argument.Channel.ExecuteCommand($"/echo -g {argument.Channel.Name} NickColor: {argument.User.NickColor}");
            argument.Channel.ExecuteCommand($"/echo -g {argument.Channel.Name} RgbNickColor: {argument.User.RgbNickColor}");
            argument.Channel.ExecuteCommand($"/echo -g {argument.Channel.Name} Evaluated Color: {color}");
        }

Will return on a new channel message:
NickColor: 4
RgbNickColor:
Evaluated Color: 762671

  • The NickColor is the correct random color if the extended color list option was off.
  • The Evaluated Color is correct, evaluated using $nick.
  • If a non-randomized extended nick color is set for the nick, RgbNickColor returns that color correctly.

The test project can be found at: https://github.com/TReKiE/AdiTestNickColor/

Actions #1

Updated by Per Amundsen over 1 year ago

  • Status changed from New to Resolved

Thanks for making the test project, it saved me some time. This issue is fixed for next beta.

Keep in mind it returns a int/$rgb value of the color, so to use it as a color you have to cast the string to int, something like:

if (!string.IsNullOrEmpty(argument.User.RgbNickColor))
{
  Color color = Color.FromArgb(Convert.ToInt32(argument.User.RgbNickColor));
}
Actions #2

Updated by Per Amundsen over 1 year ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF