diff --git a/server/src/ConnectionStatistics.cpp b/server/src/ConnectionStatistics.cpp index 636b98e..2402efe 100644 --- a/server/src/ConnectionStatistics.cpp +++ b/server/src/ConnectionStatistics.cpp @@ -258,6 +258,9 @@ void ConnectionStatistics::tick() { _properties[property::CONNECTION_FILETRANSFER_BYTES_RECEIVED_TOTAL] = (uint64_t) this->file_bytes_received; _properties[property::CONNECTION_FILETRANSFER_BYTES_SENT_TOTAL] = (uint64_t) this->file_bytes_sent; + + _properties[property::CONNECTION_FILETRANSFER_BYTES_RECEIVED_TOTAL] = (uint64_t) this->file_bytes_received; + _properties[property::CONNECTION_FILETRANSFER_BYTES_SENT_TOTAL] = (uint64_t) this->file_bytes_sent; } } diff --git a/server/src/TSServer.cpp b/server/src/TSServer.cpp index 3dec645..aee5a88 100644 --- a/server/src/TSServer.cpp +++ b/server/src/TSServer.cpp @@ -746,7 +746,7 @@ void TSServer::broadcastMessage(std::shared_ptr invoker, std::s return; } this->forEachClient([&](shared_ptr cl){ - cl->notifyTextMessage(ChatMessageMode::TEXTMODE_SERVER, invoker, 0, 0, message); + cl->notifyTextMessage(ChatMessageMode::TEXTMODE_SERVER, invoker, 0, 0, system_clock::now(), message); }); } diff --git a/server/src/client/ConnectedClient.cpp b/server/src/client/ConnectedClient.cpp index 3c176ae..4034ee5 100644 --- a/server/src/client/ConnectedClient.cpp +++ b/server/src/client/ConnectedClient.cpp @@ -240,9 +240,10 @@ std::deque> ConnectedClient::subscribeChannel(cons if(!general_granted && channel != this->currentChannel) { auto granted_permission = this->calculate_permission_value(permission::i_channel_subscribe_power, channel->channelId()); - if(!channel->permission_granted(permission::i_channel_needed_subscribe_power, granted_permission, false) && - !this->permission_granted(this->permissionValue(permission::b_channel_ignore_subscribe_power, channel), 1, true)) { - continue; + if((granted_permission.has_value && granted_permission.value == -1) || !channel->permission_granted(permission::i_channel_needed_subscribe_power, granted_permission, false)) { + auto ignore_power = this->calculate_permission_value(permission::b_channel_ignore_subscribe_power, channel->channelId()); + if(!ignore_power.has_value && ignore_power.value < 1) + continue; } } diff --git a/server/src/client/ConnectedClient.h b/server/src/client/ConnectedClient.h index 1b0ebf6..27f21f1 100644 --- a/server/src/client/ConnectedClient.h +++ b/server/src/client/ConnectedClient.h @@ -176,9 +176,9 @@ namespace ts { //Group manager chat virtual bool notifyClientChatComposing(const std::shared_ptr &); virtual bool notifyClientChatClosed(const std::shared_ptr &); - virtual bool notifyTextMessage(ChatMessageMode mode, const std::shared_ptr &sender, uint64_t targetId, ChannelId channel_id, const std::string &textMessage); + virtual bool notifyTextMessage(ChatMessageMode mode, const std::shared_ptr &sender, uint64_t targetId, ChannelId channel_id, const std::chrono::system_clock::time_point& /* timestamp */, const std::string &textMessage); inline void sendChannelMessage(const std::shared_ptr& sender, const std::string& textMessage){ - this->notifyTextMessage(ChatMessageMode::TEXTMODE_CHANNEL, sender, this->currentChannel ? this->currentChannel->channelId() : 0, 0, textMessage); + this->notifyTextMessage(ChatMessageMode::TEXTMODE_CHANNEL, sender, this->currentChannel ? this->currentChannel->channelId() : 0, 0, std::chrono::system_clock::now(), textMessage); } //Group Client Groups virtual bool notifyServerGroupClientAdd(const std::shared_ptr &invoker, const std::shared_ptr &client, const std::shared_ptr &group); @@ -259,6 +259,8 @@ namespace ts { virtual bool notifyMusicQueueOrderChange(const std::shared_ptr& bot, const std::shared_ptr& entry, int order, const std::shared_ptr& invoker); virtual bool notifyMusicPlayerStatusUpdate(const std::shared_ptr&); + virtual bool notifyConversationMessageDelete(const ChannelId /* conversation id */, const std::chrono::system_clock::time_point& /* begin timestamp */, const std::chrono::system_clock::time_point& /* begin end */, ClientDbId /* client id */, size_t /* messages */); + virtual bool closeConnection(const std::chrono::system_clock::time_point &timeout = std::chrono::system_clock::time_point()) = 0; virtual bool disconnect(const std::string& reason) = 0; diff --git a/server/src/client/ConnectedClientCommandHandler.cpp b/server/src/client/ConnectedClientCommandHandler.cpp index 539e4fe..21ff715 100644 --- a/server/src/client/ConnectedClientCommandHandler.cpp +++ b/server/src/client/ConnectedClientCommandHandler.cpp @@ -364,6 +364,7 @@ CommandResult ConnectedClient::handleCommand(Command &cmd) { else if (command == "dummy_ipchange") return this->handleCommandDummy_IpChange(cmd); else if (command == "conversationhistory") return this->handleCommandConversationHistory(cmd); else if (command == "conversationfetch") return this->handleCommandConversationFetch(cmd); + else if (command == "conversationmessagedelete") return this->handleCommandConversationMessageDelete(cmd); if (this->getType() == ClientType::CLIENT_QUERY) return CommandResult::NotImplemented; //Dont log query invalid commands if (this->getType() == ClientType::CLIENT_TEAMSPEAK) @@ -699,9 +700,13 @@ CommandResult ConnectedClient::handleCommandServerRequestConnectionInfo(Command notify[0]["connection_filetransfer_bandwidth_sent"] = report.file_send; notify[0]["connection_filetransfer_bandwidth_received"] = report.file_recv; + notify[0]["connection_filetransfer_bytes_sent_total"] = (*statistics)[property::CONNECTION_FILETRANSFER_BYTES_SENT_TOTAL].as(); notify[0]["connection_filetransfer_bytes_received_total"] = (*statistics)[property::CONNECTION_FILETRANSFER_BYTES_RECEIVED_TOTAL].as(); + notify[0]["connection_filetransfer_bytes_sent_month"] = this->server->properties()[property::VIRTUALSERVER_MONTH_BYTES_DOWNLOADED].as(); + notify[0]["connection_filetransfer_bytes_received_month"] = this->server->properties()[property::VIRTUALSERVER_MONTH_BYTES_UPLOADED].as(); + notify[0]["connection_packets_sent_total"] = (*statistics)[property::CONNECTION_PACKETS_SENT_TOTAL].as(); notify[0]["connection_bytes_sent_total"] = (*statistics)[property::CONNECTION_BYTES_SENT_TOTAL].as(); notify[0]["connection_packets_received_total"] = (*statistics)[property::CONNECTION_PACKETS_RECEIVED_TOTAL].as(); @@ -3237,6 +3242,7 @@ CommandResult ConnectedClient::handleCommandSendTextMessage(Command &cmd) { CMD_RESET_IDLE; CMD_CHK_AND_INC_FLOOD_POINTS(5); + auto timestamp = system_clock::now(); if (cmd["targetmode"].as() == ChatMessageMode::TEXTMODE_PRIVATE) { auto target = this->server->findClient(cmd["target"].as()); if (!target) return {findError("client_invalid_id"), "invalid target clid"}; @@ -3274,8 +3280,8 @@ CommandResult ConnectedClient::handleCommandSendTextMessage(Command &cmd) { } if(this->handleTextMessage(ChatMessageMode::TEXTMODE_PRIVATE, cmd["msg"], target)) return CommandResult::Success; - target->notifyTextMessage(ChatMessageMode::TEXTMODE_PRIVATE, _this.lock(), target->getClientId(), 0, cmd["msg"].string()); - this->notifyTextMessage(ChatMessageMode::TEXTMODE_PRIVATE, _this.lock(), target->getClientId(), 0, cmd["msg"].string()); + target->notifyTextMessage(ChatMessageMode::TEXTMODE_PRIVATE, _this.lock(), target->getClientId(), 0, timestamp, cmd["msg"].string()); + this->notifyTextMessage(ChatMessageMode::TEXTMODE_PRIVATE, _this.lock(), target->getClientId(), 0, timestamp, cmd["msg"].string()); } else if (cmd["targetmode"] == ChatMessageMode::TEXTMODE_CHANNEL) { if(!cmd[0].has("cid")) cmd["cid"] = 0; @@ -3327,14 +3333,14 @@ CommandResult ConnectedClient::handleCommandSendTextMessage(Command &cmd) { if(!client->calculate_and_get_join_state(channel)) continue; } - client->notifyTextMessage(ChatMessageMode::TEXTMODE_CHANNEL, _this, client_id, channel_id, message); + client->notifyTextMessage(ChatMessageMode::TEXTMODE_CHANNEL, _this, client_id, channel_id, timestamp, message); } } if(!conversation_private) { auto conversations = this->server->conversation_manager(); auto conversation = conversations->get_or_create(channel->channelId()); - conversation->register_message(this->getClientDatabaseId(), this->getUid(), this->getDisplayName(), cmd["msg"].string()); + conversation->register_message(this->getClientDatabaseId(), this->getUid(), this->getDisplayName(), timestamp, cmd["msg"].string()); } } else if (cmd["targetmode"] == ChatMessageMode::TEXTMODE_SERVER) { CACHED_PERM_CHECK(permission::b_client_server_textmessage_send, 1); @@ -3348,13 +3354,13 @@ CommandResult ConnectedClient::handleCommandSendTextMessage(Command &cmd) { if (type == ClientType::CLIENT_INTERNAL || type == ClientType::CLIENT_MUSIC) continue; - client->notifyTextMessage(ChatMessageMode::TEXTMODE_SERVER, _this.lock(), this->getClientId(), 0, cmd["msg"].string()); + client->notifyTextMessage(ChatMessageMode::TEXTMODE_SERVER, _this.lock(), this->getClientId(), 0, timestamp, cmd["msg"].string()); } { auto conversations = this->server->conversation_manager(); auto conversation = conversations->get_or_create(0); - conversation->register_message(this->getClientDatabaseId(), this->getUid(), this->getDisplayName(), cmd["msg"].string()); + conversation->register_message(this->getClientDatabaseId(), this->getUid(), this->getDisplayName(), timestamp, cmd["msg"].string()); } } else return {findError("parameter_invalid"), "invalid target mode"}; @@ -4682,7 +4688,7 @@ CommandResult ConnectedClient::handleCommandClientMute(Command &cmd) { } if (config::voice::notifyMuted) - client->notifyTextMessage(ChatMessageMode::TEXTMODE_PRIVATE, _this.lock(), client->getClientId(), 0, config::messages::mute_notify_message); + client->notifyTextMessage(ChatMessageMode::TEXTMODE_PRIVATE, _this.lock(), client->getClientId(), 0, system_clock::now(), config::messages::mute_notify_message); return CommandResult::Success; } @@ -4703,7 +4709,7 @@ CommandResult ConnectedClient::handleCommandClientUnmute(Command &cmd) { } if (config::voice::notifyMuted) - client->notifyTextMessage(ChatMessageMode::TEXTMODE_PRIVATE, _this.lock(), client->getClientId(), 0, config::messages::unmute_notify_message); + client->notifyTextMessage(ChatMessageMode::TEXTMODE_PRIVATE, _this.lock(), client->getClientId(), 0, system_clock::now(), config::messages::unmute_notify_message); return CommandResult::Success; } @@ -7611,7 +7617,6 @@ CommandResult ConnectedClient::handleCommandConversationFetch(ts::Command &cmd) return CommandResult::Success; } - CommandResult ConnectedClient::handleCommandConversationMessageDelete(ts::Command &cmd) { CMD_REF_SERVER(ref_server); CMD_CHK_AND_INC_FLOOD_POINTS(25); @@ -7667,13 +7672,22 @@ CommandResult ConnectedClient::handleCommandConversationMessageDelete(ts::Comman if(!current_conversation) continue; auto timestamp_begin = system_clock::time_point{} + milliseconds{bulk["timestamp_begin"]}; - auto timestamp_end = system_clock::time_point{} + milliseconds{bulk.has("timestamp_begin") ? bulk["timestamp_begin"].as() : 0}; + auto timestamp_end = system_clock::time_point{} + milliseconds{bulk.has("timestamp_end") ? bulk["timestamp_end"].as() : 0}; auto limit = bulk.has("limit") ? bulk["limit"].as() : 1; if(limit > 100) limit = 100; - auto delete_count = current_conversation->delete_messages(timestamp_begin, limit, timestamp_end, bulk["cldbid"]); + auto delete_count = current_conversation->delete_messages(timestamp_end, limit, timestamp_begin, bulk["cldbid"]); if(delete_count > 0) { - //TODO: Notify + for(const auto& client : ref_server->getClients()) { + if(client->connectionState() != ConnectionState::CONNECTED) + continue; + + auto type = client->getType(); + if(type == ClientType::CLIENT_INTERNAL || type == ClientType::CLIENT_MUSIC) + continue; + + client->notifyConversationMessageDelete(current_conversation_id, timestamp_begin, timestamp_end, bulk["cldbid"], delete_count); + } } } diff --git a/server/src/client/ConnectedClientNotifyHandler.cpp b/server/src/client/ConnectedClientNotifyHandler.cpp index faaee1f..c41ce4c 100644 --- a/server/src/client/ConnectedClientNotifyHandler.cpp +++ b/server/src/client/ConnectedClientNotifyHandler.cpp @@ -179,13 +179,14 @@ bool ConnectedClient::notifyChannelGroupList() { return true; } -bool ConnectedClient::notifyTextMessage(ChatMessageMode mode, const shared_ptr &invoker, uint64_t targetId, ChannelId channel_id, const string &textMessage) { +bool ConnectedClient::notifyTextMessage(ChatMessageMode mode, const shared_ptr &invoker, uint64_t targetId, ChannelId channel_id, const std::chrono::system_clock::time_point& timestamp, const string &textMessage) { //notifytextmessage targetmode=1 msg=asdasd target=2 invokerid=1 invokername=WolverinDEV invokeruid=xxjnc14LmvTk+Lyrm8OOeo4tOqw= Command cmd("notifytextmessage"); INVOKER(cmd, invoker); cmd["targetmode"] = mode; cmd["target"] = targetId; cmd["msg"] = textMessage; + cmd["timestamp"] = floor(timestamp.time_since_epoch()).count(); if(this->getType() != ClientType::CLIENT_TEAMSPEAK) cmd["cid"] = channel_id; this->sendCommand(cmd); @@ -709,6 +710,19 @@ bool ConnectedClient::notifyMusicPlayerSongChange(const std::shared_ptrsendCommand(notify); + return true; +} + +bool ConnectedClient::notifyConversationMessageDelete(const ts::ChannelId channel_id, const std::chrono::system_clock::time_point& begin, const std::chrono::system_clock::time_point& end, ts::ClientDbId client_id, size_t size) { + Command notify("notifyconversationmessagedelete"); + + notify["cid"] = channel_id; + notify["timestamp_begin"] = floor(begin.time_since_epoch()).count(); + notify["timestamp_end"] = floor(end.time_since_epoch()).count(); + notify["cldbid"] = client_id; + notify["limit"] = size; + this->sendCommand(notify); return true; } \ No newline at end of file diff --git a/server/src/client/ConnectedClientTextCommandHandler.cpp b/server/src/client/ConnectedClientTextCommandHandler.cpp index ea35ab6..2abff2d 100644 --- a/server/src/client/ConnectedClientTextCommandHandler.cpp +++ b/server/src/client/ConnectedClientTextCommandHandler.cpp @@ -122,15 +122,15 @@ bool ConnectedClient::handleTextMessage(ChatMessageMode mode, std::string text, handle_text_command_fn_t function; if(mode == ChatMessageMode::TEXTMODE_SERVER) { function = [&](const shared_ptr& sender, const string& message) { - this->notifyTextMessage(ChatMessageMode::TEXTMODE_SERVER, sender, 0, 0, message); + this->notifyTextMessage(ChatMessageMode::TEXTMODE_SERVER, sender, 0, 0, system_clock::now(), message); }; } else if(mode == ChatMessageMode::TEXTMODE_CHANNEL) { function = [&](const shared_ptr& sender, const string& message) { - this->notifyTextMessage(ChatMessageMode::TEXTMODE_CHANNEL, sender, 0, 0, message); + this->notifyTextMessage(ChatMessageMode::TEXTMODE_CHANNEL, sender, 0, 0, system_clock::now(), message); }; } else if(mode == ChatMessageMode::TEXTMODE_PRIVATE) { function = [&, target](const shared_ptr& sender, const string& message) { - this->notifyTextMessage(ChatMessageMode::TEXTMODE_PRIVATE, target, this->getClientId(), 0, message); + this->notifyTextMessage(ChatMessageMode::TEXTMODE_PRIVATE, target, this->getClientId(), 0, system_clock::now(), message); }; } diff --git a/server/src/client/SpeakingClientHandshake.cpp b/server/src/client/SpeakingClientHandshake.cpp index 187f796..812503a 100644 --- a/server/src/client/SpeakingClientHandshake.cpp +++ b/server/src/client/SpeakingClientHandshake.cpp @@ -75,6 +75,25 @@ CommandResult SpeakingClient::handleCommandHandshakeBegin(Command& cmd) { //If ! return {findError("web_handshake_invalid"), "Provided data is too old!"}; this->properties()[property::CLIENT_UNIQUE_IDENTIFIER] = base64::encode(digest::sha1("TeaSpeak-Forum#" + (*this->handshake.identityData)["user_id"].asString())); + + this->properties()[property::CLIENT_TEAFORO_ID] = (*this->handshake.identityData)["user_id"].asInt64(); + this->properties()[property::CLIENT_TEAFORO_NAME] = (*this->handshake.identityData)["user_name"].asString(); + + { + ///* 0x01 := Banned | 0x02 := Stuff | 0x04 := Premium */ + uint64_t flags = 0; + + if((*this->handshake.identityData)["is_banned"].isBool() && (*this->handshake.identityData)["is_banned"].asBool()) + flags |= 0x01U; + + if((*this->handshake.identityData)["is_staff"].isBool() && (*this->handshake.identityData)["is_staff"].asBool()) + flags |= 0x02U; + + if((*this->handshake.identityData)["is_premium"].isBool() && (*this->handshake.identityData)["is_premium"].asBool()) + flags |= 0x04U; + + this->properties()[property::CLIENT_TEAFORO_FLAGS] = flags; + } } catch (Json::Exception& exception) { return {findError("web_handshake_invalid"), "invalid json!"}; } diff --git a/server/src/client/query/QueryClient.h b/server/src/client/query/QueryClient.h index 9c64986..27bf8bf 100644 --- a/server/src/client/query/QueryClient.h +++ b/server/src/client/query/QueryClient.h @@ -102,7 +102,7 @@ namespace ts { bool notifyPluginCmd(std::string name, std::string msg,std::shared_ptr) override; bool notifyClientChatComposing(const std::shared_ptr &ptr) override; bool notifyClientChatClosed(const std::shared_ptr &ptr) override; - bool notifyTextMessage(ChatMessageMode mode, const std::shared_ptr &sender, uint64_t targetId, ChannelId channel_id, const std::string &textMessage) override; + bool notifyTextMessage(ChatMessageMode mode, const std::shared_ptr &sender, uint64_t targetId, ChannelId channel_id, const std::chrono::system_clock::time_point&, const std::string &textMessage) override; bool notifyServerGroupClientAdd(const std::shared_ptr &invoker, const std::shared_ptr &client, const std::shared_ptr &group) override; bool notifyServerGroupClientRemove(std::shared_ptr invoker, std::shared_ptr client, std::shared_ptr group) override; diff --git a/server/src/client/query/QueryClientNotify.cpp b/server/src/client/query/QueryClientNotify.cpp index b4ba516..7852a63 100644 --- a/server/src/client/query/QueryClientNotify.cpp +++ b/server/src/client/query/QueryClientNotify.cpp @@ -67,11 +67,11 @@ bool QueryClient::notifyClientChatClosed(const shared_ptr &ptr) return ConnectedClient::notifyClientChatClosed(ptr); } -bool QueryClient::notifyTextMessage(ChatMessageMode mode, const shared_ptr &sender, uint64_t targetId, ChannelId channel_id, const string &textMessage) { +bool QueryClient::notifyTextMessage(ChatMessageMode mode, const shared_ptr &sender, uint64_t targetId, ChannelId channel_id, const std::chrono::system_clock::time_point& tp, const string &textMessage) { if(mode == ChatMessageMode::TEXTMODE_PRIVATE) CHK_EVENT(QEVENTGROUP_CHAT, QEVENTSPECIFIER_CHAT_MESSAGE_PRIVATE); else if(mode == ChatMessageMode::TEXTMODE_CHANNEL) CHK_EVENT(QEVENTGROUP_CHAT, QEVENTSPECIFIER_CHAT_MESSAGE_CHANNEL); else if(mode == ChatMessageMode::TEXTMODE_SERVER) CHK_EVENT(QEVENTGROUP_CHAT, QEVENTSPECIFIER_CHAT_MESSAGE_SERVER); - return ConnectedClient::notifyTextMessage(mode, sender, targetId, channel_id, textMessage); + return ConnectedClient::notifyTextMessage(mode, sender, targetId, channel_id, tp, textMessage); } bool QueryClient::notifyServerGroupClientAdd(const shared_ptr &invoker, const shared_ptr &client, const shared_ptr &group) { diff --git a/server/src/manager/ConversationManager.cpp b/server/src/manager/ConversationManager.cpp index c26e998..63cc938 100644 --- a/server/src/manager/ConversationManager.cpp +++ b/server/src/manager/ConversationManager.cpp @@ -598,7 +598,7 @@ bool Conversation::load_message_block_index(const std::shared_ptrmessage_index.emplace_back(fio::IndexedBlockMessage{(uint32_t) (offset - block->block_offset), header, nullptr}); + index->message_index.emplace_back(fio::IndexedBlockMessage{(uint32_t) (offset - block->block_offset), {header}, nullptr}); offset += header.total_length; } } @@ -645,6 +645,11 @@ bool Conversation::load_messages(const std::shared_ptr &block, continue; } + auto result = fseek(this->file_handle, sizeof(fio::MessageHeader), SEEK_CUR); + if(result == EINVAL) { + error = "failed to seek to begin of the message data"; + return false; + } auto data = make_shared(); if(header->meta_encrypted) { @@ -985,9 +990,9 @@ void Conversation::db_save_block(const std::shared_ptr &block) sql_result.waitAndGetLater(LOG_SQL_CMD, {-1, "future error"}); } -void Conversation::register_message(ts::ClientDbId sender_database_id, const std::string &sender_unique_id, const std::string &sender_name, const std::string &message) { +void Conversation::register_message(ts::ClientDbId sender_database_id, const std::string &sender_unique_id, const std::string &sender_name, const std::chrono::system_clock::time_point &ts, const std::string &message) { auto entry = make_shared(); - entry->message_timestamp = system_clock::now(); + entry->message_timestamp = ts; this->_last_message_timestamp = entry->message_timestamp; entry->message = message; entry->sender_name = sender_name; @@ -1156,7 +1161,7 @@ size_t Conversation::delete_messages(const std::chrono::system_clock::time_point if(cldbid != 0 && (*it)->sender_database_id != cldbid) continue; - (*it)->flag_message_deleted = false; + (*it)->flag_message_deleted = true; if(++delete_count_volatile >= message_count) break; } diff --git a/server/src/manager/ConversationManager.h b/server/src/manager/ConversationManager.h index 0952163..b29c6eb 100644 --- a/server/src/manager/ConversationManager.h +++ b/server/src/manager/ConversationManager.h @@ -152,7 +152,7 @@ namespace ts { ssize_t history_length() { return this->_history_length; } inline std::chrono::system_clock::time_point last_message() { return this->_last_message_timestamp; } - void register_message(ClientDbId sender_database_id, const std::string& sender_unique_id, const std::string& sender_name, const std::string& message); + void register_message(ClientDbId sender_database_id, const std::string& sender_unique_id, const std::string& sender_name, const std::chrono::system_clock::time_point& /* timestamp */, const std::string& message); /* Lookup n messages since end timestamp. Upper time limit is begin timestamp */ std::deque> message_history(const std::chrono::system_clock::time_point& /* end timestamp */, size_t /* limit */, const std::chrono::system_clock::time_point& /* begin timestamp */); diff --git a/server/src/manager/SqlDataManager.cpp b/server/src/manager/SqlDataManager.cpp index 1482a1a..f450d41 100644 --- a/server/src/manager/SqlDataManager.cpp +++ b/server/src/manager/SqlDataManager.cpp @@ -483,6 +483,8 @@ bool SqlDataManager::update_permissions(std::string &error) { return false; if(!auto_update(permission::update::QUERY_ADMIN, "b_channel_create_modify_conversation_private", {1, true}, false, false, {100, true})) return false; + if(!auto_update(permission::update::QUERY_ADMIN, "b_channel_conversation_message_delete", {1, true}, false, false, {100, true})) + return false; if(!auto_update(permission::update::SERVER_ADMIN, "b_client_is_priority_speaker", {-2, false}, false, false, {75, true})) return false; @@ -502,6 +504,8 @@ bool SqlDataManager::update_permissions(std::string &error) { return false; if(!auto_update(permission::update::SERVER_ADMIN, "b_channel_create_modify_conversation_private", {1, true}, false, false, {75, true})) return false; + if(!auto_update(permission::update::SERVER_ADMIN, "b_channel_conversation_message_delete", {1, true}, false, false, {75, true})) + return false; if(!auto_update(permission::update::SERVER_NORMAL, "i_max_playlist_size", {50, true}, false, false, {-2, false})) return false; diff --git a/server/src/terminal/CommandHandler.cpp b/server/src/terminal/CommandHandler.cpp index d4f1e48..762d183 100644 --- a/server/src/terminal/CommandHandler.cpp +++ b/server/src/terminal/CommandHandler.cpp @@ -223,7 +223,7 @@ namespace terminal { return false; } for(const auto &cl : server->getClientsByChannel(channel)) - cl->notifyTextMessage(ChatMessageMode::TEXTMODE_CHANNEL, server->getServerRoot(), cl->getClientId(), 0, message); + cl->notifyTextMessage(ChatMessageMode::TEXTMODE_CHANNEL, server->getServerRoot(), cl->getClientId(), 0, system_clock::now(), message); } break; case ChatMessageMode::TEXTMODE_PRIVATE: @@ -233,7 +233,7 @@ namespace terminal { logError("Cloud not find manager from clid"); return false; } - client->notifyTextMessage(ChatMessageMode::TEXTMODE_CHANNEL, server->getServerRoot(), client->getClientId(), 0, message); + client->notifyTextMessage(ChatMessageMode::TEXTMODE_CHANNEL, server->getServerRoot(), client->getClientId(), 0, system_clock::now(), message); } break; default: diff --git a/shared b/shared index c8cae59..5c4df78 160000 --- a/shared +++ b/shared @@ -1 +1 @@ -Subproject commit c8cae593a016b842031b5f73e103554a4f87cb66 +Subproject commit 5c4df786ed9a2d3610c416f2d9c6e7a1fb07d5f0