soc.2009.transport: 95ad48f3: Allow to use config file as argument
hanzz at soc.pidgin.im
hanzz at soc.pidgin.im
Fri Jul 24 06:51:17 EDT 2009
-----------------------------------------------------------------
Revision: 95ad48f3f5ba30530300bf965465ace4a61afd4e
Ancestor: 2c32232d69d47e309615c879e245fa1ad205f835
Author: hanzz at soc.pidgin.im
Date: 2009-07-24T07:29:45
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/95ad48f3f5ba30530300bf965465ace4a61afd4e
Modified files:
main.cpp
ChangeLog:
Allow to use config file as argument
-------------- next part --------------
============================================================
--- main.cpp e142c7bdc477dc60d6853cb33fd71ebb58f58fd6
+++ main.cpp f3f5e0eca36b18dc9acb9205a7f530b75f0e3ffd
@@ -806,15 +806,16 @@ void GlooxMessageHandler::loadConfigFile
keyfile = g_key_file_new ();
flags = G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS;
- if (!g_key_file_load_from_file (keyfile, std::string("/etc/highflyer/" + config + ".cfg").c_str(), (GKeyFileFlags)flags, &error))
- {
-// g_error (error->message);
- Log().Get("gloox") << "Can't load config file!!!";
- g_key_file_free(keyfile);
- exit(0);
- return;
+ if (!g_key_file_load_from_file (keyfile, config.c_str(), (GKeyFileFlags)flags, &error)) {
+ if (!g_key_file_load_from_file (keyfile, std::string("/etc/highflyer/" + config + ".cfg").c_str(), (GKeyFileFlags)flags, &error))
+ {
+ Log().Get("gloox") << "Can't load config file!!!";
+ g_key_file_free(keyfile);
+ exit(0);
+ return;
+ }
}
-
+
m_configuration.discoName = (std::string)g_key_file_get_string(keyfile, "service","name", NULL);
m_configuration.protocol = (std::string)g_key_file_get_string(keyfile, "service","protocol", NULL);
m_configuration.server = (std::string)g_key_file_get_string(keyfile, "service","server", NULL);
@@ -1467,7 +1468,7 @@ int main( int argc, char* argv[] ) {
GlooxMessageHandler* GlooxMessageHandler::m_pInstance = NULL;
int main( int argc, char* argv[] ) {
if (argc != 2)
- std::cout << "Usage: " << std::string(argv[0]) << " config_file_name\n";
+ std::cout << "Usage: " << std::string(argv[0]) << " config_file_name or profile name\n";
else {
std::string config(argv[1]);
GlooxMessageHandler t(config);
More information about the Commits
mailing list