# Hellion Chat

[![Build](https://gitea.hellion-forge.cloud/JonKazama-Hellion/HellionChat/actions/workflows/build.yml/badge.svg?branch=main)](https://gitea.hellion-forge.cloud/JonKazama-Hellion/HellionChat/actions/workflows/build.yml)
[![License: EUPL-1.2](https://img.shields.io/badge/License-EUPL--1.2-blue.svg)](LICENSE)
[![Latest release](https://img.shields.io/badge/release-v1.4.4-brightgreen)](https://gitea.hellion-forge.cloud/JonKazama-Hellion/HellionChat/releases/latest)
[![Dalamud API](https://img.shields.io/badge/Dalamud-API_15-purple)](https://github.com/goatcorp/Dalamud)
[![.NET](https://img.shields.io/badge/.NET-10.0-512BD4)](https://dotnet.microsoft.com/)
[![FFXIV](https://img.shields.io/badge/FFXIV-Dawntrail-c3a37f)](https://www.finalfantasyxiv.com/)

<p align="center">
  <img src="docs/images/hellion-forge.png" alt="Hellion Forge" width="180" />
</p>

**Version 1.4.4** — Privacy-first chat plugin for FINAL FANTASY XIV / Dalamud, built on
[Chat 2](https://github.com/Infiziert90/ChatTwo) (EUPL-1.2).

Hellion Chat is a privacy-first plugin built on the Chat 2 foundation. The majority of the engine comes from Chat 2
(message store, channel logic, hook system), and most keyboard shortcuts continue to work as you'd expect. What changes:
stricter privacy defaults out of the box, custom slash commands under `/hellionchat`, no web interface, and as of
v1.1.0, a theme engine as a step toward a distinct UI look and feel.

The data-handling focus is on GDPR/EU, US, and JP regulations, as far as practically applicable for a chat plugin:
per-channel retention periods, granular filters, and self-service data export. A full breakdown is available in
[`PRIVACY.md`](PRIVACY.md).

This is a standalone repository, licensed under EUPL-1.2. With v1.0.0 the standalone cut is complete: own namespace
`HellionChat.*`, own IPC channels, own source tree structure. Distribution via custom repo. Active upstream sync ended
with the v1.4.x cycle: Chat 2 is undergoing a fundamental rework and cherry-picks are no longer portable. From here,
Hellion Chat continues as an independent codebase — background and attribution in
[`docs/UPSTREAM_SYNC.md`](docs/UPSTREAM_SYNC.md).

## Acknowledgements

Hellion Chat is built on [Chat 2](https://github.com/Infiziert90/ChatTwo) by
**[Infiziert90 (Infi)](https://github.com/Infiziert90)** and **[Anna](https://github.com/anna-is-cute)**, who maintained
the plugin for years before I ever saw the source code. The entire core architecture, the message store, the channel
logic, the hook system, and much more all come from them. If Hellion Chat helps you, the credit for that belongs in
large part to Infi and Anna. A full acknowledgement is in [NOTICE.md](NOTICE.md).

Hellion Chat is developed under **Hellion Forge**, the specialized modding and plugin branch of
[Hellion Online Media](https://hellion-media.de).

---

## Tech Stack

| Category     | Technology                                          |
| ------------ | --------------------------------------------------- |
| Platform     | Dalamud Plugin (API Level 15)                       |
| Language     | C# 13 / .NET 10 (`net10.0-windows`)                 |
| Build        | Dalamud.NET.Sdk 15.0.0, DalamudPackager 15.0.0      |
| UI           | Dear ImGui (Dalamud bindings)                       |
| Database     | SQLite (Microsoft.Data.Sqlite, MessagePack storage) |
| Localization | ResX (HellionStrings.resx, .de.resx; PR-based)      |
| Font         | Exo 2 (SIL Open Font License 1.1, bundled)          |
| Toolchain    | dotnet 10 SDK, VS Code with C# Dev Kit              |
| Deployment   | GitHub Releases + custom repo (`repo.json`)         |

---

## Features

### Privacy / Compliance

- **Channel whitelist** for database persistence with privacy-first defaults. Out of the box, only your own
  conversations are stored (tells, party, FC, linkshells, cross-world linkshells, alliance, ExtraChat). Public chat, NPC
  dialogue, system spam, and battle logs are discarded at the storage layer.
- **Per-channel retention periods** with a daily background cleanup. Tells: 365 days, own conversation channels: 90
  days, global default: 30 days. The default is OFF — the plugin deletes nothing without explicit consent.
- **Retroactive cleanup** with preview and Ctrl+Shift confirmation. Applies the current whitelist to an existing
  database, runs in the background, and calls VACUUM afterward.
- **Export** to Markdown, JSON, or CSV via the Dalamud file dialog (GDPR Art. 15 right of access). Filter by channel,
  date range, or sender substring.
- **Full privacy overview** in [`PRIVACY.md`](PRIVACY.md) and third-party components in
  [`docs/THIRD_PARTY_NOTICES.md`](docs/THIRD_PARTY_NOTICES.md): what is stored, which two outbound calls exist
  (BetterTTV opt-out, Square Enix Lodestone font), an explicit no-telemetry statement, and the mapping of GDPR rights
  (Art. 15/17/18/20/21) to concrete plugin functions.

### Onboarding

- **First-run wizard** with three profiles (Privacy-First, Relaxed, Full History) and a GDPR notice for the "Full
  History" option.
- **Configuration migration** seeds privacy defaults for existing users and shows a notification on the first plugin
  start after an update. With v1.0.0, users on config version 12 or older also receive a one-time tab layout reset; the
  old tab configuration is backed up as `pluginConfigs/HellionChat.json.pre-v13-backup`.
- **Layout migration from Chat 2** moves configuration and database to `pluginConfigs/HellionChat/` without data loss.
  Handles locked files gracefully (warns the user if Chat 2 is still loaded).
- **Migrate3 recovery** heals partially migrated databases from old Chat 2 installations.

### Look & Feel

- **Bilingual UI** (English and German) with live language switching. Hellion-specific strings are in
  `HellionStrings.<lang>.resx`.
- **Hellion HUD theme** with cyan-teal accents, slate-violet tabs, and amber highlights for active states.
- **Chat color presets** (v0.6.0) with seven built-in bundles in Settings → Appearance → Chat Colors: Classic (Chat 2
  default), High Contrast, Pastel, Dark Mode Tuned, Hellion (brand), plus bonus moods Night Blue and Indigo Violet.
  One-click apply, battle channels remain untouched.
- **Window opacity slider** for combat-friendly transparency.
- **Bundled Hellion font** (Exo 2, OFL-1.1) as an optional default instead of the system font.
- **Hellion logo** bundled in the plugin and displayed in the Dalamud plugin list.

#### Custom Themes (v1.1.0)

HellionChat ships a theme engine with ten built-in themes (Hellion Arctic, Hellion Spectrum, Chat 2 Classic, Event
Horizon, Moonlit Bloom, Mint Grove, Night Blue, Indigo Violet, Forge Merchantman, Synthwave Sunset) and a JSON-based
authoring format for custom themes. Schema and step-by-step guide in
[`docs/THEME-AUTHORING.md`](docs/THEME-AUTHORING.md). Hellion Spectrum is Deuteranopia/Protanopia-safe (red-green color
blindness) based on the Wong/Okabe-Ito palette.

#### Plugin Integrations (v1.3.0)

- **Honorific custom titles in the chat header.** When the Honorific plugin is active and a custom title is set, it is
  displayed in the chat header above the message log. Auto-detect with silent fallback: without Honorific the slot is
  invisible. Toggle in Settings → Integrations → Honorific. First cycle of a multi-stage plugin integration roadmap
  (context menu, NotificationMaster, RP status, ExtraChat, and XIVIM to follow).

### Pop-Out Convenience (v0.6.0)

- **Input bar in pop-out windows** as a global opt-in in Settings → Windows → Window Frame. When active, every pop-out
  window has a compact input at the bottom with a channel-colored icon button and text field. No more switching back to
  the main window for a quick reply.
- **Per-pop-out independent text buffer and history cursor.** Changing channels in a pop-out works globally like in the
  main window (FFXIV channel API), but half-typed input doesn't collide between the main window and pop-outs.
- **Shared input history** across all windows via singleton service. Up/Down arrow keys navigate the same list of the
  last 30 entries everywhere.

### Stability

- BetterTTV cache crash fix (null key handling).
- Font atlas build fallback for missing system fonts.
- Defensive wrapping of all migration operations.

### What's missing compared to Chat 2

The web interface was removed in Hellion Chat 0.2.0. It serves a different use case than the focus of this fork — remote
access to chat from a second device — which conflicts directly with the privacy-first premise: a chat plugin that starts
a local HTTP server is too large an attack surface for my threat model. So it's gone.

If you want the full Chat 2 feature set, the upstream plugin serves you better. Hellion Chat is deliberately the slimmer
fork.

---

## Architecture

```text
HellionChat/
├── Privacy/
│   └── PrivacyDefaults.cs       # Whitelist sets, per-channel retention table
├── Export/
│   └── MessageExporter.cs       # Markdown / JSON / CSV serializer
├── Resources/
│   ├── HellionStrings.resx      # Hellion-specific UI strings (EN)
│   ├── HellionStrings.de.resx   # German translation
│   ├── HellionStrings.Designer.cs # Hand-maintained accessor
│   ├── ChatColourPresets.cs     # Seven built-in color presets (v0.6.0)
│   ├── HellionFont.ttf          # Exo 2 variable font
│   ├── HellionFont-OFL.txt      # OFL-1.1 license text (bundled with font)
│   └── Language*.resx           # Upstream localization (Crowdin)
├── Ui/
│   ├── FirstRunWizard.cs        # Three-profile onboarding
│   ├── HellionStyle.cs          # ImGui theme push (local and global)
│   └── SettingsTabs/
│       └── Privacy.cs           # Privacy tab (filters, retention, cleanup, export)
├── Ipc/                         # IPC channels, migrated to HellionChat.* in v1.0.0
├── ChatTwoConflictDetector.cs   # Blocks plugin load if upstream Chat 2 is active
├── images/
│   └── icon.png                 # Hellion logo (256×256)
├── HellionChat.csproj           # SDK Dalamud.NET.Sdk/15.0.0
└── HellionChat.yaml             # Plugin manifest (DalamudPackager source)
```

### Rules

- **Code namespace is `HellionChat.*`.** Fully consolidated onto the plugin name since v1.0.0 — no remaining `ChatTwo.*`
  anywhere in the source tree.
- **AssemblyName is `HellionChat`.** Own slot in `pluginConfigs/`, own file manifest, no shared state with Chat 2.
  Parallel-loading upstream Chat 2 is actively blocked on startup (bilingual conflict message).
- **IPC channels are `HellionChat.*`.** Six channels for third-party plugin integration (`Register`, `Available`,
  `Unregister`, `Invoke`, `GetChatInputState`, `ChatInputStateChanged`). Details in [`docs/IPC.md`](docs/IPC.md).
- **Hellion-specific strings in `HellionStrings.*.resx`**, strings carried over from Chat 2 in `Language.*.resx`. The
  original `Language.*.resx` structure is preserved because the existing translations from the upstream Crowdin
  community remain valuable.
- **No direct access to `Plugin.Interface.UiBuilder.FontAtlas`** outside of `FontManager`. Font fallback and the Hellion
  font are managed centrally.

---

## Database

SQLite, schema inherited from upstream Chat 2 (migration level v3). Hellion extensions live in `Configuration` as
fields, not in the DB schema:

| Column           | Type    | Description                  |
| ---------------- | ------- | ---------------------------- |
| Id               | BLOB    | Guid                         |
| Receiver         | INTEGER | Receiver ContentId           |
| ContentId        | INTEGER | Sender ContentId             |
| Date             | INTEGER | Unix timestamp (ms)          |
| ChatType         | INTEGER | XivChatType / LogKind        |
| SourceKind       | INTEGER | Player / NPC / Server / etc. |
| TargetKind       | INTEGER | Player / NPC / Server / etc. |
| Sender           | BLOB    | MessagePack `List<Chunk>`    |
| Content          | BLOB    | MessagePack `List<Chunk>`    |
| SenderSource     | BLOB    | MessagePack `SeString`       |
| ContentSource    | BLOB    | MessagePack `SeString`       |
| ExtraChatChannel | BLOB    | Guid                         |
| Deleted          | BOOLEAN | Soft-delete marker           |

Path: `pluginConfigs/HellionChat/chat-sqlite.db`. WAL mode, Synchronous=NORMAL.

---

## Installation

Hellion Chat is distributed via a Dalamud **custom repository**.

### Fresh install (no prior Chat 2)

1. Open Dalamud Settings (`/xlsettings`) → **Experimental**.
2. Add a new entry under **Custom Plugin Repositories**:

```text
    https://gitea.hellion-forge.cloud/JonKazama-Hellion/HellionChat/raw/branch/main/repo.json
```

3. **Save**, then go to `/xlplugins` → **All Plugins** → Refresh.
4. Hellion Chat appears in the list — install it like any other plugin.

### Migration from Chat 2 (with existing history)

Chat 2 and Hellion Chat share the database file until Hellion Chat moves it to its own path on first start. Order
matters:

1. **Disable Chat 2** in `/xlplugins` (do not uninstall, just disable).
2. **Fully close FFXIV** so SQLite releases the file lock. A plugin reload alone is not enough.
3. Restart the game.
4. Add the custom repo as described above.
5. Install Hellion Chat. On first start, the configuration file and the entire database directory are moved into the
   HellionChat layout.
6. **Verify** under Settings → Privacy → Refresh preview that the message count looks plausible.

### Troubleshooting

**Hellion Chat shows 0 messages, even though Chat 2 was active before:**

Migration was blocked by a locked file. Close the game and move the files manually:

Linux / XIVLauncher Core:

```bash
mv ~/.xlcore/pluginConfigs/ChatTwo/chat-sqlite.db \
   ~/.xlcore/pluginConfigs/HellionChat/chat-sqlite.db
[ -d ~/.xlcore/pluginConfigs/ChatTwo/EmoteCacheV1 ] && \
  mv ~/.xlcore/pluginConfigs/ChatTwo/EmoteCacheV1 \
     ~/.xlcore/pluginConfigs/HellionChat/
```

Windows / XIVLauncher:

```powershell
Move-Item "$env:AppData\XIVLauncher\pluginConfigs\ChatTwo\chat-sqlite.db" `
          "$env:AppData\XIVLauncher\pluginConfigs\HellionChat\chat-sqlite.db" -Force
```

Start the game, enable Hellion Chat, and your history is back.

### Updates

Updates appear automatically in the plugin list once a new `vX.Y.Z` tag with a GitHub Release is published. No reinstall
needed.

---

## Distribution

Hellion Chat is distributed via its own Dalamud custom repository (`repo.json` in the repo root). Pushing a `vX.Y.Z` tag
triggers the [`release.yml`](.github/workflows/release.yml) workflow, which attaches the build output
(`HellionChat/bin/Release/HellionChat/latest.zip`) along with the matching changelog block from `HellionChat.yaml` to
the GitHub Release. Manual recovery path if the auto-trigger is missed: `gh workflow run release.yml -f tag=vX.Y.Z`.

An optional submission to the Dalamud main plugin repo (in addition to the custom repo) is on the
[roadmap](docs/ROADMAP.md).

---

## Project Status

**Version 1.4.4** — Threading and IPC safety polish on top of the v1.4.3 async-load foundation. The
`AutoTellTabsService` hot-path getter now reads from an `Interlocked` counter instead of taking a lock on every render
frame, with a resync hook for the snapshot-restore path in `SaveConfig` and a pure-helper test mirror in the Build-Suite
repo. The Honorific integration carries per-method threading banners so the framework-thread invariant is visible at the
call site, and an unsubscribe failure now logs at Warning instead of Debug — a leaked subscription across plugin reloads
is exactly the kind of thing that should not be silent. The AutoTranslate warmup thread is finally marked
`IsBackground = true`, matching the pattern used in `MessageManager` and `Plugin.RetentionSweep` since v1.4.0. The
privacy filter logs once per unknown ChatType so a future patch's added channel does not drop off the radar, and new
installs default `PrivacyPersistUnknownChannels` to `true` as a failsafe; existing configs keep their explicit choice.
No schema bump, no migration. Fifth sub-patch of the v1.4.x polish sweep series (as of 2026-05-12).

Hellion Chat is a standalone plugin, no longer a fork in the repository sense. Fully completed:

- Privacy filters (whitelist, retention, retroactive cleanup, export)
- First-run wizard with three profiles
- Plugin identity: own `HellionChat` slot, layout migration from Chat 2, Migrate3 recovery
- Bilingual UI (EN and DE) with live language switching
- Hellion theme, Hellion logo, bundled Exo 2 font
- Custom repo pipeline with automated GitHub Release distribution
- Slash commands consolidated to the `/hellionchat` family
- Web interface removed (v0.2.0)
- Audit hardening (path traversal, retention race, DbViewer consistency)
- About tab in Hellion branding, localized EN and DE, with license and disclaimer
- AI disclosure documented (see [`docs/AI_DISCLOSURE.md`](docs/AI_DISCLOSURE.md))
- Standalone cut: namespace `HellionChat.*`, IPC channels `HellionChat.*`, source tree restructure, conflict detection
  against upstream Chat 2, SQLite CVE hardening (3.50.3)
- Theme engine with ten built-in themes plus JSON authoring format (engine v1.1.0, catalog extended in v1.2.3, including
  CVD-safe Hellion Spectrum; Synthwave Sunset in v1.4.1)
- ABGR cache on theme records: `HellionStyle.PushGlobal` reads pre-computed ABGR instead of converting RGBA→ABGR per
  slot per frame (v1.4.1, ~13% render-time recovery)

In progress: incremental modernization of UI look and feel beyond the theme engine. What's planned next and what's on
the long-term list is in [`docs/ROADMAP.md`](docs/ROADMAP.md). Concrete scheduled items are also tracked in the
[Gitea issue tracker](https://gitea.hellion-forge.cloud/JonKazama-Hellion/HellionChat/issues) under the `roadmap` label.

### On Release Cadence

Anyone looking at the repo for the first time will notice a lot of releases and a high commit count in a short time.
Both are deliberate. The full reasoning — four factors behind it — is in
[`docs/LEARNING-JOURNEY.md`](docs/LEARNING-JOURNEY.md), section "How I release this fast".

---

## Community & Support

- **Hellion Forge Discord** (community for HellionChat and other Hellion Online Media plugins and tools):
  [discord.gg/X9V7Kcv5gR](https://discord.gg/X9V7Kcv5gR)
- Bug reports and feature requests:
  [Gitea Issues](https://gitea.hellion-forge.cloud/JonKazama-Hellion/HellionChat/issues)
- Discord DM: `@j.j_kazama`
- Further contact options (security, privacy, quick questions): see [SUPPORT.md](SUPPORT.md)

---

## License

EUPL-1.2 (same license as upstream Chat 2). Full text in [LICENSE](LICENSE), copyright notes with dual-holder block in
[COPYRIGHT](COPYRIGHT), personal acknowledgement to the upstream authors in [NOTICE.md](NOTICE.md).

© 2023–2026 the Chat 2 authors ([Infi](https://github.com/Infiziert90), [Anna](https://github.com/anna-is-cute), and
upstream contributors) for the engine, IPC, and storage layer. © 2026 Hellion Online Media for the Hellion Chat
extensions.

### Acknowledgments

- **[Infi](https://github.com/Infiziert90) and [Anna](https://github.com/anna-is-cute) (ascclemens)** for the Chat 2
  engine, without which this fork would not exist.
- **Dalamud team** for the plugin framework.
- **Chat 2 Crowdin community** for the upstream string translations (see Settings → Info → "Chat 2 community
  translators").

### FFXIV Disclaimer

FINAL FANTASY XIV © SQUARE ENIX CO., LTD. All rights reserved. Hellion Chat is an unofficial, fan-made plugin and is not
affiliated with, supported by, sponsored by, or approved by Square Enix.

### AI Assistance

See [`docs/AI_DISCLOSURE.md`](docs/AI_DISCLOSURE.md) for the pair-level disclosure.

---

## Project Documents

Standard repository documents live in the repo root; deeper documentation lives under [`docs/`](docs/).

### Repo Root

| Document                                   | Contents                                                                                                     |
| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------ |
| [`PRIVACY.md`](PRIVACY.md)                 | Privacy overview: local storage, outbound calls, telemetry status, GDPR rights and their plugin equivalents. |
| [`SECURITY.md`](SECURITY.md)               | Vulnerability reporting via private advisory, scope, and disclosure window.                                  |
| [`SUPPORT.md`](SUPPORT.md)                 | Guide for bugs, security, privacy, and quick questions.                                                      |
| [`CONTRIBUTING.md`](CONTRIBUTING.md)       | What I accept and decline, workflow, EUPL-1.2 confirmation.                                                  |
| [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md) | Behavioral expectations and reporting path.                                                                  |
| [`NOTICE.md`](NOTICE.md)                   | Attribution to upstream maintainers and component credits.                                                   |
| [`COPYRIGHT`](COPYRIGHT)                   | Copyright notes with dual-holder block.                                                                      |
| [`LICENSE`](LICENSE)                       | EUPL-1.2 full text.                                                                                          |

### `docs/`

| Document                                                     | Contents                                                                                                    |
| ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------- |
| [`docs/ROADMAP.md`](docs/ROADMAP.md)                         | Planned cycles, mid-term and long-term topics.                                                              |
| [`docs/CHANGELOG.md`](docs/CHANGELOG.md)                     | Curated version overview with references to GitHub release pages.                                           |
| [`docs/CONTRIBUTORS.md`](docs/CONTRIBUTORS.md)               | Testers, translators, and code contributors on the Hellion side.                                            |
| [`docs/LEARNING-JOURNEY.md`](docs/LEARNING-JOURNEY.md)       | Development history: from web stack to C# / Dalamud, lessons learned from the fork.                         |
| [`docs/IPC.md`](docs/IPC.md)                                 | IPC channel reference, tuple payload fields, migration diff for third-party plugins.                        |
| [`docs/THEME-AUTHORING.md`](docs/THEME-AUTHORING.md)         | Theme engine authoring guide (EN): JSON schema, color and layout slots, channel identity rules, validation. |
| [`docs/UPSTREAM_SYNC.md`](docs/UPSTREAM_SYNC.md)             | Upstream sync status: cherry-pick pipeline closed since v1.4.x, attribution intact.                         |
| [`docs/THIRD_PARTY_NOTICES.md`](docs/THIRD_PARTY_NOTICES.md) | NuGet dependencies with licenses, bundled assets, network status per component.                             |
| [`docs/AI_DISCLOSURE.md`](docs/AI_DISCLOSURE.md)             | Disclosure of AI assistance in the development process.                                                     |

---

Developed under **Hellion Forge**, the modding and plugin branch of **Hellion Online Media** | Bad Harzburg |
[hellion-media.de](https://hellion-media.de)
