diff --git a/backends/libpurple/main.cpp b/backends/libpurple/main.cpp index 51943171f5ebd0eb3931f864959dab0c38ec5858..e9805f51f1436751dbd19b0264f30f7c3d461ba3 100644 --- a/backends/libpurple/main.cpp +++ b/backends/libpurple/main.cpp @@ -69,6 +69,20 @@ class SpectrumNetworkPlugin; GKeyFile *keyfile; SpectrumNetworkPlugin *np; +std::string replaceAll( + std::string result, + const std::string& replaceWhat, + const std::string& replaceWithWhat) +{ + while(1) + { + const int pos = result.find(replaceWhat); + if (pos==-1) break; + result.replace(pos,replaceWhat.size(),replaceWithWhat); + } + return result; +} + static std::string KEYFILE_STRING(const std::string &cat, const std::string &key, const std::string &def = "") { gchar *str = g_key_file_get_string(keyfile, cat.c_str(), key.c_str(), 0); if (!str) { @@ -83,6 +97,11 @@ static std::string KEYFILE_STRING(const std::string &cat, const std::string &key ret.erase(ret.end() - 1); } } + + if (ret.find("$jid") != std::string::npos) { + std::string jid = KEYFILE_STRING("service", "jid"); + ret = replaceAll(ret, "$jid", jid); + } return ret; }