diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2013-06-16 07:27:00 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2013-06-16 07:27:00 +0000 |
commit | 0e88c1fc2f51c815e6b2ebd0ad79d5c0d0661a7c (patch) | |
tree | 4ca18985738be30745efac2916ffb7d2feb27e57 /protocols | |
parent | 598bd198b278e05681e79d995f9be56e057832f5 (diff) |
Skype:
- fix for future birthday
- fix for closing chat room sessions on logout
- added some logging
git-svn-id: http://svn.miranda-ng.org/main/trunk@4971 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Skype/src/skype_account.cpp | 8 | ||||
-rw-r--r-- | protocols/Skype/src/skype_chat.cpp | 46 | ||||
-rw-r--r-- | protocols/Skype/src/skype_contacts.cpp | 6 | ||||
-rw-r--r-- | protocols/Skype/src/skype_events.cpp | 2 | ||||
-rw-r--r-- | protocols/Skype/src/skype_instances.cpp | 6 | ||||
-rw-r--r-- | protocols/Skype/src/skype_profile.cpp | 9 | ||||
-rw-r--r-- | protocols/Skype/src/skype_proto.h | 2 |
7 files changed, 64 insertions, 15 deletions
diff --git a/protocols/Skype/src/skype_account.cpp b/protocols/Skype/src/skype_account.cpp index 2642ef0da6..f6b91dd8f4 100644 --- a/protocols/Skype/src/skype_account.cpp +++ b/protocols/Skype/src/skype_account.cpp @@ -126,11 +126,15 @@ void CSkypeProto::LogOut() {
if (this->IsOnline() || this->m_iStatus == ID_STATUS_CONNECTING)
{
- this->account->SetAvailability(CContact::OFFLINE);
+ this->account->SetAvailability(Contact::OFFLINE);
this->Log(L"Logout from account");
this->account->Logout(true);
- this->SetAllContactStatus(ID_STATUS_OFFLINE);
+ if ( !::Miranda_Terminated())
+ {
+ this->SetAllContactStatus(ID_STATUS_OFFLINE);
+ this->CloseAllChatSessions();
+ }
}
}
diff --git a/protocols/Skype/src/skype_chat.cpp b/protocols/Skype/src/skype_chat.cpp index 2c9f45100c..373abebd14 100644 --- a/protocols/Skype/src/skype_chat.cpp +++ b/protocols/Skype/src/skype_chat.cpp @@ -178,6 +178,8 @@ void ChatRoom::CreateChatSession(bool showWindow) gce.ptszStatus = NULL;
::CallServiceSync(MS_GC_EVENT, showWindow ? SESSION_INITDONE : WINDOW_HIDDEN, (LPARAM)&gce);
::CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
+
+ this->ppro->Log(L"Created new chat session %s", this->cid);
}
void ChatRoom::Create(const StringList &invitedMembers, CSkypeProto *ppro, ChatRoomParam *param)
@@ -277,7 +279,10 @@ void ChatRoom::Start(const ConversationRef &conversation, bool showWindow) void ChatRoom::LeaveChat()
{
- this->conversation->RetireFrom();
+ this->ppro->Log(L"Leavind chat session %s", this->cid);
+
+ if (this->conversation->RetireFrom())
+ this->ppro->Log(L"Retired from conversation %s", this->cid);
GCDEST gcd = { ppro->m_szModuleName, { NULL }, GC_EVENT_CONTROL };
gcd.ptszID = this->cid;
@@ -544,9 +549,9 @@ void ChatRoom::OnEvent(const ConversationRef &conversation, const MessageRef &me {
SEString data;
- /*Message::CONSUMPTION_STATUS status;
+ Message::CONSUMPTION_STATUS status;
message->GetPropConsumptionStatus(status);
- if (status == Message::UNCONSUMED_NORMAL)*/
+ if (status != Message::CONSUMED)
{
uint timestamp;
message->GetPropTimestamp(timestamp);
@@ -637,10 +642,12 @@ void ChatRoom::OnEvent(const ConversationRef &conversation, const MessageRef &me {
SEString data;
- /*Message::CONSUMPTION_STATUS status;
+ Message::CONSUMPTION_STATUS status;
message->GetPropConsumptionStatus(status);
- if (status == Message::UNCONSUMED_NORMAL)*/
+ if (status != Message::CONSUMED)
{
+ this->ppro->Log(L"Retired other event for conversation %s", this->cid);
+
uint timestamp;
message->GetPropTimestamp(timestamp);
@@ -677,6 +684,8 @@ void ChatRoom::OnEvent(const ConversationRef &conversation, const MessageRef &me message->GetPropConsumptionStatus(status);
if (status != Message::CONSUMED)
{
+ this->ppro->Log(L"Retired event for conversation %s", this->cid);
+
uint timestamp;
message->GetPropTimestamp(timestamp);
@@ -1082,6 +1091,31 @@ void CSkypeProto::InviteToChatRoom(HANDLE hContact) ::mir_free(gci.pszID);
}
+void CSkypeProto::CloseAllChatSessions()
+{
+ GC_INFO gci = {0};
+ gci.Flags = BYINDEX | ID | DATA;
+ gci.pszModule = this->m_szModuleName;
+
+ int count = ::CallServiceSync(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)this->m_szModuleName);
+ for (int i = 0; i < count ; i++)
+ {
+ gci.iItem = i;
+ if ( !::CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci))
+ {
+ GCDEST gcd = { this->m_szModuleName, { NULL }, GC_EVENT_CONTROL };
+ gcd.ptszID = gci.pszID;
+
+ GCEVENT gce = {0};
+ gce.cbSize = sizeof(GCEVENT);
+ gce.dwFlags = GC_TCHAR;
+ gce.pDest = &gcd;
+ CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce);
+ CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
+ }
+ }
+}
+
ChatRoom *CSkypeProto::FindChatRoom(const wchar_t *cid)
{
GC_INFO gci = {0};
@@ -1151,9 +1185,7 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam) break;*/
case GC_USER_PRIVMESS:
- {
::CallService(MS_MSG_SENDMESSAGE, (WPARAM)this->GetContactBySid(gch->ptszUID), 0);
- }
break;
case GC_USER_LOGMENU:
diff --git a/protocols/Skype/src/skype_contacts.cpp b/protocols/Skype/src/skype_contacts.cpp index 12e4eb4b82..38ce398a23 100644 --- a/protocols/Skype/src/skype_contacts.cpp +++ b/protocols/Skype/src/skype_contacts.cpp @@ -325,7 +325,11 @@ void CSkypeProto::SetAllContactStatus(int status) for (HANDLE hContact = ::db_find_first(this->m_szModuleName); hContact; hContact = ::db_find_next(hContact, this->m_szModuleName))
{
- if (::db_get_b(hContact, this->m_szModuleName, "IsSkypeOut", 0) == 0)
+ if (::db_get_b(hContact, this->m_szModuleName, "IsSkypeOut", 0) != 0)
+ continue;
+ if (this->IsChatRoom(hContact))
+ continue;
+ if (this->IsContactOnline(hContact))
::db_set_w(hContact, this->m_szModuleName, SKYPE_SETTINGS_STATUS, status);
}
diff --git a/protocols/Skype/src/skype_events.cpp b/protocols/Skype/src/skype_events.cpp index dd1c7c7684..2bcece5129 100644 --- a/protocols/Skype/src/skype_events.cpp +++ b/protocols/Skype/src/skype_events.cpp @@ -13,7 +13,7 @@ int CSkypeProto::OnModulesLoaded(WPARAM, LPARAM) bbd.pszModuleName = MODULE;
bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON;
- bbd.ptszTooltip = ::TranslateT("Invite to conference");
+ bbd.ptszTooltip = ::TranslateT("Invite contacts to conference");
bbd.hIcon = CSkypeProto::GetIconHandle("confInvite");
bbd.dwButtonID = BBB_ID_CONF_INVITE;
bbd.dwDefPos = 100 + bbd.dwButtonID;
diff --git a/protocols/Skype/src/skype_instances.cpp b/protocols/Skype/src/skype_instances.cpp index c3d8adea64..c0a6ed0bd6 100644 --- a/protocols/Skype/src/skype_instances.cpp +++ b/protocols/Skype/src/skype_instances.cpp @@ -28,7 +28,7 @@ CSkypeProto* CSkypeProto::InitSkypeProto(const char* protoName, const wchar_t* u }
char *keyPair = ppro->LoadKeyPair();
- if ( !keyPair)
+ if (keyPair == NULL)
{
CSkypeProto::ShowNotification(::TranslateT("Initialization key corrupted or not valid."), MB_ICONERROR);
return NULL;
@@ -37,7 +37,9 @@ CSkypeProto* CSkypeProto::InitSkypeProto(const char* protoName, const wchar_t* u TransportInterface::Status status = ppro->init(keyPair, "127.0.0.1", ppro->skypeKitPort, 0, 1);
if (status != TransportInterface::OK)
{
- CSkypeProto::ShowNotification(::TranslateT("SkypeKit did not initialize."), MB_ICONERROR);
+ wchar_t message[256];
+ ::mir_sntprintf(message, SIZEOF(message), ::TranslateT("SkypeKit did not initialize (%d)."), status);
+ CSkypeProto::ShowNotification(message, MB_ICONERROR);
return NULL;
}
diff --git a/protocols/Skype/src/skype_profile.cpp b/protocols/Skype/src/skype_profile.cpp index cc7583dda6..d7b12d1acd 100644 --- a/protocols/Skype/src/skype_profile.cpp +++ b/protocols/Skype/src/skype_profile.cpp @@ -71,12 +71,17 @@ void CSkypeProto::UpdateProfileBirthday(SEObject *obj, HANDLE hContact) INT day, month, year;
_stscanf(date, _T("%04d%02d%02d"), &year, &month, &day);
+ SYSTEMTIME sToday = {0};
+ GetLocalTime(&sToday);
+
+ if (sToday.wYear > year) return;
+ else if(sToday.wYear == year && sToday.wMonth > month) return;
+ else if(sToday.wYear == year && sToday.wMonth == month && sToday.wDay >= day) return;
+
::db_set_b(hContact, this->m_szModuleName, "BirthDay", day);
::db_set_b(hContact, this->m_szModuleName, "BirthMonth", month);
::db_set_w(hContact, this->m_szModuleName, "BirthYear", year);
- SYSTEMTIME sToday = {0};
- GetLocalTime(&sToday);
int nAge = sToday.wYear - year;
if (sToday.wMonth < month || (sToday.wMonth == month && sToday.wDay < day))
nAge--;
diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index ff0971c4ea..71c1d8ca4a 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -292,6 +292,8 @@ protected: void StartChat(StringList &invitedContacts);
void InviteToChatRoom(HANDLE hContact);
+ void CloseAllChatSessions();
+
ChatRoom *FindChatRoom(const wchar_t *cid);
void DeleteChatRoom(HANDLE hContact);
|