summaryrefslogtreecommitdiff
path: root/qml/Functions.qml
diff options
context:
space:
mode:
Diffstat (limited to 'qml/Functions.qml')
-rw-r--r--qml/Functions.qml17
1 files changed, 17 insertions, 0 deletions
diff --git a/qml/Functions.qml b/qml/Functions.qml
index 67c5f30..d6a9ca1 100644
--- a/qml/Functions.qml
+++ b/qml/Functions.qml
@@ -179,6 +179,7 @@ Item {
stop_game();
return;
} else if (data["type"] === "chatLine") {
+ chat.text = data["username"] + ": " + data["text"];
return;
}
@@ -239,6 +240,22 @@ Item {
})
}
+ function resign() {
+ post("board/game/" + game_id + "/resign", "", function (response) {
+ if (response["ok"]) {
+ information.text = qsTr("Game over: ") + qsTr("Resigned");
+ stop_game();
+ }
+ })
+ }
+
+ function offer_draw() {
+ post("board/game/" + game_id + "/draw/yes", "", function (response) {
+ if (response["ok"])
+ information.text = qsTr("Offered draw");
+ })
+ }
+
function challenge(username) {
post("challenge/" + username, "rated=false&clock.limit=10800&clock.increment=60&days=14&color=white", function (response) {
if (!response["error"]) {