]> git.cworth.org Git - loudgame/blobdiff - loudgame.h
Update documentation of move command for new syntax
[loudgame] / loudgame.h
index 726394bf26b0ddb1f599b2710e74999c4388a9c0..359ecfdd7287f78c38bf32c497e12ce583e0674c 100644 (file)
 #ifndef __LOUDGAME_H__
 #define __LOUDGAME_H__
 
+#include <stdarg.h>
 #include <loudmouth/loudmouth.h>
 
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
+#define LOUDGAME_PRINTF_FORMAT(fmt_index, va_index) \
+       __attribute__((__format__(__printf__, fmt_index, va_index)))
+#else
+#define LOUDGAME_PRINTF_FORMAT(fmt_index, va_index)
+#endif
+
 typedef struct _loudgame loudgame_t;
 
 typedef void (*handle_message_cb) (loudgame_t  *lg,
@@ -33,19 +41,57 @@ struct _loudgame {
     gchar              *name;
     gchar              *passwd;
     LmConnection       *connection;
+
     GMainLoop          *main_loop;
+    GHashTable         *players;
+
     int                         return_value;
 
     /* Callbacks */
     handle_message_cb   handle_message;
 };
 
+#define LOUDGAME_HELP                                                          \
+"\tsay message         \t\tSay 'message' to everyone in the current game\n"    \
+"\twhisper user message\tSay 'message' to 'user' only\n"
+
 int
 loudgame_init (loudgame_t *lg, int argc, char **argv);
 
 int
 loudgame_run (loudgame_t *lg);
 
+void
+loudgame_send (loudgame_t      *lg,
+              const char       *peer,
+              const char       *message);
+
+void
+loudgame_sendf (loudgame_t     *lg,
+               const char      *peer,
+               const char      *format,
+               ...) LOUDGAME_PRINTF_FORMAT (3, 4);
+
+void
+loudgame_vsendf (loudgame_t    *lg,
+                const char     *peer,
+                const char     *format,
+                va_list         va) LOUDGAME_PRINTF_FORMAT (3, 0);
+
+void
+loudgame_broadcast (loudgame_t *lg,
+                   const char *message);
+
+void
+loudgame_vbroadcastf (loudgame_t *lg,
+                     const char *format,
+                     va_list     va) LOUDGAME_PRINTF_FORMAT (2, 0);
+
+void
+loudgame_broadcastf (loudgame_t        *lg,
+                    const char *format,
+                    ...) LOUDGAME_PRINTF_FORMAT (2, 3);
+
 void
 loudgame_quit (loudgame_t *lg, int return_value);