|
| 1 | +// Copyright (C) 2023-2024 Lightpanda (Selecy SAS) |
| 2 | +// |
| 3 | +// Francis Bouvier <francis@lightpanda.io> |
| 4 | +// Pierre Tachoire <pierre@lightpanda.io> |
| 5 | +// |
| 6 | +// This program is free software: you can redistribute it and/or modify |
| 7 | +// it under the terms of the GNU Affero General Public License as |
| 8 | +// published by the Free Software Foundation, either version 3 of the |
| 9 | +// License, or (at your option) any later version. |
| 10 | +// |
| 11 | +// This program is distributed in the hope that it will be useful, |
| 12 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | +// GNU Affero General Public License for more details. |
| 15 | +// |
| 16 | +// You should have received a copy of the GNU Affero General Public License |
| 17 | +// along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 18 | + |
| 19 | +const std = @import("std"); |
| 20 | + |
| 21 | +pub fn processMessage(cmd: anytype) !void { |
| 22 | + const action = std.meta.stringToEnum(enum { |
| 23 | + enable, |
| 24 | + disable, |
| 25 | + }, cmd.input.action) orelse return error.UnknownMethod; |
| 26 | + |
| 27 | + switch (action) { |
| 28 | + .enable => return enable(cmd), |
| 29 | + .disable => return disable(cmd), |
| 30 | + } |
| 31 | +} |
| 32 | +fn enable(cmd: anytype) !void { |
| 33 | + return cmd.sendResult(null, .{}); |
| 34 | +} |
| 35 | + |
| 36 | +fn disable(cmd: anytype) !void { |
| 37 | + return cmd.sendResult(null, .{}); |
| 38 | +} |
0 commit comments