diff options
Diffstat (limited to 'protocols/SkypeWeb')
-rw-r--r-- | protocols/SkypeWeb/src/skype_login.cpp | 30 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.cpp | 37 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.h | 4 |
3 files changed, 40 insertions, 31 deletions
diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index 94faff30d8..396798b6dc 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -17,8 +17,34 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
+void CSkypeProto::CheckConvert()
+{
+ m_szSkypename = getMStringA(SKYPE_SETTINGS_ID);
+ if (m_szSkypename.IsEmpty()) {
+ m_szSkypename = getMStringA(SKYPE_SETTINGS_LOGIN);
+ if (!m_szSkypename.IsEmpty()) { // old settings format, need to update all settings
+ m_szSkypename.Insert(0, "8:");
+ setString(SKYPE_SETTINGS_ID, m_szSkypename);
+
+ for (auto &hContact : AccContacts()) {
+ CMStringA id(ptrA(getUStringA(hContact, "Skypename")));
+ if (!id.IsEmpty())
+ setString(hContact, SKYPE_SETTINGS_ID, (isChatRoom(hContact)) ? "19:" + id : "8:" + id);
+
+ ptrW wszNick(getWStringA(hContact, "Nick"));
+ if (wszNick == nullptr)
+ setUString(hContact, "Nick", id);
+
+ delSetting(hContact, "Skypename");
+ }
+ }
+ }
+}
+
void CSkypeProto::Login()
{
+ CheckConvert();
+
// login
m_iStatus = ID_STATUS_CONNECTING;
StartQueue();
@@ -107,6 +133,10 @@ void CSkypeProto::OnLoginSuccess() m_bThreadsTerminated = false;
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_SUCCESS, NULL, 0);
+ int oldStatus = m_iStatus;
+ m_iStatus = m_iDesiredStatus;
+ ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
+
m_szApiToken = getStringA("TokenSecret");
m_impl.m_heartBeat.StartSafe(600 * 1000);
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 8bf269e682..f146b1ebdf 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -57,27 +57,7 @@ CSkypeProto::CSkypeProto(const char* protoName, const wchar_t* userName) : m_hPollingThread = ForkThreadEx(&CSkypeProto::PollingThread, NULL, NULL);
- m_szSkypename = getMStringA(SKYPE_SETTINGS_ID);
- if (m_szSkypename.IsEmpty()) {
- m_szSkypename = getMStringA(SKYPE_SETTINGS_LOGIN);
- if (!m_szSkypename.IsEmpty()) { // old settings format, need to update all settings
- m_szSkypename.Insert(0, "8:");
- setString(SKYPE_SETTINGS_ID, m_szSkypename);
-
- for (auto &hContact : AccContacts()) {
- CMStringA id(ptrA(getUStringA(hContact, "Skypename")));
- if (!id.IsEmpty())
- setString(hContact, SKYPE_SETTINGS_ID, (isChatRoom(hContact)) ? "19:"+id : "8:"+id);
-
- ptrW wszNick(getWStringA(hContact, "Nick"));
- if (wszNick == nullptr)
- setUString(hContact, "Nick", id);
-
- delSetting(hContact, "Skypename");
- }
- }
- }
-
+ CheckConvert();
InitGroupChatModule();
}
@@ -282,17 +262,14 @@ int CSkypeProto::SetStatus(int iNewStatus) setAllContactStatuses(ID_STATUS_OFFLINE, false);
return 0;
}
- else {
- if (old_status == ID_STATUS_CONNECTING)
- return 0;
- if (old_status == ID_STATUS_OFFLINE && m_iStatus == ID_STATUS_OFFLINE)
- Login();
- else
- PushRequest(new SetStatusRequest(MirandaToSkypeStatus(m_iDesiredStatus)));
- }
+ if (m_iStatus == ID_STATUS_CONNECTING)
+ return 0;
- ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
+ if (m_iStatus == ID_STATUS_OFFLINE)
+ Login();
+ else
+ PushRequest(new SetStatusRequest(MirandaToSkypeStatus(m_iDesiredStatus)));
return 0;
}
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 8a48e595dc..3bc4a5a6c2 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -80,7 +80,7 @@ public: // menus
static void InitMenus();
- //popups
+ // popups
void InitPopups();
void UninitPopups();
@@ -158,6 +158,8 @@ public: void OnGetChatInfo(NETLIBHTTPREQUEST *response, AsyncHttpRequest *pRequest);
void OnReceiveAwayMsg(NETLIBHTTPREQUEST *response, AsyncHttpRequest *pRequest);
+ void CheckConvert(void);
+
bool CheckOauth(const char *szResponse);
void LoadProfile(NETLIBHTTPREQUEST *response, AsyncHttpRequest *pRequest);
|