Xonotic
matrix.qc File Reference
#include "matrix.qh"
#include <server/chat.qh>
+ Include dependency graph for matrix.qc:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

var void MX_Handle (int buf, string ancestor)
 

Function Documentation

◆ MX_Handle()

var void MX_Handle ( int  buf,
string  ancestor 
)

Definition at line 5 of file matrix.qc.

References json_get(), matrix_user, NULL, Say(), and strcat().

6 {
7  string type = json_get(buf, strcat(ancestor, ".type"));
8  switch (type) {
9  case "m.room.message": {
10  string msgtype = json_get(buf, strcat(ancestor, ".content.msgtype"));
11  switch (msgtype) {
12  case "m.text": {
13  string sender = json_get(buf, strcat(ancestor, ".sender"));
14  string body = json_get(buf, strcat(ancestor, ".content.body"));
15  if (sender != matrix_user && body) Say(NULL, false, NULL, body, false);
16  break;
17  }
18  }
19  break;
20  }
21  }
22 }
int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodcontrol)
message "": do not say, just test flood control return value: 1 = accept 0 = reject -1 = fake accept ...
Definition: chat.qc:25
ERASEABLE string json_get(int buf, string key)
Definition: json.qc:276
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"))
#define NULL
Definition: post.qh:17
string matrix_user
Definition: matrix.qh:4
+ Here is the call graph for this function: