docs(ipc): align IPC integration guide with HellionChat.* channel names
ipc.md guides third-party plugin authors who want to bind to our context-menu IPC and our typing-state IPC. After the v1.0.0 channel rename (ChatTwo.* → HellionChat.*) the example code in this file no longer matched the channels the plugin actually exposes — third-party authors who copy-pasted from the doc would see silent no-op subscriptions. Updated: - All 6 channel string literals in code samples (Register, Unregister, Invoke, Available, GetChatInputState, ChatInputStateChanged) - Code-path references in the Typing State IPC explanation block (HellionChat.Code.ChatType, HellionChat/Configuration.cs etc.) - Class/variable name in the example (ChatTwoIpc → HellionChatIpc) - Prose references to the plugin name Added a short migration note at the top so existing integrators see the rename in one paragraph instead of having to diff the file.
This commit is contained in:
@@ -1,7 +1,12 @@
|
|||||||
# Context Menu IPC Integration
|
# Context Menu IPC Integration
|
||||||
|
|
||||||
If you want to display custom menu items in the chat context menu, you can use
|
If you want to display custom menu items in the chat context menu, you can use
|
||||||
Chat 2's IPC.
|
Hellion Chat's IPC.
|
||||||
|
|
||||||
|
> **Migrating from Chat 2:** the channel-name prefix changed from `ChatTwo.*` to
|
||||||
|
> `HellionChat.*` in v1.0.0. If you previously bound to `ChatTwo.Register` etc.,
|
||||||
|
> rename to `HellionChat.Register` etc. Tuple shapes and call semantics are
|
||||||
|
> unchanged.
|
||||||
|
|
||||||
Here's an example.
|
Here's an example.
|
||||||
|
|
||||||
@@ -14,7 +19,7 @@ public class ContextMenuIntegration {
|
|||||||
// when your plugin is unloaded.
|
// when your plugin is unloaded.
|
||||||
private ICallGateSubscriber<string, object?> Unregister { get; }
|
private ICallGateSubscriber<string, object?> Unregister { get; }
|
||||||
// You should subscribe to this event in order to receive a notification
|
// You should subscribe to this event in order to receive a notification
|
||||||
// when Chat 2 is loaded or updated, so you can re-register.
|
// when Hellion Chat is loaded or updated, so you can re-register.
|
||||||
private ICallGateSubscriber<object?> Available { get; }
|
private ICallGateSubscriber<object?> Available { get; }
|
||||||
// Subscribe to this to draw your custom context menu items.
|
// Subscribe to this to draw your custom context menu items.
|
||||||
private ICallGateSubscriber<string, PlayerPayload?, ulong, Payload?, SeString?, SeString?, object?> Invoke { get; }
|
private ICallGateSubscriber<string, PlayerPayload?, ulong, Payload?, SeString?, SeString?, object?> Invoke { get; }
|
||||||
@@ -22,18 +27,18 @@ public class ContextMenuIntegration {
|
|||||||
// The registration ID.
|
// The registration ID.
|
||||||
private string? _id;
|
private string? _id;
|
||||||
|
|
||||||
public ChatTwoIpc(DalamudPluginInterface @interface) {
|
public HellionChatIpc(DalamudPluginInterface @interface) {
|
||||||
this.Register = @interface.GetIpcSubscriber<string>("ChatTwo.Register");
|
this.Register = @interface.GetIpcSubscriber<string>("HellionChat.Register");
|
||||||
this.Unregister = @interface.GetIpcSubscriber<string, object?>("ChatTwo.Unregister");
|
this.Unregister = @interface.GetIpcSubscriber<string, object?>("HellionChat.Unregister");
|
||||||
this.Invoke = @interface.GetIpcSubscriber<string, PlayerPayload?, ulong, Payload?, SeString?, SeString?, object?>("ChatTwo.Invoke");
|
this.Invoke = @interface.GetIpcSubscriber<string, PlayerPayload?, ulong, Payload?, SeString?, SeString?, object?>("HellionChat.Invoke");
|
||||||
this.Available = @interface.GetIpcSubscriber<object?>("ChatTwo.Available");
|
this.Available = @interface.GetIpcSubscriber<object?>("HellionChat.Available");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Enable() {
|
public void Enable() {
|
||||||
// When Chat 2 becomes available (if it loads after this plugin) or when
|
// When Hellion Chat becomes available (if it loads after this plugin) or
|
||||||
// Chat 2 is updated, register automatically.
|
// when Hellion Chat is updated, register automatically.
|
||||||
this.Available.Subscribe(() => this.Register());
|
this.Available.Subscribe(() => this.Register());
|
||||||
// Register if Chat 2 is already loaded.
|
// Register if Hellion Chat is already loaded.
|
||||||
this.Register();
|
this.Register();
|
||||||
|
|
||||||
// Listen for context menu events.
|
// Listen for context menu events.
|
||||||
@@ -75,36 +80,37 @@ public class ContextMenuIntegration {
|
|||||||
|
|
||||||
# Typing State IPC
|
# Typing State IPC
|
||||||
|
|
||||||
If you need to know whether the player is currently interacting with Chat 2's
|
If you need to know whether the player is currently interacting with Hellion
|
||||||
input box, subscribe to the typing IPC.
|
Chat's input box, subscribe to the typing IPC.
|
||||||
- `ChatTwo.GetChatInputState`: call this function to retrieve the current state.
|
- `HellionChat.GetChatInputState`: call this function to retrieve the current state.
|
||||||
- `ChatTwo.ChatInputStateChanged`: subscribe to this event to receive updates
|
- `HellionChat.ChatInputStateChanged`: subscribe to this event to receive updates
|
||||||
whenever the state changes (and once immediately after subscribing).
|
whenever the state changes (and once immediately after subscribing).
|
||||||
Both IPC endpoints use the same tuple payload:
|
Both IPC endpoints use the same tuple payload:
|
||||||
```
|
```
|
||||||
(bool InputVisible, bool InputFocused, bool HasText, bool IsTyping, int TextLength, ChatType ChannelType)
|
(bool InputVisible, bool InputFocused, bool HasText, bool IsTyping, int TextLength, ChatType ChannelType)
|
||||||
```
|
```
|
||||||
- `InputVisible`: `true` when Chat 2 is not hidden by user/cutscene/battle
|
- `InputVisible`: `true` when Hellion Chat is not hidden by user/cutscene/battle
|
||||||
settings.
|
settings.
|
||||||
- `InputFocused`: `true` while the Chat 2 input box currently has keyboard focus.
|
- `InputFocused`: `true` while the Hellion Chat input box currently has keyboard
|
||||||
|
focus.
|
||||||
- `HasText`: `true` when the input buffer contains more than whitespace.
|
- `HasText`: `true` when the input buffer contains more than whitespace.
|
||||||
- `IsTyping`: convenience flag (`InputFocused && HasText`).
|
- `IsTyping`: convenience flag (`InputFocused && HasText`).
|
||||||
- `TextLength`: length of the raw input buffer.
|
- `TextLength`: length of the raw input buffer.
|
||||||
- `ChannelType`: the `ChatTwo.Code.ChatType` representing the channel/mode that
|
- `ChannelType`: the `HellionChat.Code.ChatType` representing the channel/mode
|
||||||
will be used if the buffer is submitted. This value comes from the current
|
that will be used if the buffer is submitted. This value comes from the
|
||||||
tab's `UsedChannel` (`ChatTwo/Configuration.cs`) which the plugin keeps in
|
current tab's `UsedChannel` (`HellionChat/Configuration.cs`) which the plugin
|
||||||
sync by hooking the in-game shell (`ChatTwo/GameFunctions/Chat.cs`) and by
|
keeps in sync by hooking the in-game shell (`HellionChat/GameFunctions/Chat.cs`)
|
||||||
resolving temporary overrides inside the chat UI
|
and by resolving temporary overrides inside the chat UI
|
||||||
(`ChatTwo/Ui/ChatLogWindow.cs:597`). `InputChannel` values are converted into
|
(`HellionChat/Ui/ChatLogWindow.cs:597`). `InputChannel` values are converted
|
||||||
the exported `ChatType` via `ChatTwo/Code/InputChannelExt.ToChatType`.
|
into the exported `ChatType` via `HellionChat/Code/InputChannelExt.ToChatType`.
|
||||||
Example usage:
|
Example usage:
|
||||||
```cs
|
```cs
|
||||||
public sealed class TypingIntegration {
|
public sealed class TypingIntegration {
|
||||||
private ICallGateSubscriber<(bool InputVisible, bool InputFocused, bool HasText, bool IsTyping, int TextLength, ChatType ChannelType)> GetChatInputState { get; }
|
private ICallGateSubscriber<(bool InputVisible, bool InputFocused, bool HasText, bool IsTyping, int TextLength, ChatType ChannelType)> GetChatInputState { get; }
|
||||||
private ICallGateSubscriber<(bool InputVisible, bool InputFocused, bool HasText, bool IsTyping, int TextLength, ChatType ChannelType)> ChatInputStateChanged { get; }
|
private ICallGateSubscriber<(bool InputVisible, bool InputFocused, bool HasText, bool IsTyping, int TextLength, ChatType ChannelType)> ChatInputStateChanged { get; }
|
||||||
public TypingIntegration(DalamudPluginInterface @interface) {
|
public TypingIntegration(DalamudPluginInterface @interface) {
|
||||||
this.GetChatInputState = @interface.GetIpcSubscriber<(bool, bool, bool, bool, int, ChatType)>("ChatTwo.GetChatInputState");
|
this.GetChatInputState = @interface.GetIpcSubscriber<(bool, bool, bool, bool, int, ChatType)>("HellionChat.GetChatInputState");
|
||||||
this.ChatInputStateChanged = @interface.GetIpcSubscriber<(bool, bool, bool, bool, int, ChatType)>("ChatTwo.ChatInputStateChanged");
|
this.ChatInputStateChanged = @interface.GetIpcSubscriber<(bool, bool, bool, bool, int, ChatType)>("HellionChat.ChatInputStateChanged");
|
||||||
}
|
}
|
||||||
public void Enable() {
|
public void Enable() {
|
||||||
this.ChatInputStateChanged.Subscribe(OnChatInputStateChanged);
|
this.ChatInputStateChanged.Subscribe(OnChatInputStateChanged);
|
||||||
|
|||||||
Reference in New Issue
Block a user