|
@@ -1,10 +1,11 @@
|
|
|
var protocol = {
|
|
|
+ supportsTags: false,
|
|
|
connected: function(){
|
|
|
- ircSend(null, settings.ID, 'PASS', [settings.password]);
|
|
|
- ircSend(null, settings.ID, 'PROTOCTL', ['NICKv2', 'VHP', 'UMODE2', 'NICKIP', 'SJOIN', 'SJOIN2', 'SJ3', 'NOQUIT', 'TKLEXT', 'MLOCK', 'SID', 'MTAGS']);
|
|
|
- ircSend(null, settings.ID, 'PROTOCTL', ['EAUTH=' + settings.name + ',,,' + settings.version]);
|
|
|
- ircSend(null, settings.ID, 'PROTOCTL', ['SID=' + settings.ID]);
|
|
|
- ircSend(null, settings.ID, 'SERVER', [settings.name, '1', settings.description]);
|
|
|
+ ircSend(handlers.newTags(), settings.ID, 'PASS', [settings.password]);
|
|
|
+ ircSend(handlers.newTags(), settings.ID, 'PROTOCTL', ['NICKv2', 'VHP', 'UMODE2', 'NICKIP', 'SJOIN', 'SJOIN2', 'SJ3', 'NOQUIT', 'TKLEXT', 'MLOCK', 'SID', 'MTAGS']);
|
|
|
+ ircSend(handlers.newTags(), settings.ID, 'PROTOCTL', ['EAUTH=' + settings.name + ',,,' + settings.version]);
|
|
|
+ ircSend(handlers.newTags(), settings.ID, 'PROTOCTL', ['SID=' + settings.ID]);
|
|
|
+ ircSend(handlers.newTags(), settings.ID, 'SERVER', [settings.name, '1', settings.description]);
|
|
|
},
|
|
|
processMessage: function(msg){
|
|
|
if(!msg) return;
|
|
@@ -68,7 +69,7 @@ var protocol = {
|
|
|
}
|
|
|
var realname = user.realname;
|
|
|
var args = [nick, distance, TS, ident, host, uid, account, umodes, vhost, cloakedHost, ip, realname];
|
|
|
- ircSend(null, settings.ID, 'UID', args);
|
|
|
+ ircSend(handlers.newTags(), settings.ID, 'UID', args);
|
|
|
},
|
|
|
syncChannel: function(channel){
|
|
|
var modes = null;
|
|
@@ -135,7 +136,7 @@ var protocol = {
|
|
|
if(modes) args.push(modes); else args.push('+');
|
|
|
if(modeArgs) args.push(modeArgs);
|
|
|
args.push(text);
|
|
|
- ircSend(null, settings.ID, 'SJOIN', args);
|
|
|
+ ircSend(handlers.newTags(), settings.ID, 'SJOIN', args);
|
|
|
} while(true);
|
|
|
},
|
|
|
'makeUid': function(){
|
|
@@ -143,24 +144,24 @@ var protocol = {
|
|
|
},
|
|
|
'changeUmodes': function(user, umodes){
|
|
|
if(user.uplink == settings.me){ // services bot
|
|
|
- ircSend(null, user.uid, 'UMODE2', [makeUmodeString(umodes, true)]);
|
|
|
+ ircSend(handlers.newTags(), user.uid, 'UMODE2', [makeUmodeString(umodes, true)]);
|
|
|
} else { // normal user
|
|
|
- ircSend(null, settings.ID, 'SVS2MODE', [user.uid, makeUmodeString(umodes, false)]);
|
|
|
+ ircSend(handlers.newTags(), settings.ID, 'SVS2MODE', [user.uid, makeUmodeString(umodes, false)]);
|
|
|
}
|
|
|
user.changeUmodes(umodes);
|
|
|
+ },
|
|
|
+ 'joinChannel': function(user, channel){
|
|
|
+ ircSend(handlers.newTags(), settings.ID, 'SJOIN', [Math.floor(new Date() / 1000).toString(10), channel.name, user.uid]);
|
|
|
+ channel.joinUser(user);
|
|
|
}
|
|
|
}
|
|
|
+//>>> @time=2020-03-17T08:14:32.290Z;msgid=uwGzT2VzSTEEGab0demOxX :093 SJOIN 1584303585 #test :0931Y7O8W
|
|
|
//>>> @time=2020-03-15T12:17:07.355Z;msgid=FhjgUp20YBKQ32TGPM28tS :143 SJOIN 1580651090 #help +nt :0931Y7O8W 093375CFR 123VTY20R
|
|
|
|
|
|
function randomID(){
|
|
|
- var result = '';
|
|
|
var length = 6;
|
|
|
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
|
|
- var charactersLength = characters.length;
|
|
|
- for(var i=0; i<length; i++ ) {
|
|
|
- result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
|
- }
|
|
|
- return result;
|
|
|
+ return handlers.randomID(characters, length);
|
|
|
}
|
|
|
|
|
|
module.exports = protocol;
|
|
@@ -175,7 +176,8 @@ var handlers = {
|
|
|
getChannel: null,
|
|
|
findChannel: null,
|
|
|
quitUser: null,
|
|
|
- removeServer: null
|
|
|
+ removeServer: null,
|
|
|
+ randomID: null
|
|
|
};
|
|
|
|
|
|
var settings = {
|
|
@@ -423,9 +425,13 @@ var cmdBinds = {
|
|
|
break;
|
|
|
}
|
|
|
} else {
|
|
|
+ switch(arg){
|
|
|
+ case 'MTAGS': protocol.supportsTags = true; break;
|
|
|
+ }
|
|
|
connection.protoctl[arg] = true;
|
|
|
}
|
|
|
}
|
|
|
+ console.log(protocol);
|
|
|
},
|
|
|
|
|
|
'SERVER': function(msg){
|
|
@@ -437,7 +443,7 @@ var cmdBinds = {
|
|
|
throw 'Unknown SERVER message';
|
|
|
}
|
|
|
events.doEvent('netSynced');
|
|
|
- ircSend(null, settings.ID, 'EOS');
|
|
|
+ ircSend(handlers.newTags(), settings.ID, 'EOS');
|
|
|
},
|
|
|
|
|
|
'MD': function(msg){
|
|
@@ -589,7 +595,7 @@ var cmdBinds = {
|
|
|
},
|
|
|
|
|
|
'NETINFO': function(msg){
|
|
|
- ircSend(null, null, 'NETINFO', [settings.maxUsers.toString(10), Math.floor(new Date() / 1000).toString(10), msg.args[2], msg.args[3], "0", "0", "0", msg.args[7]]);
|
|
|
+ ircSend(handlers.newTags(), null, 'NETINFO', [settings.maxUsers.toString(10), Math.floor(new Date() / 1000).toString(10), msg.args[2], msg.args[3], "0", "0", "0", msg.args[7]]);
|
|
|
},
|
|
|
|
|
|
'SASL': function(msg){
|