1
0
mirror of https://github.com/anope/anope.git synced 2026-07-03 17:23:14 +02:00

Import logon and oper news from Atheme.

This commit is contained in:
Sadie Powell
2025-03-06 23:05:10 +00:00
parent 161841925d
commit 0005ebbbc3
+55
View File
@@ -20,6 +20,7 @@
#include "modules/info.h"
#include "modules/ns_cert.h"
#include "modules/os_forbid.h"
#include "modules/os_news.h"
#include "modules/os_oper.h"
#include "modules/os_session.h"
#include "modules/suspend.h"
@@ -199,6 +200,8 @@ private:
{ "JM", &DBAtheme::HandleIgnore },
{ "KID", &DBAtheme::HandleIgnore },
{ "KL", &DBAtheme::HandleKL },
{ "LI", &DBAtheme::HandleLI },
{ "LIO", &DBAtheme::HandleLIO },
{ "LUID", &DBAtheme::HandleIgnore },
{ "MC", &DBAtheme::HandleMC },
{ "MCFP", &DBAtheme::HandleMCFP },
@@ -787,6 +790,58 @@ private:
return true;
}
bool HandleLI(AthemeRow &row)
{
// LI <setter> <subject> <ts> <body>
auto setter = row.Get();
auto subject = row.Get();
auto ts = row.GetNum<time_t>();
auto body = row.GetRemaining();
if (!row)
return row.LogError(this);
if (!news_service)
{
Log(this) << "Unable to convert logon news as os_news is not loaded";
return true;
}
auto *ni = news_service->CreateNewsItem();
ni->type = NEWS_LOGON;
ni->text = Anope::printf("[%s] %s", subject.c_str(), body.c_str());
ni->who = setter;
ni->time = ts;
news_service->AddNewsItem(ni);
return true;
}
bool HandleLIO(AthemeRow &row)
{
// LIO <setter> <subject> <ts> <body>
auto setter = row.Get();
auto subject = row.Get();
auto ts = row.GetNum<time_t>();
auto body = row.GetRemaining();
if (!row)
return row.LogError(this);
if (!news_service)
{
Log(this) << "Unable to convert oper news as os_news is not loaded";
return true;
}
auto *ni = news_service->CreateNewsItem();
ni->type = NEWS_OPER;
ni->text = Anope::printf("[%s] %s", subject.c_str(), body.c_str());
ni->who = setter;
ni->time = ts;
news_service->AddNewsItem(ni);
return true;
}
bool HandleIgnore(AthemeRow &row)
{
Log(LOG_DEBUG_3) << "Intentionally ignoring Atheme database row: " << row.GetRow();