added get_preferred_language() to tnc_imc
authorAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 11 Nov 2010 06:30:13 +0000 (07:30 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 11 Nov 2010 06:30:13 +0000 (07:30 +0100)
src/libcharon/plugins/tnc_imc/tnc_imc_manager.c
src/libcharon/plugins/tnc_imc/tnc_imc_plugin.c
src/libcharon/tnc/imc/imc_manager.h

index f876167..107c964 100644 (file)
@@ -98,6 +98,13 @@ METHOD(imc_manager_t, get_count, int,
        return this->imcs->get_count(this->imcs);
 }
 
+METHOD(imc_manager_t, get_preferred_language, char*,
+       private_tnc_imc_manager_t *this)
+{
+       return lib->settings->get_str(lib->settings,
+                                       "charon.plugins.tnc-imc.preferred_language", "en");
+}
+
 METHOD(imc_manager_t, notify_connection_change, void,
        private_tnc_imc_manager_t *this, TNC_ConnectionID id,
                                                                         TNC_ConnectionState state)
@@ -222,6 +229,7 @@ imc_manager_t* tnc_imc_manager_create(void)
                        .add = _add,
                        .remove = _remove_, /* avoid name conflict with stdio.h */
                        .get_count = _get_count,
+                       .get_preferred_language = _get_preferred_language,
                        .notify_connection_change = _notify_connection_change,
                        .begin_handshake = _begin_handshake,
                        .set_message_types = _set_message_types,
index b6effba..c132f39 100644 (file)
@@ -153,7 +153,7 @@ METHOD(plugin_t, destroy, void,
  */
 plugin_t *tnc_imc_plugin_create()
 {
-       char *tnc_config, *pref_lang;
+       char *tnc_config;
        tnc_imc_plugin_t *this;
 
        INIT(this,
@@ -162,15 +162,12 @@ plugin_t *tnc_imc_plugin_create()
                },
        );
 
-       pref_lang = lib->settings->get_str(lib->settings,
-                                       "charon.plugins.tnc-imc.preferred_language", "en");
-       tnc_config = lib->settings->get_str(lib->settings,
-                                       "charon.plugins.tnc-imc.tnc_config", "/etc/tnc_config");
-
        /* Create IMC manager */
        charon->imcs = tnc_imc_manager_create();
 
        /* Load IMCs and abort if not all instances initalize successfully */
+       tnc_config = lib->settings->get_str(lib->settings,
+                                       "charon.plugins.tnc-imc.tnc_config", "/etc/tnc_config");
        if (!load_imcs(tnc_config))
        {
                charon->imcs->destroy(charon->imcs);
index 4019937..c52bc93 100644 (file)
@@ -56,6 +56,13 @@ struct imc_manager_t {
        int (*get_count)(imc_manager_t *this);
 
        /**
+        * Return the preferred language for recommendations
+        *
+        * @return                                      preferred language string
+        */
+       char* (*get_preferred_language)(imc_manager_t *this);
+
+       /**
         * Notify all IMC instances
         *
         * @param state                 communicate the state a connection has reached