]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/matrix.qc
602d751325337551e701a01238596d1be2e3356d
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / matrix.qc
1 #include "matrix.qh"
2
3 #include "cl_player.qh"
4
5 #include <lib/matrix/matrix.qh>
6
7 var void MX_Handle(int buf, string ancestor)
8 {
9     string type = json_get(buf, strcat(ancestor, ".type"));
10     switch (type) {
11         case "m.room.message": {
12             string msgtype = json_get(buf, strcat(ancestor, ".content.msgtype"));
13             switch (msgtype) {
14                 case "m.text": {
15                     string sender = json_get(buf, strcat(ancestor, ".sender"));
16                     string body = json_get(buf, strcat(ancestor, ".content.body"));
17                     if (sender != matrix_user && body) Say(NULL, false, NULL, body, false);
18                     break;
19                 }
20             }
21             break;
22         }
23     }
24 }