diff --git a/shared/js/ui/frames/chat_frame.ts b/shared/js/ui/frames/chat_frame.ts index eed7b3f6..ed5e809c 100644 --- a/shared/js/ui/frames/chat_frame.ts +++ b/shared/js/ui/frames/chat_frame.ts @@ -5,7 +5,6 @@ import {ChannelEntry} from "../../tree/Channel"; import {ServerEntry} from "../../tree/Server"; import {openMusicManage} from "../../ui/modal/ModalMusicManage"; import {formatMessage} from "../../ui/frames/chat"; -import {ClientInfo} from "../../ui/frames/side/client_info"; import {MusicInfo} from "../../ui/frames/side/music_info"; import {ConversationManager} from "../../ui/frames/side/ConversationManager"; import {PrivateConversationManager} from "../../ui/frames/side/PrivateConversationManager"; diff --git a/shared/js/ui/frames/side/ClientInfoController.ts b/shared/js/ui/frames/side/ClientInfoController.ts index 1a00721c..6bf510bb 100644 --- a/shared/js/ui/frames/side/ClientInfoController.ts +++ b/shared/js/ui/frames/side/ClientInfoController.ts @@ -1,10 +1,11 @@ -import {ConnectionHandler} from "tc-shared/ConnectionHandler"; +import {ConnectionHandler, ConnectionState} from "tc-shared/ConnectionHandler"; import {ClientEntry, ClientType, LocalClientEntry} from "tc-shared/tree/Client"; import { ClientForumInfo, ClientGroupInfo, ClientInfoEvents, - ClientStatusInfo, ClientVersionInfo + ClientStatusInfo, + ClientVersionInfo } from "tc-shared/ui/frames/side/ClientInfoDefinitions"; import * as ReactDOM from "react-dom"; @@ -93,6 +94,14 @@ export class ClientInfoController { this.sendOnline(); })); + this.listenerConnection.push(this.connection.events().on("notify_connection_state_changed", event => { + if(event.new_state !== ConnectionState.CONNECTED && this.currentClientStatus) { + this.currentClient = undefined; + this.currentClientStatus.leaveTimestamp = Date.now() / 1000; + this.sendOnline(); + } + })) + this.uiEvents.on("query_client_name", () => this.sendClientName()); this.uiEvents.on("query_client_description", () => this.sendClientDescription()); this.uiEvents.on("query_channel_group", () => this.sendChannelGroup());