Send prim-dns:shutting-down when rebooting

This commit is contained in:
Anna Puddles
2023-01-31 09:54:19 -05:00
committed by GitHub
parent 3ba5c32396
commit c677de9718

View File

@@ -1,5 +1,5 @@
/* The version of prim-dns. */ /* The version of prim-dns. */
string version = "2.1.0"; string version = "2.2.0";
/* The name of the configuration notecard. */ /* The name of the configuration notecard. */
string config_notecard = "prim-dns config"; string config_notecard = "prim-dns config";
@@ -402,7 +402,7 @@ state startup
if (message == "reboot") if (message == "reboot")
{ {
state read_configuration; state reboot;
} }
else if (message == "shutdown") else if (message == "shutdown")
{ {
@@ -547,7 +547,7 @@ state request_url
if (message == "reboot") if (message == "reboot")
{ {
state read_configuration; state reboot;
} }
else if (message == "shutdown") else if (message == "shutdown")
{ {
@@ -653,7 +653,7 @@ state main
} }
else if (method == "prim-dns:reboot") else if (method == "prim-dns:reboot")
{ {
state read_configuration; state reboot;
} }
else if (method == "prim-dns:shutdown") else if (method == "prim-dns:shutdown")
{ {
@@ -673,7 +673,7 @@ state main
llListenRemove(dialog_listener); llListenRemove(dialog_listener);
dialog_listener = llListen(dialog_channel, "", toucher, ""); dialog_listener = llListen(dialog_channel, "", toucher, "");
llDialog(toucher, "prim-dns v" + version, ["cancel", " ", " ", "info", "reboot", "shutdown"], dialog_channel); llDialog(toucher, "prim-dns v" + version, [" ", "cancel", " ", "info", "reboot", "shutdown"], dialog_channel);
} }
/* Handle the response from the options menu. */ /* Handle the response from the options menu. */
@@ -683,7 +683,7 @@ state main
if (message == "reboot") if (message == "reboot")
{ {
state read_configuration; state reboot;
} }
else if (message == "shutdown") else if (message == "shutdown")
{ {
@@ -710,6 +710,21 @@ state main
} }
} }
} }
state reboot
{
state_entry()
{
set_text("Rebooting...");
jsonrpc_link_notification(LINK_SET, "prim-dns:shutting-down", JSON_OBJECT, []);
state read_configuration;
}
state_exit()
{
clear_text();
}
}
state shutdown state shutdown
{ {