load chat history when connecting
This commit is contained in:
parent
9d24cb671b
commit
0774035512
|
@ -276,12 +276,29 @@ let irc = new function() {
|
|||
conn.password = undefined;
|
||||
irc.onAuthenticated();
|
||||
|
||||
["#annonces"].forEach(channel => {
|
||||
send("CHATHISTORY", ["LATEST", channel, "*", "100"]);
|
||||
});
|
||||
if(conn.caps.includes("draft/chathistory")) {
|
||||
["#annonces", "#projets", "#hs"].forEach(channel => {
|
||||
send("CHATHISTORY", ["LATEST", channel, "*", "100"]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if(msg.command == "PRIVMSG" && msg.args.length == 2) {
|
||||
if(msg.command == "PRIVMSG")
|
||||
processPRIVMSG(msg);
|
||||
}
|
||||
|
||||
function processBatch(batch) {
|
||||
const batchArgs = batch[0].args.slice(1);
|
||||
if(batchArgs.length === 2 && batchArgs[0] === "chathistory") {
|
||||
batch.forEach(msg => {
|
||||
if(msg.command === "PRIVMSG")
|
||||
processPRIVMSG(msg);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function processPRIVMSG(msg) {
|
||||
if(msg.args.length == 2) {
|
||||
let source = msg.source;
|
||||
if(source.includes("!"))
|
||||
source = source.substr(0, source.indexOf("!"));
|
||||
|
@ -289,12 +306,6 @@ let irc = new function() {
|
|||
}
|
||||
}
|
||||
|
||||
function processBatch(batch) {
|
||||
const batchArgs = batch[0].args.slice(1);
|
||||
console.log(batchArgs);
|
||||
console.log(batch);
|
||||
}
|
||||
|
||||
this.postMessage = function(channel, message) {
|
||||
if(message.startsWith("/")) {
|
||||
sendRaw(message.substring(1));
|
||||
|
|
Loading…
Reference in New Issue