From 1e737f420221294c6b35bb3ef10a4e1fdf982a9f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 27 Aug 2013 19:50:58 +0000 Subject: fix for displaying account names in Chat's popus git-svn-id: http://svn.miranda-ng.org/main/trunk@5866 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdchat/src/chat.h | 1 + src/core/stdchat/src/main.cpp | 3 +++ src/core/stdchat/src/manager.cpp | 2 +- src/core/stdchat/src/tools.cpp | 30 +++++++++++++++--------------- 4 files changed, 20 insertions(+), 16 deletions(-) (limited to 'src/core/stdchat') diff --git a/src/core/stdchat/src/chat.h b/src/core/stdchat/src/chat.h index ea4debd0a4..e496c6489a 100644 --- a/src/core/stdchat/src/chat.h +++ b/src/core/stdchat/src/chat.h @@ -51,6 +51,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#include #include #include #include diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp index edb254145a..75435f57db 100644 --- a/src/core/stdchat/src/main.cpp +++ b/src/core/stdchat/src/main.cpp @@ -21,6 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "chat.h" //globals +CLIST_INTERFACE *pcli; + HINSTANCE g_hInst; HANDLE g_hWindowList; HMENU g_hMenu = NULL; @@ -80,6 +82,7 @@ extern "C" __declspec(dllexport) int Load(void) { // set the memory & utf8 managers mir_getLP( &pluginInfo ); + mir_getCLI(); UpgradeCheck(); diff --git a/src/core/stdchat/src/manager.cpp b/src/core/stdchat/src/manager.cpp index a42b6f244a..cb8b4ae096 100644 --- a/src/core/stdchat/src/manager.cpp +++ b/src/core/stdchat/src/manager.cpp @@ -1325,7 +1325,7 @@ USERINFO* UM_AddUser(STATUSINFO* pStatusList, USERINFO** ppUserList, const TCHAR { USERINFO * pTemp = *ppUserList, *pLast = NULL; - if (!pStatusList || !ppUserList || !ppUserList) + if (!pStatusList || !ppUserList) return NULL; while(pTemp && UM_CompareItem(pTemp, pszNick, wStatus) <= 0) diff --git a/src/core/stdchat/src/tools.cpp b/src/core/stdchat/src/tools.cpp index ce06d7e015..01af1e84c6 100644 --- a/src/core/stdchat/src/tools.cpp +++ b/src/core/stdchat/src/tools.cpp @@ -93,12 +93,12 @@ static void __stdcall ShowRoomFromPopup(void * pi) ShowRoom(si, WINDOW_VISIBLE, TRUE); } -static INT_PTR CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_COMMAND: if (HIWORD(wParam) == STN_CLICKED) { - SESSION_INFO* si = (SESSION_INFO*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd,0);; + SESSION_INFO *si = (SESSION_INFO*) PUGetPluginData(hWnd); CallFunctionAsync(ShowRoomFromPopup, si); @@ -108,7 +108,7 @@ static INT_PTR CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA break; case WM_CONTEXTMENU: { - SESSION_INFO* si = (SESSION_INFO*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd,0); + SESSION_INFO *si = (SESSION_INFO*) PUGetPluginData(hWnd); if (si->hContact) if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0)) CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)"chaticon"); @@ -116,14 +116,14 @@ static INT_PTR CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA if (si->hWnd && KillTimer(si->hWnd, TIMERID_FLASHWND)) FlashWindow(si->hWnd, FALSE); - PUDeletePopup( hWnd ); + PUDeletePopup(hWnd); } break; } return DefWindowProc(hWnd, message, wParam, lParam); } -static int ShowPopup (HANDLE hContact, SESSION_INFO* si, HICON hIcon, char* pszProtoName, TCHAR* pszRoomName, COLORREF crBkg, const TCHAR* fmt, ...) +static int ShowPopup(HANDLE hContact, SESSION_INFO* si, HICON hIcon, char* pszProtoName, TCHAR* pszRoomName, COLORREF crBkg, const TCHAR* fmt, ...) { POPUPDATAT pd = {0}; va_list marker; @@ -139,13 +139,16 @@ static int ShowPopup (HANDLE hContact, SESSION_INFO* si, HICON hIcon, char* psz pd.lchContact = hContact; if ( hIcon ) - pd.lchIcon = hIcon ; + pd.lchIcon = hIcon; else pd.lchIcon = LoadIconEx( "window", FALSE ); - mir_sntprintf(pd.lptzContactName, MAX_CONTACTNAME-1, _T("%S - %s"), - pszProtoName, CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR )); - lstrcpyn( pd.lptzText, TranslateTS(szBuf), MAX_SECONDLINE-1); + PROTOACCOUNT *pa = ProtoGetAccount(pszProtoName); + mir_sntprintf(pd.lptzContactName, MAX_CONTACTNAME-1, _T("%s - %s"), + (pa == NULL) ? _A2T(pszProtoName) : pa->tszAccountName, + pcli->pfnGetContactDisplayName(hContact, 0)); + + lstrcpyn( pd.lptzText, TranslateTS(szBuf), MAX_SECONDLINE); pd.iSeconds = g_Settings.iPopupTimeout; if (g_Settings.iPopupStyle == 2) { @@ -161,7 +164,7 @@ static int ShowPopup (HANDLE hContact, SESSION_INFO* si, HICON hIcon, char* psz pd.colorText = crBkg; } - pd.PluginWindowProc = (WNDPROC)PopupDlgProc; + pd.PluginWindowProc = PopupDlgProc; pd.PluginData = si; return PUAddPopupT(&pd); } @@ -284,16 +287,13 @@ static BOOL DoPopup(SESSION_INFO* si, GCEVENT * gce) BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO* si, GCEVENT * gce, BOOL bHighlight, int bManyFix) { - BOOL bInactive; - int iEvent; - if (!gce || !si || gce->bIsMe || si->iType == GCW_SERVER) return FALSE; - bInactive = si->hWnd == NULL || GetForegroundWindow() != si->hWnd; + BOOL bInactive = si->hWnd == NULL || GetForegroundWindow() != si->hWnd; // bInactive |= GetActiveWindow() != si->hWnd; // Removed this, because it seemed to be FALSE, even when window was focused, causing incorrect notifications - iEvent = gce->pDest->iType; + int iEvent = gce->pDest->iType; if ( bHighlight ) { gce->pDest->iType |= GC_EVENT_HIGHLIGHT; -- cgit v1.2.3