Added proper log message for moved clients which enter the view
This commit is contained in:
parent
66326b2cc9
commit
89d2f8db88
2 changed files with 23 additions and 18 deletions
|
@ -498,8 +498,9 @@ namespace connection {
|
||||||
this.connection.client.handleDisconnect(DisconnectReason.SERVER_CLOSED, entry);
|
this.connection.client.handleDisconnect(DisconnectReason.SERVER_CLOSED, entry);
|
||||||
} else if(reason_id == ViewReasonId.VREASON_SERVER_STOPPED) {
|
} else if(reason_id == ViewReasonId.VREASON_SERVER_STOPPED) {
|
||||||
this.connection.client.handleDisconnect(DisconnectReason.SERVER_CLOSED, entry);
|
this.connection.client.handleDisconnect(DisconnectReason.SERVER_CLOSED, entry);
|
||||||
} else
|
} else {
|
||||||
this.connection.client.handleDisconnect(DisconnectReason.UNKNOWN, entry);
|
this.connection.client.handleDisconnect(DisconnectReason.UNKNOWN, entry);
|
||||||
|
}
|
||||||
this.connection_handler.side_bar.info_frame().update_channel_talk();
|
this.connection_handler.side_bar.info_frame().update_channel_talk();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -510,6 +511,7 @@ namespace connection {
|
||||||
let channel_from = tree.findChannel(entry["cfid"]);
|
let channel_from = tree.findChannel(entry["cfid"]);
|
||||||
let channel_to = tree.findChannel(entry["ctid"]);
|
let channel_to = tree.findChannel(entry["ctid"]);
|
||||||
|
|
||||||
|
const is_own_channel = channel_from == own_channel;
|
||||||
this.connection_handler.log.log(log.server.Type.CLIENT_VIEW_LEAVE, {
|
this.connection_handler.log.log(log.server.Type.CLIENT_VIEW_LEAVE, {
|
||||||
channel_from: channel_from ? channel_from.log_data() : undefined,
|
channel_from: channel_from ? channel_from.log_data() : undefined,
|
||||||
channel_to: channel_to ? channel_to.log_data() : undefined,
|
channel_to: channel_to ? channel_to.log_data() : undefined,
|
||||||
|
@ -518,28 +520,27 @@ namespace connection {
|
||||||
message: entry["reasonmsg"],
|
message: entry["reasonmsg"],
|
||||||
reason: parseInt(entry["reasonid"]),
|
reason: parseInt(entry["reasonid"]),
|
||||||
ban_time: parseInt(entry["bantime"]),
|
ban_time: parseInt(entry["bantime"]),
|
||||||
own_channel: channel_from == own_channel
|
own_channel: is_own_channel
|
||||||
});
|
});
|
||||||
if(reason_id == ViewReasonId.VREASON_USER_ACTION) {
|
|
||||||
if(channel_from == own_channel)
|
if(is_own_channel) {
|
||||||
|
if(reason_id == ViewReasonId.VREASON_USER_ACTION) {
|
||||||
this.connection_handler.sound.play(Sound.USER_LEFT);
|
this.connection_handler.sound.play(Sound.USER_LEFT);
|
||||||
} else if(reason_id == ViewReasonId.VREASON_SERVER_LEFT) {
|
} else if(reason_id == ViewReasonId.VREASON_SERVER_LEFT) {
|
||||||
if(channel_from == own_channel)
|
|
||||||
this.connection_handler.sound.play(Sound.USER_LEFT_DISCONNECT);
|
this.connection_handler.sound.play(Sound.USER_LEFT_DISCONNECT);
|
||||||
} else if(reason_id == ViewReasonId.VREASON_SERVER_KICK) {
|
} else if(reason_id == ViewReasonId.VREASON_SERVER_KICK) {
|
||||||
if(channel_from == own_channel)
|
|
||||||
this.connection_handler.sound.play(Sound.USER_LEFT_KICKED_SERVER);
|
this.connection_handler.sound.play(Sound.USER_LEFT_KICKED_SERVER);
|
||||||
} else if(reason_id == ViewReasonId.VREASON_CHANNEL_KICK) {
|
} else if(reason_id == ViewReasonId.VREASON_CHANNEL_KICK) {
|
||||||
if(channel_from == own_channel)
|
|
||||||
this.connection_handler.sound.play(Sound.USER_LEFT_KICKED_CHANNEL);
|
this.connection_handler.sound.play(Sound.USER_LEFT_KICKED_CHANNEL);
|
||||||
} else if(reason_id == ViewReasonId.VREASON_BAN) {
|
} else if(reason_id == ViewReasonId.VREASON_BAN) {
|
||||||
if(channel_from == own_channel)
|
|
||||||
this.connection_handler.sound.play(Sound.USER_LEFT_BANNED);
|
this.connection_handler.sound.play(Sound.USER_LEFT_BANNED);
|
||||||
} else if(reason_id == ViewReasonId.VREASON_TIMEOUT) {
|
} else if(reason_id == ViewReasonId.VREASON_TIMEOUT) {
|
||||||
if(channel_from == own_channel)
|
|
||||||
this.connection_handler.sound.play(Sound.USER_LEFT_TIMEOUT);
|
this.connection_handler.sound.play(Sound.USER_LEFT_TIMEOUT);
|
||||||
} else {
|
} else if(reason_id == ViewReasonId.VREASON_MOVED) {
|
||||||
log.error(LogCategory.NETWORKING, tr("Unknown client left reason!"));
|
this.connection_handler.sound.play(Sound.USER_LEFT_MOVED);
|
||||||
|
} else {
|
||||||
|
log.error(LogCategory.NETWORKING, tr("Unknown client left reason %d!"), reason_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!channel_to) {
|
if(!channel_to) {
|
||||||
|
@ -553,8 +554,9 @@ namespace connection {
|
||||||
create: false,
|
create: false,
|
||||||
attach: false
|
attach: false
|
||||||
});
|
});
|
||||||
if(conversation)
|
if(conversation) {
|
||||||
conversation.set_state(chat.PrivateConversationState.DISCONNECTED);
|
conversation.set_state(chat.PrivateConversationState.DISCONNECTED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -505,8 +505,11 @@ namespace log {
|
||||||
);
|
);
|
||||||
} else if(data.reason == ViewReasonId.VREASON_TIMEOUT) {
|
} else if(data.reason == ViewReasonId.VREASON_TIMEOUT) {
|
||||||
return MessageHelper.formatMessage(tr("{0} timed out{1}"), client_tag(data.client), data.message ? (" (" + data.message + ")") : "");
|
return MessageHelper.formatMessage(tr("{0} timed out{1}"), client_tag(data.client), data.message ? (" (" + data.message + ")") : "");
|
||||||
|
} else if(data.reason == ViewReasonId.VREASON_MOVED) {
|
||||||
|
return MessageHelper.formatMessage(data.own_channel ? tr("{0} disappeared from your channel {1} to {2}, moved by {3}") : tr("{0} disappeared from {1} to {2}, moved by {3}"), client_tag(data.client), channel_tag(data.channel_from), channel_tag(data.channel_to), client_tag(data.invoker));
|
||||||
}
|
}
|
||||||
return [$.spawn("div").addClass("log-error").text("Invalid view leave reason id (" + data.message + ")")];
|
|
||||||
|
return [$.spawn("div").addClass("log-error").text("Invalid view leave reason id (" + data.reason + ")")];
|
||||||
};
|
};
|
||||||
|
|
||||||
MessageBuilders["server_welcome_message"] = (data: event.WelcomeMessage, options) => {
|
MessageBuilders["server_welcome_message"] = (data: event.WelcomeMessage, options) => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue