主要修复邮箱登陆,

可以根据account搜索用户
添加暂时没做
下一个步 添加 好友
This commit is contained in:
dongl 2023-06-07 20:02:54 +08:00
parent 4f71b78676
commit 12cc086093
19 changed files with 1512 additions and 69 deletions

View File

@ -13,3 +13,5 @@ add_subdirectory(MDB/imm_mysqldb)
add_subdirectory(MDB/imm_mongodb)
add_subdirectory(TEST)

View File

@ -11,11 +11,10 @@ aux_source_directory(template_table DIR_TEMPLATE_TABLE)
add_library(imm_mysqldb
ConnectionPool.cpp
# ${DIR_USER}
# ${DIR_TEMPLATE_TABLE}
)
${DIR_TEMPLATE_TABLE}
template_table/im_user.cpp template_table/template_struct.h)
target_link_libraries(imm_mysqldb
mysqlpp mysqlclient
MP
# MP
)

View File

@ -0,0 +1,7 @@
//
// Created by dongl on 23-6-7.
//
#define IM_IM_USER_H
#include "im_user.h"

View File

@ -2,23 +2,24 @@
// Created by dongl on 23-4-16.
//
#ifndef IM_IM_USER_H
#define IM_IM_USER_H
//#ifndef IM_IM_USER_H
//#define IM_IM_USER_H
#include <mysql++/mysql++.h>
#include <mysql++/ssqls.h>
#include "sql_table_struct.h"
#if !defined(IM_IM_USER_H)
#define IM_IM_USER_H
#include <mysql++/mysql++.h>
#include <mysql++/ssqls.h>
sql_create_7(im_user,
1, 7, // 1 当主键 第三个参数是 SETCOUNT。如果这为非零值则添加一个初始化构造函数和一个成员函数该函数采用给定数量的参数用于设置结构的前 N 个字段。
mysqlpp::sql_bigint , account,
mysqlpp::sql_bigint , phone,
mysqlpp::sql_varchar, email,
mysqlpp::sql_varchar,username,
mysqlpp::sql_varchar,password,
mysqlpp::sql_varchar,password_salt,
mysqlpp::sql_tinyblob, client_info
);
sql_create_7(im_user,
1, 7, // 1 当主键 第三个参数是 SETCOUNT。如果这为非零值则添加一个初始化构造函数和一个成员函数该函数采用给定数量的参数用于设置结构的前 N 个字段。
mysqlpp::sql_bigint , account,
mysqlpp::sql_bigint , phone,
mysqlpp::sql_varchar, email,
mysqlpp::sql_varchar,username,
mysqlpp::sql_varchar,password,
mysqlpp::sql_varchar,password_salt,
mysqlpp::sql_tinyblob, client_info
)
#endif
#endif //IM_IM_USER_H
//#endif // IM_IM_USER_H

View File

@ -2,20 +2,21 @@
// Created by dongl on 23-5-4.
//
#ifndef IM2_IM_USER_FRIENDS_CPP
//#ifndef IM2_IM_USER_FRIENDS_CPP
//#define IM2_IM_USER_FRIENDS_CPP
#if !defined(IM2_IM_USER_FRIENDS_CPP)
#define IM2_IM_USER_FRIENDS_CPP
#include <mysql++/mysql++.h>
#include <mysql++/ssqls.h>
#include <mysql++/mysql++.h>
#include <mysql++/ssqls.h>
#include "sql_table_struct.h"
sql_create_5(im_user_friends,
1, 5, // 1 当主键 第三个参数是 SETCOUNT。如果这为非零值则添加一个初始化构造函数和一个成员函数该函数采用给定数量的参数用于设置结构的前 N 个字段。
mysqlpp::sql_bigint, account,
mysqlpp::sql_blob, groups,
mysqlpp::sql_blob, friends,
mysqlpp::sql_blob, to_be_added,
mysqlpp::sql_int, restrictions
);
sql_create_5(im_user_friends,
1, 5, // 1 当主键 第三个参数是 SETCOUNT。如果这为非零值则添加一个初始化构造函数和一个成员函数该函数采用给定数量的参数用于设置结构的前 N 个字段。
mysqlpp::sql_bigint, account,
mysqlpp::sql_blob, groups,
mysqlpp::sql_blob, friends,
mysqlpp::sql_blob, to_be_added,
mysqlpp::sql_int, restrictions
);
#endif //IM2_IM_USER_FRIENDS_CPP

View File

@ -1,10 +0,0 @@
//
// Created by dongl on 23-5-5.
//
#ifndef IM2_SQL_TABLE_STRUCT_H
#define IM2_SQL_TABLE_STRUCT_H
#endif //IM2_SQL_TABLE_STRUCT_H

View File

@ -0,0 +1,11 @@
//
// Created by dongl on 23-6-7.
//
#ifndef IM2_TEMPLATE_STRUCT_H
#define IM2_TEMPLATE_STRUCT_H
#include "im_user.h"
#include "im_user_friends.h"
#endif //IM2_TEMPLATE_STRUCT_H

704
MP/proto/mp.im.pb.cc Normal file
View File

@ -0,0 +1,704 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: mp.im.proto
#include "mp.im.pb.h"
#include <algorithm>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>
namespace mp {
namespace im {
class noticeDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<notice> _instance;
} _notice_default_instance_;
class dataDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<data> _instance;
} _data_default_instance_;
} // namespace im
} // namespace mp
static void InitDefaultsscc_info_data_mp_2eim_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mp::im::_data_default_instance_;
new (ptr) ::mp::im::data();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mp::im::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}, {}};
static void InitDefaultsscc_info_notice_mp_2eim_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mp::im::_notice_default_instance_;
new (ptr) ::mp::im::notice();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mp::im::notice::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_notice_mp_2eim_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_notice_mp_2eim_2eproto}, {}};
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_mp_2eim_2eproto[2];
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_mp_2eim_2eproto = nullptr;
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_mp_2eim_2eproto = nullptr;
const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_mp_2eim_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mp::im::notice, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
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_),
~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_),
};
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)},
};
static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = {
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mp::im::_notice_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mp::im::_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"
;
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_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,
&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,
};
// Force running AddDescriptors() at dynamic initialization time.
static bool dynamic_init_dummy_mp_2eim_2eproto = (static_cast<void>(::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_mp_2eim_2eproto)), true);
namespace mp {
namespace im {
// ===================================================================
void notice::InitAsDefaultInstance() {
}
class notice::_Internal {
public:
};
notice::notice(::PROTOBUF_NAMESPACE_ID::Arena* arena)
: ::PROTOBUF_NAMESPACE_ID::Message(arena) {
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:mp.im.notice)
}
notice::notice(const notice& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
::memcpy(&message_id_, &from.message_id_,
static_cast<size_t>(reinterpret_cast<char*>(&time_) -
reinterpret_cast<char*>(&message_id_)) + sizeof(time_));
// @@protoc_insertion_point(copy_constructor:mp.im.notice)
}
void notice::SharedCtor() {
::memset(&message_id_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&time_) -
reinterpret_cast<char*>(&message_id_)) + sizeof(time_));
}
notice::~notice() {
// @@protoc_insertion_point(destructor:mp.im.notice)
SharedDtor();
_internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
void notice::SharedDtor() {
GOOGLE_DCHECK(GetArena() == nullptr);
}
void notice::ArenaDtor(void* object) {
notice* _this = reinterpret_cast< notice* >(object);
(void)_this;
}
void notice::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void notice::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const notice& notice::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_notice_mp_2eim_2eproto.base);
return *internal_default_instance();
}
void notice::Clear() {
// @@protoc_insertion_point(message_clear_start:mp.im.notice)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
::memset(&message_id_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&time_) -
reinterpret_cast<char*>(&message_id_)) + sizeof(time_));
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
const char* notice::_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)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
switch (tag >> 3) {
// uint64 message_id = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
message_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else goto handle_unusual;
continue;
// uint64 time = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
time_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag,
_internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* notice::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mp.im.notice)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// uint64 message_id = 1;
if (this->message_id() != 0) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(1, this->_internal_message_id(), target);
}
// uint64 time = 2;
if (this->time() != 0) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(2, this->_internal_time(), 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.notice)
return target;
}
size_t notice::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mp.im.notice)
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;
// uint64 message_id = 1;
if (this->message_id() != 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size(
this->_internal_message_id());
}
// uint64 time = 2;
if (this->time() != 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size(
this->_internal_time());
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void notice::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mp.im.notice)
GOOGLE_DCHECK_NE(&from, this);
const notice* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<notice>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mp.im.notice)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mp.im.notice)
MergeFrom(*source);
}
}
void notice::MergeFrom(const notice& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mp.im.notice)
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.message_id() != 0) {
_internal_set_message_id(from._internal_message_id());
}
if (from.time() != 0) {
_internal_set_time(from._internal_time());
}
}
void notice::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mp.im.notice)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void notice::CopyFrom(const notice& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mp.im.notice)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool notice::IsInitialized() const {
return true;
}
void notice::InternalSwap(notice* other) {
using std::swap;
_internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(notice, time_)
+ sizeof(notice::time_)
- PROTOBUF_FIELD_OFFSET(notice, message_id_)>(
reinterpret_cast<char*>(&message_id_),
reinterpret_cast<char*>(&other->message_id_));
}
::PROTOBUF_NAMESPACE_ID::Metadata notice::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void data::InitAsDefaultInstance() {
}
class data::_Internal {
public:
};
data::data(::PROTOBUF_NAMESPACE_ID::Arena* arena)
: ::PROTOBUF_NAMESPACE_ID::Message(arena) {
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:mp.im.data)
}
data::data(const 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(),
GetArena());
}
::memcpy(&msg_type_, &from.msg_type_,
static_cast<size_t>(reinterpret_cast<char*>(&account_) -
reinterpret_cast<char*>(&msg_type_)) + sizeof(account_));
// @@protoc_insertion_point(copy_constructor:mp.im.data)
}
void data::SharedCtor() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_data_mp_2eim_2eproto.base);
msg_data_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
::memset(&msg_type_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&account_) -
reinterpret_cast<char*>(&msg_type_)) + sizeof(account_));
}
data::~data() {
// @@protoc_insertion_point(destructor:mp.im.data)
SharedDtor();
_internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
void data::SharedDtor() {
GOOGLE_DCHECK(GetArena() == nullptr);
msg_data_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
void data::ArenaDtor(void* object) {
data* _this = reinterpret_cast< data* >(object);
(void)_this;
}
void data::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void 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);
return *internal_default_instance();
}
void data::Clear() {
// @@protoc_insertion_point(message_clear_start:mp.im.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());
::memset(&msg_type_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&account_) -
reinterpret_cast<char*>(&msg_type_)) + sizeof(account_));
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
const char* 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)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
switch (tag >> 3) {
// .mp.MP_SUB_TYPE msg_type = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
_internal_set_msg_type(static_cast<::mp::MP_SUB_TYPE>(val));
} else goto handle_unusual;
continue;
// .mp.MP_SUB_TYPE session_type = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
_internal_set_session_type(static_cast<::mp::MP_SUB_TYPE>(val));
} else goto handle_unusual;
continue;
// uint64 message_id = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
message_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else goto handle_unusual;
continue;
// uint64 time = 4;
case 4:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) {
time_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else goto handle_unusual;
continue;
// uint64 account = 5;
case 5:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) {
account_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else goto handle_unusual;
continue;
// string msg_data = 6;
case 6:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) {
auto str = _internal_mutable_msg_data();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "mp.im.data.msg_data"));
CHK_(ptr);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag,
_internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* data::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mp.im.data)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .mp.MP_SUB_TYPE msg_type = 1;
if (this->msg_type() != 0) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray(
1, this->_internal_msg_type(), target);
}
// .mp.MP_SUB_TYPE session_type = 2;
if (this->session_type() != 0) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray(
2, this->_internal_session_type(), target);
}
// uint64 message_id = 3;
if (this->message_id() != 0) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(3, this->_internal_message_id(), target);
}
// uint64 time = 4;
if (this->time() != 0) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(4, this->_internal_time(), target);
}
// uint64 account = 5;
if (this->account() != 0) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(5, this->_internal_account(), target);
}
// string msg_data = 6;
if (this->msg_data().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_msg_data().data(), static_cast<int>(this->_internal_msg_data().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"mp.im.data.msg_data");
target = stream->WriteStringMaybeAliased(
6, this->_internal_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)
return target;
}
size_t data::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mp.im.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) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_msg_data());
}
// .mp.MP_SUB_TYPE msg_type = 1;
if (this->msg_type() != 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_msg_type());
}
// .mp.MP_SUB_TYPE session_type = 2;
if (this->session_type() != 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_session_type());
}
// uint64 message_id = 3;
if (this->message_id() != 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size(
this->_internal_message_id());
}
// uint64 time = 4;
if (this->time() != 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size(
this->_internal_time());
}
// uint64 account = 5;
if (this->account() != 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size(
this->_internal_account());
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void data::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mp.im.data)
GOOGLE_DCHECK_NE(&from, this);
const data* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<data>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mp.im.data)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mp.im.data)
MergeFrom(*source);
}
}
void data::MergeFrom(const data& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mp.im.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.msg_type() != 0) {
_internal_set_msg_type(from._internal_msg_type());
}
if (from.session_type() != 0) {
_internal_set_session_type(from._internal_session_type());
}
if (from.message_id() != 0) {
_internal_set_message_id(from._internal_message_id());
}
if (from.time() != 0) {
_internal_set_time(from._internal_time());
}
if (from.account() != 0) {
_internal_set_account(from._internal_account());
}
}
void data::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mp.im.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)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool data::IsInitialized() const {
return true;
}
void data::InternalSwap(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());
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(data, account_)
+ sizeof(data::account_)
- PROTOBUF_FIELD_OFFSET(data, msg_type_)>(
reinterpret_cast<char*>(&msg_type_),
reinterpret_cast<char*>(&other->msg_type_));
}
::PROTOBUF_NAMESPACE_ID::Metadata data::GetMetadata() const {
return GetMetadataStatic();
}
// @@protoc_insertion_point(namespace_scope)
} // namespace im
} // namespace mp
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);
}
PROTOBUF_NAMESPACE_CLOSE
// @@protoc_insertion_point(global_scope)
#include <google/protobuf/port_undef.inc>

681
MP/proto/mp.im.pb.h Normal file
View File

@ -0,0 +1,681 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: mp.im.proto
#ifndef GOOGLE_PROTOBUF_INCLUDED_mp_2eim_2eproto
#define GOOGLE_PROTOBUF_INCLUDED_mp_2eim_2eproto
#include <limits>
#include <string>
#include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3012000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
#if 3012004 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
#endif
#include <google/protobuf/port_undef.inc>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/arena.h>
#include <google/protobuf/arenastring.h>
#include <google/protobuf/generated_message_table_driven.h>
#include <google/protobuf/generated_message_util.h>
#include <google/protobuf/inlined_string_field.h>
#include <google/protobuf/metadata_lite.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/message.h>
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
#include <google/protobuf/extension_set.h> // IWYU pragma: export
#include <google/protobuf/unknown_field_set.h>
#include "mp.mp.pb.h"
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>
#define PROTOBUF_INTERNAL_EXPORT_mp_2eim_2eproto
PROTOBUF_NAMESPACE_OPEN
namespace internal {
class AnyMetadata;
} // namespace internal
PROTOBUF_NAMESPACE_CLOSE
// Internal implementation detail -- do not use these members.
struct TableStruct_mp_2eim_2eproto {
static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[]
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::PROTOBUF_NAMESPACE_ID::internal::AuxillaryParseTableField aux[]
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[2]
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
};
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 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::notice* Arena::CreateMaybeMessage<::mp::im::notice>(Arena*);
PROTOBUF_NAMESPACE_CLOSE
namespace mp {
namespace im {
// ===================================================================
class notice PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:mp.im.notice) */ {
public:
inline notice() : notice(nullptr) {};
virtual ~notice();
notice(const notice& from);
notice(notice&& from) noexcept
: notice() {
*this = ::std::move(from);
}
inline notice& operator=(const notice& from) {
CopyFrom(from);
return *this;
}
inline notice& operator=(notice&& from) noexcept {
if (GetArena() == from.GetArena()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
}
static const notice& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const notice* internal_default_instance() {
return reinterpret_cast<const notice*>(
&_notice_default_instance_);
}
static constexpr int kIndexInFileMessages =
0;
friend void swap(notice& a, notice& b) {
a.Swap(&b);
}
inline void Swap(notice* other) {
if (other == this) return;
if (GetArena() == other->GetArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
}
}
void UnsafeArenaSwap(notice* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArena() == other->GetArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline notice* New() const final {
return CreateMaybeMessage<notice>(nullptr);
}
notice* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
return CreateMaybeMessage<notice>(arena);
}
void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void CopyFrom(const notice& from);
void MergeFrom(const notice& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
inline void SharedCtor();
inline void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(notice* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "mp.im.notice";
}
protected:
explicit notice(::PROTOBUF_NAMESPACE_ID::Arena* arena);
private:
static void ArenaDtor(void* object);
inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_mp_2eim_2eproto);
return ::descriptor_table_mp_2eim_2eproto.file_level_metadata[kIndexInFileMessages];
}
public:
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
enum : int {
kMessageIdFieldNumber = 1,
kTimeFieldNumber = 2,
};
// uint64 message_id = 1;
void clear_message_id();
::PROTOBUF_NAMESPACE_ID::uint64 message_id() const;
void set_message_id(::PROTOBUF_NAMESPACE_ID::uint64 value);
private:
::PROTOBUF_NAMESPACE_ID::uint64 _internal_message_id() const;
void _internal_set_message_id(::PROTOBUF_NAMESPACE_ID::uint64 value);
public:
// uint64 time = 2;
void clear_time();
::PROTOBUF_NAMESPACE_ID::uint64 time() const;
void set_time(::PROTOBUF_NAMESPACE_ID::uint64 value);
private:
::PROTOBUF_NAMESPACE_ID::uint64 _internal_time() const;
void _internal_set_time(::PROTOBUF_NAMESPACE_ID::uint64 value);
public:
// @@protoc_insertion_point(class_scope:mp.im.notice)
private:
class _Internal;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
::PROTOBUF_NAMESPACE_ID::uint64 message_id_;
::PROTOBUF_NAMESPACE_ID::uint64 time_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_mp_2eim_2eproto;
};
// -------------------------------------------------------------------
class data PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:mp.im.data) */ {
public:
inline data() : data(nullptr) {};
virtual ~data();
data(const data& from);
data(data&& from) noexcept
: data() {
*this = ::std::move(from);
}
inline data& operator=(const data& from) {
CopyFrom(from);
return *this;
}
inline data& operator=(data&& from) noexcept {
if (GetArena() == from.GetArena()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
}
static const data& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const data* internal_default_instance() {
return reinterpret_cast<const data*>(
&_data_default_instance_);
}
static constexpr int kIndexInFileMessages =
1;
friend void swap(data& a, data& b) {
a.Swap(&b);
}
inline void Swap(data* other) {
if (other == this) return;
if (GetArena() == other->GetArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
}
}
void UnsafeArenaSwap(data* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArena() == other->GetArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline data* New() const final {
return CreateMaybeMessage<data>(nullptr);
}
data* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
return CreateMaybeMessage<data>(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);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
inline void SharedCtor();
inline void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(data* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "mp.im.data";
}
protected:
explicit data(::PROTOBUF_NAMESPACE_ID::Arena* arena);
private:
static void ArenaDtor(void* object);
inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_mp_2eim_2eproto);
return ::descriptor_table_mp_2eim_2eproto.file_level_metadata[kIndexInFileMessages];
}
public:
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
enum : int {
kMsgDataFieldNumber = 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);
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();
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);
private:
const std::string& _internal_msg_data() const;
void _internal_set_msg_data(const std::string& value);
std::string* _internal_mutable_msg_data();
public:
// .mp.MP_SUB_TYPE msg_type = 1;
void clear_msg_type();
::mp::MP_SUB_TYPE msg_type() const;
void set_msg_type(::mp::MP_SUB_TYPE value);
private:
::mp::MP_SUB_TYPE _internal_msg_type() const;
void _internal_set_msg_type(::mp::MP_SUB_TYPE value);
public:
// .mp.MP_SUB_TYPE session_type = 2;
void clear_session_type();
::mp::MP_SUB_TYPE session_type() const;
void set_session_type(::mp::MP_SUB_TYPE value);
private:
::mp::MP_SUB_TYPE _internal_session_type() const;
void _internal_set_session_type(::mp::MP_SUB_TYPE value);
public:
// uint64 message_id = 3;
void clear_message_id();
::PROTOBUF_NAMESPACE_ID::uint64 message_id() const;
void set_message_id(::PROTOBUF_NAMESPACE_ID::uint64 value);
private:
::PROTOBUF_NAMESPACE_ID::uint64 _internal_message_id() const;
void _internal_set_message_id(::PROTOBUF_NAMESPACE_ID::uint64 value);
public:
// uint64 time = 4;
void clear_time();
::PROTOBUF_NAMESPACE_ID::uint64 time() const;
void set_time(::PROTOBUF_NAMESPACE_ID::uint64 value);
private:
::PROTOBUF_NAMESPACE_ID::uint64 _internal_time() const;
void _internal_set_time(::PROTOBUF_NAMESPACE_ID::uint64 value);
public:
// uint64 account = 5;
void clear_account();
::PROTOBUF_NAMESPACE_ID::uint64 account() const;
void set_account(::PROTOBUF_NAMESPACE_ID::uint64 value);
private:
::PROTOBUF_NAMESPACE_ID::uint64 _internal_account() const;
void _internal_set_account(::PROTOBUF_NAMESPACE_ID::uint64 value);
public:
// @@protoc_insertion_point(class_scope:mp.im.data)
private:
class _Internal;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr msg_data_;
int msg_type_;
int session_type_;
::PROTOBUF_NAMESPACE_ID::uint64 message_id_;
::PROTOBUF_NAMESPACE_ID::uint64 time_;
::PROTOBUF_NAMESPACE_ID::uint64 account_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_mp_2eim_2eproto;
};
// ===================================================================
// ===================================================================
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif // __GNUC__
// notice
// uint64 message_id = 1;
inline void notice::clear_message_id() {
message_id_ = PROTOBUF_ULONGLONG(0);
}
inline ::PROTOBUF_NAMESPACE_ID::uint64 notice::_internal_message_id() const {
return message_id_;
}
inline ::PROTOBUF_NAMESPACE_ID::uint64 notice::message_id() const {
// @@protoc_insertion_point(field_get:mp.im.notice.message_id)
return _internal_message_id();
}
inline void notice::_internal_set_message_id(::PROTOBUF_NAMESPACE_ID::uint64 value) {
message_id_ = value;
}
inline void notice::set_message_id(::PROTOBUF_NAMESPACE_ID::uint64 value) {
_internal_set_message_id(value);
// @@protoc_insertion_point(field_set:mp.im.notice.message_id)
}
// uint64 time = 2;
inline void notice::clear_time() {
time_ = PROTOBUF_ULONGLONG(0);
}
inline ::PROTOBUF_NAMESPACE_ID::uint64 notice::_internal_time() const {
return time_;
}
inline ::PROTOBUF_NAMESPACE_ID::uint64 notice::time() const {
// @@protoc_insertion_point(field_get:mp.im.notice.time)
return _internal_time();
}
inline void notice::_internal_set_time(::PROTOBUF_NAMESPACE_ID::uint64 value) {
time_ = value;
}
inline void notice::set_time(::PROTOBUF_NAMESPACE_ID::uint64 value) {
_internal_set_time(value);
// @@protoc_insertion_point(field_set:mp.im.notice.time)
}
// -------------------------------------------------------------------
// data
// .mp.MP_SUB_TYPE msg_type = 1;
inline void data::clear_msg_type() {
msg_type_ = 0;
}
inline ::mp::MP_SUB_TYPE 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)
return _internal_msg_type();
}
inline void data::_internal_set_msg_type(::mp::MP_SUB_TYPE value) {
msg_type_ = value;
}
inline void data::set_msg_type(::mp::MP_SUB_TYPE value) {
_internal_set_msg_type(value);
// @@protoc_insertion_point(field_set:mp.im.data.msg_type)
}
// .mp.MP_SUB_TYPE session_type = 2;
inline void data::clear_session_type() {
session_type_ = 0;
}
inline ::mp::MP_SUB_TYPE 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)
return _internal_session_type();
}
inline void data::_internal_set_session_type(::mp::MP_SUB_TYPE value) {
session_type_ = value;
}
inline void data::set_session_type(::mp::MP_SUB_TYPE value) {
_internal_set_session_type(value);
// @@protoc_insertion_point(field_set:mp.im.data.session_type)
}
// uint64 message_id = 3;
inline void data::clear_message_id() {
message_id_ = PROTOBUF_ULONGLONG(0);
}
inline ::PROTOBUF_NAMESPACE_ID::uint64 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)
return _internal_message_id();
}
inline void data::_internal_set_message_id(::PROTOBUF_NAMESPACE_ID::uint64 value) {
message_id_ = value;
}
inline void data::set_message_id(::PROTOBUF_NAMESPACE_ID::uint64 value) {
_internal_set_message_id(value);
// @@protoc_insertion_point(field_set:mp.im.data.message_id)
}
// uint64 time = 4;
inline void data::clear_time() {
time_ = PROTOBUF_ULONGLONG(0);
}
inline ::PROTOBUF_NAMESPACE_ID::uint64 data::_internal_time() const {
return time_;
}
inline ::PROTOBUF_NAMESPACE_ID::uint64 data::time() const {
// @@protoc_insertion_point(field_get:mp.im.data.time)
return _internal_time();
}
inline void data::_internal_set_time(::PROTOBUF_NAMESPACE_ID::uint64 value) {
time_ = value;
}
inline void data::set_time(::PROTOBUF_NAMESPACE_ID::uint64 value) {
_internal_set_time(value);
// @@protoc_insertion_point(field_set:mp.im.data.time)
}
// uint64 account = 5;
inline void data::clear_account() {
account_ = PROTOBUF_ULONGLONG(0);
}
inline ::PROTOBUF_NAMESPACE_ID::uint64 data::_internal_account() const {
return account_;
}
inline ::PROTOBUF_NAMESPACE_ID::uint64 data::account() const {
// @@protoc_insertion_point(field_get:mp.im.data.account)
return _internal_account();
}
inline void data::_internal_set_account(::PROTOBUF_NAMESPACE_ID::uint64 value) {
account_ = value;
}
inline void data::set_account(::PROTOBUF_NAMESPACE_ID::uint64 value) {
_internal_set_account(value);
// @@protoc_insertion_point(field_set:mp.im.data.account)
}
// string msg_data = 6;
inline void data::clear_msg_data() {
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 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 std::string* data::mutable_msg_data() {
// @@protoc_insertion_point(field_mutable:mp.im.data.msg_data)
return _internal_mutable_msg_data();
}
inline const std::string& data::_internal_msg_data() const {
return msg_data_.Get();
}
inline void data::_internal_set_msg_data(const std::string& value) {
msg_data_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena());
}
inline void data::set_msg_data(std::string&& value) {
msg_data_.Set(
&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena());
// @@protoc_insertion_point(field_set_rvalue:mp.im.data.msg_data)
}
inline void data::set_msg_data(const char* value) {
GOOGLE_DCHECK(value != nullptr);
msg_data_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
GetArena());
// @@protoc_insertion_point(field_set_char:mp.im.data.msg_data)
}
inline void data::set_msg_data(const char* value,
size_t size) {
msg_data_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(
reinterpret_cast<const char*>(value), size), GetArena());
// @@protoc_insertion_point(field_set_pointer:mp.im.data.msg_data)
}
inline std::string* data::_internal_mutable_msg_data() {
return 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 void data::set_allocated_msg_data(std::string* msg_data) {
if (msg_data != nullptr) {
} else {
}
msg_data_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), msg_data,
GetArena());
// @@protoc_insertion_point(field_set_allocated:mp.im.data.msg_data)
}
inline std::string* data::unsafe_arena_release_msg_data() {
// @@protoc_insertion_point(field_unsafe_arena_release:mp.im.data.msg_data)
GOOGLE_DCHECK(GetArena() != nullptr);
return msg_data_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
GetArena());
}
inline void data::unsafe_arena_set_allocated_msg_data(
std::string* msg_data) {
GOOGLE_DCHECK(GetArena() != nullptr);
if (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)
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif // __GNUC__
// -------------------------------------------------------------------
// @@protoc_insertion_point(namespace_scope)
} // namespace im
} // namespace mp
// @@protoc_insertion_point(global_scope)
#include <google/protobuf/port_undef.inc>
#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_mp_2eim_2eproto

View File

@ -5,9 +5,12 @@
#include "IMController.h"
void IMController::run(std::shared_ptr<agreement_request> request, std::shared_ptr<agreement_response> response) {
// msg push 储存库内
if (request->m_mph->mp_type() == mp::MP_IM_PUSH_MSG) {
} else if (request->m_mph->mp_type() == mp::MP_IM_MSG) {
}
// 传来 im msg
else if (request->m_mph->mp_type() == mp::MP_IM_MSG) {
}
}

View File

@ -5,7 +5,6 @@
#ifndef IM2_DB_H
#define IM2_DB_H
#include <mysql++.h>
class DB {

View File

@ -3,16 +3,27 @@
//
#include "UserDB.h"
#include "template_table/im_user.h"
#include "template_table/template_struct.h"
/// 0505 19:34 im_user 重定义
// select user info
std::tuple<bool, PoUser> UserDB::select_user(uint64_t account, const std::string& by_field) {
std::tuple<bool, PoUser> UserDB::select_user(const std::string& account, const std::string& by_field) {
// 取池链接
conn = LinkDB::safe_grab();
auto query = conn->query("select * from im_user where %2:field=%1:account;");
query.template_defaults[1] = account;
std::string sql;
if (by_field == "account" || by_field == "phone") {
sql = "select * from im_user where %2:field=%1:account;";
} else {
sql = "select * from im_user where %2:field=%1q:account;";
}
auto query = conn->query(sql);
query.template_defaults[1] = strtol(account.c_str(), nullptr, 0);
query.template_defaults[1] = account.c_str();
query.template_defaults[2] = by_field.c_str();
query.parse();
@ -29,7 +40,7 @@ std::tuple<bool, PoUser> UserDB::select_user(uint64_t account, const std::string
// select key account is existed by account
bool UserDB::select_user_exist(uint64_t account) {
auto [exist, PoUser] = select_user(account, "account");
auto [exist, PoUser] = select_user(std::to_string(account), "account");
return exist;
}

View File

@ -15,7 +15,7 @@ class UserDB : public DB {
/// login ...
public:
// 查询用户
std::tuple<bool, PoUser> select_user(uint64_t account, const std::string& by_field);
std::tuple<bool, PoUser> select_user(const std::string& account, const std::string& by_field);
// 查询用户是否存在
bool select_user_exist(uint64_t account);
// 添加用户

View File

@ -2,9 +2,8 @@
// Created by dongl on 23-5-4.
//
#include "UserFriendsDB.h"
#include "linkDB.h"
#include "UserFriendsDB.h"
// 查询好友添加权限类型
char UserFriendsDB::select_add_type(uint64_t account) {
@ -20,6 +19,34 @@ char UserFriendsDB::select_add_type(uint64_t account) {
return ret;
}
// 搜索好友 搜索用户
std::optional<PoUser> UserFriendsDB::select_friends(uint64_t account) {
conn = LinkDB::safe_grab();
auto query = conn->query("select * from im_user where account=%1:account");
query.template_defaults[1] = account;
query.parse();
PoUser user;
auto ret = query.store();
for (const auto &row : ret) {
user.account = strtol(row[0].c_str(), nullptr, 0);
user.phone = strtol(row[1].c_str(), nullptr, 0);
user.email = row[2].c_str();
user.username = row[3].c_str();
user.password = row[4].c_str();
user.password_salt = row[5].c_str();
user.client_info = row[6].c_str();
}
// 放回链接
LinkDB::release(conn);
if (ret.num_rows() < 1) {
return std::nullopt;
}
return user;
}
// 修改好友列表数据 添加好友
/// friends {
/// uid info { }
@ -140,3 +167,5 @@ UserFriendsDB::select_friends_info(uint64_t account, uint64_t friends) {

View File

@ -8,14 +8,15 @@
#include <optional>
#include "DB.h"
#include "../../../MP/proto/mp.sri.pb.h"
#include "../../../MP/proto/mp.body.pb.h"
#include "po/po.h"
#include "document.h"
class UserFriendsDB : public DB {
public:
// 查询添加类型
char select_add_type(uint64_t account);
// 查询用户 搜索好友
std::optional<PoUser> select_friends(uint64_t account);
// 添加好友
std::tuple<bool, std::string> add_friends(uint64_t source, uint64_t target);
// 查询全部好友 好友列表

View File

@ -14,7 +14,7 @@ mp::sri *UserFriendsService::friendImProve(mp::body* body) {
// 搜索
if (subcommand == mp::MP_SUB_TYPE::MP_SEARCH_FRIENDS_ACCOUNT) {
FetchUserFriends(strtol(body->account().c_str(), nullptr, 0), "");
FetchUser(strtol(body->account().c_str(), nullptr, 0));
}
// 添加
else if (subcommand == mp::MP_SUB_TYPE::MP_ADD_FRIENDS_ACCOUNT) {
@ -91,15 +91,14 @@ void UserFriendsService::FetchUserFriends(uint64_t account, const std::string &d
}
}
// 搜索指定账户信息
/// MP_REQUEST_FRIENDS MP_SEARCH_FRIENDS_ACCOUNT
// 搜索指定账户信息 搜索可添加好友
void UserFriendsService::FetchUser(uint64_t account) {
// 后续撤掉userDB 在 userfriendsDB内 添加account模糊搜索
auto [state, user] = userDB.select_user(account, "account");
if (state) {
sri->set_username(user.username);
sri->set_account(user.account);
sri->set_phone(user.phone);
sri->set_email(user.email);
auto userinfo = userFriendsDb.select_friends(account);
if (userinfo.has_value()) {
sri->set_username(userinfo.value().username);
sri->set_account(userinfo.value().account);
sri->set_email(userinfo.value().email);
sri->set_msg("搜索成功");
sri->set_subcommand(mp::MP_SUB_TYPE::MP_SEARCH_SUCCESS);
} else {

View File

@ -25,7 +25,6 @@ private:
private:
UserFriendsDB userFriendsDb = UserFriendsDB();
UserDB userDB = UserDB();
};

View File

@ -3,7 +3,6 @@
//
#include "UserService.h"
#include "handler.h"
#include <experimental/random>
///************************************************* 登陆 ***********************************************************///
@ -29,7 +28,7 @@ mp::sri* UserService::login(mp::MP_SUB_TYPE subType, const std::string& account
void UserService::login_fun(const std::string& account, const std::string& password, const std::string& filed) {
// 判断密码
auto [exist, user] = userDb.select_user(strtol(account.c_str(), nullptr, 0), filed);
auto [exist, user] = userDb.select_user(account, filed);
// 无账户
if (!exist) {
@ -38,7 +37,7 @@ void UserService::login_fun(const std::string& account, const std::string& passw
return;
}
std::string source = account + password + user.password_salt;
std::string source = std::to_string(user.account) + password + user.password_salt;
size_t password_hash = std::hash<std::string>()(source);
if (user.password == std::to_string(password_hash)) {

View File

@ -112,6 +112,13 @@ TEST(fecth_frinds, fecth_frinds_Test) {
}
}
TEST(select_friends_fdb, fecth_frinds_Test) {
auto i = UserFriendsDB();
auto user = i.select_friends(2725096176);
printf("user.value().client_info; %s\n", user.value().client_info.c_str());
printf("user.value().client_info; %lu\n", user.value().account);
}
TEST(MSG_PULL, MSG_PULL__Test) {
MSG::Storage* storage = new MSG::Storage();