]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/lib/matrix/command.qc
Merge branch 'master' into martin-t/defaults
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / matrix / command.qc
1 #include "command.qh"
2
3 #include <common/command/_mod.qh>
4
5 GENERIC_COMMAND(mx, "Send a matrix command") {
6     switch (argv(1)) {
7         case "user":
8             strcpy(matrix_user, substring(command, argv_start_index(2), -1));
9             break;
10         case "token":
11             strcpy(matrix_access_token, substring(command, argv_start_index(2), -1));
12             break;
13         case "messages":
14             MX_Messages(string_null);
15             break;
16         case "nick":
17             MX_Nick(substring(command, argv_start_index(2), -1));
18             break;
19         case "join":
20             string s = substring(command, argv_start_index(2), -1);
21             if (s != matrix_room && matrix_room != "") {
22                 MX_Leave(matrix_room);
23                 strunzone(matrix_room);
24             }
25             matrix_room = strzone(s);
26             MX_Join(matrix_room);
27             break;
28         case "sync":
29             MX_Sync(string_null);
30             break;
31         case "typing":
32             MX_Typing(true);
33             break;
34         case "say":
35             MX_Say(substring(command, argv_start_index(2), -1));
36             break;
37         case "leave":
38             MX_Leave(matrix_room);
39             matrix_room = string_null;
40             break;
41         case "forget":
42             MX_Forget(matrix_room);
43             matrix_room = "";
44             break;
45     }
46 }