Xonotic
matrix.qc
Go to the documentation of this file.
1
#include "
matrix.qh
"
2
3
var
void
MX_Handle
(
int
buf,
string
ancestor)
4
{
5
string
type =
json_get
(buf,
strcat
(ancestor,
".type"
));
6
switch
(type) {
7
case
"m.typing"
: {
8
string
arr =
strcat
(ancestor,
".content.user_ids"
);
9
for
(
int
i = 0, n =
stof
(
json_get
(buf, sprintf(
"%s.length"
, arr))); i < n; ++i) {
10
string
s =
json_get
(buf, sprintf(
"%s.%d"
, arr, i));
11
print
(
"\{1}"
, s,
" is typing...\n"
);
12
}
13
break
;
14
}
15
case
"m.room.message"
: {
16
string
msgtype =
json_get
(buf,
strcat
(ancestor,
".content.msgtype"
));
17
switch
(msgtype) {
18
case
"m.text"
: {
19
string
sender =
json_get
(buf,
strcat
(ancestor,
".sender"
));
20
string
body =
json_get
(buf,
strcat
(ancestor,
".content.body"
));
21
if
(body)
print
(
"\{1}"
, sender,
": "
, body,
"\n"
);
22
break
;
23
}
24
}
25
break
;
26
}
27
}
28
}
stof
float stof(string val,...)
print
void print(string text,...)
MX_Handle
var void MX_Handle(int buf, string ancestor)
Definition:
matrix.qc:3
json_get
ERASEABLE string json_get(int buf, string key)
Definition:
json.qc:276
strcat
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
matrix.qh
menu
matrix.qc
Generated on Thu Mar 17 2022 17:26:29 for Xonotic by
1.8.13