fix null deref and auto rejoin channels
This commit is contained in:
@ -63,9 +63,7 @@ SOLANA_PLUGIN_EXPORT void solana_plugin_stop(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SOLANA_PLUGIN_EXPORT float solana_plugin_tick(float delta) {
|
SOLANA_PLUGIN_EXPORT float solana_plugin_tick(float delta) {
|
||||||
g_ircc->iterate(delta); // TODO: return interval, respect dcc etc
|
return g_ircc->iterate(delta);
|
||||||
|
|
||||||
return 1.f; // expect atleast once per sec
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // extern C
|
} // extern C
|
||||||
|
@ -167,6 +167,10 @@ const std::string_view IRCClient1::getServerName(void) const {
|
|||||||
return _server_name;
|
return _server_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IRCClient1::join(std::string_view channel) {
|
||||||
|
assert(false && "implement me");
|
||||||
|
}
|
||||||
|
|
||||||
void IRCClient1::connectSession(void) {
|
void IRCClient1::connectSession(void) {
|
||||||
_try_connecting_state = true;
|
_try_connecting_state = true;
|
||||||
_try_connecting_cooldown = 20.f;
|
_try_connecting_cooldown = 20.f;
|
||||||
|
@ -207,12 +207,14 @@ class IRCClient1 : public IRCClientEventProviderI {
|
|||||||
|
|
||||||
template<IRCClient_Event event_type_enum, typename EventType>
|
template<IRCClient_Event event_type_enum, typename EventType>
|
||||||
static void on_event_generic_new(irc_session_t* session, const char* event, const char* origin, const char** params, unsigned int count) {
|
static void on_event_generic_new(irc_session_t* session, const char* event, const char* origin, const char** params, unsigned int count) {
|
||||||
|
assert(session != nullptr);
|
||||||
|
|
||||||
std::vector<std::string_view> params_view;
|
std::vector<std::string_view> params_view;
|
||||||
for (size_t i = 0; i < count; i++) {
|
for (size_t i = 0; i < count; i++) {
|
||||||
params_view.push_back(params[i]);
|
params_view.push_back(params[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "IRC: event " << event << " " << origin << "\n";
|
std::cout << "IRC: event '" << (event?event:"<nullptr>") << "' o:" << (origin?origin:"<nullptr>") << "\n";
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (std::string_view{event} == "ACTION") {
|
if (std::string_view{event} == "ACTION") {
|
||||||
@ -228,7 +230,8 @@ class IRCClient1 : public IRCClientEventProviderI {
|
|||||||
auto* ircc = static_cast<IRCClient1*>(irc_get_ctx(session));
|
auto* ircc = static_cast<IRCClient1*>(irc_get_ctx(session));
|
||||||
assert(ircc != nullptr);
|
assert(ircc != nullptr);
|
||||||
|
|
||||||
ircc->dispatch(event_type_enum, EventType{origin, params_view});
|
// hack if origin is null
|
||||||
|
ircc->dispatch(event_type_enum, EventType{origin?origin:"<nullptr>", params_view});
|
||||||
ircc->_event_fired = true;
|
ircc->_event_fired = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user