summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-04-13 20:22:59 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-04-13 20:22:59 +0300
commit680873487c4a7987012606119a744e5ca725ad30 (patch)
tree8e5fbc68a253c3ec44287754c9295670f1ee44c3 /protocols/FacebookRM
parent6c4136504c660bf3359e6641362672c4b9502be5 (diff)
merge with trunk
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r--protocols/FacebookRM/src/captcha.cpp2
-rw-r--r--protocols/FacebookRM/src/dialogs.cpp4
-rw-r--r--protocols/FacebookRM/src/process.cpp2
-rw-r--r--protocols/FacebookRM/src/proto.cpp20
-rw-r--r--protocols/FacebookRM/src/theme.cpp27
-rw-r--r--protocols/FacebookRM/src/theme.h2
6 files changed, 23 insertions, 34 deletions
diff --git a/protocols/FacebookRM/src/captcha.cpp b/protocols/FacebookRM/src/captcha.cpp
index 367a03bb66..6c9d2335a6 100644
--- a/protocols/FacebookRM/src/captcha.cpp
+++ b/protocols/FacebookRM/src/captcha.cpp
@@ -39,7 +39,7 @@ static INT_PTR CALLBACK CaptchaFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- Window_SetIcon_IcoLib(hwndDlg, GetIconHandle("key"));
+ Window_SetIcon_IcoLib(hwndDlg, g_plugin.getIconHandle(IDI_KEYS));
params = (CAPTCHA_FORM_PARAMS*)lParam;
SetDlgItemText(hwndDlg, IDC_INSTRUCTION, TranslateT("Enter the text you see"));
diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp
index d29d84b1b9..0c7c9616dd 100644
--- a/protocols/FacebookRM/src/dialogs.cpp
+++ b/protocols/FacebookRM/src/dialogs.cpp
@@ -212,7 +212,7 @@ INT_PTR CALLBACK FBMindProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpara
{
TranslateDialogDefault(hwnd);
- Window_SetIcon_IcoLib(hwnd, GetIconHandle("mind"));
+ Window_SetIcon_IcoLib(hwnd, g_plugin.getIconHandle(IDI_MIND));
data = reinterpret_cast<post_status_data*>(lparam);
@@ -634,7 +634,7 @@ CFacebookGuardDialog::CFacebookGuardDialog(FacebookProto *proto, const char *fb_
bool CFacebookGuardDialog::OnInitDialog()
{
- Window_SetIcon_IcoLib(m_hwnd, GetIconHandle("facebook"));
+ Window_SetIcon_IcoLib(m_hwnd, g_plugin.getIconHandle(IDI_FACEBOOK));
SendMessage(m_text.GetHwnd(), EM_LIMITTEXT, 6, 0);
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp
index b63006bea3..29c1fac120 100644
--- a/protocols/FacebookRM/src/process.cpp
+++ b/protocols/FacebookRM/src/process.cpp
@@ -324,7 +324,7 @@ void FacebookProto::LoadHistory(void *pParam)
POPUPDATAW ppd;
ppd.iSeconds = 5;
ppd.lchContact = hContact;
- ppd.lchIcon = IcoLib_GetIconByHandle(GetIconHandle("conversation")); // TODO: Use better icon
+ ppd.lchIcon = IcoLib_GetIconByHandle(g_plugin.getIconHandle(IDI_CONVERSATION)); // TODO: Use better icon
wcsncpy(ppd.lpwzContactName, m_tszUserName, MAX_CONTACTNAME);
wcsncpy(ppd.lpwzText, TranslateT("Loading history started."), MAX_SECONDLINE);
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index fef127544d..d2221ae899 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -104,7 +104,7 @@ FacebookProto::FacebookProto(const char* proto_name, const wchar_t* username) :
evtype.module = m_szModuleName;
evtype.eventType = FACEBOOK_EVENTTYPE_CALL;
evtype.descr = LPGEN("Video call");
- evtype.eventIcon = GetIconHandle("facebook");
+ evtype.eventIcon = g_plugin.getIconHandle(IDI_FACEBOOK);
evtype.flags = DETF_HISTORY | DETF_MSGWINDOW;
DbEvent_RegisterType(&evtype);
}
@@ -454,7 +454,7 @@ int FacebookProto::OnToolbarInit(WPARAM, LPARAM)
ttb.pszService = service;
ttb.pszTooltipUp = ttb.name = LPGEN("Share status...");
- ttb.hIconHandleUp = IcoLib_GetIconByHandle(GetIconHandle("mind"));
+ ttb.hIconHandleUp = g_plugin.getIconHandle(IDI_MIND);
g_plugin.addTTB(&ttb);
return 0;
@@ -926,7 +926,7 @@ void FacebookProto::InitPopups()
// Client
mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Client errors"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Client");
- ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("facebook"));
+ ppc.hIcon = g_plugin.getIcon(IDI_FACEBOOK);
ppc.colorBack = RGB(191, 0, 0); // red
ppc.colorText = RGB(255, 255, 255); // white
popupClasses.push_back(Popup_RegisterClass(&ppc));
@@ -934,7 +934,7 @@ void FacebookProto::InitPopups()
// Newsfeeds
mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Wall posts"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Newsfeed");
- ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("newsfeed"));
+ ppc.hIcon = g_plugin.getIcon(IDI_NEWSFEED);
ppc.colorBack = RGB(255, 255, 255); // white
ppc.colorText = RGB(0, 0, 0); // black
popupClasses.push_back(Popup_RegisterClass(&ppc));
@@ -942,7 +942,7 @@ void FacebookProto::InitPopups()
// Notifications
mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Notifications"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Notification");
- ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("notification"));
+ ppc.hIcon = g_plugin.getIcon(IDI_NOTIFICATION);
ppc.colorBack = RGB(59, 89, 152); // Facebook's blue
ppc.colorText = RGB(255, 255, 255); // white
popupClasses.push_back(Popup_RegisterClass(&ppc));
@@ -950,7 +950,7 @@ void FacebookProto::InitPopups()
// Others
mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Other events"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Other");
- ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("facebook"));
+ ppc.hIcon = g_plugin.getIcon(IDI_FACEBOOK);
ppc.colorBack = RGB(255, 255, 255); // white
ppc.colorText = RGB(0, 0, 0); // black
popupClasses.push_back(Popup_RegisterClass(&ppc));
@@ -958,7 +958,7 @@ void FacebookProto::InitPopups()
// Friendship changes
mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Friendship events"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Friendship");
- ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("friendship"));
+ ppc.hIcon = g_plugin.getIcon(IDI_FRIENDS);
ppc.colorBack = RGB(47, 71, 122); // Facebook's darker blue
ppc.colorText = RGB(255, 255, 255); // white
popupClasses.push_back(Popup_RegisterClass(&ppc));
@@ -966,7 +966,7 @@ void FacebookProto::InitPopups()
// Ticker
mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Real-time friends activity"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Ticker");
- ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("newsfeed"));
+ ppc.hIcon = g_plugin.getIcon(IDI_NEWSFEED);
ppc.colorBack = RGB(255, 255, 255); // white
ppc.colorText = RGB(0, 0, 0); // black
popupClasses.push_back(Popup_RegisterClass(&ppc));
@@ -974,7 +974,7 @@ void FacebookProto::InitPopups()
// On this day (memories)
mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Memories"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Memories");
- ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("memories"));
+ ppc.hIcon = g_plugin.getIcon(IDI_MEMORIES);
ppc.colorBack = RGB(255, 255, 255); // white
ppc.colorText = RGB(0, 0, 0); // black
popupClasses.push_back(Popup_RegisterClass(&ppc));
@@ -1039,7 +1039,7 @@ void FacebookProto::MessageRead(MCONTACT hContact)
wchar_t ttime[64];
wcsftime(ttime, _countof(ttime), L"%X", localtime(&time));
- HICON hIcon = IcoLib_GetIconByHandle(GetIconHandle("read"));
+ HICON hIcon = g_plugin.getIcon(IDI_READ);
if (isChatRoom(hContact)) {
// Load readers names
diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp
index 9fd5413896..be9a232bc1 100644
--- a/protocols/FacebookRM/src/theme.cpp
+++ b/protocols/FacebookRM/src/theme.cpp
@@ -57,15 +57,6 @@ void InitIcons(void)
g_plugin.registerIcon("Protocols/Facebook", icons, "Facebook");
}
-HANDLE GetIconHandle(const char* name)
-{
- for (auto &it : icons)
- if (mir_strcmp(it.szName, name) == 0)
- return it.hIcolib;
-
- return nullptr;
-}
-
// Helper functions
template<INT_PTR(__cdecl FacebookProto::*Fcn)(WPARAM, LPARAM)>
INT_PTR GlobalService(WPARAM wParam, LPARAM lParam)
@@ -107,7 +98,7 @@ void InitContactMenus()
SET_UID(mi, 0x1e9d0534, 0xc319, 0x42a2, 0xbe, 0xd5, 0x1e, 0xae, 0xe1, 0x54, 0xd, 0x89);
mi.position = -2000006001;
- mi.hIcolibItem = GetIconHandle("friendship");
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_FRIENDS);
mi.name.a = LPGEN("Visit friendship details");
mi.pszService = "FacebookProto/VisitFriendship";
CreateServiceFunction(mi.pszService, GlobalService<&FacebookProto::VisitFriendship>);
@@ -115,7 +106,7 @@ void InitContactMenus()
SET_UID(mi, 0xd3bfd7d6, 0x43c3, 0x4b05, 0x81, 0x40, 0xc8, 0xbe, 0x81, 0xd9, 0x95, 0xff);
mi.position = -2000006002;
- mi.hIcolibItem = GetIconHandle("conversation");
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_CONVERSATION);
mi.name.a = LPGEN("Visit conversation");
mi.pszService = "FacebookProto/VisitConversation";
CreateServiceFunction(mi.pszService, GlobalService<&FacebookProto::VisitConversation>);
@@ -123,7 +114,7 @@ void InitContactMenus()
SET_UID(mi, 0xc631b2ea, 0xa133, 0x4cc9, 0x81, 0x1e, 0xad, 0x8f, 0x36, 0x5c, 0x74, 0xbf);
mi.position = -2000006003;
- mi.hIcolibItem = GetIconHandle("mind");
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_MIND);
mi.name.a = LPGEN("Share status...");
mi.pszService = "FacebookProto/Mind";
CreateServiceFunction(mi.pszService, GlobalService<&FacebookProto::OnMind>);
@@ -131,7 +122,7 @@ void InitContactMenus()
SET_UID(mi, 0x10ce2dbf, 0x8acf, 0x4f51, 0x89, 0x76, 0xd9, 0x67, 0xef, 0x69, 0x1d, 0x9d);
mi.position = -2000006004;
- mi.hIcolibItem = GetIconHandle("poke");
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_POKE);
mi.name.a = LPGEN("Poke");
mi.pszService = "FacebookProto/Poke";
CreateServiceFunction(mi.pszService, GlobalService<&FacebookProto::Poke>);
@@ -139,7 +130,7 @@ void InitContactMenus()
SET_UID(mi, 0x58e75db0, 0xb9e0, 0x4aa8, 0xbb, 0x42, 0x8d, 0x7d, 0xd1, 0xf6, 0x8e, 0x99);
mi.position = -2000006005;
- mi.hIcolibItem = GetIconHandle("conversation"); // TODO: Use better icon
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_CONVERSATION); // TODO: Use better icon
mi.name.a = LPGEN("Load history");
mi.pszService = "FacebookProto/LoadHistory";
CreateServiceFunction(mi.pszService, GlobalService<&FacebookProto::LoadHistory>);
@@ -200,7 +191,7 @@ void FacebookProto::OnBuildProtoMenu()
mi.pszService = "/Mind";
CreateProtoService(mi.pszService, &FacebookProto::OnMind);
mi.name.a = LPGEN("Share status...");
- mi.hIcolibItem = GetIconHandle("mind");
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_MIND);
m_hStatusMind = Menu_AddProtoMenuItem(&mi, m_szModuleName);
mi.pszService = "/VisitProfile";
@@ -229,19 +220,19 @@ void FacebookProto::OnBuildProtoMenu()
mi.pszService = "/CheckNewsfeeds";
CreateProtoService(mi.pszService, &FacebookProto::CheckNewsfeeds);
mi.name.a = LPGEN("Check newsfeeds");
- mi.hIcolibItem = GetIconHandle("newsfeed");
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_NEWSFEED);
Menu_AddProtoMenuItem(&mi, m_szModuleName);
mi.pszService = "/CheckMemories";
CreateProtoService(mi.pszService, &FacebookProto::CheckMemories);
mi.name.a = LPGEN("Check memories");
- mi.hIcolibItem = GetIconHandle("memories");
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_MEMORIES);
Menu_AddProtoMenuItem(&mi, m_szModuleName);
mi.pszService = "/CheckNotifications";
CreateProtoService(mi.pszService, &FacebookProto::CheckNotifications);
mi.name.a = LPGEN("Check notifications");
- mi.hIcolibItem = GetIconHandle("notification");
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_NOTIFICATION);
Menu_AddProtoMenuItem(&mi, m_szModuleName);
}
diff --git a/protocols/FacebookRM/src/theme.h b/protocols/FacebookRM/src/theme.h
index 71dfff4ffb..550816f565 100644
--- a/protocols/FacebookRM/src/theme.h
+++ b/protocols/FacebookRM/src/theme.h
@@ -23,6 +23,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
void InitIcons(void);
-HANDLE GetIconHandle(const char *name);
-
void InitContactMenus(void);