remove old code ifdef

This commit is contained in:
Green Sky 2024-01-12 15:18:10 +01:00
parent 80140ae9b6
commit 9d3d81d4ff
No known key found for this signature in database

View File

@ -9,69 +9,6 @@ void ToxEventProviderBase::dispatchEvents(const Tox_Events* events) {
// forward events to event handlers // forward events to event handlers
#if 0
// TODO: make order independent (construct string and lookup event id)
#define HANDLE_EVENT(x) \
for (size_t i = 0; i < tox_events_get_##x##_size(events); i++) { \
for (auto* tei : _subscribers.at(event_type_index)) { \
if (tei->onToxEvent(tox_events_get_##x(events, i))) { \
break; \
} \
} \
} \
event_type_index++;
size_t event_type_index = 0;
// IMPORTANT: the order defines the type
HANDLE_EVENT(self_connection_status);
HANDLE_EVENT(friend_request);
HANDLE_EVENT(friend_connection_status);
HANDLE_EVENT(friend_lossy_packet);
HANDLE_EVENT(friend_lossless_packet);
HANDLE_EVENT(friend_name);
HANDLE_EVENT(friend_status);
HANDLE_EVENT(friend_status_message);
HANDLE_EVENT(friend_message);
HANDLE_EVENT(friend_read_receipt);
HANDLE_EVENT(friend_typing);
HANDLE_EVENT(file_chunk_request);
HANDLE_EVENT(file_recv);
HANDLE_EVENT(file_recv_chunk);
HANDLE_EVENT(file_recv_control);
HANDLE_EVENT(conference_invite);
HANDLE_EVENT(conference_connected);
HANDLE_EVENT(conference_peer_list_changed);
HANDLE_EVENT(conference_peer_name);
HANDLE_EVENT(conference_title);
HANDLE_EVENT(conference_message);
HANDLE_EVENT(group_peer_name);
HANDLE_EVENT(group_peer_status);
HANDLE_EVENT(group_topic);
HANDLE_EVENT(group_privacy_state);
HANDLE_EVENT(group_voice_state);
HANDLE_EVENT(group_topic_lock);
HANDLE_EVENT(group_peer_limit);
HANDLE_EVENT(group_password);
HANDLE_EVENT(group_message);
HANDLE_EVENT(group_private_message);
HANDLE_EVENT(group_custom_packet);
HANDLE_EVENT(group_custom_private_packet);
HANDLE_EVENT(group_invite);
HANDLE_EVENT(group_peer_join);
HANDLE_EVENT(group_peer_exit);
HANDLE_EVENT(group_self_join);
HANDLE_EVENT(group_join_fail);
HANDLE_EVENT(group_moderation);
#undef HANDLE_EVENT
#else
const uint32_t event_count = tox_events_get_size(events); const uint32_t event_count = tox_events_get_size(events);
for (uint32_t j = 0; j < event_count; ++j) { for (uint32_t j = 0; j < event_count; ++j) {
const Tox_Event *event = tox_events_get(events, j); const Tox_Event *event = tox_events_get(events, j);
@ -133,7 +70,6 @@ void ToxEventProviderBase::dispatchEvents(const Tox_Events* events) {
break; break;
} }
} }
#endif
} }
void ToxEventProviderBase::subscribe(ToxEventI* object, const Tox_Event_Type event_type) { void ToxEventProviderBase::subscribe(ToxEventI* object, const Tox_Event_Type event_type) {