mirror of
https://codeberg.org/emersion/gamja
synced 2025-03-13 07:48:37 +01:00
lib/client: set a default server prefix
Set the default server prefix to "*". This allows the rest of the code to assume all messages always have a prefix.
This commit is contained in:
parent
e28769216a
commit
d2e41666ad
@ -32,7 +32,7 @@ export default class Client extends EventTarget {
|
||||
};
|
||||
|
||||
status = Client.Status.DISCONNECTED;
|
||||
serverPrefix = null;
|
||||
serverPrefix = { name: "*" };
|
||||
nick = null;
|
||||
availableCaps = {};
|
||||
enabledCaps = {};
|
||||
@ -158,14 +158,6 @@ export default class Client extends EventTarget {
|
||||
if (!msg.prefix) {
|
||||
msg.prefix = this.serverPrefix;
|
||||
}
|
||||
// Some servers send e.g. NOTICE messages before RPL_WELCOME
|
||||
if (!msg.prefix) {
|
||||
msg.prefix = {
|
||||
name: null,
|
||||
user: null,
|
||||
host: null,
|
||||
};
|
||||
}
|
||||
|
||||
var msgBatch = null;
|
||||
if (msg.tags["batch"]) {
|
||||
@ -185,9 +177,12 @@ export default class Client extends EventTarget {
|
||||
return;
|
||||
}
|
||||
|
||||
if (msg.prefix) {
|
||||
this.serverPrefix = msg.prefix;
|
||||
}
|
||||
|
||||
console.log("Registration complete");
|
||||
this.setStatus(Client.Status.REGISTERED);
|
||||
this.serverPrefix = msg.prefix;
|
||||
break;
|
||||
case irc.RPL_ISUPPORT:
|
||||
var tokens = msg.params.slice(1, -1);
|
||||
@ -477,16 +472,10 @@ export default class Client extends EventTarget {
|
||||
}
|
||||
|
||||
isMyNick(nick) {
|
||||
if (!nick) {
|
||||
return false;
|
||||
}
|
||||
return this.cm(nick) == this.cm(this.nick);
|
||||
}
|
||||
|
||||
isChannel(name) {
|
||||
if (!name) {
|
||||
return false;
|
||||
}
|
||||
var chanTypes = this.isupport.get("CHANTYPES") || irc.STD_CHANTYPES;
|
||||
return chanTypes.indexOf(name[0]) >= 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user