diff options
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/SkypeWeb/src/skype_dialogs.h | 35 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_events.cpp | 8 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_icons.cpp | 18 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_login.cpp | 13 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_messages.cpp | 9 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.cpp | 35 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.h | 41 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/stdafx.h | 1 |
8 files changed, 58 insertions, 102 deletions
diff --git a/protocols/SkypeWeb/src/skype_dialogs.h b/protocols/SkypeWeb/src/skype_dialogs.h index d7be605e94..b07265ef1b 100644 --- a/protocols/SkypeWeb/src/skype_dialogs.h +++ b/protocols/SkypeWeb/src/skype_dialogs.h @@ -20,41 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. typedef CProtoDlgBase<CSkypeProto> CSkypeDlgBase;
-class CSkypePasswordEditor : public CSkypeDlgBase
-{
-private:
- typedef CSkypeDlgBase CSuper;
-
- CCtrlButton m_ok;
- CCtrlEdit m_password;
- CCtrlCheck m_savePermanently;
-
-protected:
- void OnInitDialog()
- {
- SendMessage(m_password.GetHwnd(), EM_LIMITTEXT, 20, 0);
- }
-
- void OnOk(CCtrlButton*)
- {
- /*if (m_savePermanently.Enabled())
- m_proto->setString("Password", m_password.GetTextA());
- if (m_proto->password != NULL)
- mir_free(m_proto->password);
- m_proto->password = mir_utf8encodeW(m_password.GetText());
- */
- EndDialog(m_hwnd, 1);
- }
-
-public:
- CSkypePasswordEditor(CSkypeProto *proto) :
- CSkypeDlgBase(proto, IDD_PASSWORD_EDITOR, false), m_ok(this, IDOK),
- m_password(this, IDC_PASSWORD), m_savePermanently(this, IDC_SAVEPERMANENTLY)
- {
- m_ok.OnClick = Callback(this, &CSkypePasswordEditor::OnOk);
- }
-};
-
class CSkypeInviteDlg : public CSkypeDlgBase
{
private:
diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp index 2be1b79804..f670130e66 100644 --- a/protocols/SkypeWeb/src/skype_events.cpp +++ b/protocols/SkypeWeb/src/skype_events.cpp @@ -231,7 +231,7 @@ void CSkypeProto::InitPopups() ppc.colorText = RGB(0, 0, 0);
ppc.iSeconds = 30;
ppc.PluginWindowProc = PopupDlgProcCall;
- m_hPopupClassCall = Popup_RegisterClass(&ppc);
+ m_PopupClasses.insert(Popup_RegisterClass(&ppc));
mir_sntprintf(desc, _T("%s %s"), m_tszUserName, TranslateT("Notifications"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Notification");
@@ -241,7 +241,7 @@ void CSkypeProto::InitPopups() ppc.colorBack = RGB(255, 255, 255);
ppc.colorText = RGB(0, 0, 0);
ppc.iSeconds = 5;
- m_hPopupClassNotify = Popup_RegisterClass(&ppc);
+ m_PopupClasses.insert(Popup_RegisterClass(&ppc));
mir_sntprintf(desc, _T("%s %s"), m_tszUserName, TranslateT("Errors"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Error");
@@ -251,7 +251,7 @@ void CSkypeProto::InitPopups() ppc.colorBack = RGB(255, 255, 255);
ppc.colorText = RGB(0, 0, 0);
ppc.iSeconds = -1;
- m_hPopupClassNotify = Popup_RegisterClass(&ppc);
+ m_PopupClasses.insert(Popup_RegisterClass(&ppc));
}
int CSkypeProto::ProcessSrmmEvent(WPARAM, LPARAM lParam)
@@ -300,7 +300,7 @@ void CSkypeProto::SkypeSetTimer(void*) void CSkypeProto::SkypeUnsetTimer(void*)
{
mir_cslock lck(timerLock);
- if (CSkypeProto::m_timer)
+ if (CSkypeProto::m_timer && Accounts.getCount() == 0)
KillTimer(NULL, CSkypeProto::m_timer);
CSkypeProto::m_timer = 0;
}
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_icons.cpp b/protocols/SkypeWeb/src/skype_icons.cpp index 0848c87077..0a521aabd5 100644 --- a/protocols/SkypeWeb/src/skype_icons.cpp +++ b/protocols/SkypeWeb/src/skype_icons.cpp @@ -19,15 +19,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. IconInfo CSkypeProto::Icons[] =
{
- { LPGENT("Protocol icon"), "main", IDI_SKYPE },
- { LPGENT("Create new chat icon"), "conference", IDI_CONFERENCE },
- { LPGENT("Sync history icon"), "synchistory", IDI_SYNCHISTORY },
- { LPGENT("Block user icon"), "user_block", IDI_BLOCKUSER },
- { LPGENT("Unblock user icon"), "user_unblock", IDI_UNBLOCKUSER },
- { LPGENT("Incoming call icon"), "inc_call", IDI_CALL },
- { LPGENT("Notification icon"), "notify", IDI_NOTIFY },
- { LPGENT("Error icon"), "error", IDI_ERRORICON },
- { LPGENT("Action icon"), "me_action", IDI_ACTION_ME }
+ { LPGENT("Protocol icon"), "main", IDI_SKYPE },
+ { LPGENT("Create new chat icon"), "conference", IDI_CONFERENCE },
+ { LPGENT("Sync history icon"), "synchistory", IDI_SYNCHISTORY },
+ { LPGENT("Block user icon"), "user_block", IDI_BLOCKUSER },
+ { LPGENT("Unblock user icon"), "user_unblock", IDI_UNBLOCKUSER },
+ { LPGENT("Incoming call icon"), "inc_call", IDI_CALL },
+ { LPGENT("Notification icon"), "notify", IDI_NOTIFY },
+ { LPGENT("Error icon"), "error", IDI_ERRORICON },
+ { LPGENT("Action icon"), "me_action", IDI_ACTION_ME }
};
void CSkypeProto::InitIcons()
{
diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index 54879eb61a..c4a5601aae 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -235,6 +235,13 @@ void CSkypeProto::SendPresence(bool isLogin) void CSkypeProto::OnCapabilitiesSended(const NETLIBHTTPREQUEST *response)
{
+ if (response == NULL || response->pData == NULL)
+ {
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
+ SetStatus(ID_STATUS_OFFLINE);
+ return;
+ }
+
SendRequest(new SetStatusRequest(m_szRegToken, MirandaToSkypeStatus(m_iDesiredStatus), m_szServer), &CSkypeProto::OnStatusChanged);
LIST<char> skypenames(1);
@@ -248,6 +255,7 @@ void CSkypeProto::OnCapabilitiesSended(const NETLIBHTTPREQUEST *response) mir_free(skypenames[i]);
skypenames.destroy();
+
m_hPollingThread = ForkThreadEx(&CSkypeProto::PollingThread, 0, NULL);
PushRequest(new GetAvatarRequest(ptrA(getStringA("AvatarUrl"))), &CSkypeProto::OnReceiveAvatar, NULL);
@@ -257,9 +265,6 @@ void CSkypeProto::OnCapabilitiesSended(const NETLIBHTTPREQUEST *response) if (getBool("AutoSync", true))
PushRequest(new SyncHistoryFirstRequest(m_szRegToken, 100, m_szServer), &CSkypeProto::OnSyncHistory);
- if (response == NULL || response->pData == NULL)
- return;
-
JSONNode root = JSONNode::parse(response->pData);
if (root)
setString("SelfEndpointName", SelfUrlToName(root["selfLink"].as_string().c_str()));
@@ -267,7 +272,7 @@ void CSkypeProto::OnCapabilitiesSended(const NETLIBHTTPREQUEST *response) void CSkypeProto::OnStatusChanged(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL)
+ if (response == NULL || response->pData == NULL)
{
debugLogA(__FUNCTION__ ": failed to change status");
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 11a6dc8ff0..d5cc4727c4 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -141,11 +141,8 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node) std::string composeTime = node["composetime"].as_string();
time_t timestamp = getByte("UseLocalTime", 0) ? time(NULL) : IsoToUnixTime(composeTime.c_str());
- std::string conversationLink = node["conversationLink"].as_string();
- std::string fromLink = node["from"].as_string();
-
- CMStringA skypename(ContactUrlToName(conversationLink.c_str()));
- CMStringA from(ContactUrlToName(fromLink.c_str()));
+ CMStringA skypename(ContactUrlToName(node["conversationLink"].as_string().c_str()));
+ CMStringA from(ContactUrlToName(node["from"].as_string().c_str()));
std::string content = node["content"].as_string();
int emoteOffset = node["skypeemoteoffset"].as_int();
@@ -182,7 +179,7 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node) {
AppendDBEvent(hContact, dbevent, message, skypeEditedId.c_str(), timestamp);
}
- else OnReceiveMessage(clientMsgId.c_str(), conversationLink.c_str(), timestamp, message, emoteOffset);
+ else OnReceiveMessage(clientMsgId.c_str(), node["conversationLink"].as_string().c_str(), timestamp, message, emoteOffset);
}
else if (!mir_strcmpi(messageType.c_str(), "Event/SkypeVideoMessage")) {}
else if (!mir_strcmpi(messageType.c_str(), "Event/Call"))
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index edc211f175..fc2cbfecd4 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName) :
-PROTO<CSkypeProto>(protoName, userName), password(NULL)
+PROTO<CSkypeProto>(protoName, userName), m_PopupClasses(1)
{
m_hProtoIcon = Icons[0].Handle;
@@ -42,8 +42,6 @@ PROTO<CSkypeProto>(protoName, userName), password(NULL) CreateProtoService("/IncomingCallCLE", &CSkypeProto::OnIncomingCallCLE);
CreateProtoService("/IncomingCallPP", &CSkypeProto::OnIncomingCallPP);
- //HookProtoEvent(ME_MSG_WINDOWEVENT, &CSkypeProto::ProcessSrmmEvent);
-
m_tszAvatarFolder = std::tstring(VARST(_T("%miranda_avatarcache%"))) + _T("\\") + m_tszUserName;
DWORD dwAttributes = GetFileAttributes(m_tszAvatarFolder.c_str());
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
@@ -65,16 +63,25 @@ PROTO<CSkypeProto>(protoName, userName), password(NULL) CSkypeProto::~CSkypeProto()
{
+ requestQueue->Stop();
delete requestQueue;
- Netlib_CloseHandle(m_hNetlibUser);
- m_hNetlibUser = NULL;
- CloseHandle(m_hTrouterEvent);
+
+ if (m_pollingConnection)
+ CallService(MS_NETLIB_SHUTDOWN, (WPARAM)m_pollingConnection, 0);
+ if (m_TrouterConnection)
+ CallService(MS_NETLIB_SHUTDOWN, (WPARAM)m_TrouterConnection, 0);
+
+ Netlib_CloseHandle(m_hNetlibUser); m_hNetlibUser = NULL;
+ CloseHandle(m_hTrouterEvent); m_hTrouterEvent = NULL;
+
if (m_hCallHook)
DestroyHookableEvent(m_hCallHook);
- if (m_hPopupClassCall)
- Popup_UnregisterClass(m_hPopupClassCall);
- if (m_hPopupClassNotify)
- Popup_UnregisterClass(m_hPopupClassNotify);
+
+ for (int i = 0; i < m_PopupClasses.getCount(); i++)
+ {
+ Popup_UnregisterClass(m_PopupClasses[i]);
+ }
+
SkypeUnsetTimer(this);
}
@@ -292,15 +299,7 @@ int CSkypeProto::OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam int CSkypeProto::OnPreShutdown(WPARAM, LPARAM)
{
debugLogA(__FUNCTION__);
-
isTerminated = true;
- if (m_pollingConnection)
- CallService(MS_NETLIB_SHUTDOWN, (WPARAM)m_pollingConnection, 0);
- if (m_TrouterConnection)
- CallService(MS_NETLIB_SHUTDOWN, (WPARAM)m_TrouterConnection, 0);
- SkypeUnsetTimer(this);
-
requestQueue->Stop();
-
return 0;
}
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index d88b54c102..1540ac4c8c 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -21,23 +21,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. typedef void(CSkypeProto::*SkypeResponseCallback)(const NETLIBHTTPREQUEST *response);
typedef void(CSkypeProto::*SkypeResponseWithArgCallback)(const NETLIBHTTPREQUEST *response, void *arg);
-struct TRInfo
-{
- std::string socketIo,
- connId,
- st,
- se,
- instance,
- ccid,
- sessId,
- sig,
- url;
-};
-
struct CSkypeProto : public PROTO < CSkypeProto >
{
- friend CSkypePasswordEditor;
-
public:
//////////////////////////////////////////////////////////////////////////////////////
@@ -97,29 +82,33 @@ public: static mir_cs accountsLock;
private:
- char *password;
RequestQueue *requestQueue;
- bool isTerminated;
+
+ bool isTerminated,
+ HistorySynced;
std::map<std::string, std::string> cookies;
- HANDLE m_pollingConnection, m_hPollingThread, m_hTrouterThread, m_TrouterConnection, m_hTrouterEvent, m_hCallHook;
static std::map<std::tstring, std::tstring> languages;
- static INT_PTR CALLBACK PasswordEditorProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
-
- bool HistorySynced;
+ HANDLE m_pollingConnection,
+ m_hPollingThread,
+ m_hTrouterThread,
+ m_TrouterConnection,
+ m_hTrouterEvent,
+ m_hCallHook;
TRInfo TRouter;
- HANDLE
- m_hPopupClassCall,
- m_hPopupClassNotify;
+ LIST <void> m_PopupClasses;
// accounts
- ptrA m_szServer, m_szRegToken, m_szTokenSecret, m_szEndpointId, m_szSelfSkypeName;
+ ptrA m_szServer,
+ m_szRegToken,
+ m_szTokenSecret,
+ m_szEndpointId,
+ m_szSelfSkypeName;
static CSkypeProto* GetContactAccount(MCONTACT hContact);
-
int __cdecl OnAccountLoaded(WPARAM, LPARAM);
INT_PTR __cdecl OnAccountManagerInit(WPARAM, LPARAM);
diff --git a/protocols/SkypeWeb/src/stdafx.h b/protocols/SkypeWeb/src/stdafx.h index c6762544bd..6e57b8969a 100644 --- a/protocols/SkypeWeb/src/stdafx.h +++ b/protocols/SkypeWeb/src/stdafx.h @@ -67,6 +67,7 @@ extern LIST<CSkypeProto> Accounts; #include "skype_menus.h"
#include "skype_dialogs.h"
#include "skype_options.h"
+#include "skype_trouter.h"
#include "http_request.h"
#include "requests\login.h"
#include "requests\profile.h"
|