summaryrefslogtreecommitdiff
path: root/protocols/Skype
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2012-10-23 18:30:46 +0000
committerAlexander Lantsev <aunsane@gmail.com>2012-10-23 18:30:46 +0000
commit368f94af7740623a97c2c51c1a7d1a3f15593f1d (patch)
treecbb2d80054070f2ef08f4948a31f25ca20bb43f1 /protocols/Skype
parente2bbd04dc810a27ee78a64b7c41f5fa2fea10988 (diff)
- fixed som errors
- second approach to UserIsTyping git-svn-id: http://svn.miranda-ng.org/main/trunk@2062 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype')
-rw-r--r--protocols/Skype/src/skype_contacts.cpp22
-rw-r--r--protocols/Skype/src/skype_icons.cpp12
-rw-r--r--protocols/Skype/src/skype_menus.cpp6
-rw-r--r--protocols/Skype/src/skype_proto.cpp27
-rw-r--r--protocols/Skype/src/skype_proto.h2
5 files changed, 40 insertions, 29 deletions
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; i<SIZEOF(iconList); i++)
+ for (size_t i = 0; i < SIZEOF(CSkypeProto::iconList); i++)
{
- if(strcmp(iconList[i].Name, name) == 0)
- return iconList[i].Handle;
+ if (::strcmp(CSkypeProto::iconList[i].Name, name) == 0)
+ return CSkypeProto::iconList[i].Handle;
}
return 0;
}
void CSkypeProto::UninitIcons()
{
- for (int i = 0; i < SIZEOF(iconList); i++)
+ for (size_t i = 0; i < SIZEOF(CSkypeProto::iconList); i++)
{
- ::Skin_RemoveIcon(iconList[i].Name);
+ ::Skin_RemoveIcon(CSkypeProto::iconList[i].Name);
}
} \ No newline at end of file
diff --git a/protocols/Skype/src/skype_menus.cpp b/protocols/Skype/src/skype_menus.cpp
index 128862dc03..7e92097b06 100644
--- a/protocols/Skype/src/skype_menus.cpp
+++ b/protocols/Skype/src/skype_menus.cpp
@@ -106,7 +106,7 @@ void CSkypeProto::InitMenus()
mi.ptszName = LPGENT("Request authorization");
mi.flags = CMIF_ICONFROMICOLIB | CMIF_TCHAR;
mi.position = -2000001000;
- mi.icolibItem = GetIconHandle("authReuest");
+ mi.icolibItem = CSkypeProto::GetIconHandle("authReuest");
mi.pszService = "Skype/ReqAuth";
g_hContactMenuItems[CMI_AUTH_REQUEST] = Menu_AddContactMenuItem(&mi);
g_hContactMenuSvc[CMI_AUTH_REQUEST] = CreateServiceFunction(mi.pszService, SkypeMenuHandleRequestAuth);
@@ -115,7 +115,7 @@ void CSkypeProto::InitMenus()
mi.pszService = "Skype/GrantAuth";
mi.ptszName = LPGENT("Grant authorization");
mi.position = -2000001001;
- mi.icolibItem = GetIconHandle("authGrant");
+ mi.icolibItem = CSkypeProto::GetIconHandle("authGrant");
g_hContactMenuItems[CMI_AUTH_GRANT] = Menu_AddContactMenuItem(&mi);
g_hContactMenuSvc[CMI_AUTH_GRANT] = CreateServiceFunction(mi.pszService, SkypeMenuHandleGrantAuth);
@@ -123,7 +123,7 @@ void CSkypeProto::InitMenus()
mi.pszService = "Skype/RevokeAuth";
mi.ptszName = LPGENT("Revoke authorization");
mi.position = -2000001002;
- mi.icolibItem = GetIconHandle("authRevoke");
+ mi.icolibItem = CSkypeProto::GetIconHandle("authRevoke");
g_hContactMenuItems[CMI_AUTH_REVOKE] = Menu_AddContactMenuItem(&mi);
g_hContactMenuSvc[CMI_AUTH_REVOKE] = CreateServiceFunction(mi.pszService, SkypeMenuRevokeAuth);
}
diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp
index c0d59c087e..3b6ee25f25 100644
--- a/protocols/Skype/src/skype_proto.cpp
+++ b/protocols/Skype/src/skype_proto.cpp
@@ -225,6 +225,7 @@ int __cdecl CSkypeProto::RecvFile( HANDLE hContact, PROTORECVFILET* ) { retur
int __cdecl CSkypeProto::RecvMsg( HANDLE hContact, PROTORECVEVENT* pre)
{
+ this->UserIsTyping(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();