Note: I will be using a C++ notations for glib structures.
Before I send a patch about rewriting LoadPluginSettings to C, I have to write one before. It will be smaller and it will rewrite function from abrt-cli called
static void get_reporter_plugin_settings(const vector_string_t& reporters, map_map_string_t &settings)
a new interface will be
static GHashTable *get_reporter_plugin_settings(const vector_string_t& reporters)
and returned value is GHashTable<char*, map_string_t>. In a second patch(the one which will rewrite LoadPluginSettings) returned value will be GHashTable<char *, GHashTable<char *, char*>. Returned value must be *strongly* documented.
I also have to introduce a new funcion in dbus. (store_/load_)hash_table_(type).
--here I am right now--
After transmitting data structure to daemon, I'm almost done, because of beauty of passing settings to daemon(writing them to stdin)
Now a little bit about LoadPluginSettings
Interface: extern GHashTable *load_plugin_settings(const char *pPath, bool skipKeysWithoutValue);
load_plugin_settings return NULL on error or initialized GHashTable
Data structure: GHashTable<char *, char*>
A new dbus functions must be: (load_/save_)hash_table_str(DBus*, GHashTable<char *, char*>);
Simple taste of code:
GHashTable *single_plugin_settings = load_plugin_settings(path.c_str(), false); if (!single_plugin_settings) continue;
stats:
src/cli/dbus.cpp | 6 +- src/cli/dbus.h | 2 +- src/cli/report.cpp | 11 ++- src/daemon/CommLayerServerDBus.cpp | 4 +- src/daemon/Makefile.am | 2 + src/daemon/MiddleWare.cpp | 5 +- src/daemon/MiddleWare.h | 2 +- src/daemon/PluginManager.cpp | 11 ++-- src/daemon/PluginManager.h | 2 + src/hooks/Makefile.am | 1 + src/include/abrt_types.h | 2 - src/include/abrtlib.h | 31 +++++----- src/include/plugin.h | 6 +- src/lib/Makefile.am | 2 + src/lib/Plugin.cpp | 15 ++--- src/lib/abrt_dbus.c | 101 ++++++++++++++++++++++++++++++++ src/lib/abrt_dbus.h | 4 + src/lib/load_plugin_settings.cpp | 11 ++-- src/plugins/CCpp.cpp | 56 +++++++++--------- src/plugins/CCpp.h | 2 +- src/plugins/KerneloopsScanner.cpp | 6 +- src/plugins/Makefile.am | 8 ++- src/plugins/abrt-action-bugzilla.cpp | 16 ++--- src/plugins/abrt-action-kerneloops.cpp | 15 ++--- src/plugins/abrt-action-mailx.cpp | 25 ++++---- src/plugins/abrt-action-rhtsupport.cpp | 25 ++++---- src/plugins/abrt-action-upload.cpp | 13 ++--