-
-
-
518 if (e.Data.Nick.Equals(client.Nickname, StringComparison.OrdinalIgnoreCase))
-
-
-
521 var username = e.Data.Nick;
-
522 var channelName = isPrivate ? username : e.Data.Channel;
-
-
524 ulong MapAndGetChannelId(Dictionary<ulong, string?> dicToCheck)
-
-
526 ulong? resultId =
null;
-
527 if (!dicToCheck.Any(x =>
-
-
529 if (x.Value != channelName)
-
-
-
-
-
-
535 resultId = channelIdCounter++;
-
536 dicToCheck.Add(resultId.Value, channelName);
-
537 if (dicToCheck == queryChannelIdMap)
-
538 channelIdMap.Add(resultId.Value,
null);
-
-
-
541 return resultId!.Value;
-
-
-
544 ulong userId, channelId;
-
-
-
547 userId = MapAndGetChannelId(
new Dictionary<ulong, string?>(queryChannelIdMap
-
548 .Cast<KeyValuePair<ulong, string?>>()));
-
549 channelId = isPrivate ? userId : MapAndGetChannelId(channelIdMap);
-
-
-
552 var channelFriendlyName = isPrivate ? String.Format(CultureInfo.InvariantCulture,
"PM: {0}", channelName) : channelName;
-
-
-
-
-
557 IsPrivateChannel = isPrivate,
-
558 EmbedsSupported =
false,
-
-
-
-
-
-
-
-
-
567 EnqueueMessage(message);
-
+
+
+
+
+
516 if (e.Data.Nick.Equals(client.Nickname, StringComparison.OrdinalIgnoreCase))
+
+
+
519 var username = e.Data.Nick;
+
520 var channelName = isPrivate ? username : e.Data.Channel;
+
+
522 ulong MapAndGetChannelId(Dictionary<ulong, string?> dicToCheck)
+
+
524 ulong? resultId =
null;
+
525 if (!dicToCheck.Any(x =>
+
+
527 if (x.Value != channelName)
+
+
+
+
+
+
533 resultId = channelIdCounter++;
+
534 dicToCheck.Add(resultId.Value, channelName);
+
535 if (dicToCheck == queryChannelIdMap)
+
536 channelIdMap.Add(resultId.Value,
null);
+
+
+
539 return resultId!.Value;
+
+
+
542 ulong userId, channelId;
+
+
+
545 userId = MapAndGetChannelId(
new Dictionary<ulong, string?>(queryChannelIdMap
+
546 .Cast<KeyValuePair<ulong, string?>>()));
+
547 channelId = isPrivate ? userId : MapAndGetChannelId(channelIdMap);
+
+
+
550 var channelFriendlyName = isPrivate ? String.Format(CultureInfo.InvariantCulture,
"PM: {0}", channelName) : channelName;
+
+
+
+
+
555 IsPrivateChannel = isPrivate,
+
556 EmbedsSupported =
false,
+
+
+
+
+
+
+
+
+
565 EnqueueMessage(message);
+
-
-
-
-
-
-
-
-
-
-
-
594 client.Listen(
false);
-
-
-
-
598 Logger.LogWarning(ex,
"IRC Non-Blocking Listen Exception!");
-
-
-
-
602 TaskCreationOptions.None,
-
603 TaskScheduler.Current)
-
604 .WaitAsync(cancellationToken);
-
-
-
-
-
613 client.WriteLine(
"CAP REQ :sasl", Priority.Critical);
-
614 cancellationToken.ThrowIfCancellationRequested();
-
-
616 Logger.LogTrace(
"Logging in...");
-
617 client.Login(nickname, nickname, 0, nickname);
-
618 cancellationToken.ThrowIfCancellationRequested();
-
-
-
621 var receivedAck =
false;
-
622 var receivedPlus =
false;
-
-
624 void AuthenticationDelegate(
object sender, ReadLineEventArgs e)
-
-
626 if (e.Line.Contains(
"ACK :sasl", StringComparison.Ordinal))
-
-
628 else if (e.Line.Contains(
"AUTHENTICATE +", StringComparison.Ordinal))
-
-
-
-
632 Logger.LogTrace(
"Performing handshake...");
-
633 client.OnReadLine += AuthenticationDelegate;
-
-
-
636 using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
-
637 timeoutCts.CancelAfter(TimeSpan.FromSeconds(25));
-
638 var timeoutToken = timeoutCts.Token;
-
-
640 var listenTimeSpan = TimeSpan.FromMilliseconds(10);
-
-
-
643 await NonBlockingListen(cancellationToken);
-
-
645 client.WriteLine(
"AUTHENTICATE PLAIN", Priority.Critical);
-
646 timeoutToken.ThrowIfCancellationRequested();
-
-
648 for (; !receivedPlus;
-
-
650 await NonBlockingListen(cancellationToken);
-
-
-
-
654 client.OnReadLine -= AuthenticationDelegate;
-
+
+
+
+
+
+
+
+
+
+
+
592 client.Listen(
false);
+
+
+
+
596 Logger.LogWarning(ex,
"IRC Non-Blocking Listen Exception!");
+
+
+
+
600 TaskCreationOptions.None,
+
601 TaskScheduler.Current)
+
602 .WaitAsync(cancellationToken);
+
+
+
+
+
611 client.WriteLine(
"CAP REQ :sasl", Priority.Critical);
+
612 cancellationToken.ThrowIfCancellationRequested();
+
+
614 Logger.LogTrace(
"Logging in...");
+
615 client.Login(nickname, nickname, 0, nickname);
+
616 cancellationToken.ThrowIfCancellationRequested();
+
+
+
619 var receivedAck =
false;
+
620 var receivedPlus =
false;
+
+
622 void AuthenticationDelegate(
object sender, ReadLineEventArgs e)
+
+
624 if (e.Line.Contains(
"ACK :sasl", StringComparison.Ordinal))
+
+
626 else if (e.Line.Contains(
"AUTHENTICATE +", StringComparison.Ordinal))
+
+
+
+
630 Logger.LogTrace(
"Performing handshake...");
+
631 client.OnReadLine += AuthenticationDelegate;
+
+
+
634 using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
+
635 timeoutCts.CancelAfter(TimeSpan.FromSeconds(25));
+
636 var timeoutToken = timeoutCts.Token;
+
+
638 var listenTimeSpan = TimeSpan.FromMilliseconds(10);
+
+
+
641 await NonBlockingListen(cancellationToken);
+
+
643 client.WriteLine(
"AUTHENTICATE PLAIN", Priority.Critical);
+
644 timeoutToken.ThrowIfCancellationRequested();
+
+
646 for (; !receivedPlus;
+
+
648 await NonBlockingListen(cancellationToken);
+
+
+
+
652 client.OnReadLine -= AuthenticationDelegate;
+
+
+
655 cancellationToken.ThrowIfCancellationRequested();
-
657 cancellationToken.ThrowIfCancellationRequested();
-
-
-
660 Logger.LogTrace(
"Sending credentials...");
-
661 var authString = String.Format(
-
662 CultureInfo.InvariantCulture,
-
-
-
-
-
667 var b64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(authString));
-
668 var authLine = $
"AUTHENTICATE {b64}";
-
669 client.WriteLine(authLine, Priority.Critical);
-
670 cancellationToken.ThrowIfCancellationRequested();
-
-
672 Logger.LogTrace(
"Finishing authentication...");
-
673 client.WriteLine(
"CAP END", Priority.Critical);
-
+
+
658 Logger.LogTrace(
"Sending credentials...");
+
659 var authString = String.Format(
+
660 CultureInfo.InvariantCulture,
+
+
+
+
+
665 var b64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(authString));
+
666 var authLine = $
"AUTHENTICATE {b64}";
+
667 client.WriteLine(authLine, Priority.Critical);
+
668 cancellationToken.ThrowIfCancellationRequested();
+
+
670 Logger.LogTrace(
"Finishing authentication...");
+
671 client.WriteLine(
"CAP END", Priority.Critical);
+
-
-
-
-
-
-
-
685 Logger.LogTrace(
"Not hard disconnecting, already offline");
-
-
+
+
+
+
+
+
+
683 Logger.LogTrace(
"Not hard disconnecting, already offline");
+
+
+
+
687 Logger.LogTrace(
"Hard disconnect");
-
689 Logger.LogTrace(
"Hard disconnect");
-
-
-
-
693 var disconnectTask = Task.Factory.StartNew(
-
-
-
-
-
-
-
-
-
702 Logger.LogWarning(e,
"Error disconnecting IRC!");
-
-
-
-
-
707 TaskScheduler.Current);
-
-
-
-
-
712 listenTask ?? Task.CompletedTask),
-
-
+
+
+
691 var disconnectTask = Task.Factory.StartNew(
+
+
+
+
+
+
+
+
+
700 Logger.LogWarning(e,
"Error disconnecting IRC!");
+
+
+
+
+
705 TaskScheduler.Current);
+
+
+
+
+
710 listenTask ?? Task.CompletedTask),
+
+
-
-
-
-
-
723 var newClient =
new IrcFeatures
-
-
725 SupportNonRfc =
true,
-
726 CtcpUserInfo =
"You are going to play. And I am going to watch. And everything will be just fine...",
-
-
728 AutoRejoinOnKick =
true,
-
-
-
731 AutoReconnect =
false,
-
732 ActiveChannelSyncing =
true,
-
733 AutoNickHandling =
true,
-
734 CtcpVersion = assemblyInfo.VersionString,
-
-
736 EnableUTF8Recode =
true,
-
-
-
739 newClient.ValidateServerCertificate =
true;
-
-
741 newClient.OnChannelMessage += Client_OnChannelMessage;
-
742 newClient.OnQueryMessage += Client_OnQueryMessage;
-
-
744 if (loggingConfiguration.ProviderNetworkDebug)
-
-
746 newClient.OnReadLine += (sender, e) => Logger.LogTrace(
"READ: {line}", e.Line);
-
747 newClient.OnWriteLine += (sender, e) => Logger.LogTrace(
"WRITE: {line}", e.Line);
-
-
-
750 newClient.OnError += (sender, e) =>
-
-
752 Logger.LogError(
"IRC ERROR: {error}", e.ErrorMessage);
-
753 newClient.Disconnect();
-
-
-
-
+
+
+
+
+
721 var newClient =
new IrcFeatures
+
+
723 SupportNonRfc =
true,
+
724 CtcpUserInfo =
"You are going to play. And I am going to watch. And everything will be just fine...",
+
+
726 AutoRejoinOnKick =
true,
+
+
+
729 AutoReconnect =
false,
+
730 ActiveChannelSyncing =
true,
+
731 AutoNickHandling =
true,
+
732 CtcpVersion = assemblyInfo.VersionString,
+
+
734 EnableUTF8Recode =
true,
+
+
+
737 newClient.ValidateServerCertificate =
true;
+
+
739 newClient.OnChannelMessage += Client_OnChannelMessage;
+
740 newClient.OnQueryMessage += Client_OnQueryMessage;
+
+
742 if (loggingConfiguration.ProviderNetworkDebug)
+
+
744 newClient.OnReadLine += (sender, e) => Logger.LogTrace(
"READ: {line}", e.Line);
+
745 newClient.OnWriteLine += (sender, e) => Logger.LogTrace(
"WRITE: {line}", e.Line);
+
+
+
748 newClient.OnError += (sender, e) =>
+
+
750 Logger.LogError(
"IRC ERROR: {error}", e.ErrorMessage);
+
751 newClient.Disconnect();
+
+
+
+
-
+
-
+
Information about an engine installation.
override string ToString()
@@ -765,27 +763,27 @@ $(document).ready(function() { init_codefold(0); });
Represents a Providers.IProvider channel.
Represents a tgs_chat_user datum.
IProvider for internet relay chat.
-
IrcFeatures InstantiateClient()
Creates a new instance of the IRC client. Reusing the same client after a disconnection seems to caus...
+
IrcFeatures InstantiateClient()
Creates a new instance of the IRC client. Reusing the same client after a disconnection seems to caus...
readonly IAssemblyInformationProvider assemblyInfo
The IAssemblyInformationProvider obtained from constructor, used for the CTCP version string.
readonly ushort port
Port of the server to connect to.
readonly string password
Password which will used for authentication.
override async ValueTask< Dictionary< Models.ChatChannel, IEnumerable< ChannelRepresentation > > > MapChannelsImpl(IEnumerable< Models.ChatChannel > channels, CancellationToken cancellationToken)
override async ValueTask< Func< string?, string, ValueTask< Func< bool, ValueTask > > > > SendUpdateMessage(Models.RevisionInformation revisionInformation, EngineVersion engineVersion, DateTimeOffset? estimatedCompletionTime, string? gitHubOwner, string? gitHubRepo, ulong channelId, bool localCommitPushed, CancellationToken cancellationToken)
Send the message for a deployment.A ValueTask<TResult> resulting in a Func<T1, T2,...
override string BotMention
The string that indicates the IProvider was mentioned.
-
override async ValueTask DisconnectImpl(CancellationToken cancellationToken)
+
override async ValueTask DisconnectImpl(CancellationToken cancellationToken)
ulong channelIdCounter
Id counter for channelIdMap.
IrcProvider(IJobManager jobManager, IAsyncDelayer asyncDelayer, ILogger< IrcProvider > logger, IAssemblyInformationProvider assemblyInformationProvider, Models.ChatBot chatBot, FileLoggingConfiguration loggingConfiguration)
Initializes a new instance of the IrcProvider class.
-
async ValueTask HardDisconnect(CancellationToken cancellationToken)
Attempt to disconnect from IRC immediately.
+
async ValueTask HardDisconnect(CancellationToken cancellationToken)
Attempt to disconnect from IRC immediately.
const int PreambleMessageLength
Length of the preamble when writing a message to the server. Must be summed with the channel name to ...
override async ValueTask DisposeAsync()
-
async ValueTask SaslAuthenticate(CancellationToken cancellationToken)
Run SASL authentication on client.
+
async ValueTask SaslAuthenticate(CancellationToken cancellationToken)
Run SASL authentication on client.
readonly string address
Address of the server to connect to.
void Client_OnQueryMessage(object sender, IrcEventArgs e)
When a query message is received in IRC.
-
override async ValueTask Connect(CancellationToken cancellationToken)
+
override async ValueTask Connect(CancellationToken cancellationToken)
readonly? IrcPasswordType passwordType
The IrcPasswordType of password.
-
async ValueTask Login(IrcFeatures client, string nickname, CancellationToken cancellationToken)
Register the client on the network.
+
async ValueTask Login(IrcFeatures client, string nickname, CancellationToken cancellationToken)
Register the client on the network.
readonly string nickname
IRC nickname.
-
void HandleMessage(IrcEventArgs e, bool isPrivate)
Handle an IRC message.
+
void HandleMessage(IrcEventArgs e, bool isPrivate)
Handle an IRC message.
IrcFeatures client
The IrcFeatures client.
readonly Dictionary< ulong, string > queryChannelIdMap
Map of ChannelRepresentation.RealIds to query users.
override bool Connected
If the IProvider is currently connected.
diff --git a/changelog.yml b/changelog.yml
index 5a828e94a3..471090fc25 100644
--- a/changelog.yml
+++ b/changelog.yml
@@ -215,6 +215,10 @@ Components:
- 'nix: bump up sha256 of fixed deviation'
Author: Lorwp
PullRequest: 2109
+ - Descriptions:
+ - Fixed IRC provider not being able to send update messages for non-GitHub repositories.
+ Author: Cyberboss
+ PullRequest: 2136
Unreleased: true
- Version: 6.13.0
ComponentVersions:
diff --git a/class_tgstation_1_1_server_1_1_host_1_1_components_1_1_chat_1_1_providers_1_1_irc_provider.html b/class_tgstation_1_1_server_1_1_host_1_1_components_1_1_chat_1_1_providers_1_1_irc_provider.html
index ab605cab8f..8406b53a1d 100644
--- a/class_tgstation_1_1_server_1_1_host_1_1_components_1_1_chat_1_1_providers_1_1_irc_provider.html
+++ b/class_tgstation_1_1_server_1_1_host_1_1_components_1_1_chat_1_1_providers_1_1_irc_provider.html
@@ -506,7 +506,7 @@ Additional Inherited Members
152 }
ChatConnectionStringBuilder for ChatProvider.Irc.
-
IrcFeatures InstantiateClient()
Creates a new instance of the IRC client. Reusing the same client after a disconnection seems to caus...
+
IrcFeatures InstantiateClient()
Creates a new instance of the IRC client. Reusing the same client after a disconnection seems to caus...
readonly IAssemblyInformationProvider assemblyInfo
The IAssemblyInformationProvider obtained from constructor, used for the CTCP version string.
readonly ushort port
Port of the server to connect to.
readonly string password
Password which will used for authentication.
@@ -521,7 +521,7 @@ Additional Inherited Members
readonly Dictionary< ulong, string?> channelIdMap
Map of ChannelRepresentation.RealIds to channel names.
readonly IJobManager jobManager
The IJobManager for the Provider.
-
References Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.address, Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.assemblyInfo, Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.channelIdCounter, Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.channelIdMap, Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.client, Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.InstantiateClient(), Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.loggingConfiguration, Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.nickname, Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.password, Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.passwordType, Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.port, Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.queryChannelIdMap, and Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.ssl.
+
References Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.address, Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.assemblyInfo, Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.channelIdCounter, Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.channelIdMap, Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.client, Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.InstantiateClient(), Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.loggingConfiguration, Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.nickname, Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.password, Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.passwordType, Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.port, Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.queryChannelIdMap, and Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.ssl.
@@ -652,82 +652,82 @@ Here is the call graph for this function:
-
Definition at line 367 of file IrcProvider.cs.
-
368 {
-
369 cancellationToken.ThrowIfCancellationRequested();
-
370 try
-
371 {
-
372 await Task.Factory.StartNew(
-
373 () =>
-
374 {
-
-
-
377 },
-
378 cancellationToken,
-
-
380 TaskScheduler.Current)
-
381 .WaitAsync(cancellationToken);
+
Definition at line 365 of file IrcProvider.cs.
+
366 {
+
367 cancellationToken.ThrowIfCancellationRequested();
+
368 try
+
369 {
+
370 await Task.Factory.StartNew(
+
371 () =>
+
372 {
+
+
+
375 },
+
376 cancellationToken,
+
+
378 TaskScheduler.Current)
+
379 .WaitAsync(cancellationToken);
+
380
+
381 cancellationToken.ThrowIfCancellationRequested();
382
-
383 cancellationToken.ThrowIfCancellationRequested();
-
384
-
-
386 () =>
-
387 {
-
388 Logger.LogTrace(
"Starting blocking listen...");
-
389 try
-
390 {
-
-
392 }
-
-
394 {
-
395 Logger.LogWarning(ex,
"IRC Main Listen Exception!");
-
396 }
-
397
-
398 Logger.LogTrace(
"Exiting listening task...");
-
399 },
-
400 cancellationToken,
-
-
402 TaskScheduler.Current);
-
403
-
-
-
406 {
-
-
-
-
410 break;
-
-
-
413 cancellationToken.ThrowIfCancellationRequested();
-
414 client.SendMessage(SendType.Message,
"NickServ", String.Format(CultureInfo.InvariantCulture,
"IDENTIFY {0}",
password));
-
415 break;
-
-
-
418 break;
-
-
-
421 cancellationToken.ThrowIfCancellationRequested();
-
-
423 break;
-
424 case null:
-
-
426 break;
-
427 default:
-
428 throw new InvalidOperationException($"Invalid IrcPasswordType: {passwordType.Value}");
-
429 }
+
+
384 () =>
+
385 {
+
386 Logger.LogTrace(
"Starting blocking listen...");
+
387 try
+
388 {
+
+
390 }
+
+
392 {
+
393 Logger.LogWarning(ex,
"IRC Main Listen Exception!");
+
394 }
+
395
+
396 Logger.LogTrace(
"Exiting listening task...");
+
397 },
+
398 cancellationToken,
+
+
400 TaskScheduler.Current);
+
401
+
+
+
404 {
+
+
+
+
408 break;
+
+
+
411 cancellationToken.ThrowIfCancellationRequested();
+
412 client.SendMessage(SendType.Message,
"NickServ", String.Format(CultureInfo.InvariantCulture,
"IDENTIFY {0}",
password));
+
413 break;
+
+
+
416 break;
+
+
+
419 cancellationToken.ThrowIfCancellationRequested();
+
+
421 break;
+
422 case null:
+
+
424 break;
+
425 default:
+
426 throw new InvalidOperationException($"Invalid IrcPasswordType: {passwordType.Value}");
+
427 }
+
428
+
429 cancellationToken.ThrowIfCancellationRequested();
430
-
431 cancellationToken.ThrowIfCancellationRequested();
-
432
-
433 Logger.LogTrace(
"Connection established!");
-
434 }
-
435 catch (
Exception e) when (e is not OperationCanceledException)
-
436 {
-
-
438 }
-
439 }
+
431 Logger.LogTrace(
"Connection established!");
+
432 }
+
433 catch (
Exception e) when (e is not OperationCanceledException)
+
434 {
+
+
436 }
+
437 }
-
async ValueTask SaslAuthenticate(CancellationToken cancellationToken)
Run SASL authentication on client.
-
async ValueTask Login(IrcFeatures client, string nickname, CancellationToken cancellationToken)
Register the client on the network.
+
async ValueTask SaslAuthenticate(CancellationToken cancellationToken)
Run SASL authentication on client.
+
async ValueTask Login(IrcFeatures client, string nickname, CancellationToken cancellationToken)
Register the client on the network.
Task? listenTask
The ValueTask used for IrcConnection.Listen(bool).
ILogger< Provider > Logger
The ILogger for the Provider.
IIOManager that resolves paths to Environment.CurrentDirectory.
@@ -766,37 +766,37 @@ Here is the call graph for this function:
-
Definition at line 442 of file IrcProvider.cs.
-
443 {
-
444 try
-
445 {
-
446 await Task.Factory.StartNew(
-
447 () =>
-
448 {
-
449 try
-
450 {
-
451 client.RfcQuit(
"Mr. Stark, I don't feel so good...", Priority.Critical);
-
452 }
-
-
454 {
-
455 Logger.LogWarning(e,
"Error quitting IRC!");
-
456 }
-
457 },
-
458 cancellationToken,
-
-
460 TaskScheduler.Current);
-
-
462 }
-
463 catch (OperationCanceledException)
-
464 {
-
465 throw;
-
466 }
-
-
468 {
-
469 Logger.LogWarning(e,
"Error disconnecting from IRC!");
-
470 }
-
471 }
-
async ValueTask HardDisconnect(CancellationToken cancellationToken)
Attempt to disconnect from IRC immediately.
+
Definition at line 440 of file IrcProvider.cs.
+
441 {
+
442 try
+
443 {
+
444 await Task.Factory.StartNew(
+
445 () =>
+
446 {
+
447 try
+
448 {
+
449 client.RfcQuit(
"Mr. Stark, I don't feel so good...", Priority.Critical);
+
450 }
+
+
452 {
+
453 Logger.LogWarning(e,
"Error quitting IRC!");
+
454 }
+
455 },
+
456 cancellationToken,
+
+
458 TaskScheduler.Current);
+
+
460 }
+
461 catch (OperationCanceledException)
+
462 {
+
463 throw;
+
464 }
+
+
466 {
+
467 Logger.LogWarning(e,
"Error disconnecting from IRC!");
+
468 }
+
469 }
+
async ValueTask HardDisconnect(CancellationToken cancellationToken)
Attempt to disconnect from IRC immediately.
References Tgstation.Server.Host.IO.DefaultIOManager.BlockingTaskCreationOptions.
@@ -837,7 +837,7 @@ Here is the call graph for this function:
161 }
-
References Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.HardDisconnect().
+
References Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.HardDisconnect().
@@ -896,59 +896,59 @@ Here is the call graph for this function:
-
Definition at line 516 of file IrcProvider.cs.
-
517 {
-
518 if (e.Data.Nick.Equals(
client.Nickname, StringComparison.OrdinalIgnoreCase))
-
519 return;
-
520
-
521 var username = e.Data.Nick;
-
522 var channelName = isPrivate ? username : e.Data.Channel;
-
523
-
524 ulong MapAndGetChannelId(Dictionary<ulong, string?> dicToCheck)
-
525 {
-
526 ulong? resultId = null;
-
527 if (!dicToCheck.Any(x =>
-
528 {
-
529 if (x.Value != channelName)
-
530 return false;
-
531 resultId = x.Key;
-
532 return true;
-
533 }))
-
534 {
-
-
536 dicToCheck.Add(resultId.Value, channelName);
-
-
-
539 }
-
540
-
541 return resultId!.Value;
-
542 }
-
543
-
544 ulong userId, channelId;
-
-
546 {
-
-
548 .Cast<KeyValuePair<ulong, string?>>()));
-
549 channelId = isPrivate ? userId : MapAndGetChannelId(
channelIdMap);
-
550 }
-
551
-
552 var channelFriendlyName = isPrivate ? String.Format(CultureInfo.InvariantCulture, "PM: {0}", channelName) : channelName;
-
553 var message = new Message(
-
554 new ChatUser(
-
555 new ChannelRepresentation(
address, channelFriendlyName, channelId)
-
556 {
-
557 IsPrivateChannel = isPrivate,
-
558 EmbedsSupported = false,
-
559
-
560
-
561 },
-
562 username,
-
563 username,
-
564 userId),
-
565 e.Data.Message);
-
566
-
-
568 }
+
Definition at line 514 of file IrcProvider.cs.
+
515 {
+
516 if (e.Data.Nick.Equals(
client.Nickname, StringComparison.OrdinalIgnoreCase))
+
517 return;
+
518
+
519 var username = e.Data.Nick;
+
520 var channelName = isPrivate ? username : e.Data.Channel;
+
521
+
522 ulong MapAndGetChannelId(Dictionary<ulong, string?> dicToCheck)
+
523 {
+
524 ulong? resultId = null;
+
525 if (!dicToCheck.Any(x =>
+
526 {
+
527 if (x.Value != channelName)
+
528 return false;
+
529 resultId = x.Key;
+
530 return true;
+
531 }))
+
532 {
+
+
534 dicToCheck.Add(resultId.Value, channelName);
+
+
+
537 }
+
538
+
539 return resultId!.Value;
+
540 }
+
541
+
542 ulong userId, channelId;
+
+
544 {
+
+
546 .Cast<KeyValuePair<ulong, string?>>()));
+
547 channelId = isPrivate ? userId : MapAndGetChannelId(
channelIdMap);
+
548 }
+
549
+
550 var channelFriendlyName = isPrivate ? String.Format(CultureInfo.InvariantCulture, "PM: {0}", channelName) : channelName;
+
551 var message = new Message(
+
552 new ChatUser(
+
553 new ChannelRepresentation(
address, channelFriendlyName, channelId)
+
554 {
+
555 IsPrivateChannel = isPrivate,
+
556 EmbedsSupported = false,
+
557
+
558
+
559 },
+
560 username,
+
561 username,
+
562 userId),
+
563 e.Data.Message);
+
564
+
+
566 }
void EnqueueMessage(Message? message)
Queues a message for NextMessage(CancellationToken).
@@ -986,40 +986,40 @@ Here is the call graph for this function:
- Returns
- A ValueTask representing the running operation.
-
Definition at line 681 of file IrcProvider.cs.
-
682 {
-
-
684 {
-
685 Logger.LogTrace(
"Not hard disconnecting, already offline");
-
686 return;
-
687 }
+
Definition at line 679 of file IrcProvider.cs.
+
680 {
+
+
682 {
+
683 Logger.LogTrace(
"Not hard disconnecting, already offline");
+
684 return;
+
685 }
+
686
+
687 Logger.LogTrace(
"Hard disconnect");
688
-
689 Logger.LogTrace(
"Hard disconnect");
-
690
-
691
-
692
-
693 var disconnectTask = Task.Factory.StartNew(
-
694 () =>
-
695 {
-
696 try
-
697 {
-
-
699 }
-
-
701 {
-
702 Logger.LogWarning(e,
"Error disconnecting IRC!");
-
703 }
-
704 },
-
705 cancellationToken,
-
-
707 TaskScheduler.Current);
-
708
-
709 await Task.WhenAny(
-
710 Task.WhenAll(
-
711 disconnectTask,
-
-
-
714 }
+
689
+
690
+
691 var disconnectTask = Task.Factory.StartNew(
+
692 () =>
+
693 {
+
694 try
+
695 {
+
+
697 }
+
+
699 {
+
700 Logger.LogWarning(e,
"Error disconnecting IRC!");
+
701 }
+
702 },
+
703 cancellationToken,
+
+
705 TaskScheduler.Current);
+
706
+
707 await Task.WhenAny(
+
708 Task.WhenAll(
+
709 disconnectTask,
+
+
+
712 }
override bool Connected
If the IProvider is currently connected.
async ValueTask Delay(TimeSpan timeSpan, CancellationToken cancellationToken)
Create a Task that completes after a given timeSpan .A ValueTask representing the running operation.
@@ -1076,43 +1076,43 @@ Here is the caller graph for this function:
Creates a new instance of the IRC client. Reusing the same client after a disconnection seems to cause issues.
- Returns
- The IrcFeatures client to use.
-
Definition at line 721 of file IrcProvider.cs.
-
722 {
-
723 var newClient = new IrcFeatures
-
724 {
-
725 SupportNonRfc = true,
-
726 CtcpUserInfo = "You are going to play. And I am going to watch. And everything will be just fine...",
-
727 AutoRejoin = true,
-
728 AutoRejoinOnKick = true,
-
729 AutoRelogin = false,
-
730 AutoRetry = false,
-
731 AutoReconnect = false,
-
732 ActiveChannelSyncing = true,
-
733 AutoNickHandling = true,
-
-
-
736 EnableUTF8Recode = true,
-
737 };
-
-
739 newClient.ValidateServerCertificate = true;
-
740
-
-
-
743
-
-
745 {
-
746 newClient.OnReadLine += (sender, e) =>
Logger.LogTrace(
"READ: {line}", e.Line);
-
747 newClient.OnWriteLine += (sender, e) =>
Logger.LogTrace(
"WRITE: {line}", e.Line);
-
748 }
-
749
-
750 newClient.OnError += (sender, e) =>
-
751 {
-
752 Logger.LogError(
"IRC ERROR: {error}", e.ErrorMessage);
-
753 newClient.Disconnect();
-
754 };
-
755
-
756 return newClient;
-
757 }
+
Definition at line 719 of file IrcProvider.cs.
+
720 {
+
721 var newClient = new IrcFeatures
+
722 {
+
723 SupportNonRfc = true,
+
724 CtcpUserInfo = "You are going to play. And I am going to watch. And everything will be just fine...",
+
725 AutoRejoin = true,
+
726 AutoRejoinOnKick = true,
+
727 AutoRelogin = false,
+
728 AutoRetry = false,
+
729 AutoReconnect = false,
+
730 ActiveChannelSyncing = true,
+
731 AutoNickHandling = true,
+
+
+
734 EnableUTF8Recode = true,
+
735 };
+
+
737 newClient.ValidateServerCertificate = true;
+
738
+
+
+
741
+
+
743 {
+
744 newClient.OnReadLine += (sender, e) =>
Logger.LogTrace(
"READ: {line}", e.Line);
+
745 newClient.OnWriteLine += (sender, e) =>
Logger.LogTrace(
"WRITE: {line}", e.Line);
+
746 }
+
747
+
748 newClient.OnError += (sender, e) =>
+
749 {
+
750 Logger.LogError(
"IRC ERROR: {error}", e.ErrorMessage);
+
751 newClient.Disconnect();
+
752 };
+
753
+
754 return newClient;
+
755 }
void Client_OnQueryMessage(object sender, IrcEventArgs e)
When a query message is received in IRC.
void Client_OnChannelMessage(object sender, IrcEventArgs e)
When a channel message is received in IRC.
bool ProviderNetworkDebug
If Chat Providers should log their network traffic. Normally disabled because it is too noisy.
@@ -1189,35 +1189,35 @@ Here is the caller graph for this function:
-
Definition at line 481 of file IrcProvider.cs.
-
482 {
-
483 var promise = new TaskCompletionSource<object>();
-
484
-
485 void Callback(object? sender, EventArgs e)
-
486 {
-
487 Logger.LogTrace(
"IRC Registered.");
-
488 promise.TrySetResult(e);
-
489 }
+
Definition at line 479 of file IrcProvider.cs.
+
480 {
+
481 var promise = new TaskCompletionSource<object>();
+
482
+
483 void Callback(object? sender, EventArgs e)
+
484 {
+
485 Logger.LogTrace(
"IRC Registered.");
+
486 promise.TrySetResult(e);
+
487 }
+
488
+
489 client.OnRegistered += Callback;
490
-
491 client.OnRegistered += Callback;
+
492
-
-
494
-
495 using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
-
496 cts.CancelAfter(TimeSpan.FromSeconds(30));
-
497
-
498 try
-
499 {
-
500 await promise.Task.WaitAsync(cts.Token);
-
501 client.OnRegistered -= Callback;
-
502 }
-
503 catch (OperationCanceledException)
-
504 {
-
-
-
507 throw new JobException(
"Timed out waiting for IRC Registration");
-
508 }
-
509 }
+
493 using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
+
494 cts.CancelAfter(TimeSpan.FromSeconds(30));
+
495
+
496 try
+
497 {
+
498 await promise.Task.WaitAsync(cts.Token);
+
499 client.OnRegistered -= Callback;
+
500 }
+
501 catch (OperationCanceledException)
+
502 {
+
+
+
505 throw new JobException(
"Timed out waiting for IRC Registration");
+
506 }
+
507 }
@@ -1329,70 +1329,70 @@ Here is the caller graph for this function:
- Returns
- A ValueTask representing the running operation.
-
Definition at line 611 of file IrcProvider.cs.
-
612 {
-
613 client.WriteLine(
"CAP REQ :sasl", Priority.Critical);
-
614 cancellationToken.ThrowIfCancellationRequested();
-
615
-
616 Logger.LogTrace(
"Logging in...");
-
-
618 cancellationToken.ThrowIfCancellationRequested();
-
619
-
620
-
621 var receivedAck = false;
-
622 var receivedPlus = false;
-
623
-
624 void AuthenticationDelegate(object sender, ReadLineEventArgs e)
-
625 {
-
626 if (e.Line.Contains("ACK :sasl", StringComparison.Ordinal))
-
627 receivedAck = true;
-
628 else if (e.Line.Contains("AUTHENTICATE +", StringComparison.Ordinal))
-
629 receivedPlus = true;
-
630 }
-
631
-
632 Logger.LogTrace(
"Performing handshake...");
-
633 client.OnReadLine += AuthenticationDelegate;
-
634 try
-
635 {
-
636 using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
-
637 timeoutCts.CancelAfter(TimeSpan.FromSeconds(25));
-
638 var timeoutToken = timeoutCts.Token;
-
639
-
640 var listenTimeSpan = TimeSpan.FromMilliseconds(10);
-
641 for (; !receivedAck;
-
-
-
644
-
645 client.WriteLine(
"AUTHENTICATE PLAIN", Priority.Critical);
-
646 timeoutToken.ThrowIfCancellationRequested();
-
647
-
648 for (; !receivedPlus;
-
-
-
651 }
-
652 finally
-
653 {
-
654 client.OnReadLine -= AuthenticationDelegate;
-
655 }
+
Definition at line 609 of file IrcProvider.cs.
+
610 {
+
611 client.WriteLine(
"CAP REQ :sasl", Priority.Critical);
+
612 cancellationToken.ThrowIfCancellationRequested();
+
613
+
614 Logger.LogTrace(
"Logging in...");
+
+
616 cancellationToken.ThrowIfCancellationRequested();
+
617
+
618
+
619 var receivedAck = false;
+
620 var receivedPlus = false;
+
621
+
622 void AuthenticationDelegate(object sender, ReadLineEventArgs e)
+
623 {
+
624 if (e.Line.Contains("ACK :sasl", StringComparison.Ordinal))
+
625 receivedAck = true;
+
626 else if (e.Line.Contains("AUTHENTICATE +", StringComparison.Ordinal))
+
627 receivedPlus = true;
+
628 }
+
629
+
630 Logger.LogTrace(
"Performing handshake...");
+
631 client.OnReadLine += AuthenticationDelegate;
+
632 try
+
633 {
+
634 using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
+
635 timeoutCts.CancelAfter(TimeSpan.FromSeconds(25));
+
636 var timeoutToken = timeoutCts.Token;
+
637
+
638 var listenTimeSpan = TimeSpan.FromMilliseconds(10);
+
639 for (; !receivedAck;
+
+
+
642
+
643 client.WriteLine(
"AUTHENTICATE PLAIN", Priority.Critical);
+
644 timeoutToken.ThrowIfCancellationRequested();
+
645
+
646 for (; !receivedPlus;
+
+
+
649 }
+
650 finally
+
651 {
+
652 client.OnReadLine -= AuthenticationDelegate;
+
653 }
+
654
+
655 cancellationToken.ThrowIfCancellationRequested();
656
-
657 cancellationToken.ThrowIfCancellationRequested();
-
658
-
659
-
660 Logger.LogTrace(
"Sending credentials...");
-
661 var authString = String.Format(
-
662 CultureInfo.InvariantCulture,
-
663 "{0}{1}{0}{1}{2}",
-
-
665 '\0',
-
-
667 var b64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(authString));
-
668 var authLine = $"AUTHENTICATE {b64}";
-
669 client.WriteLine(authLine, Priority.Critical);
-
670 cancellationToken.ThrowIfCancellationRequested();
-
671
-
672 Logger.LogTrace(
"Finishing authentication...");
-
673 client.WriteLine(
"CAP END", Priority.Critical);
-
674 }
+
657
+
658 Logger.LogTrace(
"Sending credentials...");
+
659 var authString = String.Format(
+
660 CultureInfo.InvariantCulture,
+
661 "{0}{1}{0}{1}{2}",
+
+
663 '\0',
+
+
665 var b64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(authString));
+
666 var authLine = $"AUTHENTICATE {b64}";
+
667 client.WriteLine(authLine, Priority.Critical);
+
668 cancellationToken.ThrowIfCancellationRequested();
+
669
+
670 Logger.LogTrace(
"Finishing authentication...");
+
671 client.WriteLine(
"CAP END", Priority.Critical);
+
672 }
Task NonBlockingListen(CancellationToken cancellationToken)
Perform a non-blocking IrcConnection.Listen(bool).
References Tgstation.Server.Host.Utils.AsyncDelayer.Delay().
@@ -1617,70 +1617,68 @@ Here is the caller graph for this function:
227 {
228 ArgumentNullException.ThrowIfNull(revisionInformation);
229 ArgumentNullException.ThrowIfNull(engineVersion);
-
230 ArgumentNullException.ThrowIfNull(gitHubOwner);
-
231 ArgumentNullException.ThrowIfNull(gitHubRepo);
-
232
-
233 var commitInsert = revisionInformation.CommitSha![..7];
-
234 string remoteCommitInsert;
-
235 if (revisionInformation.CommitSha == revisionInformation.OriginCommitSha)
-
236 {
-
237 commitInsert = String.Format(CultureInfo.InvariantCulture, localCommitPushed ? "^{0}" : "{0}", commitInsert);
-
238 remoteCommitInsert = String.Empty;
-
239 }
-
240 else
-
241 remoteCommitInsert = String.Format(CultureInfo.InvariantCulture, ". Remote commit: ^{0}", revisionInformation.OriginCommitSha![..7]);
-
242
-
243 var testmergeInsert = (revisionInformation.ActiveTestMerges?.Count ?? 0) == 0
-
244 ? String.Empty
-
245 : String.Format(
-
246 CultureInfo.InvariantCulture,
-
247 " (Test Merges: {0})",
-
248 String.Join(
-
249 ", ",
-
250 revisionInformation
-
251 .ActiveTestMerges!
-
-
253 .Select(x =>
-
254 {
-
255 var result = String.Format(CultureInfo.InvariantCulture, "#{0} at {1}", x.Number, x.TargetCommitSha![..7]);
-
256 if (x.Comment != null)
-
257 result += String.Format(CultureInfo.InvariantCulture, " ({0})", x.Comment);
-
258 return result;
-
259 })));
-
260
-
-
-
263 null,
-
-
265 {
-
266 Text = String.Format(
-
267 CultureInfo.InvariantCulture,
-
268 $"{prefix}: Deploying revision: {0}{1}{2} BYOND Version: {3}{4}",
-
269 commitInsert,
-
270 testmergeInsert,
-
271 remoteCommitInsert,
-
-
273 estimatedCompletionTime.HasValue
-
274 ? $" ETA: {estimatedCompletionTime - DateTimeOffset.UtcNow}"
-
275 : String.Empty),
-
276 },
-
277 channelId,
-
278 cancellationToken);
-
279
-
280 return async (errorMessage, dreamMakerOutput) =>
-
281 {
-
-
283 null,
-
-
285 {
-
286 Text = $"{prefix}: Deployment {(errorMessage == null ? "complete" : "failed")}!",
-
287 },
-
288 channelId,
-
289 cancellationToken);
-
290
-
291 return active => ValueTask.CompletedTask;
-
292 };
-
293 }
+
230
+
231 var commitInsert = revisionInformation.CommitSha![..7];
+
232 string remoteCommitInsert;
+
233 if (revisionInformation.CommitSha == revisionInformation.OriginCommitSha)
+
234 {
+
235 commitInsert = String.Format(CultureInfo.InvariantCulture, localCommitPushed ? "^{0}" : "{0}", commitInsert);
+
236 remoteCommitInsert = String.Empty;
+
237 }
+
238 else
+
239 remoteCommitInsert = String.Format(CultureInfo.InvariantCulture, ". Remote commit: ^{0}", revisionInformation.OriginCommitSha![..7]);
+
240
+
241 var testmergeInsert = (revisionInformation.ActiveTestMerges?.Count ?? 0) == 0
+
242 ? String.Empty
+
243 : String.Format(
+
244 CultureInfo.InvariantCulture,
+
245 " (Test Merges: {0})",
+
246 String.Join(
+
247 ", ",
+
248 revisionInformation
+
249 .ActiveTestMerges!
+
+
251 .Select(x =>
+
252 {
+
253 var result = String.Format(CultureInfo.InvariantCulture, "#{0} at {1}", x.Number, x.TargetCommitSha![..7]);
+
254 if (x.Comment != null)
+
255 result += String.Format(CultureInfo.InvariantCulture, " ({0})", x.Comment);
+
256 return result;
+
257 })));
+
258
+
+
+
261 null,
+
+
263 {
+
264 Text = String.Format(
+
265 CultureInfo.InvariantCulture,
+
266 $"{prefix}: Deploying revision: {0}{1}{2} BYOND Version: {3}{4}",
+
267 commitInsert,
+
268 testmergeInsert,
+
269 remoteCommitInsert,
+
+
271 estimatedCompletionTime.HasValue
+
272 ? $" ETA: {estimatedCompletionTime - DateTimeOffset.UtcNow}"
+
273 : String.Empty),
+
274 },
+
275 channelId,
+
276 cancellationToken);
+
277
+
278 return async (errorMessage, dreamMakerOutput) =>
+
279 {
+
+
281 null,
+
+
283 {
+
284 Text = $"{prefix}: Deployment {(errorMessage == null ? "complete" : "failed")}!",
+
285 },
+
286 channelId,
+
287 cancellationToken);
+
288
+
289 return active => ValueTask.CompletedTask;
+
290 };
+
291 }
override string ToString()
EngineType? Engine
The EngineType.
diff --git a/class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_default_i_o_manager.html b/class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_default_i_o_manager.html
index 3793215db9..582a77c450 100644
--- a/class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_default_i_o_manager.html
+++ b/class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_default_i_o_manager.html
@@ -2262,7 +2262,7 @@ Here is the call graph for this function:
Definition at line 31 of file DefaultIOManager.cs.
-
Referenced by Tgstation.Server.Host.Components.Repository.Repository.AddTestMerge(), Tgstation.Server.Host.Components.Repository.Repository.CheckoutObject(), Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.Connect(), Tgstation.Server.Host.Components.StaticFiles.Configuration.CreateDirectory(), Tgstation.Server.Host.System.WindowsProcessFeatures.CreateDump(), Tgstation.Server.Host.Components.Repository.LibGit2RepositoryFactory.CreateFromPath(), Tgstation.Server.Host.IO.DefaultIOManager.DeleteDirectory(), Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.DisconnectImpl(), Tgstation.Server.Host.Components.Repository.Repository.FetchOrigin(), Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.HardDisconnect(), Tgstation.Server.Host.Components.Repository.Repository.MergeOrigin(), Tgstation.Server.Host.System.Process.Process(), Tgstation.Server.Host.Components.StaticFiles.Configuration.Read(), Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.SendMessage(), Tgstation.Server.Host.Components.Repository.Repository.Synchronize(), Tgstation.Server.Host.Components.Repository.Repository.UpdateSubmodules(), and Tgstation.Server.Host.Components.StaticFiles.Configuration.Write().
+
Referenced by Tgstation.Server.Host.Components.Repository.Repository.AddTestMerge(), Tgstation.Server.Host.Components.Repository.Repository.CheckoutObject(), Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.Connect(), Tgstation.Server.Host.Components.StaticFiles.Configuration.CreateDirectory(), Tgstation.Server.Host.System.WindowsProcessFeatures.CreateDump(), Tgstation.Server.Host.Components.Repository.LibGit2RepositoryFactory.CreateFromPath(), Tgstation.Server.Host.IO.DefaultIOManager.DeleteDirectory(), Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.DisconnectImpl(), Tgstation.Server.Host.Components.Repository.Repository.FetchOrigin(), Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.HardDisconnect(), Tgstation.Server.Host.Components.Repository.Repository.MergeOrigin(), Tgstation.Server.Host.System.Process.Process(), Tgstation.Server.Host.Components.StaticFiles.Configuration.Read(), Tgstation.Server.Host.Components.Chat.Providers.IrcProvider.SendMessage(), Tgstation.Server.Host.Components.Repository.Repository.Synchronize(), Tgstation.Server.Host.Components.Repository.Repository.UpdateSubmodules(), and Tgstation.Server.Host.Components.StaticFiles.Configuration.Write().