From 368f94af7740623a97c2c51c1a7d1a3f15593f1d Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Tue, 23 Oct 2012 18:30:46 +0000 Subject: - fixed som errors - second approach to UserIsTyping git-svn-id: http://svn.miranda-ng.org/main/trunk@2062 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/src/skype_contacts.cpp | 22 +++++++++++----------- protocols/Skype/src/skype_icons.cpp | 12 ++++++------ protocols/Skype/src/skype_menus.cpp | 6 +++--- protocols/Skype/src/skype_proto.cpp | 27 +++++++++++++++++++-------- protocols/Skype/src/skype_proto.h | 2 +- 5 files changed, 40 insertions(+), 29 deletions(-) (limited to 'protocols/Skype') diff --git a/protocols/Skype/src/skype_contacts.cpp b/protocols/Skype/src/skype_contacts.cpp index 8a11a38eb2..e1d21ef8f8 100644 --- a/protocols/Skype/src/skype_contacts.cpp +++ b/protocols/Skype/src/skype_contacts.cpp @@ -417,7 +417,7 @@ void CSkypeProto::UpdateContactLanguages(HANDLE hContact, CContact::Ref contact) for (int i = 0; i < SIZEOF(languages); i++) if ( lstrcmpiA((char*)isocode, languages[i].ISOcode) == 0) { - this->SetSettingString(hContact, "Language1", languages[i].szName); + this->SetSettingString(hContact, "Language1", ::mir_a2u(languages[i].szName)); break; } } @@ -505,22 +505,22 @@ void CSkypeProto::UpdateContactTimezone(HANDLE hContact, CContact::Ref contact) if (data > 0) { uint diffmin = (data - 24*3600) / 60; - TCHAR sign[2]; + wchar_t sign[2]; if (diffmin < 0) - sign = _T("-"); + ::wcscpy(sign, L"-"); else - sign = _T("+"); - uint hours = abs(diffmin / 60); - uint mins = abs(diffmin % 60); - TCHAR timeshift[7]; - mir_sntprinf(timeshift, SIZEOF(timeshift), _T("%s%d:%02d"), sign, hours, mins); + ::wcscpy(sign, L"+"); + uint hours = ::abs((int)(diffmin / 60)); + uint mins = ::abs((int)(diffmin % 60)); + wchar_t timeshift[7]; + ::mir_sntprintf(timeshift, SIZEOF(timeshift), _T("%s%d:%02d"), sign, hours, mins); - LPCTSTR szMin = _tcschr(timeshift, ':'); - int nTz = _ttoi(timeshift) * -2; + wchar_t *szMin = wcschr(timeshift, ':'); + int nTz = ::_wtoi(timeshift) * -2; nTz += (nTz < 0 ? -1 : 1) * (szMin ? _ttoi( szMin + 1 ) / 30 : 0); TIME_ZONE_INFORMATION tzinfo; - if (GetTimeZoneInformation(&tzinfo) == TIME_ZONE_ID_DAYLIGHT) + if (::GetTimeZoneInformation(&tzinfo) == TIME_ZONE_ID_DAYLIGHT) nTz -= tzinfo.DaylightBias / 30; this->SetSettingByte(hContact, "Timezone", (signed char)nTz); diff --git a/protocols/Skype/src/skype_icons.cpp b/protocols/Skype/src/skype_icons.cpp index f9661572ce..3c20e742e7 100644 --- a/protocols/Skype/src/skype_icons.cpp +++ b/protocols/Skype/src/skype_icons.cpp @@ -34,20 +34,20 @@ void CSkypeProto::InitIcons() } } -HANDLE GetIconHandle(const char* name) +HANDLE CSkypeProto::GetIconHandle(const char* name) { - for(size_t i=0; iUserIsTyping(hContact, PROTOTYPE_SELFTYPING_OFF); return ::Proto_RecvMessage(hContact, pre); } @@ -313,15 +314,25 @@ int __cdecl CSkypeProto::SetAwayMsg( int m_iStatus, const TCHAR* msg ) { retu int __cdecl CSkypeProto::UserIsTyping( HANDLE hContact, int type ) { - // todo: rewrite - CConversation::Ref conversation; - g_skype->GetConversationByIdentity(::mir_u2a(this->GetSettingString(hContact, "sid")), conversation); - if (conversation) - { - Message::Ref message; - conversation->SetMyTextStatusTo(Participant::WRITING); + if (hContact && this->IsOnline() && this->m_iStatus != ID_STATUS_INVISIBLE) + { + CConversation::Ref conversation; + g_skype->GetConversationByIdentity(::mir_u2a(this->GetSettingString(hContact, "sid")), conversation); + if (conversation) + { + switch (type) + { + case PROTOTYPE_SELFTYPING_ON: + conversation->SetMyTextStatusTo(Participant::WRITING); + return 0; + + case PROTOTYPE_SELFTYPING_OFF: + conversation->SetMyTextStatusTo(Participant::READING); // mb TEXT_UNKNOWN? + return 0; + } + } } - return 0; + return 1; } int __cdecl CSkypeProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam) diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index 93a7f8a53c..9bedb853a8 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -96,7 +96,7 @@ public: // icons static void InitIcons(); static void UninitIcons(); - HANDLE GetIconHandle(const char *name); + static HANDLE GetIconHandle(const char *name); // menus static void InitMenus(); -- cgit v1.2.3