Merge pull request #12
fix: hide unused ECLS indices from chat selector menu
This commit is contained in:
+21
-10
@@ -559,15 +559,16 @@ public sealed class ChatLogWindow : Window, IUiComponent {
|
|||||||
name += $": {lsName}";
|
name += $": {lsName}";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (channel.IsExtraChatLinkshell() && Plugin.ExtraChat.ChannelNames.Count == 0) {
|
if (channel.IsExtraChatLinkshell()) {
|
||||||
// Sadly the ExtraChat IPC doesn't provide a method to
|
// Check if the linkshell with this index is registered in
|
||||||
// lookup what channel numbers are assigned, or what the
|
// the ExtraChat plugin by seeing if the command is
|
||||||
// channel names are.
|
// registered. The command gets registered only if a
|
||||||
//
|
// linkshell is assigned (and even gets unassigned if the
|
||||||
// Show all ExtraChat options if the user is in at least
|
// index changes!).
|
||||||
// one channel.
|
if (!Plugin.CommandManager.Commands.ContainsKey(channel.Prefix())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ImGui.Selectable(name)) {
|
if (ImGui.Selectable(name)) {
|
||||||
SetChannel(channel);
|
SetChannel(channel);
|
||||||
@@ -702,11 +703,21 @@ public sealed class ChatLogWindow : Window, IUiComponent {
|
|||||||
internal void SetChannel(InputChannel? channel)
|
internal void SetChannel(InputChannel? channel)
|
||||||
{
|
{
|
||||||
channel ??= InputChannel.Say;
|
channel ??= InputChannel.Say;
|
||||||
|
|
||||||
_tellTarget = null;
|
_tellTarget = null;
|
||||||
|
|
||||||
|
// Instead of calling SetChannel(), we ask the ExtraChat plugin to set a
|
||||||
|
// channel override by just calling the command directly.
|
||||||
if (channel.Value.IsExtraChatLinkshell()) {
|
if (channel.Value.IsExtraChatLinkshell()) {
|
||||||
// Instead of calling SetChannel(), we ask the ExtraChat plugin to
|
// Check that the command is registered in Dalamud so the game code
|
||||||
// set a channel override by just calling the command directly.
|
// never sees the command itself.
|
||||||
|
if (!Plugin.CommandManager.Commands.ContainsKey(channel.Value.Prefix())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send the command through the game chat. We can't call
|
||||||
|
// ICommandManager.ProcessCommand() here because ExtraChat only
|
||||||
|
// registers stub handlers and actually processes its commands in a
|
||||||
|
// SendMessage detour.
|
||||||
var bytes = Encoding.UTF8.GetBytes(channel.Value.Prefix());
|
var bytes = Encoding.UTF8.GetBytes(channel.Value.Prefix());
|
||||||
Plugin.Common.Functions.Chat.SendMessageUnsafe(bytes);
|
Plugin.Common.Functions.Chat.SendMessageUnsafe(bytes);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user