- Partially implement tab switch
- Better support character switch
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>1.28.2</Version>
|
<Version>1.29.0</Version>
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
|||||||
@@ -164,6 +164,9 @@ internal sealed unsafe class Chat : IDisposable
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
ChangeChannelNameDetour(agent);
|
ChangeChannelNameDetour(agent);
|
||||||
|
|
||||||
|
// Inform all clients that a new login happend
|
||||||
|
Plugin.ServerCore.SendNewLogin();
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte ChatLogRefreshDetour(nint log, ushort eventId, AtkValue* value)
|
private byte ChatLogRefreshDetour(nint log, ushort eventId, AtkValue* value)
|
||||||
|
|||||||
@@ -38,10 +38,12 @@ public class HostContext
|
|||||||
Host.Events.ExceptionEncountered += ExceptionEncountered;
|
Host.Events.ExceptionEncountered += ExceptionEncountered;
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
|
#if DEBUG
|
||||||
Host.Settings.Debug.Requests = true;
|
Host.Settings.Debug.Requests = true;
|
||||||
Host.Settings.Debug.Routing = true;
|
Host.Settings.Debug.Routing = true;
|
||||||
Host.Settings.Debug.Responses = true;
|
Host.Settings.Debug.Responses = true;
|
||||||
Host.Settings.Debug.AccessControl = true;
|
Host.Settings.Debug.AccessControl = true;
|
||||||
|
#endif
|
||||||
Host.Events.Logger = logMessage => Plugin.Log.Information(logMessage);
|
Host.Events.Logger = logMessage => Plugin.Log.Information(logMessage);
|
||||||
|
|
||||||
IsActive = true;
|
IsActive = true;
|
||||||
@@ -116,7 +118,6 @@ public class HostContext
|
|||||||
{
|
{
|
||||||
await ctx.Response.Send("Nothing to see here.");
|
await ctx.Response.Send("Nothing to see here.");
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
|
||||||
private async Task CheckAuthenticationCookie(HttpContextBase ctx)
|
private async Task CheckAuthenticationCookie(HttpContextBase ctx)
|
||||||
{
|
{
|
||||||
@@ -132,4 +133,5 @@ public class HostContext
|
|||||||
|
|
||||||
// Do nothing to let auth pass
|
// Do nothing to let auth pass
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,8 @@ public class Processing
|
|||||||
var channels = await Plugin.Framework.RunOnTick(Plugin.ChatLogWindow.GetAvailableChannels);
|
var channels = await Plugin.Framework.RunOnTick(Plugin.ChatLogWindow.GetAvailableChannels);
|
||||||
var channelName = await Plugin.Framework.RunOnTick(() => ReadChannelName(Plugin.ChatLogWindow.PreviousChannel));
|
var channelName = await Plugin.Framework.RunOnTick(() => ReadChannelName(Plugin.ChatLogWindow.PreviousChannel));
|
||||||
|
|
||||||
sse.OutboundQueue.Enqueue(new NewMessageEvent(new Messages(messages)));
|
// Using the bulk message event to clear everything on the client side that may still exist
|
||||||
|
sse.OutboundQueue.Enqueue(new BulkMessagesEvent(new Messages(messages)));
|
||||||
sse.OutboundQueue.Enqueue(new SwitchChannelEvent(new SwitchChannel(channelName)));
|
sse.OutboundQueue.Enqueue(new SwitchChannelEvent(new SwitchChannel(channelName)));
|
||||||
sse.OutboundQueue.Enqueue(new ChannelListEvent(new ChannelList(channels.ToDictionary(pair => pair.Key, pair => (uint)pair.Value))));
|
sse.OutboundQueue.Enqueue(new ChannelListEvent(new ChannelList(channels.ToDictionary(pair => pair.Key, pair => (uint)pair.Value))));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,6 +92,25 @@ public class ServerCore : IAsyncDisposable
|
|||||||
Plugin.Log.Error(ex, "Sending channel switch over SSE failed.");
|
Plugin.Log.Error(ex, "Sending channel switch over SSE failed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void SendNewLogin()
|
||||||
|
{
|
||||||
|
if (!HostContext.IsActive)
|
||||||
|
return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Plugin.Framework.RunOnTick(async () =>
|
||||||
|
{
|
||||||
|
foreach (var eventServer in HostContext.EventConnections)
|
||||||
|
await HostContext.Processing.PrepareNewClient(eventServer);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Plugin.Log.Error(ex, "Preparing all clients after login failed.");
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public void InvalidateSessions()
|
public void InvalidateSessions()
|
||||||
|
|||||||
+3
-2
@@ -88,6 +88,9 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
ExtraChat = new ExtraChat(this);
|
ExtraChat = new ExtraChat(this);
|
||||||
FontManager = new FontManager();
|
FontManager = new FontManager();
|
||||||
|
|
||||||
|
// ChatLog calls this in its ctor if the player is already logged in
|
||||||
|
ServerCore = new ServerCore(this);
|
||||||
|
|
||||||
ChatLogWindow = new ChatLogWindow(this);
|
ChatLogWindow = new ChatLogWindow(this);
|
||||||
SettingsWindow = new SettingsWindow(this);
|
SettingsWindow = new SettingsWindow(this);
|
||||||
DbViewer = new DbViewer(this);
|
DbViewer = new DbViewer(this);
|
||||||
@@ -130,8 +133,6 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
AutoTranslate.PreloadCache();
|
AutoTranslate.PreloadCache();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ServerCore = new ServerCore(this);
|
|
||||||
|
|
||||||
// Automatically start the webserver if requested
|
// Automatically start the webserver if requested
|
||||||
if (Config.WebinterfaceAutoStart)
|
if (Config.WebinterfaceAutoStart)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -374,6 +374,10 @@ public sealed class ChatLogWindow : Window
|
|||||||
// If channel is null it doesn't have a default, and we never selected this channel before
|
// If channel is null it doesn't have a default, and we never selected this channel before
|
||||||
if (channel != null)
|
if (channel != null)
|
||||||
SetChannel(tab.Channel ?? tab.PreviousChannel);
|
SetChannel(tab.Channel ?? tab.PreviousChannel);
|
||||||
|
|
||||||
|
// Inform the webinterface about tab switch
|
||||||
|
// TODO implement tabs in the webinterface
|
||||||
|
Plugin.ServerCore.SendNewLogin();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static bool InBattle => Plugin.Condition[ConditionFlag.InCombat];
|
internal static bool InBattle => Plugin.Condition[ConditionFlag.InCombat];
|
||||||
|
|||||||
Reference in New Issue
Block a user