use the irc connected helper function
We should not mess with irc-framework internals. Technically we shouldn't even access the connection object, it's not part of the documented API surface
This commit is contained in:
parent
c2e7390127
commit
8ca9ee873b
@ -416,10 +416,8 @@ class Network {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.irc) {
|
if (this.irc) {
|
||||||
const connected = this.irc.connection && this.irc.connection.connected;
|
|
||||||
|
|
||||||
if (this.nick !== oldNick) {
|
if (this.nick !== oldNick) {
|
||||||
if (connected) {
|
if (this.irc.connected) {
|
||||||
// Send new nick straight away
|
// Send new nick straight away
|
||||||
this.irc.changeNick(this.nick);
|
this.irc.changeNick(this.nick);
|
||||||
} else {
|
} else {
|
||||||
@ -434,7 +432,7 @@ class Network {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
connected &&
|
this.irc.connected &&
|
||||||
this.realname !== oldRealname &&
|
this.realname !== oldRealname &&
|
||||||
this.irc.network.cap.isEnabled("setname")
|
this.irc.network.cap.isEnabled("setname")
|
||||||
) {
|
) {
|
||||||
|
@ -15,7 +15,7 @@ const input: PluginInputHandler = function (network, chan, cmd, args) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (irc.connection && irc.connection.connected) {
|
if (irc.connected) {
|
||||||
chan.pushMessage(
|
chan.pushMessage(
|
||||||
this,
|
this,
|
||||||
new Msg({
|
new Msg({
|
||||||
|
@ -47,7 +47,7 @@ const input: PluginInputHandler = function (network, chan, cmd, args) {
|
|||||||
// If connected to IRC, send to server and wait for ACK
|
// If connected to IRC, send to server and wait for ACK
|
||||||
// otherwise update the nick and UI straight away
|
// otherwise update the nick and UI straight away
|
||||||
if (network.irc) {
|
if (network.irc) {
|
||||||
if (network.irc.connection && network.irc.connection.connected) {
|
if (network.irc.connected) {
|
||||||
network.irc.changeNick(newNick);
|
network.irc.changeNick(newNick);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -36,9 +36,7 @@ const input: PluginInputHandler = function (network, chan, cmd, args) {
|
|||||||
if (
|
if (
|
||||||
target.type !== ChanType.CHANNEL ||
|
target.type !== ChanType.CHANNEL ||
|
||||||
target.state === ChanState.PARTED ||
|
target.state === ChanState.PARTED ||
|
||||||
!network.irc ||
|
!network.irc.connected
|
||||||
!network.irc.connection ||
|
|
||||||
!network.irc.connection.connected
|
|
||||||
) {
|
) {
|
||||||
this.part(network, target);
|
this.part(network, target);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user