Add command menu for messages received from loopback.
[cascardo/f2fchat.git] / f2fchat.c
index 711811c..eb9423c 100644 (file)
--- a/f2fchat.c
+++ b/f2fchat.c
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#include "friend.h"
+#include <glib.h>
+#include <stdio.h>
+
+static gboolean quit(gpointer data)
+{
+       GMainLoop *loop = data;
+       g_main_loop_quit(loop);
+       return G_SOURCE_CONTINUE;
+}
+
 int main(int argc, char **argv)
 {
+       struct cache *cache;
+       GMainLoop *loop;
+       g_type_init();
+       if (sock_init()) {
+               fprintf(stderr, "Error creating socket.\n");
+               return 1;
+       }
+       friend_init();
+       create_cache(&cache);
+       load_cache(cache, "friends.cache");
+       loop = g_main_loop_new(g_main_context_default(), TRUE);
+       g_main_loop_run(loop);
+       store_cache(cache, "friends.cache");
+       destroy_cache(cache);
        return 0;
 }