Deferred capability notifications from modules

Reloading modules sends CAP DEL followed by an immediate CAP NEW:

    :staberinde.local CAP * DEL :account-tag
    :staberinde.local CAP * NEW :account-tag

This isn't very nice. /modrestart is particularly bad. In order to avoid
doing this, we remember the capability set at the beginning of module
operations, compare that with the set afterwards, and report only the
differences with CAP {DEL,NEW}.
This commit is contained in:
Ed Kellett 2019-07-08 03:53:29 +01:00
parent 9ac0390734
commit 28cc8bb924
No known key found for this signature in database
GPG key ID: CB9986DEF342FABC
3 changed files with 43 additions and 6 deletions

View file

@ -274,9 +274,13 @@ do_modload(struct Client *source_p, const char *module)
return;
}
mod_remember_clicaps();
origin = strcmp(module, m_bn) == 0 ? MAPI_ORIGIN_CORE : MAPI_ORIGIN_EXTENSION;
load_one_module(module, origin, false);
mod_notify_clicaps();
rb_free(m_bn);
}
@ -300,9 +304,13 @@ do_modunload(struct Client *source_p, const char *module)
return;
}
mod_remember_clicaps();
if(unload_one_module(m_bn, true) == false)
sendto_one_notice(source_p, ":Module %s is not loaded", m_bn);
mod_notify_clicaps();
rb_free(m_bn);
}
@ -322,6 +330,8 @@ do_modreload(struct Client *source_p, const char *module)
check_core = mod->core;
mod_remember_clicaps();
if(unload_one_module(m_bn, true) == false)
{
sendto_one_notice(source_p, ":Module %s is not loaded", m_bn);
@ -337,6 +347,8 @@ do_modreload(struct Client *source_p, const char *module)
exit(0);
}
mod_notify_clicaps();
rb_free(m_bn);
}