mirror of
https://github.com/MeshEnvy/lobbs.git
synced 2026-10-31 02:11:59 +01:00
feat(meshtastic): extract LoBBS plugin library
This commit is contained in:
1 parent
1f7ded8f3f
commit
5bffe8d259
124 files changed
+10907
-39
No files matched your search
@@ -0,0 +1,40 @@
|
||||
#if !MESHTASTIC_EXCLUDE_LOBBS
|
||||
|
||||
#include "StatusCommands.h"
|
||||
#include "../../LoBBSCommandRegistry.h"
|
||||
#include "../../LoBBSHooks.h"
|
||||
#include "../../LoBBSResponse.h"
|
||||
|
||||
#include "LoBBSStackGuard.h"
|
||||
|
||||
static void handleStatus(LoBBSCommandCtx &ctx)
|
||||
{
|
||||
LoBBSResponse resp;
|
||||
lobbsApplyFilter("status_lines", ctx, resp.records, LoScalar());
|
||||
if (resp.records.empty()) {
|
||||
lobbsResponseSetError(resp, "No status.");
|
||||
}
|
||||
lobbsCommandReplyResponse(ctx, resp);
|
||||
}
|
||||
|
||||
static void slashStatus(LoBBSCommandCtx *ctx, const LoScalar &args)
|
||||
{
|
||||
if (!ctx || !lobbsSlashVerbIs(args, "status"))
|
||||
return;
|
||||
handleStatus(*ctx);
|
||||
}
|
||||
|
||||
static void filterStatusHelpTopics(LoBBSCommandCtx *ctx, std::vector<LoScalar> &topics, const LoScalar &args)
|
||||
{
|
||||
(void)ctx;
|
||||
(void)args;
|
||||
lobbsRecordPush(topics, "status", "what's happening");
|
||||
}
|
||||
|
||||
void lobbsStatusRegisterCommands()
|
||||
{
|
||||
lobbsAddAction("slash_cmd", slashStatus, LOBBS_HOOK_PRIORITY_STATUS);
|
||||
lobbsAddFilter("help_topics", filterStatusHelpTopics, LOBBS_HOOK_PRIORITY_STATUS);
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user