summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern/src/modern_clistmenus.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Clist_modern/src/modern_clistmenus.cpp')
-rw-r--r--plugins/Clist_modern/src/modern_clistmenus.cpp57
1 files changed, 29 insertions, 28 deletions
diff --git a/plugins/Clist_modern/src/modern_clistmenus.cpp b/plugins/Clist_modern/src/modern_clistmenus.cpp
index fdbb006717..d04ae3ce93 100644
--- a/plugins/Clist_modern/src/modern_clistmenus.cpp
+++ b/plugins/Clist_modern/src/modern_clistmenus.cpp
@@ -38,9 +38,8 @@ INT_PTR CloseAction(WPARAM wParam, LPARAM lParam)
int k;
g_CluiData.bSTATE = STATE_PREPEARETOEXIT; // workaround for avatar service and other wich destroys service on OK_TOEXIT
do
- { k = CallService(MS_SYSTEM_OKTOEXIT, 0, 0);
- }
- while (!k);
+ k = CallService(MS_SYSTEM_OKTOEXIT, 0, 0);
+ while (!k);
if (k)
DestroyWindow(pcli->hwndContactList);
@@ -50,7 +49,7 @@ INT_PTR CloseAction(WPARAM wParam, LPARAM lParam)
int InitCustomMenus(void)
{
- CreateServiceFunction("CloseAction", CloseAction );
+ CreateServiceFunction("CloseAction", CloseAction);
LoadFavoriteContactMenu();
return 0;
}
@@ -69,13 +68,13 @@ void UninitCustomMenus(void)
#define CLUI_FAVSETRATE "CLUI/SetContactRate" //LParam is rate, Wparam is contact handle
#define CLUI_FAVTOGGLESHOWOFFLINE "CLUI/ToggleContactShowOffline"
-static HGENMENU hFavoriteContactMenu = NULL;
+static HGENMENU hFavoriteContactMenu = NULL;
static HGENMENU *hFavoriteContactMenuItems = NULL;
-static HGENMENU hShowIfOflineItem = NULL;
+static HGENMENU hShowIfOflineItem = NULL;
static HANDLE hOnContactMenuBuild_FAV = NULL;
-static TCHAR * FAVMENUROOTNAME = LPGENT("&Contact rate");
+static TCHAR *FAVMENUROOTNAME = LPGENT("&Contact rate");
static TCHAR *rates[] = {
LPGENT("None"),
@@ -86,17 +85,17 @@ static TCHAR *rates[] = {
static IconItem iconList[] =
{
- { LPGEN("Contact rate None"), "Rate1", IDI_FAVORITE_0 },
- { LPGEN("Contact rate Low"), "Rate2", IDI_FAVORITE_1 },
- { LPGEN("Contact rate Medium"), "Rate3", IDI_FAVORITE_2 },
- { LPGEN("Contact rate High"), "Rate4", IDI_FAVORITE_3 }
+ { LPGEN("Contact rate none"), "Rate1", IDI_FAVORITE_0 },
+ { LPGEN("Contact rate low"), "Rate2", IDI_FAVORITE_1 },
+ { LPGEN("Contact rate medium"), "Rate3", IDI_FAVORITE_2 },
+ { LPGEN("Contact rate high"), "Rate4", IDI_FAVORITE_3 }
};
static int FAV_OnContactMenuBuild(WPARAM hContact, LPARAM)
{
BYTE bContactRate = db_get_b(hContact, "CList", "Rate", 0);
- if ( bContactRate > SIZEOF(rates)-1)
- bContactRate = SIZEOF(rates)-1;
+ if (bContactRate > SIZEOF(rates) - 1)
+ bContactRate = SIZEOF(rates) - 1;
BOOL bModifyMenu = FALSE;
@@ -109,9 +108,9 @@ static int FAV_OnContactMenuBuild(WPARAM hContact, LPARAM)
mi.ptszName = FAVMENUROOTNAME;
else {
TCHAR *str1 = TranslateTS(FAVMENUROOTNAME), *str2 = TranslateTS(rates[bContactRate]);
- int bufsize = (lstrlen(str1)+lstrlen(str2)+15)*sizeof(TCHAR);
- TCHAR *name = (TCHAR*)_alloca(bufsize);
- mir_sntprintf(name, bufsize/sizeof(TCHAR), _T("%s (%s)"),str1,str2);
+ int bufsize = (lstrlen(str1) + lstrlen(str2) + 15) * sizeof(TCHAR);
+ TCHAR *name = (TCHAR *)_alloca(bufsize);
+ mir_sntprintf(name, bufsize / sizeof(TCHAR), _T("%s (%s)"), str1, str2);
mi.ptszName = name;
mi.flags |= CMIF_KEEPUNTRANSLATED;
}
@@ -124,19 +123,19 @@ static int FAV_OnContactMenuBuild(WPARAM hContact, LPARAM)
}
OptParam op;
- op.Handle = hFavoriteContactMenu;
+ op.Handle = hFavoriteContactMenu;
op.Setting = OPT_MENUITEMSETUNIQNAME;
- op.Value = (INT_PTR)"ModernClistMenu_ContactRate";
+ op.Value = (INT_PTR)"ModernClistMenu_ContactRate";
CallService(MO_SETOPTIONSMENUITEM, 0, (LPARAM)&op);
mi.hParentMenu = hFavoriteContactMenu;
if (!hFavoriteContactMenuItems) {
- hFavoriteContactMenuItems = (HGENMENU*)malloc(sizeof(HANDLE)*SIZEOF(rates));
- memset(hFavoriteContactMenuItems, 0, sizeof(HANDLE)*SIZEOF(rates));
+ hFavoriteContactMenuItems = (HGENMENU *)malloc(sizeof(HANDLE) * SIZEOF(rates));
+ memset(hFavoriteContactMenuItems, 0, sizeof(HANDLE) * SIZEOF(rates));
}
int i;
- for (i=0; i < SIZEOF(rates); i++) {
+ for (i = 0; i < SIZEOF(rates); i++) {
mi.icolibItem = iconList[i].hIcolib;
mi.ptszName = rates[i];
mi.flags = CMIF_CHILDPOPUP | CMIF_TCHAR | ((bContactRate == i) ? CMIF_CHECKED : 0);
@@ -146,20 +145,22 @@ static int FAV_OnContactMenuBuild(WPARAM hContact, LPARAM)
mi.flags |= CMIM_FLAGS | CMIM_ICON;
Menu_ModifyItem(hFavoriteContactMenuItems[i], &mi);
}
- else hFavoriteContactMenuItems[i] = Menu_AddContactMenuItem(&mi);
+ else
+ hFavoriteContactMenuItems[i] = Menu_AddContactMenuItem(&mi);
}
mi.hIcon = NULL;
mi.ptszName = LPGENT("Show even if offline");
mi.flags = CMIF_CHILDPOPUP | CMIF_TCHAR | (db_get_b(hContact, "CList", "noOffline", 0) ? CMIF_CHECKED : 0);
mi.pszService = CLUI_FAVTOGGLESHOWOFFLINE;
- mi.popupPosition = i+100000000;
+ mi.popupPosition = i + 100000000;
mi.position = -100000000;
if (bModifyMenu && hShowIfOflineItem) {
mi.flags |= CMIM_FLAGS | CMIM_ICON;
Menu_ModifyItem(hShowIfOflineItem, &mi);
}
- else hShowIfOflineItem = Menu_AddContactMenuItem(&mi);
+ else
+ hShowIfOflineItem = Menu_AddContactMenuItem(&mi);
return 0;
}
@@ -172,7 +173,7 @@ INT_PTR FAV_SetRate(WPARAM hContact, LPARAM nRate)
return 0;
}
-INT_PTR FAV_ToggleShowOffline(WPARAM hContact,LPARAM lParam)
+INT_PTR FAV_ToggleShowOffline(WPARAM hContact, LPARAM lParam)
{
if (hContact)
db_set_b((MCONTACT)hContact, "CList", "noOffline", !db_get_b((MCONTACT)hContact, "CList", "noOffline", 0));
@@ -184,8 +185,8 @@ int LoadFavoriteContactMenu()
{
Icon_Register(g_hInst, LPGEN("Contact list"), iconList, SIZEOF(iconList));
- CreateServiceFunction(CLUI_FAVSETRATE,FAV_SetRate);
- CreateServiceFunction(CLUI_FAVTOGGLESHOWOFFLINE,FAV_ToggleShowOffline);
+ CreateServiceFunction(CLUI_FAVSETRATE, FAV_SetRate);
+ CreateServiceFunction(CLUI_FAVTOGGLESHOWOFFLINE, FAV_ToggleShowOffline);
hOnContactMenuBuild_FAV = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, FAV_OnContactMenuBuild);
return 0;
}
@@ -196,7 +197,7 @@ int UnloadFavoriteContactMenu()
hFavoriteContactMenuItems = NULL;
if (hFavoriteContactMenu)
- CallService(MO_REMOVEMENUITEM,(WPARAM)hFavoriteContactMenu,0);
+ CallService(MO_REMOVEMENUITEM, (WPARAM)hFavoriteContactMenu, 0);
hFavoriteContactMenu = NULL;
return 0;