Changeset - 4a88d7715448
[Not reviewed]
0 4 0
HanzZ - 13 years ago 2012-09-05 17:52:41
hanzz.k@gmail.com
Allow unregistered options to be passed by command line
4 files changed with 24 insertions and 5 deletions:
0 comments (0 inline, 0 general)
backends/libpurple/main.cpp
Show inline comments
 
@@ -1528,7 +1528,9 @@ static void gotAttention(PurpleAccount *account, const char *who, PurpleConversa
 
static bool initPurple() {
 
	bool ret;
 

	
 
	if (!resolvePurpleFunctions()) {
 
	std::string libPurpleDllPath = CONFIG_STRING_DEFAULTED(config, "purple.libpurple_dll_path", "");
 

	
 
	if (!resolvePurpleFunctions(libPurpleDllPath)) {
 
		LOG4CXX_ERROR(logger, "Unable to load libpurple.dll or some of the needed methods");
 
		return false;
 
	}
 
@@ -1538,7 +1540,7 @@ static bool initPurple() {
 
	purple_plugins_add_search_path_wrapped(pluginsDir.c_str());
 

	
 
	std::string cacertsDir = CONFIG_STRING_DEFAULTED(config, "purple.cacerts_dir", "./ca-certs");
 
	LOG4CXX_INFO(logger, "Setting libpurple plugins directory to: " << cacertsDir);
 
	LOG4CXX_INFO(logger, "Setting libpurple cacerts directory to: " << cacertsDir);
 
	purple_certificate_add_ca_search_path_wrapped(cacertsDir.c_str());
 
 
 
	std::string userDir = CONFIG_STRING_DEFAULTED(config, "service.working_dir", "./");
backends/libpurple/purple_defs.cpp
Show inline comments
 
@@ -138,9 +138,19 @@ purple_account_option_get_type_wrapped_fnc purple_account_option_get_type_wrappe
 
purple_account_option_get_setting_wrapped_fnc purple_account_option_get_setting_wrapped = NULL;
 
wpurple_g_io_channel_win32_new_socket_wrapped_fnc wpurple_g_io_channel_win32_new_socket_wrapped = NULL;
 
#endif
 
bool resolvePurpleFunctions() {
 
bool resolvePurpleFunctions(const std::string& libPurpleDllPath) {
 
#if PURPLE_RUNTIME
 
	f_hPurple = LoadLibrary(L"libpurple.dll");
 
	wstring dllPath;
 
	if (!libPurpleDllPath.empty())
 
	{
 
		dllPath = utf8ToUtf16(libPurpleDllPath);
 
	}
 
	else
 
	{
 
		// No path was specified, so try loading libpurple from the current working directory
 
		dllPath = L"libpurple.dll";
 
	}
 
	f_hPurple = LoadLibrary(dllPath.c_str());
 
	if (!f_hPurple)
 
			return false;
 
	purple_debug_set_ui_ops_wrapped = (purple_debug_set_ui_ops_wrapped_fnc)GetProcAddress(f_hPurple, "purple_debug_set_ui_ops");
backends/libpurple/purple_defs.h
Show inline comments
 
#pragma once
 
#include <string>
 

	
 
#if PURPLE_RUNTIME
 

	
 
#include <Windows.h>
 
@@ -570,5 +572,5 @@ extern wpurple_g_io_channel_win32_new_socket_wrapped_fnc wpurple_g_io_channel_wi
 
#define wpurple_g_io_channel_win32_new_socket_wrapped wpurple_g_io_channel_win32_new_socket
 
#endif
 

	
 
bool resolvePurpleFunctions();
 
bool resolvePurpleFunctions(const std::string& libPurpleDllPath);
 

	
src/config.cpp
Show inline comments
 
@@ -138,6 +138,11 @@ bool Config::load(std::istream &ifs, boost::program_options::options_description
 
	if (m_argc != 0 && m_argv) {
 
		basic_command_line_parser<char> parser = command_line_parser(m_argc, m_argv).options(opts).allow_unregistered();
 
		parsed_options parsed = parser.run();
 
		BOOST_FOREACH(option &opt, parsed.options) {
 
			if (opt.unregistered && !opt.value.empty()) {
 
				m_unregistered[opt.string_key] = variable_value(opt.value[0], false);
 
			}
 
		}
 
		store(parsed, m_variables);
 
	}
 

	
0 comments (0 inline, 0 general)