added [backend] no_vcard_fetch variable to stop fetching vcard from remote network and answer only with avatar

This commit is contained in:
HanzZ 2011-08-18 00:29:46 +02:00
parent a1d9abd984
commit 93ddc62068
3 changed files with 15 additions and 5 deletions

View file

@ -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());
}
}
}

View file

@ -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

View file

@ -70,6 +70,7 @@ bool Config::load(const std::string &configfile, boost::program_options::options
("logging.backend_config", value<std::string>()->default_value(""), "Path to log4cxx config file which is used for backends")
("backend.default_avatar", value<std::string>()->default_value(""), "Full path to default avatar")
("backend.avatars_directory", value<std::string>()->default_value(""), "Path to directory with avatars")
("backend.no_vcard_fetch", value<bool>()->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);