Skip to content

Commit

Permalink
Merge branch 'kiwiirc:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
edfletcher authored Jul 29, 2023
2 parents 46214c6 + f2989ca commit 4743e06
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/commands/handlers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,15 +307,18 @@ const handlers = {
const cache_key = command.params[1].toLowerCase();
const cache = handler.cache('whois.' + cache_key);

// <source> 338 <target> <nick> <user>@<host> <ip> :Actual user@host, Actual IP
// <source> 338 <target> <nick> [<user>@]<host> <ip> :Actual user@host, Actual IP
const user_host = command.params[command.params.length - 3] || '';
const host = user_host.substring(user_host.indexOf('@') + 1);
const mask_sep = user_host.indexOf('@');
const user = user_host.substring(0, mask_sep) || undefined;
const host = user_host.substring(mask_sep + 1);
const ip = command.params[command.params.length - 2];

// UnrealIRCd uses this numeric for something else resulting in ip+host
// to be empty, so ignore this is that's the case
if (ip && host) {
cache.actual_ip = ip;
cache.actual_username = user;
cache.actual_hostname = host;
}
},
Expand All @@ -338,7 +341,7 @@ const handlers = {
// This exposes some fields (that may or may not be set).
// Valid keys that should always be set: nick, ident, hostname, real_name
// Valid optional keys: actual_ip, actual_hostname, account, server,
// server_info
// server_info, actual_username
// More optional fields MAY exist, depending on the type of ircd.
const cache_key = command.params[1].toLowerCase();
const cache = handler.cache('whois.' + cache_key);
Expand Down

0 comments on commit 4743e06

Please sign in to comment.