2017-05-18 22:08:54 +02:00
|
|
|
"use strict";
|
|
|
|
|
2019-11-16 18:24:03 +01:00
|
|
|
import socket from "../socket";
|
|
|
|
import store from "../store";
|
|
|
|
import {switchToChannel} from "../router";
|
2017-05-18 22:08:54 +02:00
|
|
|
|
2020-03-21 21:55:36 +01:00
|
|
|
socket.on("join", function (data) {
|
2019-11-12 16:51:40 +01:00
|
|
|
store.getters.initChannel(data.chan);
|
2018-07-18 20:40:09 +02:00
|
|
|
|
2019-11-03 15:59:43 +01:00
|
|
|
const network = store.getters.findNetwork(data.network);
|
2019-11-02 20:40:59 +01:00
|
|
|
|
|
|
|
if (!network) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
network.channels.splice(data.index || -1, 0, data.chan);
|
2018-07-06 20:15:15 +02:00
|
|
|
|
2017-05-18 22:08:54 +02:00
|
|
|
// Queries do not automatically focus, unless the user did a whois
|
|
|
|
if (data.chan.type === "query" && !data.shouldOpen) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-11-11 20:18:55 +01:00
|
|
|
switchToChannel(store.getters.findChannel(data.chan.id).channel);
|
2017-05-18 22:08:54 +02:00
|
|
|
});
|