summaryrefslogtreecommitdiff
path: root/plugins/FavContacts/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/FavContacts/src')
-rw-r--r--plugins/FavContacts/src/headers.h4
-rw-r--r--plugins/FavContacts/src/main.cpp24
2 files changed, 10 insertions, 18 deletions
diff --git a/plugins/FavContacts/src/headers.h b/plugins/FavContacts/src/headers.h
index 59d3693926..5e9771fd6e 100644
--- a/plugins/FavContacts/src/headers.h
+++ b/plugins/FavContacts/src/headers.h
@@ -52,14 +52,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <m_idle.h>
#include <m_awaymsg.h>
#include <m_avatars.h>
-#include <m_toolbar.h>
+#include <m_toptoolbar.h>
#include <m_fontservice.h>
#include <m_hotkeys.h>
#include "../resource.h"
-#define NEWTSTR_ALLOCA(A) (A==NULL)?NULL:_tcscpy((TCHAR*)alloca(sizeof(TCHAR)*(_tcslen(A)+1)),A)
-
struct Options
{
BYTE bSecondLine;
diff --git a/plugins/FavContacts/src/main.cpp b/plugins/FavContacts/src/main.cpp
index d1bfd4ee2a..7f844cbeb0 100644
--- a/plugins/FavContacts/src/main.cpp
+++ b/plugins/FavContacts/src/main.cpp
@@ -121,20 +121,16 @@ static __forceinline COLORREF sttShadeColor(COLORREF clLine1, COLORREF clBack)
);
}
-HANDLE hhkProcessTBLoaded = NULL;
int ProcessTBLoaded(WPARAM wParam, LPARAM lParam)
{
- TBButton button = {0};
+ TTBButton button = {0};
button.cbSize = sizeof(button);
- button.pszButtonID = "FavContacts/ShowMenu";
button.pszTooltipUp = button.pszTooltipUp =
- button.pszButtonName = "Favourite Contacts";
- button.pszServiceName = MS_FAVCONTACTS_SHOWMENU;
- button.defPos = 200;
- button.tbbFlags = TBBF_SHOWTOOLTIP|TBBF_VISIBLE;
- button.hSecondaryIconHandle = button.hPrimaryIconHandle = (HANDLE)g_icoFavourite;
- CallService(MS_TB_ADDBUTTON, 0, (LPARAM)&button);
-
+ button.name = LPGEN("Favourite Contacts");
+ button.pszService = MS_FAVCONTACTS_SHOWMENU;
+ button.dwFlags = TTBBF_SHOWTOOLTIP | TTBBF_VISIBLE;
+ button.hIconHandleDn = button.hIconHandleUp = (HANDLE)g_icoFavourite;
+ TopToolbar_AddButton(&button);
return 0;
}
@@ -177,6 +173,8 @@ int ProcessReloadFonts(WPARAM wParam, LPARAM lParam)
int ProcessModulesLoaded(WPARAM wParam, LPARAM lParam)
{
+ HookEvent(ME_TTB_MODULELOADED, ProcessTBLoaded);
+
if (ServiceExists(MS_MSG_ADDICON)) {
StatusIconData sid = {0};
sid.cbSize = sizeof(sid);
@@ -263,16 +261,13 @@ int ProcessModulesLoaded(WPARAM wParam, LPARAM lParam)
hotkey.DefHotKey = MAKEWORD('Q', HOTKEYF_EXT);
Hotkey_Register(&hotkey);
- if (ServiceExists(MS_AV_GETAVATARBITMAP))
- {
+ if (ServiceExists(MS_AV_GETAVATARBITMAP)) {
HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
for ( ; hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
if (DBGetContactSettingByte(hContact, "FavContacts", "IsFavourite", 0))
CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hContact, 0);
}
- if (!hhkProcessTBLoaded) hhkProcessTBLoaded = HookEvent(ME_TB_MODULELOADED, ProcessTBLoaded);
-
return 0;
}
@@ -327,7 +322,6 @@ extern "C" __declspec(dllexport) int Load(void)
HookEvent(ME_OPT_INITIALISE, ProcessOptInitialise);
HookEvent(ME_SYSTEM_MODULESLOADED, ProcessModulesLoaded);
- hhkProcessTBLoaded = HookEvent(ME_TB_MODULELOADED, ProcessTBLoaded);
/////////////////////////////////////////////////////////////////////////////////////