diff options
Diffstat (limited to 'plugins/Clist_modern')
-rw-r--r-- | plugins/Clist_modern/src/modern_clc.cpp | 4 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clistmenus.cpp | 25 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clistsettings.cpp | 4 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_commonprototypes.h | 2 |
4 files changed, 34 insertions, 1 deletions
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 2e9646681d..4d92425f45 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -1611,6 +1611,10 @@ static int clcHookModulesLoaded(WPARAM, LPARAM) HookEvent(ME_SMILEYADD_OPTIONSCHANGED, clcHookSmileyAddOptionsChanged);
}
+ // Set initial value for all contacts
+ for (auto &hContact : Contacts())
+ SetRateExtraIcon(hContact, -1, FALSE);
+
CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("List background")"/CLC"), 0);
CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("Menu background")"/Menu"), 0);
CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("Status bar background")"/StatusBar"), 0);
diff --git a/plugins/Clist_modern/src/modern_clistmenus.cpp b/plugins/Clist_modern/src/modern_clistmenus.cpp index 802cad6cd7..deb29d1a92 100644 --- a/plugins/Clist_modern/src/modern_clistmenus.cpp +++ b/plugins/Clist_modern/src/modern_clistmenus.cpp @@ -35,6 +35,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define CLUI_FAVSETRATE "CLUI/SetContactRate" //LParam is rate, Wparam is contact handle
#define CLUI_FAVTOGGLESHOWOFFLINE "CLUI/ToggleContactShowOffline"
+static HANDLE hExtraIcon = nullptr;
+
static wchar_t *FAVMENUROOTNAME = LPGENW("&Contact rate");
static wchar_t *rates[] = {
@@ -126,6 +128,27 @@ void UnloadFavoriteContactMenu() /////////////////////////////////////////////////////////////////////////////////////////
+void SetRateExtraIcon(MCONTACT hContact, int bRate, BOOL clear)
+{
+ if (hContact == NULL)
+ return;
+
+ if (bRate < 0)
+ bRate = db_get_b(hContact, "CList", "Rate", 0);
+
+ const char *icon = nullptr;
+ switch (bRate) {
+ case 1: icon = "Rate2"; break;
+ case 2: icon = "Rate3"; break;
+ case 3: icon = "Rate4"; break;
+ }
+
+ if (icon != nullptr || clear)
+ ExtraIcon_SetIconByName(hExtraIcon, hContact, icon);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
static INT_PTR CloseAction(WPARAM, LPARAM)
{
g_CluiData.bSTATE = STATE_PREPARETOEXIT; // workaround for avatar service and other wich destroys service on OK_TOEXIT
@@ -139,6 +162,8 @@ int InitCustomMenus(void) g_plugin.registerIcon(LPGEN("Contact list"), iconList);
+ hExtraIcon = ExtraIcon_RegisterIcolib("contact_rate", LPGEN("Contact rate"), "Rate4");
+
CreateServiceFunction(CLUI_FAVSETRATE, FAV_SetRate);
CreateServiceFunction(CLUI_FAVTOGGLESHOWOFFLINE, FAV_ToggleShowOffline);
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, FAV_OnContactMenuBuild);
diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp index c786522386..0f5ea19bb5 100644 --- a/plugins/Clist_modern/src/modern_clistsettings.cpp +++ b/plugins/Clist_modern/src/modern_clistsettings.cpp @@ -159,8 +159,10 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) if (!strcmp(cws->szModule, "CList")) {
// name is null or (setting is myhandle)
- if (!strcmp(cws->szSetting, "Rate"))
+ if (!strcmp(cws->szSetting, "Rate")) {
+ SetRateExtraIcon(hContact, cws->value.type == DBVT_DELETED ? 0 : cws->value.bVal);
Clist_Broadcast(CLM_AUTOREBUILD, 0, 0);
+ }
else if (!strcmp(cws->szSetting, "NotOnList"))
pdnce->NotOnList = cws->value.bVal;
diff --git a/plugins/Clist_modern/src/modern_commonprototypes.h b/plugins/Clist_modern/src/modern_commonprototypes.h index 69c0264136..d84b89c2a3 100644 --- a/plugins/Clist_modern/src/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/modern_commonprototypes.h @@ -189,6 +189,8 @@ void UnloadAvatarOverlayIcon(); / void UnLoadContactListModule(); //clistmod.c
void UpdateAllAvatars(ClcData *dat); //cache_func.c
+void SetRateExtraIcon(MCONTACT hContact, int bRate = -1, BOOL clear = TRUE);
+
void ApplyViewMode(const char *Name);
void SaveViewMode(const char *name, const wchar_t *szGroupFilter, const char *szProtoFilter, unsigned dwStatusMask, unsigned dwStickyStatusMask,
unsigned stickies, unsigned options, unsigned operators, unsigned lmdat);
|