summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Sluift/client.cpp')
-rw-r--r--Sluift/client.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/Sluift/client.cpp b/Sluift/client.cpp
index 0dc7014..75f675d 100644
--- a/Sluift/client.cpp
+++ b/Sluift/client.cpp
@@ -360,2 +360,5 @@ SLUIFT_LUA_FUNCTION_WITH_HELP(
message->setType(type);
+ if (!getClient(L)->getClient()->isAvailable()) {
+ throw Lua::Exception("Trying to send message while client is offline.");
+ }
getClient(L)->getClient()->sendMessage(message);
@@ -405,3 +408,5 @@ SLUIFT_LUA_FUNCTION_WITH_HELP(
}
-
+ if (!getClient(L)->getClient()->getPresenceSender()->isAvailable()) {
+ throw Lua::Exception("Trying to send presence while client is offline.");
+ }
getClient(L)->getClient()->getPresenceSender()->sendPresence(presence);
@@ -491,3 +496,5 @@ SLUIFT_LUA_FUNCTION_WITH_HELP(
Sluift::globals.eventLoop.runOnce();
-
+ if (!getClient(L)->getClient()->isAvailable()) {
+ throw Lua::Exception("Trying to send data while client is offline.");
+ }
getClient(L)->getClient()->sendData(std::string(Lua::checkString(L, 2)));