conga/ricci/ricci DBusController.cpp DBusContr ...
CVSROOT: /cvs/cluster
Module name: conga
Changes by: kupcevic at sourceware.org 2006-07-25 19:30:15
Modified files:
ricci/ricci : DBusController.cpp DBusController.h
Log message:
D-BUS API changed
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/ricci/DBusController.cpp.diff?cvsroot=cluster&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/ricci/DBusController.h.diff?cvsroot=cluster&r1=1.4&r2=1.5
ricci/ricci/DBusController.cpp +8 -31
@@ -47,32 +47,8 @@ -DBusController::DBusController() : - rhel4(false) +DBusController::DBusController() { - char* buff = 0; - string release; - try { - ifstream is("/etc/redhat-release"); - is.seekg(0, ios::end); - unsigned int length = is.tellg(); - is.seekg(0, ios::beg); - buff = new char[length]; - is.read(buff, length); - - string rel(buff, length); - delete [] buff; - buff = 0; - - release = utils::strip(rel); - } catch ( ... ) { - delete [] buff; - throw; - } - if (release.find("Nahant") != release.npos) - rhel4 = true; - - // TODO: dynamically determine, // currently, rpm requires storage and cluster modules _mod_map["storage"] = "modstorage_rw";
@@ -149,13 +125,14 @@ string msg_clean(remove_chars(message, '\n')); const char* msg_clean_c_str = msg_clean.c_str(); - // DBus API conformance dirty hack const void* message_dbus_ready = 0; - if (rhel4) - message_dbus_ready = msg_clean_c_str; - else - message_dbus_ready = &msg_clean_c_str; - // dirty hack done +#if (DBUS_MAJOR_VERSION == 1) || (DBUS_MAJOR_VERSION == 0 && DBUS_MINOR_VERSION >= 90) + message_dbus_ready = &msg_clean_c_str; +#elif DBUS_MAJOR_VERSION == 0 && DBUS_MINOR_VERSION < 90 + message_dbus_ready = msg_clean_c_str; +#else +#error "unrecognized major DBUS number" +#endif if (!dbus_message_append_args(msg, DBUS_TYPE_STRING, message_dbus_ready,
ricci/ricci/DBusController.h +0 -5
@@ -48,11 +48,6 @@ private: std::map<std::string, std::string> _mod_map; - -// DBus API conformace -bool rhel4;// RHEL4's DBus - - };