diff options
Diffstat (limited to 'protocols')
| -rw-r--r-- | protocols/Discord/src/utils.cpp | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/protocols/Discord/src/utils.cpp b/protocols/Discord/src/utils.cpp index 2e7c5defe7..7ed5a734f1 100644 --- a/protocols/Discord/src/utils.cpp +++ b/protocols/Discord/src/utils.cpp @@ -237,6 +237,7 @@ void CDiscordProto::PreparePrivateChannel(const JSONNode &root) CheckAvatarChange(si->hContact, root["icon"].as_mstring());
+ bool bHasMe = false;
GCEVENT gce = { si, GC_EVENT_JOIN };
for (auto &it : root["recipients"]) {
CMStringW wszId = it["id"].as_mstring();
@@ -244,23 +245,29 @@ void CDiscordProto::PreparePrivateChannel(const JSONNode &root) if (wszNick.IsEmpty())
wszNick = getNick(it);
+ gce.bIsMe = _wtoi64(wszId) == m_ownId;
gce.pszUID.w = wszId;
gce.pszNick.w = wszNick;
gce.pszStatus.w = (_wtoi64(wszId) == ownerId) ? L"Owners" : L"Participants";
Chat_Event(&gce);
+
+ if (gce.bIsMe)
+ bHasMe = true;
}
- CMStringW wszId(FORMAT, L"%lld", getId(DB_KEY_ID)), wszNick;
- if (auto iDiscr = getDword(DB_KEY_DISCR))
- wszNick.Format(L"%s#%d", getMStringW(DB_KEY_NICK).c_str(), iDiscr);
- else
- wszNick = getMStringW(DB_KEY_NICK);
-
- gce.bIsMe = true;
- gce.pszUID.w = wszId;
- gce.pszNick.w = wszNick;
- gce.pszStatus.w = (_wtoi64(wszId) == ownerId) ? L"Owners" : L"Participants";
- Chat_Event(&gce);
+ if (!bHasMe) {
+ CMStringW wszId(FORMAT, L"%lld", getId(DB_KEY_ID)), wszNick;
+ if (auto iDiscr = getDword(DB_KEY_DISCR))
+ wszNick.Format(L"%s#%d", getMStringW(DB_KEY_NICK).c_str(), iDiscr);
+ else
+ wszNick = getMStringW(DB_KEY_NICK);
+
+ gce.bIsMe = true;
+ gce.pszUID.w = wszId;
+ gce.pszNick.w = wszNick;
+ gce.pszStatus.w = (_wtoi64(wszId) == ownerId) ? L"Owners" : L"Participants";
+ Chat_Event(&gce);
+ }
}
Chat_Control(si, m_bHideGroupchats ? WINDOW_HIDDEN : SESSION_INITDONE);
|
