summaryrefslogtreecommitdiff
path: root/protocols/Telegram/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Telegram/src')
-rw-r--r--protocols/Telegram/src/main.cpp13
-rw-r--r--protocols/Telegram/src/server.cpp5
-rw-r--r--protocols/Telegram/src/stdafx.h5
3 files changed, 14 insertions, 9 deletions
diff --git a/protocols/Telegram/src/main.cpp b/protocols/Telegram/src/main.cpp
index f2fb0cd153..6af8517ab7 100644
--- a/protocols/Telegram/src/main.cpp
+++ b/protocols/Telegram/src/main.cpp
@@ -43,15 +43,10 @@ static IconItem iconList[] =
{ LPGEN("Premium user"), "premuim", IDI_PREMIUM },
};
-extern "C" int __declspec(dllexport) Load(void)
-{
- g_plugin.registerIcon("Protocols/Telegram", iconList, "tg");
- return 0;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-extern "C" int __declspec(dllexport) Unload(void)
+int CMPlugin::Load()
{
+ registerIcon("Protocols/Telegram", iconList, "tg");
+
+ m_hIcon = ExtraIcon_RegisterIcolib("tg_premium", "Telegram Premium User", getIconHandle(IDI_PREMIUM));
return 0;
}
diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp
index 6700034f60..0bdeb2d79b 100644
--- a/protocols/Telegram/src/server.cpp
+++ b/protocols/Telegram/src/server.cpp
@@ -138,6 +138,11 @@ void CMTProto::ProcessUser(td::td_api::updateUser *pObj)
if (pUser->usernames_)
UpdateString(hContact, "Nick", pUser->usernames_->editable_username_);
+ if (pUser->is_premium_)
+ ExtraIcon_SetIconByName(g_plugin.m_hIcon, hContact, "tg_premium");
+ else
+ ExtraIcon_SetIconByName(g_plugin.m_hIcon, hContact, nullptr);
+
if (pUser->status_) {
if (pUser->status_->get_id() == td::td_api::userStatusOffline::ID) {
auto *pOffline = (td::td_api::userStatusOffline *)pUser->status_.get();
diff --git a/protocols/Telegram/src/stdafx.h b/protocols/Telegram/src/stdafx.h
index c5a21971fb..dc9121cfb8 100644
--- a/protocols/Telegram/src/stdafx.h
+++ b/protocols/Telegram/src/stdafx.h
@@ -14,6 +14,7 @@
#include <m_clist.h>
#include <m_contacts.h>
#include <m_database.h>
+#include <m_extraicons.h>
#include <m_icolib.h>
#include <m_langpack.h>
#include <m_options.h>
@@ -32,6 +33,10 @@
struct CMPlugin : public ACCPROTOPLUGIN<CMTProto>
{
CMPlugin();
+
+ HANDLE m_hIcon;
+
+ int Load() override;
};
#endif //_COMMON_H_ \ No newline at end of file