summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/Skype/src/skype_account.cpp24
-rw-r--r--protocols/Skype/src/skype_proto.cpp34
-rw-r--r--protocols/Skype/src/skype_proto.h3
3 files changed, 30 insertions, 31 deletions
diff --git a/protocols/Skype/src/skype_account.cpp b/protocols/Skype/src/skype_account.cpp
index 7396785e7a..44b01e9216 100644
--- a/protocols/Skype/src/skype_account.cpp
+++ b/protocols/Skype/src/skype_account.cpp
@@ -103,7 +103,7 @@ bool CSkypeProto::PreparePassword()
bool CSkypeProto::LogIn()
{
- if (this->IsOnline()|| !this->PrepareLogin())
+ if (this->IsOnline() || !this->PrepareLogin())
return false;
if (g_skype->GetAccount(::mir_u2a(this->login), this->account))
@@ -133,7 +133,6 @@ void CSkypeProto::LogOut()
this->account->SetAvailability(CContact::OFFLINE);
this->account->Logout(true);
- this->m_iStatus = ID_STATUS_OFFLINE;
this->SetAllContactStatus(ID_STATUS_OFFLINE);
}
}
@@ -229,7 +228,26 @@ void CSkypeProto::OnLoggedIn()
fetch(this->transferList);
- this->SetStatus(this->m_iDesiredStatus);
+ this->SetServerStatus(this->m_iDesiredStatus);
+}
+
+void CSkypeProto::SetServerStatus(int iNewStatus)
+{
+ if (!this->account)
+ return;
+
+ // change status
+ if (m_iStatus == iNewStatus)
+ return;
+
+ int oldStatus = m_iStatus;
+ m_iStatus = iNewStatus;
+
+ CContact::AVAILABILITY availability = this->MirandaToSkypeStatus(iNewStatus);
+ if (availability != CContact::UNKNOWN)
+ this->account->SetAvailability(availability);
+
+ this->SendBroadcast(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, this->m_iStatus);
}
void CSkypeProto::OnCblUpdated()
diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp
index ac28c0a6e2..faf7a980e0 100644
--- a/protocols/Skype/src/skype_proto.cpp
+++ b/protocols/Skype/src/skype_proto.cpp
@@ -375,22 +375,7 @@ int __cdecl CSkypeProto::SetApparentMode( HANDLE hContact, int mode ) { retur
int CSkypeProto::SetStatus(int new_status)
{
- /*switch (new_status)
- {
- case ID_STATUS_OCCUPIED:
- new_status = ID_STATUS_DND;
- break;
- case ID_STATUS_FREECHAT:
- new_status = ID_STATUS_ONLINE;
- break;
- case ID_STATUS_ONTHEPHONE:
- case ID_STATUS_OUTTOLUNCH:
- case ID_STATUS_NA:
- new_status = ID_STATUS_AWAY;
- break;
- }*/
-
- if (new_status == this->m_iStatus)
+ if (new_status == this->m_iDesiredStatus)
return 0;
int old_status = this->m_iStatus;
@@ -399,6 +384,8 @@ int CSkypeProto::SetStatus(int new_status)
if (new_status == ID_STATUS_OFFLINE)
{
this->LogOut();
+ this->m_iStatus = this->m_iDesiredStatus = ID_STATUS_OFFLINE;
+ this->SendBroadcast(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
}
else
{
@@ -410,20 +397,13 @@ int CSkypeProto::SetStatus(int new_status)
}
else
{
- if ( !this->account->IsOnline())
- return 0;
-
- CContact::AVAILABILITY availability = this->MirandaToSkypeStatus(new_status);
- if (availability != CContact::UNKNOWN)
- {
- this->account->SetAvailability(availability);
- this->m_iStatus = new_status;
- }
+ if ( this->account->IsOnline())
+ SetServerStatus(new_status);
+ else
+ SendBroadcast(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
}
}
- this->SetSettingWord("Status", this->m_iStatus);
- this->SendBroadcast(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, this->m_iStatus);
return 0;
}
diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h
index a93101c926..c58e0fe581 100644
--- a/protocols/Skype/src/skype_proto.h
+++ b/protocols/Skype/src/skype_proto.h
@@ -306,7 +306,7 @@ protected:
bool IsChatRoom(HANDLE hContact);
HANDLE GetChatRoomByCid(const wchar_t *cid);
- HANDLE AddChatRoom(CConversation::Ref conversation);
+ HANDLE AddChatRoom(CConversation::Ref conversation);
wchar_t *CSkypeProto::GetChatUsers(const wchar_t *cid);
void CSkypeProto::UpdateChatUserStatus(CContact::Ref contact);
@@ -406,6 +406,7 @@ protected:
static char *RemoveHtml(const char *data);
+ void SetServerStatus(int iStatus);
int SkypeToMirandaStatus(CContact::AVAILABILITY availability);
CContact::AVAILABILITY MirandaToSkypeStatus(int status);