summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server_communication.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/server_communication.c b/server_communication.c
index 45f4243..007b599 100644
--- a/server_communication.c
+++ b/server_communication.c
@@ -70,3 +70,29 @@ gboolean server_ping(struct server *server) {
return result;
}
+GSList *server_find(struct server *server, const gchar *type, const gchar *str) {
+ GSocket *socket = server_connect(server);
+
+ if(socket == NULL) {
+ return NULL;
+ }
+
+ gchar buffer[0x400];
+ g_snprintf(buffer, 0x400, "find %s %s\nexit\n", type, str);
+ g_socket_send(socket, buffer, strlen(buffer), NULL, NULL);
+
+ GSList *list = NULL;
+ gssize size;
+ while((size = g_socket_receive(socket, buffer, 0x400, NULL, NULL)) > 0) {
+ if(buffer[size - 1] == '\n') {
+ buffer[size - 1] = '\0';
+ }
+ g_debug("got %s", buffer);
+ }
+
+ g_debug("closed: %d", size);
+
+ g_socket_close(socket, NULL);
+
+ return NULL;
+}