|
@@ -53,7 +53,7 @@ var protocol = {
|
|
if(user.account){
|
|
if(user.account){
|
|
account = user.account;
|
|
account = user.account;
|
|
}
|
|
}
|
|
- var umodes = '+oSB'; // TODO
|
|
|
|
|
|
+ var umodes = makeUmodeString(user.umodes, true);
|
|
var vhost = '*';
|
|
var vhost = '*';
|
|
if(user.vhost){
|
|
if(user.vhost){
|
|
vhost = user.vhost;
|
|
vhost = user.vhost;
|
|
@@ -68,7 +68,6 @@ var protocol = {
|
|
}
|
|
}
|
|
var realname = user.realname;
|
|
var realname = user.realname;
|
|
var args = [nick, distance, TS, ident, host, uid, account, umodes, vhost, cloakedHost, ip, realname];
|
|
var args = [nick, distance, TS, ident, host, uid, account, umodes, vhost, cloakedHost, ip, realname];
|
|
- console.log(args);
|
|
|
|
ircSend(null, settings.ID, 'UID', args);
|
|
ircSend(null, settings.ID, 'UID', args);
|
|
},
|
|
},
|
|
syncChannel: function(channel){
|
|
syncChannel: function(channel){
|
|
@@ -100,7 +99,7 @@ var protocol = {
|
|
if(chmodeMap[c].name == statusMode){
|
|
if(chmodeMap[c].name == statusMode){
|
|
for(sm in connection.statusmodes){
|
|
for(sm in connection.statusmodes){
|
|
if(connection.statusmodes[sm] == c){
|
|
if(connection.statusmodes[sm] == c){
|
|
- status += sm;
|
|
|
|
|
|
+ status += sm; // assign status character to user
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -136,13 +135,19 @@ var protocol = {
|
|
if(modes) args.push(modes); else args.push('+');
|
|
if(modes) args.push(modes); else args.push('+');
|
|
if(modeArgs) args.push(modeArgs);
|
|
if(modeArgs) args.push(modeArgs);
|
|
args.push(text);
|
|
args.push(text);
|
|
- console.log(args);
|
|
|
|
ircSend(null, settings.ID, 'SJOIN', args);
|
|
ircSend(null, settings.ID, 'SJOIN', args);
|
|
-
|
|
|
|
} while(true);
|
|
} while(true);
|
|
},
|
|
},
|
|
'makeUid': function(){
|
|
'makeUid': function(){
|
|
return settings.me.sid + randomID();
|
|
return settings.me.sid + randomID();
|
|
|
|
+ },
|
|
|
|
+ 'changeUmodes': function(user, umodes){
|
|
|
|
+ if(user.uplink == settings.me){ // services bot
|
|
|
|
+ ircSend(null, user.uid, 'UMODE2', [makeUmodeString(umodes, true)]);
|
|
|
|
+ } else { // normal user
|
|
|
|
+ ircSend(null, settings.ID, 'SVS2MODE', [user.uid, makeUmodeString(umodes, false)]);
|
|
|
|
+ }
|
|
|
|
+ user.changeUmodes(umodes);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//>>> @time=2020-03-15T12:17:07.355Z;msgid=FhjgUp20YBKQ32TGPM28tS :143 SJOIN 1580651090 #help +nt :0931Y7O8W 093375CFR 123VTY20R
|
|
//>>> @time=2020-03-15T12:17:07.355Z;msgid=FhjgUp20YBKQ32TGPM28tS :143 SJOIN 1580651090 #help +nt :0931Y7O8W 093375CFR 123VTY20R
|
|
@@ -253,7 +258,7 @@ var umodeMap = {
|
|
'W': { 'name': 'WHOISNOTICE', 'user': false, 'services': false },
|
|
'W': { 'name': 'WHOISNOTICE', 'user': false, 'services': false },
|
|
'G': { 'name': 'CENSORMESSAGES', 'user': true, 'services': true },
|
|
'G': { 'name': 'CENSORMESSAGES', 'user': true, 'services': true },
|
|
'T': { 'name': 'NOCTCPMESSAGES', 'user': true, 'services': true },
|
|
'T': { 'name': 'NOCTCPMESSAGES', 'user': true, 'services': true },
|
|
- 'S': { 'name': 'SERVICEUSER', 'user': false, 'services': true },
|
|
|
|
|
|
+ 'S': { 'name': 'SERVICEUSER', 'user': false, 'services': false },
|
|
'B': { 'name': 'BOT', 'user': true, 'services': true }
|
|
'B': { 'name': 'BOT', 'user': true, 'services': true }
|
|
};
|
|
};
|
|
|
|
|
|
@@ -324,6 +329,32 @@ function parseUmodes(modeString){
|
|
return modes;
|
|
return modes;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function makeUmodeString(umodes, own){
|
|
|
|
+ var out = '';
|
|
|
|
+ var plus = false;
|
|
|
|
+ var addPM = true;
|
|
|
|
+ for(char in umodeMap){
|
|
|
|
+ var name = umodeMap[char].name;
|
|
|
|
+ if(name in umodes){
|
|
|
|
+ if(own || umodeMap[char].services){
|
|
|
|
+ if(umodes[name] && (addPM || !plus)){
|
|
|
|
+ addPM = false;
|
|
|
|
+ plus = true;
|
|
|
|
+ out += '+';
|
|
|
|
+ } else if(!umodes[name] && (addPM || plus)){
|
|
|
|
+ addPM = false;
|
|
|
|
+ plus = false;
|
|
|
|
+ out += '-';
|
|
|
|
+ }
|
|
|
|
+ out += char;
|
|
|
|
+ } else {
|
|
|
|
+ console.log('Attempted to set umode ' + char + ' which is not settable by services');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return out;
|
|
|
|
+}
|
|
|
|
+
|
|
function parseModePrefix(text){
|
|
function parseModePrefix(text){
|
|
var modes = {'status': [], 'list': [] };
|
|
var modes = {'status': [], 'list': [] };
|
|
var isUser = false;
|
|
var isUser = false;
|