175 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
32 lines
1.5 KiB
C++
32 lines
1.5 KiB
C++
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
#pragma once
|
|
#include "gateway/social.hpp"
|
|
#include "gateway/legacy_client.hpp"
|
|
#include "gateway/roster_translation.hpp"
|
|
#include <map>
|
|
#include <set>
|
|
|
|
// Contact-only authority. These bindings MUST NOT be merged into world actor,
|
|
// combat, questgiver or interaction bindings. Reset on authenticated World end.
|
|
class NativeSocialTranslation {
|
|
std::map<uint64_t,gateway::SourceContact> friends_;
|
|
std::set<uint64_t> ignores_;
|
|
bool friends_seen_=false,ignores_seen_=false;
|
|
gateway::NativeSocialContact contact(uint64_t,const gateway::RosterRealm&) const;
|
|
gateway::SocialProjection list(uint32_t,const gateway::RosterRealm&) const;
|
|
public:
|
|
struct Prepared {
|
|
std::vector<gateway::LegacyPacket> source;
|
|
std::vector<gateway::SocialProjection> native;
|
|
bool held=false;
|
|
};
|
|
static bool handles_client(uint32_t opcode){return gateway::handles_social_request(opcode);}
|
|
Prepared client(uint32_t,std::span<const uint8_t>,const gateway::RosterRealm&) const;
|
|
std::optional<std::vector<gateway::SocialProjection>> receive(uint16_t,std::span<const uint8_t>,const gateway::RosterRealm&);
|
|
std::set<uint64_t> contact_name_ids() const;
|
|
std::optional<gateway::SourceContact> source_friend(uint64_t id) const {
|
|
auto it=friends_.find(id);return it==friends_.end()?std::nullopt:std::optional(it->second);
|
|
}
|
|
void reset() noexcept {friends_.clear();ignores_.clear();friends_seen_=ignores_seen_=false;}
|
|
};
|