Hide meaningless real names
This commit is contained in:
@@ -2,6 +2,7 @@ import { html, Component } from "../lib/index.js";
|
|||||||
import linkify from "../lib/linkify.js";
|
import linkify from "../lib/linkify.js";
|
||||||
import { strip as stripANSI } from "../lib/ansi.js";
|
import { strip as stripANSI } from "../lib/ansi.js";
|
||||||
import { BufferType, ServerStatus, getServerName } from "../state.js";
|
import { BufferType, ServerStatus, getServerName } from "../state.js";
|
||||||
|
import * as irc from "../lib/irc.js";
|
||||||
|
|
||||||
const UserStatus = {
|
const UserStatus = {
|
||||||
HERE: "here",
|
HERE: "here",
|
||||||
@@ -134,7 +135,7 @@ export default function BufferHeader(props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let realname = props.buffer.name;
|
let realname = props.buffer.name;
|
||||||
if (props.user.realname) {
|
if (irc.isMeaningfulRealname(props.user.realname, props.buffer.name)) {
|
||||||
realname = stripANSI(props.user.realname || "");
|
realname = stripANSI(props.user.realname || "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { html, Component } from "../lib/index.js";
|
|||||||
import { getNickURL } from "../state.js";
|
import { getNickURL } from "../state.js";
|
||||||
import { strip as stripANSI } from "../lib/ansi.js";
|
import { strip as stripANSI } from "../lib/ansi.js";
|
||||||
import Membership from "./membership.js";
|
import Membership from "./membership.js";
|
||||||
|
import * as irc from "../lib/irc.js";
|
||||||
|
|
||||||
class MemberItem extends Component {
|
class MemberItem extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -48,7 +49,7 @@ class MemberItem extends Component {
|
|||||||
mask = `${user.username}@${user.hostname}`;
|
mask = `${user.username}@${user.hostname}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user.realname) {
|
if (irc.isMeaningfulRealname(user.realname, this.props.nick)) {
|
||||||
title = stripANSI(user.realname);
|
title = stripANSI(user.realname);
|
||||||
if (mask) {
|
if (mask) {
|
||||||
title = `${title} (${mask})`;
|
title = `${title} (${mask})`;
|
||||||
|
|||||||
+17
@@ -638,3 +638,20 @@ export function forEachChannelModeUpdate(msg, isupport, callback) {
|
|||||||
callback(mode, add, arg);
|
callback(mode, add, arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Since the realname is mandatory, many clients set a meaningless realname.
|
||||||
|
*/
|
||||||
|
export function isMeaningfulRealname(realname, nick) {
|
||||||
|
if (!realname || realname === nick) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (realname.toLowerCase() === "realname") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: add more quirks
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user