diff --git a/backends/libpurple/main.cpp b/backends/libpurple/main.cpp index 1b95b35f..9dabcc19 100644 --- a/backends/libpurple/main.cpp +++ b/backends/libpurple/main.cpp @@ -58,6 +58,7 @@ static GOptionEntry options_entries[] = { { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, "", NULL } }; +static void *notify_user_info(PurpleConnection *gc, const char *who, PurpleNotifyUserInfo *user_info); static GHashTable *ui_info = NULL; static GHashTable *spectrum_ui_get_info(void) @@ -381,8 +382,18 @@ class SpectrumNetworkPlugin : public NetworkPlugin { if (CONFIG_STRING(config, "service.protocol") == "any" && legacyName.find("prpl-") == 0) { name = name.substr(name.find(".") + 1); } - serv_get_info(purple_account_get_connection(account), name.c_str()); m_vcards[user + name] = id; + + std::cout << name << " " << purple_account_get_username(account) << "\n"; + if (CONFIG_BOOL(config, "backend.no_vcard_fetch") && name != purple_account_get_username(account)) { + PurpleNotifyUserInfo *user_info = purple_notify_user_info_new(); + notify_user_info(purple_account_get_connection(account), name.c_str(), user_info); + purple_notify_user_info_destroy(user_info); + } + else { + serv_get_info(purple_account_get_connection(account), name.c_str()); + } + } } diff --git a/spectrum/src/sample.cfg b/spectrum/src/sample.cfg index 1ef0b140..d971d8a1 100644 --- a/spectrum/src/sample.cfg +++ b/spectrum/src/sample.cfg @@ -19,10 +19,8 @@ protocol=any #protocol=prpl-icq [backend] -default_avatar=catmelonhead.jpg -[purple] -test=test1 -test2=test3 +#default_avatar=catmelonhead.jpg +no_vcard_fetch=true [logging] #config=logging.cfg # log4cxx/log4j logging configuration file diff --git a/src/config.cpp b/src/config.cpp index d3c755bd..46ef14c2 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -70,6 +70,7 @@ bool Config::load(const std::string &configfile, boost::program_options::options ("logging.backend_config", value()->default_value(""), "Path to log4cxx config file which is used for backends") ("backend.default_avatar", value()->default_value(""), "Full path to default avatar") ("backend.avatars_directory", value()->default_value(""), "Path to directory with avatars") + ("backend.no_vcard_fetch", value()->default_value(false), "True if VCards for buddies should not be fetched. Only avatars will be forwarded.") ; parsed_options parsed = parse_config_file(ifs, opts, true);