Ejemplo n.º 1
0
void get_helper_list (const Socket &client)
{
    HelperRepository::iterator it = __helpers.begin ();

    __send_trans.clear ();
    __send_trans.put_command (SCIM_TRANS_CMD_REPLY);
    __send_trans.put_data ((uint32)__helpers.size ());

    for (; it != __helpers.end (); ++it) {
        __send_trans.put_data (it->first.uuid);
        __send_trans.put_data (it->first.name);
        __send_trans.put_data (it->first.icon);
        __send_trans.put_data (it->first.description);
        __send_trans.put_data (it->first.option);
    }

    __send_trans.write_to_socket (client);
}
Ejemplo n.º 2
0
void run_helper (const String &uuid, const String &config, const String &display)
{
    SCIM_DEBUG_MAIN(1) << "run_helper (" << uuid << "," << config << "," << display << ")\n";

    for (size_t i = 0; i < __helpers.size (); ++i) {
        if (__helpers [i].first.uuid == uuid && __helpers [i].second.length ()) {

            int pid;

            pid = fork ();

            if (pid < 0) return;

            if (pid == 0) {
                char * argv [] = { SCIM_HELPER_LAUNCHER_PROGRAM,
                                   "--daemon",
                                   "--config", const_cast<char*> (config.c_str ()),
                                   "--display", const_cast<char*> (display.c_str ()),
                                   const_cast<char*> (__helpers [i].second.c_str ()),
                                   const_cast<char*> (__helpers [i].first.uuid.c_str ()),
                                   0};

                SCIM_DEBUG_MAIN(2) << " Call scim-helper-launcher.\n";

                execv (SCIM_HELPER_LAUNCHER_PROGRAM, argv);
                exit (-1);
            }

            int status;
            waitpid (pid, &status, 0);

            break;
        }
    }

    SCIM_DEBUG_MAIN(2) << " exit run_helper ().\n";
}