From 1b6b7ac88e07f1e7122d6f792927e077256c27da Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Thu, 4 Jul 2013 12:05:12 +0000 Subject: added tooltip creation for group chats git-svn-id: http://svn.miranda-ng.org/main/trunk@5231 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/src/skype.h | 1 + protocols/Skype/src/skype_chat.cpp | 55 ++++++++++++++++++++++++++++++++++ protocols/Skype/src/skype_proto.h | 1 + protocols/Skype/src/skype_services.cpp | 3 ++ 4 files changed, 60 insertions(+) (limited to 'protocols') diff --git a/protocols/Skype/src/skype.h b/protocols/Skype/src/skype.h index 84aec32161..d27c7564ab 100644 --- a/protocols/Skype/src/skype.h +++ b/protocols/Skype/src/skype.h @@ -40,6 +40,7 @@ #include #include #include + #include #include 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(""), TranslateTS(tszTitle), _T("\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 diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index e640686f31..8629f5b63f 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -327,6 +327,7 @@ protected: // chat void InitChatModule(); + INT_PTR __cdecl SkypeGCGetToolTipText(WPARAM wParam, LPARAM lParam); bool IsChatRoom(HANDLE hContact); diff --git a/protocols/Skype/src/skype_services.cpp b/protocols/Skype/src/skype_services.cpp index 5ab0deb67f..01e598727e 100644 --- a/protocols/Skype/src/skype_services.cpp +++ b/protocols/Skype/src/skype_services.cpp @@ -1,4 +1,5 @@ #include "skype.h" +#include void CSkypeProto::InitServiceList() { @@ -19,4 +20,6 @@ void CSkypeProto::InitInstanceServiceList() this->CreateServiceObj(PS_GETAVATARCAPS, &CSkypeProto::GetAvatarCaps); this->CreateServiceObj(PS_GETMYAVATART, &CSkypeProto::GetMyAvatar); this->CreateServiceObj(PS_SETMYAVATART, &CSkypeProto::SetMyAvatar); + // service to get from protocol chat buddy info + this->CreateServiceObj(MS_GC_PROTO_GETTOOLTIPTEXT, &CSkypeProto::SkypeGCGetToolTipText); } -- cgit v1.2.3