X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=f2fchat.c;h=eb9423c61de0348693fa47d3e843789c2cf471cf;hb=2ce1e48602de964b8a12747b4a329fc082da7523;hp=55bdc5a04fde185fd4e09e39addae0f62b16c5fd;hpb=9952158738901f331b9e04939f6fbc3e58be03a5;p=cascardo%2Ff2fchat.git diff --git a/f2fchat.c b/f2fchat.c index 55bdc5a..eb9423c 100644 --- a/f2fchat.c +++ b/f2fchat.c @@ -17,16 +17,30 @@ */ #include "friend.h" +#include +#include + +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; - int out = 0; + 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"); - while (!out) { - out = 1; - } + 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;