Add command menu for messages received from loopback.
[cascardo/f2fchat.git] / friend.c
index 2e50f36..af5d5e3 100644 (file)
--- a/friend.c
+++ b/friend.c
@@ -26,6 +26,7 @@
 #include <errno.h>
 #include <stdio.h>
 #include "message.h"
+#include "menu.h"
 
 enum {
        STATE_OFFLINE,
@@ -88,6 +89,20 @@ void friend_got_message(struct friend *friend, char *buffer, size_t len)
        }
 }
 
+void friend_cmd(gchar **args, GSocketAddress *address)
+{
+       printf("%s\n", args[1]);
+}
+
+void friend_init(void)
+{
+       struct menu_item *mi;
+       mi = g_malloc(sizeof(*mi));
+       mi->cmd = "friend";
+       mi->func = friend_cmd;
+       menu_add(mi);
+}
+
 struct cache {
        GList *friends;
 };