summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/misc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/VKontakte/src/misc.cpp')
-rw-r--r--protocols/VKontakte/src/misc.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index 6951a76f56..0b55ba50a4 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -1304,9 +1304,8 @@ CMStringW CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &j
for (auto &jnUser : jnFUsers) {
int iUserId = jnUser["id"].as_int();
CMStringW wszNick(FORMAT, L"%s %s", jnUser["first_name"].as_mstring().c_str(), jnUser["last_name"].as_mstring().c_str());
- CMStringW wszLink(FORMAT, L"https://vk.com/id%d", iUserId);
- CVkUserInfo *vkUser = new CVkUserInfo(jnUser["id"].as_int(), false, wszNick, wszLink, FindUser(iUserId));
+ CVkUserInfo *vkUser = new CVkUserInfo(jnUser["id"].as_int(), false, wszNick, UserProfileUrl(iUserId), FindUser(iUserId));
vkUsers.insert(vkUser);
}
@@ -1326,7 +1325,7 @@ CMStringW CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &j
wszNick = ptrW(db_get_wsa(hContact, m_szModuleName, "Nick"));
else
wszNick = TranslateT("(Unknown contact)");
- wszUrl.AppendFormat(L"https://vk.com/id%d", uid);
+ wszUrl = UserProfileUrl(uid);
}
time_t datetime = (time_t)jnMsg["date"].as_int();
@@ -1593,3 +1592,8 @@ bool CVkProto::IsMessageExist(UINT iMsgId, VKMesType vkType)
return ((vkType == vkOUT) == (bool)(dbei.flags & DBEF_SENT));
}
+
+CMStringW CVkProto::UserProfileUrl(LONG iUserId)
+{
+ return CMStringW(FORMAT, L"https://vk.com/%s%d", iUserId > 0 ? L"id" : L"club", iUserId > 0 ? iUserId : -1 * iUserId);
+} \ No newline at end of file