diff options
author | George Hazan <ghazan@miranda.im> | 2019-02-27 11:05:05 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-02-27 11:05:05 +0300 |
commit | 288a07c81370226937d882b7a14fe3b6e3607e9e (patch) | |
tree | 11b756523da778da019b8e17b699fe6ab1c378c9 /protocols | |
parent | f5d8bbfb549446c53671250364a60af02b9874e7 (diff) |
fixes #1867 (MRA: email notification isn't shown on startup)
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/ICQ-WIM/src/poll.cpp | 32 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/proto.h | 1 |
2 files changed, 22 insertions, 11 deletions
diff --git a/protocols/ICQ-WIM/src/poll.cpp b/protocols/ICQ-WIM/src/poll.cpp index 09782ee30b..cc3cb81027 100644 --- a/protocols/ICQ-WIM/src/poll.cpp +++ b/protocols/ICQ-WIM/src/poll.cpp @@ -200,6 +200,20 @@ void CIcqProto::ProcessMyInfo(const JSONNode &ev) CheckAvatarChange(0, ev); } +void CIcqProto::EmailNotification(const wchar_t *pwszText) +{ + char szServiceFunction[MAX_PATH]; + mir_snprintf(szServiceFunction, "%s%s", m_szModuleName, PS_GOTO_INBOX); + + CLISTEVENT cle = {}; + cle.hDbEvent = 1; + cle.hIcon = IcoLib_GetIconByHandle(iconList[1].hIcolib); + cle.flags = CLEF_UNICODE; + cle.pszService = szServiceFunction; + cle.szTooltip.w = pwszText; + g_clistApi.pfnAddEvent(&cle); +} + void CIcqProto::ProcessNotification(const JSONNode &ev) { for (auto &fld : ev["fields"]) { @@ -218,23 +232,19 @@ void CIcqProto::ProcessNotification(const JSONNode &ev) CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&Popup, 0); } - char szServiceFunction[MAX_PATH]; - mir_snprintf(szServiceFunction, "%s%s", m_szModuleName, PS_GOTO_INBOX); - - CLISTEVENT cle = {}; - cle.hDbEvent = 1; - cle.hIcon = Popup.lchIcon; - cle.flags = CLEF_UNICODE; - cle.pszService = szServiceFunction; - cle.szTooltip.w = Popup.lptzText; - g_clistApi.pfnAddEvent(&cle); + EmailNotification(Popup.lptzText); } const JSONNode &status = fld["mailbox.status"]; if (status) { JSONROOT root(status.as_string().c_str()); - m_szMailBox = (*root)["email"].as_mstring(); + m_szMailBox = (*root)["email"].as_mstring(); m_unreadEmails = (*root)["unreadCount"].as_int(); + + if (m_unreadEmails > 0) { + CMStringW wszMessage(FORMAT, TranslateT("You have %d unread emails"), m_unreadEmails); + EmailNotification(wszMessage); + } } } } diff --git a/protocols/ICQ-WIM/src/proto.h b/protocols/ICQ-WIM/src/proto.h index 9426cc8e08..ea5f310dbb 100644 --- a/protocols/ICQ-WIM/src/proto.h +++ b/protocols/ICQ-WIM/src/proto.h @@ -151,6 +151,7 @@ class CIcqProto : public PROTO<CIcqProto> MCONTACT CheckOwnMessage(const CMStringA &reqId, const CMStringA &msgId, bool bRemove); void CheckPassword(void); void ConnectionFailed(int iReason, int iErrorCode = 0); + void EmailNotification(const wchar_t *pwszText); void GetPermitDeny(); void MoveContactToGroup(MCONTACT hContact, const wchar_t *pwszGroup, const wchar_t *pwszNewGroup); void RetrieveUserHistory(MCONTACT, __int64 startMsgId, __int64 endMsgId = -1); |