From 66da42c0f8f80a021a06a65c929f2eb634e06b25 Mon Sep 17 00:00:00 2001 From: dongl <2725096176@qq.com> Date: Tue, 20 Jun 2023 20:03:02 +0800 Subject: [PATCH] =?UTF-8?q?MP=20=E4=BF=AE=E6=94=B9=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E4=BA=86=20im=5Fmsg=5Fdata=20=E6=95=B0=E6=8D=AE=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MP/IMDataPacket.cpp | 59 +++++++ MP/IMDataPacket.h | 29 +++ MP/MsgData.h | 40 +++++ MP/Notice.h | 26 +++ MP/Response.cpp | 2 +- MP/proto/mp.im.pb.cc | 181 +++++++++---------- MP/proto/mp.im.pb.h | 254 +++++++++++++-------------- MP/proto/mp.mp.pb.cc | 10 +- MP/proto/mp.mp.pb.h | 7 +- MP/protohuf/mp.im.proto | 11 +- MP/protohuf/mp.mp.proto | 14 +- MS/works/controller/IMController.cpp | 4 +- 12 files changed, 399 insertions(+), 238 deletions(-) create mode 100644 MP/IMDataPacket.cpp create mode 100644 MP/IMDataPacket.h create mode 100644 MP/MsgData.h create mode 100644 MP/Notice.h diff --git a/MP/IMDataPacket.cpp b/MP/IMDataPacket.cpp new file mode 100644 index 0000000..df89f96 --- /dev/null +++ b/MP/IMDataPacket.cpp @@ -0,0 +1,59 @@ +// +// Created by dongl on 23-6-20. +// + +#include "IMDataPacket.h" + +IMDataPacket::IMDataPacket(mp::MP_TYPE type, mp::im::msg_data* data) : + Mph(type), + MsgData(data) { + +} + +IMDataPacket::IMDataPacket(mp::MP_TYPE type, mp::MP_SUB_TYPE subType, + mp::MP_SUB_TYPE sessionType, uint64_t messageId, + time_t time, uint64_t account, std::string &imMsgData) : + Mph(type), + MsgData(subType, sessionType,messageId, time, account,imMsgData) { + +} + +IMDataPacket::IMDataPacket(mp::MP_TYPE type, mp::MP_SUB_TYPE subType, + uint64_t messageId, time_t time) : + Mph(type), + MsgData(subType, messageId, time) { + +} + +std::string IMDataPacket::packet() { + // 包体长度 + mph->set_mpb_size(data->ByteSizeLong()); + + // im_data_packet 的 L 为 16bit + std::string temp; + + // 判断是否超过数据包限制大小 一个包 大概0.06MB + if (mph->ByteSizeLong() + data->ByteSizeLong() > 65535) { + return "超过数据包限制大小,无法构造,长度请低于65535, 或者分包"; + } + + // L +// temp.push_back(mph->ByteSizeLong()); + if (mph->ByteSizeLong() + data->ByteSizeLong() <= 255) { + temp.push_back(0); + temp.push_back(mph->ByteSizeLong()); + } else { + short len = mph->ByteSizeLong() + data->ByteSizeLong(); + char LTV_L[2]; + memcpy(LTV_L, &len, sizeof(LTV_L)); + temp.append(LTV_L); + } + + // T + mph->AppendToString(&temp); + // V + data->AppendToString(&temp); + + return temp; +} + diff --git a/MP/IMDataPacket.h b/MP/IMDataPacket.h new file mode 100644 index 0000000..f03c3e1 --- /dev/null +++ b/MP/IMDataPacket.h @@ -0,0 +1,29 @@ +// +// Created by dongl on 23-6-20. +// + +#ifndef IM2_IMDATAPACKET_H +#define IM2_IMDATAPACKET_H + + +#include "Mph.h" +#include "MsgData.h" +#include "Notice.h" + +class IMDataPacket : public Mph, MsgData { +public: + IMDataPacket(mp::MP_TYPE type, mp::im::msg_data* data); + + IMDataPacket(mp::MP_TYPE type, mp::MP_SUB_TYPE subType, + mp::MP_SUB_TYPE sessionType, uint64_t messageId, + time_t time, uint64_t account, std::string &imMsgData); + + IMDataPacket(mp::MP_TYPE type, mp::MP_SUB_TYPE subType, + uint64_t messageId, time_t time); + +public: + std::string packet(); +}; + + +#endif //IM2_IMDATAPACKET_H diff --git a/MP/MsgData.h b/MP/MsgData.h new file mode 100644 index 0000000..da1e914 --- /dev/null +++ b/MP/MsgData.h @@ -0,0 +1,40 @@ +// +// Created by dongl on 23-6-20. +// + +#ifndef IM2_MSGDATA_H +#define IM2_MSGDATA_H + +#include "proto/mp.im.pb.h" + +class MsgData { +public: + explicit MsgData(mp::im::msg_data *data) : data(data) {} + + MsgData(mp::MP_SUB_TYPE sub_type, mp::MP_SUB_TYPE session_type, + uint64_t message_id, time_t time, uint64_t account, std::string& im_msg_data) { + data = new mp::im::msg_data(); + data->set_msg_type(sub_type); + data->set_session_type(session_type); + data->set_message_id(message_id); + data->set_time(time); + data->set_account(account); + data->set_allocated_im_msg_data(&im_msg_data); + } + + MsgData(mp::MP_SUB_TYPE sub_type, uint64_t message_id, time_t time) { + data = new mp::im::msg_data(); + data->set_msg_type(sub_type); + data->set_message_id(message_id); + data->set_time(time); + } + + virtual ~MsgData() { + delete data; + } + +protected: + mp::im::msg_data* data; +}; + +#endif //IM2_MSGDATA_H diff --git a/MP/Notice.h b/MP/Notice.h new file mode 100644 index 0000000..0c8b65a --- /dev/null +++ b/MP/Notice.h @@ -0,0 +1,26 @@ +// +// Created by dongl on 23-6-20. +// + +#ifndef IM2_NOTICE_H +#define IM2_NOTICE_H + +class Notice { +public: + explicit Notice(mp::im::notice *notice) : notice(notice) {} + + Notice(uint64_t messageId, time_t time) { + notice = new mp::im::notice(); + notice->set_message_id(messageId); + notice->set_time(time); + } + + virtual ~Notice() { + delete notice; + } + +protected: + mp::im::notice* notice; +}; + +#endif //IM2_NOTICE_H diff --git a/MP/Response.cpp b/MP/Response.cpp index 9d80aba..90cbbe3 100644 --- a/MP/Response.cpp +++ b/MP/Response.cpp @@ -29,7 +29,7 @@ Response::~Response() { void Response::init() { response = new mp::response(); response->set_allocated_sri(sri); - mph->set_mpb_size( response->ByteSizeLong()); + mph->set_mpb_size(response->ByteSizeLong()); } std::string Response::packet () { diff --git a/MP/proto/mp.im.pb.cc b/MP/proto/mp.im.pb.cc index 4f2dca4..c3c35fc 100644 --- a/MP/proto/mp.im.pb.cc +++ b/MP/proto/mp.im.pb.cc @@ -20,25 +20,25 @@ class noticeDefaultTypeInternal { public: ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; } _notice_default_instance_; -class dataDefaultTypeInternal { +class msg_dataDefaultTypeInternal { public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _data_default_instance_; + ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; +} _msg_data_default_instance_; } // namespace im } // namespace mp -static void InitDefaultsscc_info_data_mp_2eim_2eproto() { +static void InitDefaultsscc_info_msg_data_mp_2eim_2eproto() { GOOGLE_PROTOBUF_VERIFY_VERSION; { - void* ptr = &::mp::im::_data_default_instance_; - new (ptr) ::mp::im::data(); + void* ptr = &::mp::im::_msg_data_default_instance_; + new (ptr) ::mp::im::msg_data(); ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); } - ::mp::im::data::InitAsDefaultInstance(); + ::mp::im::msg_data::InitAsDefaultInstance(); } -::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_data_mp_2eim_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_data_mp_2eim_2eproto}, {}}; +::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_msg_data_mp_2eim_2eproto = + {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_msg_data_mp_2eim_2eproto}, {}}; static void InitDefaultsscc_info_notice_mp_2eim_2eproto() { GOOGLE_PROTOBUF_VERIFY_VERSION; @@ -67,45 +67,46 @@ const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_mp_2eim_2eproto::offsets[] PRO PROTOBUF_FIELD_OFFSET(::mp::im::notice, message_id_), PROTOBUF_FIELD_OFFSET(::mp::im::notice, time_), ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(::mp::im::data, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::mp::im::msg_data, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(::mp::im::data, msg_type_), - PROTOBUF_FIELD_OFFSET(::mp::im::data, session_type_), - PROTOBUF_FIELD_OFFSET(::mp::im::data, message_id_), - PROTOBUF_FIELD_OFFSET(::mp::im::data, time_), - PROTOBUF_FIELD_OFFSET(::mp::im::data, account_), - PROTOBUF_FIELD_OFFSET(::mp::im::data, msg_data_), + PROTOBUF_FIELD_OFFSET(::mp::im::msg_data, msg_type_), + PROTOBUF_FIELD_OFFSET(::mp::im::msg_data, session_type_), + PROTOBUF_FIELD_OFFSET(::mp::im::msg_data, message_id_), + PROTOBUF_FIELD_OFFSET(::mp::im::msg_data, time_), + PROTOBUF_FIELD_OFFSET(::mp::im::msg_data, account_), + PROTOBUF_FIELD_OFFSET(::mp::im::msg_data, im_msg_data_), }; static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { { 0, -1, sizeof(::mp::im::notice)}, - { 7, -1, sizeof(::mp::im::data)}, + { 7, -1, sizeof(::mp::im::msg_data)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { reinterpret_cast(&::mp::im::_notice_default_instance_), - reinterpret_cast(&::mp::im::_data_default_instance_), + reinterpret_cast(&::mp::im::_msg_data_default_instance_), }; const char descriptor_table_protodef_mp_2eim_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = "\n\013mp.im.proto\022\005mp.im\032\013mp.mp.proto\"*\n\006not" - "ice\022\022\n\nmessage_id\030\001 \001(\004\022\014\n\004time\030\002 \001(\004\"\225\001" - "\n\004data\022!\n\010msg_type\030\001 \001(\0162\017.mp.MP_SUB_TYP" - "E\022%\n\014session_type\030\002 \001(\0162\017.mp.MP_SUB_TYPE" - "\022\022\n\nmessage_id\030\003 \001(\004\022\014\n\004time\030\004 \001(\004\022\017\n\007ac" - "count\030\005 \001(\004\022\020\n\010msg_data\030\006 \001(\tb\006proto3" + "ice\022\022\n\nmessage_id\030\001 \001(\004\022\014\n\004time\030\002 \001(\004\"\234\001" + "\n\010msg_data\022!\n\010msg_type\030\001 \001(\0162\017.mp.MP_SUB" + "_TYPE\022%\n\014session_type\030\002 \001(\0162\017.mp.MP_SUB_" + "TYPE\022\022\n\nmessage_id\030\003 \001(\004\022\014\n\004time\030\004 \001(\004\022\017" + "\n\007account\030\005 \001(\004\022\023\n\013im_msg_data\030\006 \001(\tb\006pr" + "oto3" ; static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_mp_2eim_2eproto_deps[1] = { &::descriptor_table_mp_2emp_2eproto, }; static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_mp_2eim_2eproto_sccs[2] = { - &scc_info_data_mp_2eim_2eproto.base, + &scc_info_msg_data_mp_2eim_2eproto.base, &scc_info_notice_mp_2eim_2eproto.base, }; static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_mp_2eim_2eproto_once; const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_mp_2eim_2eproto = { - false, false, descriptor_table_protodef_mp_2eim_2eproto, "mp.im.proto", 237, + false, false, descriptor_table_protodef_mp_2eim_2eproto, "mp.im.proto", 244, &descriptor_table_mp_2eim_2eproto_once, descriptor_table_mp_2eim_2eproto_sccs, descriptor_table_mp_2eim_2eproto_deps, 2, 1, schemas, file_default_instances, TableStruct_mp_2eim_2eproto::offsets, file_level_metadata_mp_2eim_2eproto, 2, file_level_enum_descriptors_mp_2eim_2eproto, file_level_service_descriptors_mp_2eim_2eproto, @@ -349,80 +350,80 @@ void notice::InternalSwap(notice* other) { // =================================================================== -void data::InitAsDefaultInstance() { +void msg_data::InitAsDefaultInstance() { } -class data::_Internal { +class msg_data::_Internal { public: }; -data::data(::PROTOBUF_NAMESPACE_ID::Arena* arena) +msg_data::msg_data(::PROTOBUF_NAMESPACE_ID::Arena* arena) : ::PROTOBUF_NAMESPACE_ID::Message(arena) { SharedCtor(); RegisterArenaDtor(arena); - // @@protoc_insertion_point(arena_constructor:mp.im.data) + // @@protoc_insertion_point(arena_constructor:mp.im.msg_data) } -data::data(const data& from) +msg_data::msg_data(const msg_data& from) : ::PROTOBUF_NAMESPACE_ID::Message() { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - msg_data_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - if (!from._internal_msg_data().empty()) { - msg_data_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_msg_data(), + im_msg_data_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (!from._internal_im_msg_data().empty()) { + im_msg_data_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_im_msg_data(), GetArena()); } ::memcpy(&msg_type_, &from.msg_type_, static_cast(reinterpret_cast(&account_) - reinterpret_cast(&msg_type_)) + sizeof(account_)); - // @@protoc_insertion_point(copy_constructor:mp.im.data) + // @@protoc_insertion_point(copy_constructor:mp.im.msg_data) } -void data::SharedCtor() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_data_mp_2eim_2eproto.base); - msg_data_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +void msg_data::SharedCtor() { + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_msg_data_mp_2eim_2eproto.base); + im_msg_data_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); ::memset(&msg_type_, 0, static_cast( reinterpret_cast(&account_) - reinterpret_cast(&msg_type_)) + sizeof(account_)); } -data::~data() { - // @@protoc_insertion_point(destructor:mp.im.data) +msg_data::~msg_data() { + // @@protoc_insertion_point(destructor:mp.im.msg_data) SharedDtor(); _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } -void data::SharedDtor() { +void msg_data::SharedDtor() { GOOGLE_DCHECK(GetArena() == nullptr); - msg_data_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + im_msg_data_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); } -void data::ArenaDtor(void* object) { - data* _this = reinterpret_cast< data* >(object); +void msg_data::ArenaDtor(void* object) { + msg_data* _this = reinterpret_cast< msg_data* >(object); (void)_this; } -void data::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +void msg_data::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { } -void data::SetCachedSize(int size) const { +void msg_data::SetCachedSize(int size) const { _cached_size_.Set(size); } -const data& data::default_instance() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_data_mp_2eim_2eproto.base); +const msg_data& msg_data::default_instance() { + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_msg_data_mp_2eim_2eproto.base); return *internal_default_instance(); } -void data::Clear() { -// @@protoc_insertion_point(message_clear_start:mp.im.data) +void msg_data::Clear() { +// @@protoc_insertion_point(message_clear_start:mp.im.msg_data) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - msg_data_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + im_msg_data_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); ::memset(&msg_type_, 0, static_cast( reinterpret_cast(&account_) - reinterpret_cast(&msg_type_)) + sizeof(account_)); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } -const char* data::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +const char* msg_data::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArena(); (void)arena; while (!ctx->Done(&ptr)) { @@ -467,12 +468,12 @@ const char* data::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter CHK_(ptr); } else goto handle_unusual; continue; - // string msg_data = 6; + // string im_msg_data = 6; case 6: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) { - auto str = _internal_mutable_msg_data(); + auto str = _internal_mutable_im_msg_data(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); - CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "mp.im.data.msg_data")); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "mp.im.msg_data.im_msg_data")); CHK_(ptr); } else goto handle_unusual; continue; @@ -498,9 +499,9 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* data::_InternalSerialize( +::PROTOBUF_NAMESPACE_ID::uint8* msg_data::_InternalSerialize( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:mp.im.data) + // @@protoc_insertion_point(serialize_to_array_start:mp.im.msg_data) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; @@ -536,37 +537,37 @@ failure: target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(5, this->_internal_account(), target); } - // string msg_data = 6; - if (this->msg_data().size() > 0) { + // string im_msg_data = 6; + if (this->im_msg_data().size() > 0) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_msg_data().data(), static_cast(this->_internal_msg_data().length()), + this->_internal_im_msg_data().data(), static_cast(this->_internal_im_msg_data().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, - "mp.im.data.msg_data"); + "mp.im.msg_data.im_msg_data"); target = stream->WriteStringMaybeAliased( - 6, this->_internal_msg_data(), target); + 6, this->_internal_im_msg_data(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } - // @@protoc_insertion_point(serialize_to_array_end:mp.im.data) + // @@protoc_insertion_point(serialize_to_array_end:mp.im.msg_data) return target; } -size_t data::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:mp.im.data) +size_t msg_data::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:mp.im.msg_data) size_t total_size = 0; ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - // string msg_data = 6; - if (this->msg_data().size() > 0) { + // string im_msg_data = 6; + if (this->im_msg_data().size() > 0) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( - this->_internal_msg_data()); + this->_internal_im_msg_data()); } // .mp.MP_SUB_TYPE msg_type = 1; @@ -611,30 +612,30 @@ size_t data::ByteSizeLong() const { return total_size; } -void data::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:mp.im.data) +void msg_data::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:mp.im.msg_data) GOOGLE_DCHECK_NE(&from, this); - const data* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( + const msg_data* source = + ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( &from); if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:mp.im.data) + // @@protoc_insertion_point(generalized_merge_from_cast_fail:mp.im.msg_data) ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:mp.im.data) + // @@protoc_insertion_point(generalized_merge_from_cast_success:mp.im.msg_data) MergeFrom(*source); } } -void data::MergeFrom(const data& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:mp.im.data) +void msg_data::MergeFrom(const msg_data& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:mp.im.msg_data) GOOGLE_DCHECK_NE(&from, this); _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; - if (from.msg_data().size() > 0) { - _internal_set_msg_data(from._internal_msg_data()); + if (from.im_msg_data().size() > 0) { + _internal_set_im_msg_data(from._internal_im_msg_data()); } if (from.msg_type() != 0) { _internal_set_msg_type(from._internal_msg_type()); @@ -653,37 +654,37 @@ void data::MergeFrom(const data& from) { } } -void data::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:mp.im.data) +void msg_data::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:mp.im.msg_data) if (&from == this) return; Clear(); MergeFrom(from); } -void data::CopyFrom(const data& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:mp.im.data) +void msg_data::CopyFrom(const msg_data& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:mp.im.msg_data) if (&from == this) return; Clear(); MergeFrom(from); } -bool data::IsInitialized() const { +bool msg_data::IsInitialized() const { return true; } -void data::InternalSwap(data* other) { +void msg_data::InternalSwap(msg_data* other) { using std::swap; _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_); - msg_data_.Swap(&other->msg_data_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + im_msg_data_.Swap(&other->im_msg_data_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); ::PROTOBUF_NAMESPACE_ID::internal::memswap< - PROTOBUF_FIELD_OFFSET(data, account_) - + sizeof(data::account_) - - PROTOBUF_FIELD_OFFSET(data, msg_type_)>( + PROTOBUF_FIELD_OFFSET(msg_data, account_) + + sizeof(msg_data::account_) + - PROTOBUF_FIELD_OFFSET(msg_data, msg_type_)>( reinterpret_cast(&msg_type_), reinterpret_cast(&other->msg_type_)); } -::PROTOBUF_NAMESPACE_ID::Metadata data::GetMetadata() const { +::PROTOBUF_NAMESPACE_ID::Metadata msg_data::GetMetadata() const { return GetMetadataStatic(); } @@ -695,8 +696,8 @@ PROTOBUF_NAMESPACE_OPEN template<> PROTOBUF_NOINLINE ::mp::im::notice* Arena::CreateMaybeMessage< ::mp::im::notice >(Arena* arena) { return Arena::CreateMessageInternal< ::mp::im::notice >(arena); } -template<> PROTOBUF_NOINLINE ::mp::im::data* Arena::CreateMaybeMessage< ::mp::im::data >(Arena* arena) { - return Arena::CreateMessageInternal< ::mp::im::data >(arena); +template<> PROTOBUF_NOINLINE ::mp::im::msg_data* Arena::CreateMaybeMessage< ::mp::im::msg_data >(Arena* arena) { + return Arena::CreateMessageInternal< ::mp::im::msg_data >(arena); } PROTOBUF_NAMESPACE_CLOSE diff --git a/MP/proto/mp.im.pb.h b/MP/proto/mp.im.pb.h index 13b2696..cdcbe35 100644 --- a/MP/proto/mp.im.pb.h +++ b/MP/proto/mp.im.pb.h @@ -57,16 +57,16 @@ struct TableStruct_mp_2eim_2eproto { extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_mp_2eim_2eproto; namespace mp { namespace im { -class data; -class dataDefaultTypeInternal; -extern dataDefaultTypeInternal _data_default_instance_; +class msg_data; +class msg_dataDefaultTypeInternal; +extern msg_dataDefaultTypeInternal _msg_data_default_instance_; class notice; class noticeDefaultTypeInternal; extern noticeDefaultTypeInternal _notice_default_instance_; } // namespace im } // namespace mp PROTOBUF_NAMESPACE_OPEN -template<> ::mp::im::data* Arena::CreateMaybeMessage<::mp::im::data>(Arena*); +template<> ::mp::im::msg_data* Arena::CreateMaybeMessage<::mp::im::msg_data>(Arena*); template<> ::mp::im::notice* Arena::CreateMaybeMessage<::mp::im::notice>(Arena*); PROTOBUF_NAMESPACE_CLOSE namespace mp { @@ -222,23 +222,23 @@ class notice PROTOBUF_FINAL : }; // ------------------------------------------------------------------- -class data PROTOBUF_FINAL : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:mp.im.data) */ { +class msg_data PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:mp.im.msg_data) */ { public: - inline data() : data(nullptr) {}; - virtual ~data(); + inline msg_data() : msg_data(nullptr) {}; + virtual ~msg_data(); - data(const data& from); - data(data&& from) noexcept - : data() { + msg_data(const msg_data& from); + msg_data(msg_data&& from) noexcept + : msg_data() { *this = ::std::move(from); } - inline data& operator=(const data& from) { + inline msg_data& operator=(const msg_data& from) { CopyFrom(from); return *this; } - inline data& operator=(data&& from) noexcept { + inline msg_data& operator=(msg_data&& from) noexcept { if (GetArena() == from.GetArena()) { if (this != &from) InternalSwap(&from); } else { @@ -256,20 +256,20 @@ class data PROTOBUF_FINAL : static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { return GetMetadataStatic().reflection; } - static const data& default_instance(); + static const msg_data& default_instance(); static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY - static inline const data* internal_default_instance() { - return reinterpret_cast( - &_data_default_instance_); + static inline const msg_data* internal_default_instance() { + return reinterpret_cast( + &_msg_data_default_instance_); } static constexpr int kIndexInFileMessages = 1; - friend void swap(data& a, data& b) { + friend void swap(msg_data& a, msg_data& b) { a.Swap(&b); } - inline void Swap(data* other) { + inline void Swap(msg_data* other) { if (other == this) return; if (GetArena() == other->GetArena()) { InternalSwap(other); @@ -277,7 +277,7 @@ class data PROTOBUF_FINAL : ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(data* other) { + void UnsafeArenaSwap(msg_data* other) { if (other == this) return; GOOGLE_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -285,17 +285,17 @@ class data PROTOBUF_FINAL : // implements Message ---------------------------------------------- - inline data* New() const final { - return CreateMaybeMessage(nullptr); + inline msg_data* New() const final { + return CreateMaybeMessage(nullptr); } - data* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { - return CreateMaybeMessage(arena); + msg_data* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); } void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; - void CopyFrom(const data& from); - void MergeFrom(const data& from); + void CopyFrom(const msg_data& from); + void MergeFrom(const msg_data& from); PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -309,13 +309,13 @@ class data PROTOBUF_FINAL : inline void SharedCtor(); inline void SharedDtor(); void SetCachedSize(int size) const final; - void InternalSwap(data* other); + void InternalSwap(msg_data* other); friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "mp.im.data"; + return "mp.im.msg_data"; } protected: - explicit data(::PROTOBUF_NAMESPACE_ID::Arena* arena); + explicit msg_data(::PROTOBUF_NAMESPACE_ID::Arena* arena); private: static void ArenaDtor(void* object); inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); @@ -335,36 +335,36 @@ class data PROTOBUF_FINAL : // accessors ------------------------------------------------------- enum : int { - kMsgDataFieldNumber = 6, + kImMsgDataFieldNumber = 6, kMsgTypeFieldNumber = 1, kSessionTypeFieldNumber = 2, kMessageIdFieldNumber = 3, kTimeFieldNumber = 4, kAccountFieldNumber = 5, }; - // string msg_data = 6; - void clear_msg_data(); - const std::string& msg_data() const; - void set_msg_data(const std::string& value); - void set_msg_data(std::string&& value); - void set_msg_data(const char* value); - void set_msg_data(const char* value, size_t size); - std::string* mutable_msg_data(); - std::string* release_msg_data(); - void set_allocated_msg_data(std::string* msg_data); + // string im_msg_data = 6; + void clear_im_msg_data(); + const std::string& im_msg_data() const; + void set_im_msg_data(const std::string& value); + void set_im_msg_data(std::string&& value); + void set_im_msg_data(const char* value); + void set_im_msg_data(const char* value, size_t size); + std::string* mutable_im_msg_data(); + std::string* release_im_msg_data(); + void set_allocated_im_msg_data(std::string* im_msg_data); GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" " string fields are deprecated and will be removed in a" " future release.") - std::string* unsafe_arena_release_msg_data(); + std::string* unsafe_arena_release_im_msg_data(); GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" " string fields are deprecated and will be removed in a" " future release.") - void unsafe_arena_set_allocated_msg_data( - std::string* msg_data); + void unsafe_arena_set_allocated_im_msg_data( + std::string* im_msg_data); private: - const std::string& _internal_msg_data() const; - void _internal_set_msg_data(const std::string& value); - std::string* _internal_mutable_msg_data(); + const std::string& _internal_im_msg_data() const; + void _internal_set_im_msg_data(const std::string& value); + std::string* _internal_mutable_im_msg_data(); public: // .mp.MP_SUB_TYPE msg_type = 1; @@ -412,14 +412,14 @@ class data PROTOBUF_FINAL : void _internal_set_account(::PROTOBUF_NAMESPACE_ID::uint64 value); public: - // @@protoc_insertion_point(class_scope:mp.im.data) + // @@protoc_insertion_point(class_scope:mp.im.msg_data) private: class _Internal; template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr msg_data_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr im_msg_data_; int msg_type_; int session_type_; ::PROTOBUF_NAMESPACE_ID::uint64 message_id_; @@ -481,187 +481,187 @@ inline void notice::set_time(::PROTOBUF_NAMESPACE_ID::uint64 value) { // ------------------------------------------------------------------- -// data +// msg_data // .mp.MP_SUB_TYPE msg_type = 1; -inline void data::clear_msg_type() { +inline void msg_data::clear_msg_type() { msg_type_ = 0; } -inline ::mp::MP_SUB_TYPE data::_internal_msg_type() const { +inline ::mp::MP_SUB_TYPE msg_data::_internal_msg_type() const { return static_cast< ::mp::MP_SUB_TYPE >(msg_type_); } -inline ::mp::MP_SUB_TYPE data::msg_type() const { - // @@protoc_insertion_point(field_get:mp.im.data.msg_type) +inline ::mp::MP_SUB_TYPE msg_data::msg_type() const { + // @@protoc_insertion_point(field_get:mp.im.msg_data.msg_type) return _internal_msg_type(); } -inline void data::_internal_set_msg_type(::mp::MP_SUB_TYPE value) { +inline void msg_data::_internal_set_msg_type(::mp::MP_SUB_TYPE value) { msg_type_ = value; } -inline void data::set_msg_type(::mp::MP_SUB_TYPE value) { +inline void msg_data::set_msg_type(::mp::MP_SUB_TYPE value) { _internal_set_msg_type(value); - // @@protoc_insertion_point(field_set:mp.im.data.msg_type) + // @@protoc_insertion_point(field_set:mp.im.msg_data.msg_type) } // .mp.MP_SUB_TYPE session_type = 2; -inline void data::clear_session_type() { +inline void msg_data::clear_session_type() { session_type_ = 0; } -inline ::mp::MP_SUB_TYPE data::_internal_session_type() const { +inline ::mp::MP_SUB_TYPE msg_data::_internal_session_type() const { return static_cast< ::mp::MP_SUB_TYPE >(session_type_); } -inline ::mp::MP_SUB_TYPE data::session_type() const { - // @@protoc_insertion_point(field_get:mp.im.data.session_type) +inline ::mp::MP_SUB_TYPE msg_data::session_type() const { + // @@protoc_insertion_point(field_get:mp.im.msg_data.session_type) return _internal_session_type(); } -inline void data::_internal_set_session_type(::mp::MP_SUB_TYPE value) { +inline void msg_data::_internal_set_session_type(::mp::MP_SUB_TYPE value) { session_type_ = value; } -inline void data::set_session_type(::mp::MP_SUB_TYPE value) { +inline void msg_data::set_session_type(::mp::MP_SUB_TYPE value) { _internal_set_session_type(value); - // @@protoc_insertion_point(field_set:mp.im.data.session_type) + // @@protoc_insertion_point(field_set:mp.im.msg_data.session_type) } // uint64 message_id = 3; -inline void data::clear_message_id() { +inline void msg_data::clear_message_id() { message_id_ = PROTOBUF_ULONGLONG(0); } -inline ::PROTOBUF_NAMESPACE_ID::uint64 data::_internal_message_id() const { +inline ::PROTOBUF_NAMESPACE_ID::uint64 msg_data::_internal_message_id() const { return message_id_; } -inline ::PROTOBUF_NAMESPACE_ID::uint64 data::message_id() const { - // @@protoc_insertion_point(field_get:mp.im.data.message_id) +inline ::PROTOBUF_NAMESPACE_ID::uint64 msg_data::message_id() const { + // @@protoc_insertion_point(field_get:mp.im.msg_data.message_id) return _internal_message_id(); } -inline void data::_internal_set_message_id(::PROTOBUF_NAMESPACE_ID::uint64 value) { +inline void msg_data::_internal_set_message_id(::PROTOBUF_NAMESPACE_ID::uint64 value) { message_id_ = value; } -inline void data::set_message_id(::PROTOBUF_NAMESPACE_ID::uint64 value) { +inline void msg_data::set_message_id(::PROTOBUF_NAMESPACE_ID::uint64 value) { _internal_set_message_id(value); - // @@protoc_insertion_point(field_set:mp.im.data.message_id) + // @@protoc_insertion_point(field_set:mp.im.msg_data.message_id) } // uint64 time = 4; -inline void data::clear_time() { +inline void msg_data::clear_time() { time_ = PROTOBUF_ULONGLONG(0); } -inline ::PROTOBUF_NAMESPACE_ID::uint64 data::_internal_time() const { +inline ::PROTOBUF_NAMESPACE_ID::uint64 msg_data::_internal_time() const { return time_; } -inline ::PROTOBUF_NAMESPACE_ID::uint64 data::time() const { - // @@protoc_insertion_point(field_get:mp.im.data.time) +inline ::PROTOBUF_NAMESPACE_ID::uint64 msg_data::time() const { + // @@protoc_insertion_point(field_get:mp.im.msg_data.time) return _internal_time(); } -inline void data::_internal_set_time(::PROTOBUF_NAMESPACE_ID::uint64 value) { +inline void msg_data::_internal_set_time(::PROTOBUF_NAMESPACE_ID::uint64 value) { time_ = value; } -inline void data::set_time(::PROTOBUF_NAMESPACE_ID::uint64 value) { +inline void msg_data::set_time(::PROTOBUF_NAMESPACE_ID::uint64 value) { _internal_set_time(value); - // @@protoc_insertion_point(field_set:mp.im.data.time) + // @@protoc_insertion_point(field_set:mp.im.msg_data.time) } // uint64 account = 5; -inline void data::clear_account() { +inline void msg_data::clear_account() { account_ = PROTOBUF_ULONGLONG(0); } -inline ::PROTOBUF_NAMESPACE_ID::uint64 data::_internal_account() const { +inline ::PROTOBUF_NAMESPACE_ID::uint64 msg_data::_internal_account() const { return account_; } -inline ::PROTOBUF_NAMESPACE_ID::uint64 data::account() const { - // @@protoc_insertion_point(field_get:mp.im.data.account) +inline ::PROTOBUF_NAMESPACE_ID::uint64 msg_data::account() const { + // @@protoc_insertion_point(field_get:mp.im.msg_data.account) return _internal_account(); } -inline void data::_internal_set_account(::PROTOBUF_NAMESPACE_ID::uint64 value) { +inline void msg_data::_internal_set_account(::PROTOBUF_NAMESPACE_ID::uint64 value) { account_ = value; } -inline void data::set_account(::PROTOBUF_NAMESPACE_ID::uint64 value) { +inline void msg_data::set_account(::PROTOBUF_NAMESPACE_ID::uint64 value) { _internal_set_account(value); - // @@protoc_insertion_point(field_set:mp.im.data.account) + // @@protoc_insertion_point(field_set:mp.im.msg_data.account) } -// string msg_data = 6; -inline void data::clear_msg_data() { - msg_data_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +// string im_msg_data = 6; +inline void msg_data::clear_im_msg_data() { + im_msg_data_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); } -inline const std::string& data::msg_data() const { - // @@protoc_insertion_point(field_get:mp.im.data.msg_data) - return _internal_msg_data(); +inline const std::string& msg_data::im_msg_data() const { + // @@protoc_insertion_point(field_get:mp.im.msg_data.im_msg_data) + return _internal_im_msg_data(); } -inline void data::set_msg_data(const std::string& value) { - _internal_set_msg_data(value); - // @@protoc_insertion_point(field_set:mp.im.data.msg_data) +inline void msg_data::set_im_msg_data(const std::string& value) { + _internal_set_im_msg_data(value); + // @@protoc_insertion_point(field_set:mp.im.msg_data.im_msg_data) } -inline std::string* data::mutable_msg_data() { - // @@protoc_insertion_point(field_mutable:mp.im.data.msg_data) - return _internal_mutable_msg_data(); +inline std::string* msg_data::mutable_im_msg_data() { + // @@protoc_insertion_point(field_mutable:mp.im.msg_data.im_msg_data) + return _internal_mutable_im_msg_data(); } -inline const std::string& data::_internal_msg_data() const { - return msg_data_.Get(); +inline const std::string& msg_data::_internal_im_msg_data() const { + return im_msg_data_.Get(); } -inline void data::_internal_set_msg_data(const std::string& value) { +inline void msg_data::_internal_set_im_msg_data(const std::string& value) { - msg_data_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); + im_msg_data_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); } -inline void data::set_msg_data(std::string&& value) { +inline void msg_data::set_im_msg_data(std::string&& value) { - msg_data_.Set( + im_msg_data_.Set( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); - // @@protoc_insertion_point(field_set_rvalue:mp.im.data.msg_data) + // @@protoc_insertion_point(field_set_rvalue:mp.im.msg_data.im_msg_data) } -inline void data::set_msg_data(const char* value) { +inline void msg_data::set_im_msg_data(const char* value) { GOOGLE_DCHECK(value != nullptr); - msg_data_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + im_msg_data_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), GetArena()); - // @@protoc_insertion_point(field_set_char:mp.im.data.msg_data) + // @@protoc_insertion_point(field_set_char:mp.im.msg_data.im_msg_data) } -inline void data::set_msg_data(const char* value, +inline void msg_data::set_im_msg_data(const char* value, size_t size) { - msg_data_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + im_msg_data_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( reinterpret_cast(value), size), GetArena()); - // @@protoc_insertion_point(field_set_pointer:mp.im.data.msg_data) + // @@protoc_insertion_point(field_set_pointer:mp.im.msg_data.im_msg_data) } -inline std::string* data::_internal_mutable_msg_data() { +inline std::string* msg_data::_internal_mutable_im_msg_data() { - return msg_data_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + return im_msg_data_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); } -inline std::string* data::release_msg_data() { - // @@protoc_insertion_point(field_release:mp.im.data.msg_data) - return msg_data_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +inline std::string* msg_data::release_im_msg_data() { + // @@protoc_insertion_point(field_release:mp.im.msg_data.im_msg_data) + return im_msg_data_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); } -inline void data::set_allocated_msg_data(std::string* msg_data) { - if (msg_data != nullptr) { +inline void msg_data::set_allocated_im_msg_data(std::string* im_msg_data) { + if (im_msg_data != nullptr) { } else { } - msg_data_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), msg_data, + im_msg_data_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), im_msg_data, GetArena()); - // @@protoc_insertion_point(field_set_allocated:mp.im.data.msg_data) + // @@protoc_insertion_point(field_set_allocated:mp.im.msg_data.im_msg_data) } -inline std::string* data::unsafe_arena_release_msg_data() { - // @@protoc_insertion_point(field_unsafe_arena_release:mp.im.data.msg_data) +inline std::string* msg_data::unsafe_arena_release_im_msg_data() { + // @@protoc_insertion_point(field_unsafe_arena_release:mp.im.msg_data.im_msg_data) GOOGLE_DCHECK(GetArena() != nullptr); - return msg_data_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + return im_msg_data_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); } -inline void data::unsafe_arena_set_allocated_msg_data( - std::string* msg_data) { +inline void msg_data::unsafe_arena_set_allocated_im_msg_data( + std::string* im_msg_data) { GOOGLE_DCHECK(GetArena() != nullptr); - if (msg_data != nullptr) { + if (im_msg_data != nullptr) { } else { } - msg_data_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - msg_data, GetArena()); - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:mp.im.data.msg_data) + im_msg_data_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + im_msg_data, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:mp.im.msg_data.im_msg_data) } #ifdef __GNUC__ diff --git a/MP/proto/mp.mp.pb.cc b/MP/proto/mp.mp.pb.cc index 93c6e54..df9bbd4 100644 --- a/MP/proto/mp.mp.pb.cc +++ b/MP/proto/mp.mp.pb.cc @@ -33,7 +33,7 @@ const char descriptor_table_protodef_mp_2emp_2eproto[] PROTOBUF_SECTION_VARIABLE "\022\024\n\020MP_RESPONSE_CODE\020\027\022\027\n\023MP_RESPONSE_FR" "IENDS\020\030\022\026\n\022MP_RESPONSE_GROUPS\020\031\022\021\n\014MP_IM" "_NOTICE\020\310\001\022\023\n\016MP_IM_PUSH_MSG\020\311\001\022\023\n\016MP_IM" - "_PULL_MSG\020\312\001\022\016\n\tMP_IM_MSG\020\313\001*\325\007\n\013MP_SUB_" + "_PULL_MSG\020\312\001\022\016\n\tMP_IM_MSG\020\313\001*\373\007\n\013MP_SUB_" "TYPE\022\022\n\016MP_LOGIN_EMAIL\020\000\022\022\n\016MP_LOGIN_PHO" "NE\020\001\022\024\n\020MP_LOGIN_ACCOUNT\020\002\022\025\n\021MP_REGISTE" "R_EMAIL\020\003\022\025\n\021MP_REGISTER_PHONE\020\004\022\024\n\020MP_L" @@ -57,8 +57,9 @@ const char descriptor_table_protodef_mp_2emp_2eproto[] PROTOBUF_SECTION_VARIABLE "P_REMOVE_FAIL\020J\022\017\n\013MP_GET_FAIL\020K\022\022\n\016MP_S" "EARCH_FAIL\020L\022\020\n\014MP_ADD_CHECK\020P\022\017\n\nMP_IM_" "TEXT\020\310\001\022\020\n\013MP_IM_PHOTO\020\311\001\022\020\n\013MP_IM_AUDIO" - "\020\312\001\022\020\n\013MP_IM_VIDEO\020\313\001\022\016\n\tMP_FRIEND\020\254\002\022\r\n" - "\010MP_GROUP\020\255\002b\006proto3" + "\020\312\001\022\020\n\013MP_IM_VIDEO\020\313\001\022\026\n\021MP_SESSION_FRIE" + "ND\020\254\002\022\025\n\020MP_SESSION_GROUP\020\255\002\022\024\n\017MP_SESSI" + "ON_TEMP\020\256\002b\006proto3" ; static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_mp_2emp_2eproto_deps[1] = { }; @@ -66,7 +67,7 @@ static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_mp_ }; static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_mp_2emp_2eproto_once; const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_mp_2emp_2eproto = { - false, false, descriptor_table_protodef_mp_2emp_2eproto, "mp.mp.proto", 1380, + false, false, descriptor_table_protodef_mp_2emp_2eproto, "mp.mp.proto", 1418, &descriptor_table_mp_2emp_2eproto_once, descriptor_table_mp_2emp_2eproto_sccs, descriptor_table_mp_2emp_2eproto_deps, 0, 0, schemas, file_default_instances, TableStruct_mp_2emp_2eproto::offsets, file_level_metadata_mp_2emp_2eproto, 0, file_level_enum_descriptors_mp_2emp_2eproto, file_level_service_descriptors_mp_2emp_2eproto, @@ -155,6 +156,7 @@ bool MP_SUB_TYPE_IsValid(int value) { case 203: case 300: case 301: + case 302: return true; default: return false; diff --git a/MP/proto/mp.mp.pb.h b/MP/proto/mp.mp.pb.h index aa28840..4aa8622 100644 --- a/MP/proto/mp.mp.pb.h +++ b/MP/proto/mp.mp.pb.h @@ -141,14 +141,15 @@ enum MP_SUB_TYPE : int { MP_IM_PHOTO = 201, MP_IM_AUDIO = 202, MP_IM_VIDEO = 203, - MP_FRIEND = 300, - MP_GROUP = 301, + MP_SESSION_FRIEND = 300, + MP_SESSION_GROUP = 301, + MP_SESSION_TEMP = 302, MP_SUB_TYPE_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(), MP_SUB_TYPE_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max() }; bool MP_SUB_TYPE_IsValid(int value); constexpr MP_SUB_TYPE MP_SUB_TYPE_MIN = MP_LOGIN_EMAIL; -constexpr MP_SUB_TYPE MP_SUB_TYPE_MAX = MP_GROUP; +constexpr MP_SUB_TYPE MP_SUB_TYPE_MAX = MP_SESSION_TEMP; constexpr int MP_SUB_TYPE_ARRAYSIZE = MP_SUB_TYPE_MAX + 1; const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* MP_SUB_TYPE_descriptor(); diff --git a/MP/protohuf/mp.im.proto b/MP/protohuf/mp.im.proto index 328a553..4b4d488 100644 --- a/MP/protohuf/mp.im.proto +++ b/MP/protohuf/mp.im.proto @@ -13,14 +13,17 @@ message notice { // pull push uint64 time = 2; // 时间 用于消息同步的生命周期 } -// 获取/推送 [消息包] -message data { +// 获取/推送 [消息包] // 通知数据包 拉推包 实际数据包 请求 响应都有 +message msg_data { MP_SUB_TYPE msg_type = 1; // [] 数组 // 消息类型 子命令 分辨什么类型的消息 文本 视频 音频? - MP_SUB_TYPE session_type = 2; // [] 数组 // 会话 目标/来源 类型 分辨是群消息还是 单体消息 + MP_SUB_TYPE session_type = 2; // [] 数组 // 会话 目标/来源 类型 分辨是群消息还是 单体消息 uint64 message_id = 3; // [] 数组 // 消息id 字节序 转成 uint64 uint64 time = 4; // 时间 uint64 account = 5; // [] 数组 // 消息 目标/来源 - string msg_data = 6; // [] 数组 // 消息数据字节序 + string im_msg_data = 6; // [] 数组 // 消息数据字节序 } + + + diff --git a/MP/protohuf/mp.mp.proto b/MP/protohuf/mp.mp.proto index b226799..68c6b62 100644 --- a/MP/protohuf/mp.mp.proto +++ b/MP/protohuf/mp.mp.proto @@ -21,10 +21,10 @@ enum MP_TYPE { // 200 以后为 聊天消息包 - MP_IM_NOTICE = 200; // 消息推送通知 - MP_IM_PUSH_MSG = 201; // 推消息 ---> 推至储存库/同步库 - MP_IM_PULL_MSG = 202; // 拉消息 ---> 同步库/储存库拉取 - MP_IM_MSG = 203; // 消息包本体 包含数据 阅完即焚 + MP_IM_NOTICE = 200; // 消息推送通知 // 响应 + MP_IM_PUSH_MSG = 201; // 推消息 ---> 推至储存库/同步库 // 请求 + MP_IM_PULL_MSG = 202; // 拉消息 ---> 同步库/储存库拉取 // 请求 + MP_IM_MSG = 203; // 消息包本体 包含数据 im msg实际数据 // 响应 } enum MP_SUB_TYPE { @@ -88,7 +88,6 @@ enum MP_SUB_TYPE { ///***********************************************************************************/// - /// 200+ IM ***********************************************************************************/// MP_IM_TEXT = 200; // 文本 @@ -96,8 +95,9 @@ enum MP_SUB_TYPE { MP_IM_AUDIO = 202; // 语音 MP_IM_VIDEO = 203; // 视频 - MP_FRIEND = 300; // 单体会话 - MP_GROUP = 301; // 群组会话 + MP_SESSION_FRIEND = 300; // 单体会话 + MP_SESSION_GROUP = 301; // 群组会话 + MP_SESSION_TEMP = 302; // 临时会话 ///***********************************************************************************/// } \ No newline at end of file diff --git a/MS/works/controller/IMController.cpp b/MS/works/controller/IMController.cpp index d99faaf..e933e37 100644 --- a/MS/works/controller/IMController.cpp +++ b/MS/works/controller/IMController.cpp @@ -5,11 +5,11 @@ #include "IMController.h" void IMController::run(std::shared_ptr request, std::shared_ptr response) { - // msg push 储存库内 + // msg push 储存库内 正常会话 要同步库 储存库 if (request->m_mph->mp_type() == mp::MP_IM_PUSH_MSG) { } - // 传来 im msg + // 传来 im msg 临时会话 消息包本体 要同步库 else if (request->m_mph->mp_type() == mp::MP_IM_MSG) { }