summaryrefslogtreecommitdiff
path: root/minecctl/rcon-commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'minecctl/rcon-commands.c')
-rw-r--r--minecctl/rcon-commands.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/minecctl/rcon-commands.c b/minecctl/rcon-commands.c
index f18f082..61a682c 100644
--- a/minecctl/rcon-commands.c
+++ b/minecctl/rcon-commands.c
@@ -12,8 +12,8 @@
#include "shared/utils.h"
#include "shared/rcon-protocol.h"
#include "minecctl.h"
-#include "rcon-commands.h"
#include "server.h"
+#include "rcon-commands.h"
#include "misc.h"
static void send_packet(int sfd, const char *buf, size_t len)
@@ -93,6 +93,7 @@ static void send_msg(int sfd, char *buf, size_t len, enum rcon_packet_type type,
rcon_packet_id++;
}
+/* FIXME: return error message */
static int rcon_login(struct cfg *cfg, struct server *server)
{
const char *error;
@@ -296,12 +297,6 @@ bool do_status(struct cfg *cfg)
return true;
}
-bool do_ping(_unused_ struct cfg *cfg)
-{
- die("Not implemented");
- return false;
-}
-
static bool get_player_count(int fd, unsigned *current, unsigned *max)
{
char buf[4096];
@@ -382,18 +377,21 @@ bool do_stop_all(struct cfg *cfg)
return rv;
}
-bool do_rcon_pcount(struct cfg *cfg, unsigned *online, unsigned *max)
+bool do_rcon_pcount(struct cfg *cfg, struct server *server, unsigned *online,
+ unsigned *max, const char **error)
{
- struct server *server;
bool rv;
int fd;
- server = server_get_default(cfg);
fd = rcon_login(cfg, server);
- if (fd < 0)
+ if (fd < 0) {
+ *error = "failed to login";
return false;
+ }
rv = get_player_count(fd, online, max);
+ if (!rv)
+ *error = "failed to get player count";
close(fd);