diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2013-07-04 12:05:12 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2013-07-04 12:05:12 +0000 |
commit | 1b6b7ac88e07f1e7122d6f792927e077256c27da (patch) | |
tree | 8de94bb82fae3a73a291350e940277c0e11ae255 /protocols/Skype/src/skype_chat.cpp | |
parent | 173c419faeb1c726f84127627dc8860f7538f5cf (diff) |
added tooltip creation for group chats
git-svn-id: http://svn.miranda-ng.org/main/trunk@5231 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src/skype_chat.cpp')
-rw-r--r-- | protocols/Skype/src/skype_chat.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/protocols/Skype/src/skype_chat.cpp b/protocols/Skype/src/skype_chat.cpp index a16fdf0d73..cde19dac34 100644 --- a/protocols/Skype/src/skype_chat.cpp +++ b/protocols/Skype/src/skype_chat.cpp @@ -1720,3 +1720,58 @@ void CSkypeProto::OnConversationListChange( void CSkypeProto::ChatRoomParseUriComands(const wchar_t *commands)
{
}
+
+static void appendString(bool bIsTipper, const TCHAR *tszTitle, const TCHAR *tszValue, TCHAR* buf, size_t bufSize)
+{
+ if (*buf) {
+ const TCHAR *szSeparator = (bIsTipper) ? _T("\n") : ((IsWinVerMEPlus()) ? _T("\r\n") : _T(" | "));
+ _tcsncat(buf, szSeparator, bufSize);
+ }
+
+ size_t len = _tcslen(buf);
+ buf += len;
+ bufSize -= len;
+
+ if (bIsTipper)
+ mir_sntprintf(buf, bufSize, _T("%s%s%s%s"), _T("<b>"), TranslateTS(tszTitle), _T("</b>\t"), tszValue);
+ else {
+ TCHAR* p = TranslateTS(tszTitle);
+ mir_sntprintf(buf, bufSize, _T("%s%s\t%s"), p, _tcslen(p)<=7 ? _T("\t") : _T(""), tszValue);
+ }
+}
+
+INT_PTR __cdecl CSkypeProto::SkypeGCGetToolTipText(WPARAM wParam, LPARAM lParam)
+{
+ if ( !wParam || !lParam)
+ return 0; //room global tooltip not supported yet
+
+ ChatRoom *room = this->FindChatRoom((TCHAR *)wParam);
+ if (room == NULL)
+ return 0; //no room found
+
+ ChatMember *member = room->FindChatMember((TCHAR *)lParam);
+ if (member == NULL)
+ return 0; //no contact found
+
+ // ok process info output will be:
+ // Skype name: sid
+ // Nick: Nickname
+ // Status: StatusText
+ // Role: Moderator
+
+ TCHAR outBuf[2048];
+ outBuf[0]=_T('\0');
+
+ bool bIsTipper = db_get_b(NULL, "Tab_SRMsg", "adv_TipperTooltip", 0) && ServiceExists("mToolTip/HideTip");
+
+ //sid
+ appendString(bIsTipper, _T("Skype name:"), member->GetSid(), outBuf, SIZEOF(outBuf));
+ //nick
+ appendString(bIsTipper, _T("Nick:"), member->GetNick(), outBuf, SIZEOF(outBuf));
+ //status
+ appendString(bIsTipper, _T("Status:"), (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,(WPARAM)member->GetStatus(),GSMDF_TCHAR), outBuf, SIZEOF(outBuf));
+ //role
+ appendString(bIsTipper, _T("Role:"), ::TranslateW(ChatRoom::Roles[member->GetRank()]), outBuf, SIZEOF(outBuf));
+
+ return (INT_PTR)(outBuf[0] == 0 ? NULL : mir_tstrdup(outBuf));
+}
\ No newline at end of file |