summaryrefslogtreecommitdiff
path: root/plugins/Scriver
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-08-02 18:43:52 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-08-02 18:43:52 +0000
commit685797951c34c866e27b5d24e3bdb9d7867356c5 (patch)
treed3e54ee2b8416b4639ebf7545edb2d81238c9004 /plugins/Scriver
parentf43cfc59f5a300a040b19d36f090e4f4816fcbb1 (diff)
fix for the proper MS_GC_PROTO_GETTOOLTIPTEXT processing in chats
git-svn-id: http://svn.miranda-ng.org/main/trunk@5552 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Scriver')
-rw-r--r--plugins/Scriver/src/chat/window.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp
index b7aa3daa79..96a5676002 100644
--- a/plugins/Scriver/src/chat/window.cpp
+++ b/plugins/Scriver/src/chat/window.cpp
@@ -777,7 +777,6 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, POINT * pt, SESS
static HWND oldParent=NULL;
RECT clientRect;
BOOL bNewTip=FALSE;
- USERINFO *ui1 = NULL;
if (hoveredItem == currentHovered)
return;
@@ -807,28 +806,29 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, POINT * pt, SESS
ti.uId = 1;
ti.rect = clientRect;
- ui1 = SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, currentHovered);
- if (ui1) {
- // /GetChatToolTipText
- // wParam = roomID parentdat->ptszID
- // lParam = userID ui1->pszUID
- if ( ProtoServiceExists(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT))
- ti.lpszText = (TCHAR*)ProtoCallService(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)parentdat->ptszID, (LPARAM)ui1->pszUID);
- else {
- TCHAR ptszBuf[1024];
- mir_sntprintf(ptszBuf, SIZEOF(ptszBuf), _T("%s: %s\r\n%s: %s\r\n%s: %s"),
- TranslateT("Nick name"), ui1->pszNick,
- TranslateT("Unique id"), ui1->pszUID,
- TranslateT("Status"), TM_WordToString( parentdat->pStatuses, ui1->Status));
- ti.lpszText = mir_tstrdup(ptszBuf);
+ TCHAR tszBuf[1024]; tszBuf[0] = 0;
+ USERINFO *ui = SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, currentHovered);
+ if (ui) {
+ if ( ProtoServiceExists(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT)) {
+ TCHAR *p = (TCHAR*)ProtoCallService(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)parentdat->ptszID, (LPARAM)ui->pszUID);
+ if (p != NULL) {
+ _tcsncpy_s(tszBuf, SIZEOF(tszBuf), p, _TRUNCATE);
+ mir_free(p);
+ }
}
+
+ if (tszBuf[0] == 0)
+ mir_sntprintf(tszBuf, SIZEOF(tszBuf), _T("%s: %s\r\n%s: %s\r\n%s: %s"),
+ TranslateT("Nick name"), ui->pszNick,
+ TranslateT("Unique id"), ui->pszUID,
+ TranslateT("Status"), TM_WordToString(parentdat->pStatuses, ui->Status));
+
+ ti.lpszText = tszBuf;
}
- SendMessage( hwndToolTip, bNewTip ? TTM_ADDTOOL : TTM_UPDATETIPTEXT, 0, (LPARAM)&ti);
- SendMessage( hwndToolTip, TTM_ACTIVATE, (ti.lpszText!=NULL) , 0 );
- SendMessage( hwndToolTip, TTM_SETMAXTIPWIDTH, 0 , 400 );
- if (ti.lpszText)
- mir_free(ti.lpszText);
+ SendMessage(hwndToolTip, bNewTip ? TTM_ADDTOOL : TTM_UPDATETIPTEXT, 0, (LPARAM)&ti);
+ SendMessage(hwndToolTip, TTM_ACTIVATE, ti.lpszText != NULL, 0);
+ SendMessage(hwndToolTip, TTM_SETMAXTIPWIDTH, 0 , 400);
}
}