Keep track of channel members, add /nick command
This commit is contained in:
parent
9a3409e970
commit
dba59fe2c7
2 changed files with 58 additions and 2 deletions
|
@ -1,5 +1,7 @@
|
|||
const RPL_WELCOME = "001";
|
||||
const RPL_TOPIC = "332";
|
||||
const RPL_NAMREPLY = "353";
|
||||
const RPL_ENDOFNAMES = "366";
|
||||
const ERR_PASSWDMISMATCH = "464";
|
||||
|
||||
function parsePrefix(s) {
|
||||
|
@ -106,3 +108,20 @@ function formatMessage(msg) {
|
|||
s += "\r\n";
|
||||
return s;
|
||||
}
|
||||
|
||||
function parseMembership(s) {
|
||||
// TODO: use the PREFIX token from RPL_ISUPPORT
|
||||
const STD_MEMBERSHIPS = "~&@%+";
|
||||
|
||||
var i;
|
||||
for (i = 0; i < s.length; i++) {
|
||||
if (STD_MEMBERSHIPS.indexOf(s[i]) < 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
prefix: s.slice(0, i),
|
||||
nick: s.slice(i),
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue