Ejemplo n.º 1
0
Archivo: server.c Proyecto: hychen/ibus
gboolean
bus_server_listen (BusServer *server)
{
    g_assert (BUS_IS_SERVER (server));

    const gchar *mechanisms[] = {
        "EXTERNAL",
        NULL
    };

    const gchar *address = "unix:tmpdir=/tmp/";
    gboolean retval;

#if 0
    path = ibus_get_socket_folder ();
    mkdir (path, 0700);
    chmod (path, 0700);

    address = ibus_get_address ();
#endif

    retval = ibus_server_listen (IBUS_SERVER (server), address);

#if 0
    chmod (ibus_get_socket_path (), 0600);
#endif

    ibus_server_set_auth_mechanisms ((IBusServer *)server, mechanisms);

    if (!retval) {
#if 0
        g_printerr ("Can not listen on %s! Please try remove directory %s and run again.", address, path);
#else
        g_printerr ("Can not listen on %s!", address);
#endif
        exit (-1);
    }

    ibus_write_address (ibus_server_get_address (IBUS_SERVER (server)));

    return retval;
}
Ejemplo n.º 2
0
Archivo: server.c Proyecto: iwaim/ibus
gboolean
bus_server_listen (BusServer *server)
{
    g_assert (BUS_IS_SERVER (server));

    // const gchar *address = "unix:abstract=/tmp/ibus-c"
    const gchar *address;
    gchar *path;
    gboolean retval;

    path = g_strdup_printf("/tmp/ibus-%s", ibus_get_user_name ());
    mkdir (path, 0775);
    address = ibus_get_address ();

    retval = ibus_server_listen (IBUS_SERVER (server), address);

    if (!retval) {
        g_printerr ("Can not listen on %s! Please try remove directory %s and run again.", address, path);
        exit (-1);
    }

    g_free(path);
    return retval;
}