]> git.cworth.org Git - loudgame/blobdiff - loudgame.h
Separate common code into loudgame.c and demonstrate with separate lg-test and lg...
[loudgame] / loudgame.h
diff --git a/loudgame.h b/loudgame.h
new file mode 100644 (file)
index 0000000..726394b
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2008 Carl Worth
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see http://www.gnu.org/licenses/ .
+ *
+ * Author: Carl Worth <cworth@cworth.org>
+ */
+
+#ifndef __LOUDGAME_H__
+#define __LOUDGAME_H__
+
+#include <loudmouth/loudmouth.h>
+
+typedef struct _loudgame loudgame_t;
+
+typedef void (*handle_message_cb) (loudgame_t  *lg,
+                                  const char   *peer,
+                                  const char   *message);
+
+struct _loudgame {
+    gchar              *server;
+    gchar              *name;
+    gchar              *passwd;
+    LmConnection       *connection;
+    GMainLoop          *main_loop;
+    int                         return_value;
+
+    /* Callbacks */
+    handle_message_cb   handle_message;
+};
+
+int
+loudgame_init (loudgame_t *lg, int argc, char **argv);
+
+int
+loudgame_run (loudgame_t *lg);
+
+void
+loudgame_quit (loudgame_t *lg, int return_value);
+
+#endif /* __LOUDGAME_H__ */