diff --git a/changelog.d/110.misc b/changelog.d/110.misc new file mode 100644 index 00000000..4d9109a0 --- /dev/null +++ b/changelog.d/110.misc @@ -0,0 +1 @@ +Include any certfp lines in a whois response. diff --git a/src/codes.ts b/src/codes.ts index cadc560e..3fada45b 100644 --- a/src/codes.ts +++ b/src/codes.ts @@ -157,6 +157,10 @@ export const replyCodes = { name: 'rpl_globalusers', type: 'reply' }, + 276: { + name: 'rpl_whoiscertfp', + type: 'reply', + }, 300: { name: 'rpl_none', type: 'reply' diff --git a/src/irc.ts b/src/irc.ts index 40c85898..80eb972f 100644 --- a/src/irc.ts +++ b/src/irc.ts @@ -1052,6 +1052,8 @@ export class Client extends (EventEmitter as unknown as new () => TypedEmitter TypedEmitter { @@ -1690,14 +1693,18 @@ export class Client extends (EventEmitter as unknown as new () => TypedEmitter(nick: string, key: K, value: V, onlyIfExists = false) { + let data: WhoisResponse|undefined = this.state.whoisData.get(nick); + if (onlyIfExists && !data) { + return; + } + else if (!data) { + data = { nick }; + this.state.whoisData.set(nick, data); + } + data[key] = value; } private _clearWhoisData(nick: string) { diff --git a/src/state.ts b/src/state.ts index d4eae97a..0edd2e04 100644 --- a/src/state.ts +++ b/src/state.ts @@ -14,6 +14,7 @@ export interface WhoisResponse { account?: string; accountinfo?: string; realHost?: string; + certfp?: string; } export interface IrcSupported { diff --git a/src/testing/index.ts b/src/testing/index.ts index e69c03d7..a8638c55 100644 --- a/src/testing/index.ts +++ b/src/testing/index.ts @@ -1,5 +1,5 @@ import { randomUUID } from 'crypto'; -import { Client, ClientEvents, Message } from '..'; +import { Client, ClientEvents, IrcClientOpts, Message } from '..'; const DEFAULT_PORT = parseInt(process.env.IRC_TEST_PORT ?? '6667', 10); const DEFAULT_ADDRESS = process.env.IRC_TEST_ADDRESS ?? "127.0.0.1"; @@ -75,7 +75,10 @@ export class TestIrcServer { } public readonly clients: Record = {}; - constructor(public readonly address = DEFAULT_ADDRESS, public readonly port = DEFAULT_PORT) { } + constructor( + public readonly address = DEFAULT_ADDRESS, public readonly port = DEFAULT_PORT, + public readonly customConfig: Partial = {} + ) { } async setUp(clients = ['speaker', 'listener']) { const connections: Promise[] = []; @@ -86,6 +89,7 @@ export class TestIrcServer { autoConnect: false, connectionTimeout: 4000, debug: true, + ...this.customConfig, }); this.clients[clientName] = client; // Make sure we load isupport before reporting readyness.