Example #1
0
void messages::reload(service *cfg)
{
    assert(cfg != NULL);

    const char *key = NULL, *value;
    linked_pointer<service::keynode> sp = cfg->getList("messages");

    while(sp) {
        key = sp->getId();
        value = sp->getPointer();
        if(key && value) {
            if(!stricmp(key, "keysize") && !is_configured())
                keysize = atoi(value);
            else if(!stricmp(key, "expires"))
                duration = atoi(value) * 60;
        }
        sp.next();
    }

    if(is_configured())
        return;

    msgs = new LinkedObject*[keysize];
    memset(msgs, 0, sizeof(LinkedObject *) * keysize);
}
Example #2
0
BuildContext*
build_clean_dir (BasicAutotoolsPlugin *plugin, GFile *dir,
                 GError **err)
{
	BuildContext *context = NULL;
	BuildProgram *prog;
	GFile *build_dir;
	BuildConfiguration *config;
	GList *vars;

	if (is_configured (plugin, dir))
	{
		config = build_configuration_list_get_selected (plugin->configurations);
		vars = build_configuration_get_variables (config);

		build_dir = build_file_from_file (plugin, dir, NULL);

		prog = build_program_new_with_command (build_dir,
		                                       "%s",
		                                       CHOOSE_COMMAND (plugin, CLEAN)),
		build_program_add_env_list (prog, vars);

		context = build_execute_command (plugin, prog, TRUE, err);
		g_object_unref (build_dir);
	}

	return context;
}
Example #3
0
void Remote::Disconnected(const QString& error) {
  if (retry_count_++ >= kMaxRetries) {
    // Show an error and give up if we're above the retry count
    if (!error.isEmpty()) {
      emit Error("XMPP remote control disconnected: " + error);
    }
  } else if (is_configured()) {
    // Try again
    QTimer::singleShot(0, connection_, SLOT(Connect()));
  }
}
Example #4
0
/* Run configure if needed and then the build command */
BuildContext*
build_configure_and_build (BasicAutotoolsPlugin *plugin, BuildFunc func, GFile *file, IAnjutaBuilderCallback callback, gpointer user_data, GError **error)
{
	if (!is_configured (plugin, file))
	{
		/* Run configure first */
		return build_configure_dialog (plugin, func, file, callback, user_data, error);
	}
	else
	{
		/* Some build functions have less arguments but
		 * it is not a problem in C */
		return func (plugin, file, callback, user_data, error);
	}
}
Example #5
0
void Remote::ReloadSettings() {
  QSettings s;
  s.beginGroup(RemoteSettingsPage::kSettingsGroup);

  QString username = s.value("username").toString();
  QString password = s.value("password").toString();
  QString agent_name = s.value("agent_name", RemoteSettingsPage::DefaultAgentName()).toString();

  // Have the settings changed?
  if (username != connection_->username() ||
      password != connection_->password() ||
      agent_name != connection_->agent_name()) {
    connection_->set_username(username);
    connection_->set_agent_name(agent_name);
    connection_->set_password(password);

    if (connection_->is_connected()) {
      // We'll reconnect later
      connection_->Disconnect();
    } else if (is_configured()) {
      connection_->Connect();
    }
  }
}