From mboxrd@z Thu Jan 1 00:00:00 1970 From: kupcevic@sourceware.org Date: 25 Jul 2006 19:30:16 -0000 Subject: [Cluster-devel] conga/ricci/ricci DBusController.cpp DBusContr ... Message-ID: <20060725193016.14078.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 --- conga/ricci/ricci/DBusController.cpp 2006/07/25 19:10:18 1.12 +++ conga/ricci/ricci/DBusController.cpp 2006/07/25 19:30:15 1.13 @@ -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, --- conga/ricci/ricci/DBusController.h 2006/05/23 17:45:38 1.4 +++ conga/ricci/ricci/DBusController.h 2006/07/25 19:30:15 1.5 @@ -48,11 +48,6 @@ private: std::map _mod_map; - - // DBus API conformace - bool rhel4; // RHEL4's DBus - - };