diff options
| author | Patrick | 2023-07-20 23:15:26 +0200 |
|---|---|---|
| committer | Patrick | 2023-07-20 23:15:26 +0200 |
| commit | 07e667e29883740aa0b82199cf0518a2e2684e26 (patch) | |
| tree | 0dc0ba2a6fceeeaab1147cbf3b20fec0727f281c /examples | |
| parent | 464bfb1912d0806143386f61c33dd45fbafc38e8 (diff) | |
| download | matrix_esp_thesis-07e667e29883740aa0b82199cf0518a2e2684e26.tar.gz matrix_esp_thesis-07e667e29883740aa0b82199cf0518a2e2684e26.zip | |
cli send encrypted & manage megolm session, save/load megolm sessions
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/Cli.c | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/examples/Cli.c b/examples/Cli.c index b2fbe45..4a8e571 100644 --- a/examples/Cli.c +++ b/examples/Cli.c @@ -133,8 +133,6 @@ ExecuteCommand( "{\"body\":\"%s\",\"msgtype\":\"m.text\"}",
args[1]);
- printf("Sending %s to %s\n", body, args[0]);
-
MatrixClientSendEvent(client,
args[0],
"m.room.message",
@@ -148,6 +146,43 @@ ExecuteCommand( else if (CheckCommand(cmd, "getuserid")) {
printf("User ID: %s\n", client->userId);
}
+ else if (CheckCommand(cmd, "sendencrypted")) {
+ CHECK_ARGS(2, "<room_id> <message>")
+
+ static char body[1024];
+ snprintf(body, 1024,
+ "{\"body\":\"%s\",\"msgtype\":\"m.text\"}",
+ args[1]);
+
+ MatrixClientSendEventEncrypted(client,
+ args[0],
+ "m.room.message",
+ body);
+ }
+ else if (CheckCommand(cmd, "sharesession")) {
+ CHECK_ARGS(2, "<user_id> <device_id>")
+
+ MatrixClientShareMegolmOutSession(&client,
+ args[0],
+ args[1],
+ &client->megolmOutSessions[0]);
+ }
+ else if (CheckCommand(cmd, "savesession")) {
+ CHECK_ARGS(2, "<filename> <key>")
+
+ MatrixMegolmOutSessionSave(
+ &client->megolmOutSessions[0],
+ args[0],
+ args[1]);
+ }
+ else if (CheckCommand(cmd, "loadsession")) {
+ CHECK_ARGS(2, "<filename> <key>")
+
+ MatrixMegolmOutSessionLoad(
+ &client->megolmOutSessions[0],
+ args[0],
+ args[1]);
+ }
#undef CHECK_ARGS
}
|
