diff options
| -rw-r--r-- | include/m_clistint.h | 5 | ||||
| -rw-r--r-- | plugins/Clist_modern/src/hdr/modern_clist.h | 1 | ||||
| -rw-r--r-- | plugins/Clist_modern/src/hdr/modern_commonprototypes.h | 2 | ||||
| -rw-r--r-- | plugins/Clist_modern/src/init.cpp | 1 | ||||
| -rw-r--r-- | plugins/Clist_modern/src/modern_clc.cpp | 8 | ||||
| -rw-r--r-- | plugins/Clist_modern/src/modern_clcitems.cpp | 4 | ||||
| -rw-r--r-- | plugins/Clist_modern/src/modern_clcpaint.cpp | 70 | ||||
| -rw-r--r-- | plugins/Clist_modern/src/modern_clistevents.cpp | 6 | ||||
| -rw-r--r-- | plugins/Clist_modern/src/modern_clistmod.cpp | 37 | ||||
| -rw-r--r-- | plugins/Clist_modern/src/modern_clistsettings.cpp | 10 | ||||
| -rw-r--r-- | plugins/Clist_modern/src/modern_contact.cpp | 2 | ||||
| -rw-r--r-- | src/modules/clist/clc.h | 1 | ||||
| -rw-r--r-- | src/modules/clist/clistcore.cpp | 2 | ||||
| -rw-r--r-- | src/modules/clist/clistmod.cpp | 11 | 
14 files changed, 71 insertions, 89 deletions
diff --git a/include/m_clistint.h b/include/m_clistint.h index 6f341464e3..7b3681d72c 100644 --- a/include/m_clistint.h +++ b/include/m_clistint.h @@ -470,6 +470,11 @@ typedef struct  	 *************************************************************************************/
  	void   (*pfnReloadExtraIcons)(void);
  	void   (*pfnSetAllExtraIcons)(HWND hwndList,HANDLE hContact);
 +
 +	/*************************************************************************************
 +	 * Miranda NG additions
 +	 *************************************************************************************/
 +	int    (*pfnGetContactIcon)(HANDLE hContact);
  }
  	CLIST_INTERFACE;
 diff --git a/plugins/Clist_modern/src/hdr/modern_clist.h b/plugins/Clist_modern/src/hdr/modern_clist.h index 6a62ea3924..9e44332162 100644 --- a/plugins/Clist_modern/src/hdr/modern_clist.h +++ b/plugins/Clist_modern/src/hdr/modern_clist.h @@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  #define _CLIST_H_
  void LoadContactTree(void);
 -int ExtIconFromStatusMode(HANDLE hContact, const char *szProto,int status);
  HTREEITEM GetTreeItemByHContact(HANDLE hContact);
  void cli_ChangeContactIcon(HANDLE hContact,int iIcon,int add);
  int GetContactInfosForSort(HANDLE hContact,char **Proto,TCHAR **Name,int *Status);
 diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h index 9b2970ec06..19f2d1d3d2 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h @@ -220,7 +220,6 @@ int     ClcDoProtoAck(HANDLE wParam,ACKDATA * ack);  int     ModernSkinButtonDeleteAll();                                                   //modernbutton.c
  int     GetAverageMode( void );                                                   //clisttray.c
  int     GetContactCachedStatus(HANDLE hContact);                                 //clistsettings.c
 -INT_PTR GetContactIcon(WPARAM wParam,LPARAM lParam);                              //clistmod.c
  int     GetContactIconC(ClcCacheEntry *cacheEntry);                           //clistmod.c
  int     GetContactIndex(ClcGroup *group,ClcContact *contact);               //clcidents.c
  int     GetStatusForContact(HANDLE hContact,char *szProto);                           //clistsettings.c
 @@ -287,6 +286,7 @@ int     cliGetGroupContentsCount(ClcGroup *group, int visibleOnly);  int     cliFindRowByText(HWND hwnd, ClcData *dat, const TCHAR *text, int prefixOk);
  int     cliGetRowsPriorTo(ClcGroup *group,ClcGroup *subgroup,int contactIndex);
  int     cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact);
 +int     cli_GetContactIcon(HANDLE hContact);
  int     cli_RemoveEvent(HANDLE hContact, HANDLE hDbEvent);
  void    cli_AddContactToTree(HWND hwnd,ClcData *dat,HANDLE hContact,int updateTotalCount,int checkHideOffline);
  void    cli_DeleteItemFromTree(HWND hwnd, HANDLE hItem);
 diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp index 5d2bc8c7fd..ed6ac90cd1 100644 --- a/plugins/Clist_modern/src/init.cpp +++ b/plugins/Clist_modern/src/init.cpp @@ -191,6 +191,7 @@ static HRESULT SubclassClistInterface()  	pcli->pfnFindRowByText         = cliFindRowByText;
  	//partialy overloaded - call default handlers from inside
 +	pcli->pfnGetContactIcon        = cli_GetContactIcon;
  	pcli->pfnIconFromStatusMode    = cli_IconFromStatusMode;
  	pcli->pfnLoadCluiGlobalOpts    = CLUI_cli_LoadCluiGlobalOpts;
  	pcli->pfnSortCLC               = cli_SortCLC;
 diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index c4b1973a12..15e8300427 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -1505,7 +1505,7 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wP  	BOOL needRepaint = FALSE;
  	WORD status;
  	RECT iconRect = {0};
 -	int contacticon = CallService(MS_CLIST_GETCONTACTICON, wParam, 1);
 +	int contacticon = corecli.pfnGetContactIcon((HANDLE)wParam);
  	HANDLE hSelItem = NULL;
  	ClcContact *selcontact = NULL;
 @@ -1522,7 +1522,7 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wP  	bool isVisiblebyFilter  = (( ( style & CLS_SHOWHIDDEN ) && nHiddenStatus != -1 ) || !nHiddenStatus );
  	bool ifVisibleByClui    = !pcli->pfnIsHiddenMode( dat, status );
  	bool isVisible          = g_CluiData.bFilterEffective&CLVM_FILTER_STATUS ? TRUE : ifVisibleByClui;
 -	bool isIconChanged      = CallService(MS_CLIST_GETCONTACTICON, wParam, 0) != LOWORD(lParam);
 +	bool isIconChanged      = cli_GetContactIcon((HANDLE)wParam) != LOWORD(lParam);
  	shouldShow              = isVisiblebyFilter	 &&   ( isVisible || isIconChanged ) ;
 @@ -1706,13 +1706,13 @@ static LRESULT clcOnIntmStatusChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM  			pdnce___SetStatus( pdnce, GetStatusForContact(pdnce->hContact,pdnce->m_cache_cszProto));
  			if ( !dat->force_in_dialog && (dat->second_line_show || dat->third_line_show))
  				gtaRenewText(pdnce->hContact);
 -			SendMessage(hwnd,INTM_ICONCHANGED, wParam, (LPARAM) CallService(MS_CLIST_GETCONTACTICON, wParam, 1));
 +			SendMessage(hwnd,INTM_ICONCHANGED, wParam, corecli.pfnGetContactIcon((HANDLE)wParam));
  			ClcContact *contact;
  			if ( FindItem(hwnd,dat,(HANDLE)wParam,&contact,NULL,NULL,TRUE)) {
  				if (contact && contact->type == CLCIT_CONTACT) {
  					if ( !contact->image_is_special && pdnce___GetStatus( pdnce ) > ID_STATUS_OFFLINE)
 -						contact->iImage = CallService(MS_CLIST_GETCONTACTICON, wParam, 1);
 +						contact->iImage = corecli.pfnGetContactIcon((HANDLE)wParam);
  					if (contact->isSubcontact && contact->subcontacts && contact->subcontacts->type == CLCIT_CONTACT)
  						pcli->pfnClcBroadcast( INTM_STATUSCHANGED,(WPARAM)contact->subcontacts->hContact,0); //forward status changing to host meta contact
  				}
 diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 4dd41f3120..35a4eed2fe 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -55,7 +55,7 @@ void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup)  			p.avatar_pos = AVATAR_POS_DONT_HAVE;
  			Cache_GetAvatar(dat, &p);
 -			p.iImage = CallService(MS_CLIST_GETCONTACTICON,(WPARAM)cacheEntry->hContact,1);
 +			p.iImage = corecli.pfnGetContactIcon(cacheEntry->hContact);
  			memset(p.iExtraImage, 0xFF, sizeof(p.iExtraImage));
  			p.proto = cacheEntry->m_cache_cszProto;		
  			p.type = CLCIT_CONTACT;
 @@ -204,7 +204,7 @@ static void _LoadDataToContact(ClcContact *cont, ClcGroup *group, ClcData *dat,  	Cache_GetAvatar(dat,cont);
  	Cache_GetText(dat,cont,1);
  	Cache_GetTimezone(dat,cont->hContact);
 -	cont->iImage = CallService(MS_CLIST_GETCONTACTICON,(WPARAM)hContact,1);
 +	cont->iImage = corecli.pfnGetContactIcon(hContact);
  	cont->bContactRate = db_get_b(hContact, "CList", "Rate",0);
  }
 diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index de90016af7..cb56dfbee8 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -1515,24 +1515,19 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact  								}
  							case SETTING_AVATAR_OVERLAY_TYPE_PROTOCOL:
  								{
 -									int item;
 -
 -									item = ExtIconFromStatusMode( Drawing->hContact, Drawing->proto, 
 -										Drawing->proto == NULL ? ID_STATUS_OFFLINE : GetContactCachedStatus( Drawing->hContact ));
 -									if ( item != -1 )
 -										_DrawStatusIcon( Drawing, dat, item, hdcMem, 
 -										p_rect.left,  p_rect.top, ICON_HEIGHT, ICON_HEIGHT, 
 -										CLR_NONE, CLR_NONE, ( blendmode == 255 )?ILD_NORMAL:( blendmode == 128 )?ILD_BLEND50:ILD_BLEND25 );
 -									break;
 +									int item = pcli->pfnIconFromStatusMode(Drawing->proto, Drawing->proto == NULL ? ID_STATUS_OFFLINE : GetContactCachedStatus(Drawing->hContact), Drawing->hContact);
 +									if (item != -1)
 +										_DrawStatusIcon(Drawing, dat, item, hdcMem, 
 +											p_rect.left,  p_rect.top, ICON_HEIGHT, ICON_HEIGHT, 
 +											CLR_NONE, CLR_NONE, ( blendmode == 255 )?ILD_NORMAL:( blendmode == 128 )?ILD_BLEND50:ILD_BLEND25 );
  								}
 +								break;
  							case SETTING_AVATAR_OVERLAY_TYPE_CONTACT:
 -								{
 -									if ( Drawing->iImage != -1 )
 -										_DrawStatusIcon( Drawing, dat, Drawing->iImage, hdcMem, 
 +								if ( Drawing->iImage != -1 )
 +									_DrawStatusIcon( Drawing, dat, Drawing->iImage, hdcMem, 
  										p_rect.left,  p_rect.top, ICON_HEIGHT, ICON_HEIGHT, 
  										CLR_NONE, CLR_NONE, ( blendmode == 255 )?ILD_NORMAL:( blendmode == 128 )?ILD_BLEND50:ILD_BLEND25 );
 -									break;
 -								}
 +								break;
  							}
  						}
  					}
 @@ -2956,20 +2951,18 @@ void CLCPaint::_DrawContactAvatar( HDC hdcMem, ClcData *dat, ClcContact *Drawing  		if (dat->avatars_draw_overlay && dat->avatars_maxheight_size >= ICON_HEIGHT + (dat->avatars_draw_border ? 2 : 0)
  			&&  GetContactCachedStatus(Drawing->hContact) - ID_STATUS_OFFLINE < SIZEOF(g_pAvatarOverlayIcons))
  		{
 -			switch( dat->avatars_overlay_type )
 -			{
 +			switch(dat->avatars_overlay_type) {
  			case SETTING_AVATAR_OVERLAY_TYPE_NORMAL:
  				overlayIdx = g_pAvatarOverlayIcons[GetContactCachedStatus( Drawing->hContact ) - ID_STATUS_OFFLINE].listID;
  				break;
  			case SETTING_AVATAR_OVERLAY_TYPE_PROTOCOL:
 -				overlayIdx = ExtIconFromStatusMode( Drawing->hContact, Drawing->proto, 
 -					Drawing->proto == NULL ? ID_STATUS_OFFLINE : GetContactCachedStatus( Drawing->hContact ));
 +				overlayIdx = pcli->pfnIconFromStatusMode(Drawing->proto, Drawing->proto == NULL ? ID_STATUS_OFFLINE : GetContactCachedStatus(Drawing->hContact), Drawing->hContact);
  				break;
  			case SETTING_AVATAR_OVERLAY_TYPE_CONTACT:
  				overlayIdx = Drawing->iImage;
  				break;
  			}
 -		}                                   
 +		}
  		_GetBlendMode( dat, Drawing, selected, hottrack, GIM_AVATAR_AFFECT, NULL, &blendmode );
  		AniAva_SetAvatarPos( Drawing->hContact, prcItem, overlayIdx, blendmode );
  		AniAva_RenderAvatar( Drawing->hContact, hdcMem, prcItem );
 @@ -3029,42 +3022,33 @@ void CLCPaint::_DrawContactAvatar( HDC hdcMem, ClcData *dat, ClcContact *Drawing  			&&  GetContactCachedStatus(Drawing->hContact) - ID_STATUS_OFFLINE < SIZEOF(g_pAvatarOverlayIcons))
  		{
  			POINT ptOverlay = { prcItem->right-ICON_HEIGHT, prcItem->bottom-ICON_HEIGHT };
 -			if ( dat->avatars_draw_border )
 -			{
 +			if ( dat->avatars_draw_border ) {
  				ptOverlay.x--;
  				ptOverlay.y--;
  			}
 -			switch( dat->avatars_overlay_type )
 -			{
 +			switch( dat->avatars_overlay_type ) {
  			case SETTING_AVATAR_OVERLAY_TYPE_NORMAL:
 -				{
 -					ske_ImageList_DrawEx( hAvatarOverlays, g_pAvatarOverlayIcons[GetContactCachedStatus( Drawing->hContact ) - ID_STATUS_OFFLINE].listID, 
 -						hdcMem, 
 -						ptOverlay.x, ptOverlay.y, ICON_HEIGHT, ICON_HEIGHT, 
 -						CLR_NONE, CLR_NONE, 
 -						( blendmode == 255 )?ILD_NORMAL:( blendmode == 128 )?ILD_BLEND50:ILD_BLEND25 );
 -					break;
 -				}
 +				ske_ImageList_DrawEx( hAvatarOverlays, g_pAvatarOverlayIcons[GetContactCachedStatus( Drawing->hContact ) - ID_STATUS_OFFLINE].listID, 
 +					hdcMem, 
 +					ptOverlay.x, ptOverlay.y, ICON_HEIGHT, ICON_HEIGHT, 
 +					CLR_NONE, CLR_NONE, 
 +					( blendmode == 255 )?ILD_NORMAL:( blendmode == 128 )?ILD_BLEND50:ILD_BLEND25 );
 +				break;
  			case SETTING_AVATAR_OVERLAY_TYPE_PROTOCOL:
  				{
 -					int item;
 -
 -					item = ExtIconFromStatusMode( Drawing->hContact, Drawing->proto, 
 -						Drawing->proto == NULL ? ID_STATUS_OFFLINE : GetContactCachedStatus( Drawing->hContact ));
 +					int item = pcli->pfnIconFromStatusMode(Drawing->proto, Drawing->proto == NULL ? ID_STATUS_OFFLINE : GetContactCachedStatus(Drawing->hContact), Drawing->hContact);
  					if ( item != -1 )
  						_DrawStatusIcon( Drawing, dat, item, hdcMem, 
 -						ptOverlay.x, ptOverlay.y, ICON_HEIGHT, ICON_HEIGHT, 
 -						CLR_NONE, CLR_NONE, ( blendmode == 255 )?ILD_NORMAL:( blendmode == 128 )?ILD_BLEND50:ILD_BLEND25 );
 -					break;
 +							ptOverlay.x, ptOverlay.y, ICON_HEIGHT, ICON_HEIGHT, 
 +							CLR_NONE, CLR_NONE, ( blendmode == 255 )?ILD_NORMAL:( blendmode == 128 )?ILD_BLEND50:ILD_BLEND25 );
  				}
 +				break;
  			case SETTING_AVATAR_OVERLAY_TYPE_CONTACT:
 -				{
 -					if ( Drawing->iImage != -1 )
 -						_DrawStatusIcon( Drawing, dat, Drawing->iImage, hdcMem, 
 +				if ( Drawing->iImage != -1 )
 +					_DrawStatusIcon( Drawing, dat, Drawing->iImage, hdcMem, 
  						ptOverlay.x, ptOverlay.y, ICON_HEIGHT, ICON_HEIGHT, 
  						CLR_NONE, CLR_NONE, ( blendmode == 255 )?ILD_NORMAL:( blendmode == 128 )?ILD_BLEND50:ILD_BLEND25 );
 -					break;
 -				}
 +				break;
  			}
  		}
  	}
 diff --git a/plugins/Clist_modern/src/modern_clistevents.cpp b/plugins/Clist_modern/src/modern_clistevents.cpp index 7778b24724..8768318a3d 100644 --- a/plugins/Clist_modern/src/modern_clistevents.cpp +++ b/plugins/Clist_modern/src/modern_clistevents.cpp @@ -341,7 +341,7 @@ static int EventArea_DrawWorker(HWND hWnd, HDC hDC)  	rc.left += 26; 
  	if (g_CluiData.hUpdateContact != 0) {
  		TCHAR *szName = pcli->pfnGetContactDisplayName(g_CluiData.hUpdateContact, 0);
 -		int iIcon = CallService(MS_CLIST_GETCONTACTICON, (WPARAM) g_CluiData.hUpdateContact, 0);
 +		int iIcon = cli_GetContactIcon(g_CluiData.hUpdateContact);
  		ske_ImageList_DrawEx(g_himlCListClc, iIcon, hDC, rc.left, (rc.bottom + rc.top - GetSystemMetrics(SM_CYSMICON)) / 2, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), CLR_NONE, CLR_NONE, ILD_NORMAL);
  		rc.left += 18;
 @@ -359,7 +359,7 @@ static int EventArea_DrawWorker(HWND hWnd, HDC hDC)  		GetMenuItemInfo(g_CluiData.hMenuNotify, iCount - 1, TRUE, &mii);
  		nmi = (struct NotifyMenuItemExData *) mii.dwItemData;
  		szName = pcli->pfnGetContactDisplayName(nmi->hContact, 0);
 -		iIcon = CallService(MS_CLIST_GETCONTACTICON, (WPARAM) nmi->hContact, 0);
 +		iIcon = cli_GetContactIcon(nmi->hContact);
  		ske_ImageList_DrawEx(g_himlCListClc, iIcon, hDC, rc.left, (rc.bottom + rc.top - GetSystemMetrics(SM_CYSMICON)) / 2, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), CLR_NONE, CLR_NONE, ILD_NORMAL);
  		rc.left += 18;
  		ske_ImageList_DrawEx(g_himlCListClc, nmi->iIcon, hDC, 4, (rc.bottom + rc.top) / 2 - 8, 16, 16, CLR_NONE, CLR_NONE, ILD_NORMAL);
 @@ -486,7 +486,7 @@ static LRESULT CALLBACK EventArea_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LP  				if (GetMenuItemInfoA(g_CluiData.hMenuNotify, (UINT) dis->itemID, FALSE, &mii) != 0) {
  					nmi = (NotifyMenuItemExData *) mii.dwItemData;
  					if (nmi) {
 -						int iIcon = CallService(MS_CLIST_GETCONTACTICON, (WPARAM) nmi->hContact, 0);                        
 +						int iIcon = cli_GetContactIcon(nmi->hContact);                        
  						ske_ImageList_DrawEx(g_himlCListClc, nmi->iIcon, dis->hDC, 2, (dis->rcItem.bottom + dis->rcItem.top - GetSystemMetrics(SM_CYSMICON)) / 2, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), CLR_NONE, CLR_NONE, ILD_NORMAL);
  						ske_ImageList_DrawEx(g_himlCListClc, iIcon, dis->hDC, 2+GetSystemMetrics(SM_CXSMICON)+2, (dis->rcItem.bottom + dis->rcItem.top - GetSystemMetrics(SM_CYSMICON)) / 2, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), CLR_NONE, CLR_NONE, ILD_NORMAL);
  						return TRUE;
 diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp index 75bfc5a271..f3da87eae2 100644 --- a/plugins/Clist_modern/src/modern_clistmod.cpp +++ b/plugins/Clist_modern/src/modern_clistmod.cpp @@ -87,12 +87,7 @@ HICON cliGetIconFromStatusMode(HANDLE hContact, const char *szProto,int status)  		}
  	}
 -	return ske_ImageList_GetIcon(g_himlCListClc,ExtIconFromStatusMode(hContact,szProto,status),ILD_NORMAL);
 -}
 -
 -int ExtIconFromStatusMode(HANDLE hContact, const char *szProto,int status)
 -{
 -	return pcli->pfnIconFromStatusMode(szProto,status,hContact);
 +	return ske_ImageList_GetIcon(g_himlCListClc,pcli->pfnIconFromStatusMode(szProto,status,hContact),ILD_NORMAL);
  }
  int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact)
 @@ -134,29 +129,22 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact)  	return corecli.pfnIconFromStatusMode(szProto,nStatus,NULL);
  }
 -int GetContactIconC(ClcCacheEntry *cacheEntry)
 +int cli_GetContactIcon(HANDLE hContact)
  {
 -	return ExtIconFromStatusMode(cacheEntry->hContact,cacheEntry->m_cache_cszProto,cacheEntry->m_cache_cszProto == NULL ? ID_STATUS_OFFLINE : pdnce___GetStatus( cacheEntry ));
 +	int res = corecli.pfnGetContactIcon(hContact);
 +	if (res != -1)
 +		res &= 0xFFFF;
 +	return res;
  }
 -//lParam
 -// 0 - default - return icon id in order: transport status icon, protostatus icon, meta is affected
 -
 -
 -INT_PTR GetContactIcon(WPARAM wParam,LPARAM lParam)
 +int GetContactIconC(ClcCacheEntry *p)
  {
 -	int status;
 -	char *szProto = GetContactProto((HANDLE)wParam);
 -	if (szProto == NULL)
 -		status = ID_STATUS_OFFLINE;
 -	else
 -		status = db_get_w((HANDLE) wParam, szProto, "Status", ID_STATUS_OFFLINE);
 -	int res = ExtIconFromStatusMode((HANDLE)wParam,szProto,szProto == NULL?ID_STATUS_OFFLINE:status); //by FYR
 -	if (lParam == 0 && res != -1)
 -		res &= 0xFFFF;
 -	return res;
 +	return pcli->pfnIconFromStatusMode(p->m_cache_cszProto,p->m_cache_cszProto == NULL ? ID_STATUS_OFFLINE : pdnce___GetStatus(p), p->hContact);
  }
 +//lParam
 +// 0 - default - return icon id in order: transport status icon, protostatus icon, meta is affected
 +
  void UnLoadContactListModule()  //unhooks noncritical events
  {
  	UninitTrayMenu();
 @@ -203,7 +191,6 @@ HRESULT PreLoadContactListModule()  	//initialize firstly hooks
  	//clist interface is empty yet so handles should check
 -	CreateServiceFunction(MS_CLIST_GETCONTACTICON, GetContactIcon);
  	CreateServiceFunction(MS_CLUI_GETCAPS, GetCapsService);
  	// catch langpack events
 @@ -237,8 +224,6 @@ HRESULT  CluiLoadModule()  	CreateServiceFunction(MS_CLIST_TOGGLESOUNDS,ToggleSounds);
  	CreateServiceFunction(MS_CLIST_SETUSEGROUPS,SetUseGroups);
 -	CreateServiceFunction(MS_CLIST_GETCONTACTICON,GetContactIcon);
 -
  	MySetProcessWorkingSetSize = (BOOL (WINAPI*)(HANDLE,SIZE_T,SIZE_T))GetProcAddress(GetModuleHandle(_T("kernel32")),"SetProcessWorkingSetSize");
  	hCListImages = ImageList_Create(16, 16, ILC_MASK|ILC_COLOR32, 32, 0);
  	InitCustomMenus();
 diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp index 2a89d42954..4dd9db47cb 100644 --- a/plugins/Clist_modern/src/modern_clistsettings.cpp +++ b/plugins/Clist_modern/src/modern_clistsettings.cpp @@ -418,7 +418,7 @@ int ContactAdded(WPARAM wParam,LPARAM lParam)  {
  	if ( !MirandaExiting()) {
  		HANDLE hContact = (HANDLE)wParam;
 -		cli_ChangeContactIcon(hContact,ExtIconFromStatusMode(hContact,(char*)GetContactCachedProtocol(hContact),ID_STATUS_OFFLINE),1); ///by FYR
 +		cli_ChangeContactIcon(hContact,pcli->pfnIconFromStatusMode((char*)GetContactCachedProtocol(hContact),ID_STATUS_OFFLINE,hContact),1); ///by FYR
  		pcli->pfnSortContacts();
  	}
  	return 0;
 @@ -468,7 +468,7 @@ int ContactSettingChanged(WPARAM wParam,LPARAM lParam)  					amRequestAwayMsg(hContact);  
  				pcli->pfnClcBroadcast(INTM_STATUSCHANGED, wParam, 0);
 -				cli_ChangeContactIcon(hContact, ExtIconFromStatusMode(hContact,cws->szModule, cws->value.wVal), 0); //by FYR
 +				cli_ChangeContactIcon(hContact, pcli->pfnIconFromStatusMode(cws->szModule, cws->value.wVal, hContact), 0); //by FYR
  				pcli->pfnSortContacts();
  			}
  			else {
 @@ -495,7 +495,8 @@ int ContactSettingChanged(WPARAM wParam,LPARAM lParam)  			InvalidateDNCEbyPointer(hContact,pdnce,cws->value.type);		
  			if (cws->value.type == DBVT_DELETED || cws->value.bVal == 0) {
  				char *szProto = GetContactProto((HANDLE)wParam);
 -				cli_ChangeContactIcon(hContact,ExtIconFromStatusMode(hContact,szProto,szProto == NULL?ID_STATUS_OFFLINE:db_get_w(hContact,szProto,"Status",ID_STATUS_OFFLINE)),1);  //by FYR
 +				cli_ChangeContactIcon(hContact,pcli->pfnIconFromStatusMode(szProto, 
 +					szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact,szProto,"Status",ID_STATUS_OFFLINE), hContact),1);  //by FYR
  			}
  			pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
  		}
 @@ -508,7 +509,8 @@ int ContactSettingChanged(WPARAM wParam,LPARAM lParam)  		if ( !strcmp(cws->szSetting,"p")) {
  			InvalidateDNCEbyPointer(hContact,pdnce,cws->value.type);	
  			char *szProto = (cws->value.type == DBVT_DELETED) ? NULL : cws->value.pszVal;
 -			cli_ChangeContactIcon(hContact,ExtIconFromStatusMode(hContact,szProto,szProto == NULL?ID_STATUS_OFFLINE:db_get_w(hContact,szProto,"Status",ID_STATUS_OFFLINE)),0); //by FYR
 +			cli_ChangeContactIcon(hContact,pcli->pfnIconFromStatusMode(szProto, 
 +				szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact,szProto,"Status",ID_STATUS_OFFLINE), hContact), 0);
  		}
  	}
 diff --git a/plugins/Clist_modern/src/modern_contact.cpp b/plugins/Clist_modern/src/modern_contact.cpp index 180b4a2939..29db1d8e81 100644 --- a/plugins/Clist_modern/src/modern_contact.cpp +++ b/plugins/Clist_modern/src/modern_contact.cpp @@ -174,7 +174,7 @@ INT_PTR ContactChangeGroup(WPARAM wParam,LPARAM lParam)  		db_unset((HANDLE)wParam,"CList","Group");
  	else
  		db_set_ws((HANDLE)wParam,"CList","Group",pcli->pfnGetGroupName(lParam, NULL));
 -	CallService(MS_CLUI_CONTACTADDED,wParam,ExtIconFromStatusMode((HANDLE)wParam,GetContactProto((HANDLE)wParam),GetContactStatus((HANDLE)wParam)));
 +	CallService(MS_CLUI_CONTACTADDED, wParam, pcli->pfnIconFromStatusMode(GetContactProto((HANDLE)wParam),GetContactStatus((HANDLE)wParam),(HANDLE)wParam));
  	return 0;
  }
 diff --git a/src/modules/clist/clc.h b/src/modules/clist/clc.h index 1e259be92d..215e0eaec7 100644 --- a/src/modules/clist/clc.h +++ b/src/modules/clist/clc.h @@ -146,6 +146,7 @@ int   fnGetImlIconIndex(HICON hIcon);  int   fnRemoveEvent(HANDLE hContact, HANDLE dbEvent);
  /* clistmod.c */
 +int    fnGetContactIcon(HANDLE hContact);
  int    fnIconFromStatusMode(const char *szProto, int status, HANDLE hContact);
  int    fnShowHide(WPARAM wParam, LPARAM lParam);
  HICON  fnGetIconFromStatusMode(HANDLE hContact, const char *szProto, int status);
 diff --git a/src/modules/clist/clistcore.cpp b/src/modules/clist/clistcore.cpp index 3979e73cfc..31d7ab129b 100644 --- a/src/modules/clist/clistcore.cpp +++ b/src/modules/clist/clistcore.cpp @@ -211,6 +211,8 @@ static INT_PTR srvRetrieveInterface(WPARAM, LPARAM)  		cli.pfnReloadExtraIcons                = fnReloadExtraIcons;
  		cli.pfnSetAllExtraIcons                = fnSetAllExtraIcons;
 +		cli.pfnGetContactIcon                  = fnGetContactIcon;
 +
  		rc = LoadContactListModule2();
  		if (rc == 0)
  			rc = LoadCLCModule();
 diff --git a/src/modules/clist/clistmod.cpp b/src/modules/clist/clistmod.cpp index e25dcad0d3..75e63a242f 100644 --- a/src/modules/clist/clistmod.cpp +++ b/src/modules/clist/clistmod.cpp @@ -181,15 +181,18 @@ int fnIconFromStatusMode(const char *szProto, int status, HANDLE)  	return 1;
  }
 -static INT_PTR GetContactIcon(WPARAM wParam, LPARAM)
 +int fnGetContactIcon(HANDLE hContact)
  {
 -	char *szProto = GetContactProto((HANDLE)wParam);
 -	HANDLE hContact = (HANDLE)wParam;
 -
 +	char *szProto = GetContactProto(hContact);
  	return cli.pfnIconFromStatusMode(szProto,
  		szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact);
  }
 +static INT_PTR GetContactIcon(WPARAM wParam, LPARAM)
 +{
 +	return cli.pfnGetContactIcon((HANDLE)wParam);
 +}
 +
  static void AddProtoIconIndex(PROTOACCOUNT* pa)
  {
  	ProtoIconIndex *pii = new ProtoIconIndex;
  | 
