diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2016-04-13 16:12:52 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2016-04-13 16:12:52 +0000 |
commit | 122306cee52b2da3694e3e04ad139fe92def1693 (patch) | |
tree | c5768c1aed3a65f3a74d0db80ffd7e05f5676e11 | |
parent | fdc5bdfae8a4a70cfd91ec0a8554005a3c0bbae2 (diff) |
SkypeWeb: code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@16643 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/SkypeWeb/src/skype_chatrooms.cpp | 4 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_contacts.cpp | 3 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_db.cpp | 55 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_db.h | 36 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_events.cpp | 1 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_history_sync.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_login.cpp | 21 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_messages.cpp | 3 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_network.cpp | 12 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_options.cpp | 14 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_polling.cpp | 7 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.cpp | 26 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.h | 4 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_trouter.cpp | 6 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_utils.cpp | 4 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/stdafx.h | 2 |
16 files changed, 113 insertions, 87 deletions
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 3fbb360eac..9e6506e015 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -148,7 +148,7 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam) return 0;
}
- ptrA chat_id(mir_t2a(gch->pDest->ptszID));
+ _T2A chat_id(gch->pDest->ptszID);
switch (gch->pDest->iType)
{
@@ -200,7 +200,7 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam) case 30:
CMString newTopic = ChangeTopicForm();
if (!newTopic.IsEmpty())
- SendRequest(new SetChatPropertiesRequest(chat_id, "topic", ptrA(mir_utf8encodeT(newTopic.GetBuffer())), li));
+ SendRequest(new SetChatPropertiesRequest(chat_id, "topic", T2Utf(newTopic.GetBuffer()), li));
break;
}
break;
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index afa53243fa..d88603cb6c 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -77,8 +77,7 @@ MCONTACT CSkypeProto::FindContact(const char *skypename) MCONTACT hContact = NULL;
for (hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName))
{
- ptrA cSkypename(getStringA(hContact, SKYPE_SETTINGS_ID));
- if (!mir_strcmpi(skypename, cSkypename))
+ if (!mir_strcmpi(skypename, CID(this, hContact)))
break;
}
return hContact;
diff --git a/protocols/SkypeWeb/src/skype_db.cpp b/protocols/SkypeWeb/src/skype_db.cpp index e297458ed0..91a40a5d79 100644 --- a/protocols/SkypeWeb/src/skype_db.cpp +++ b/protocols/SkypeWeb/src/skype_db.cpp @@ -17,6 +17,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
+struct SkypeDBType { int type; char *name; DWORD flags; } g_SkypeDBTypes[] =
+{
+ { SKYPE_DB_EVENT_TYPE_INCOMING_CALL, LPGEN("Incoming call"), DETF_NONOTIFY },
+ { SKYPE_DB_EVENT_TYPE_EDITED_MESSAGE, LPGEN("Edited message"), 0 },
+ { SKYPE_DB_EVENT_TYPE_ACTION, LPGEN("Action"), 0 },
+ { SKYPE_DB_EVENT_TYPE_CALL_INFO, LPGEN("Call information"), 0 },
+ { SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO, LPGEN("File transfer information"), 0 },
+ { SKYPE_DB_EVENT_TYPE_URIOBJ, LPGEN("URI object"), 0 },
+ { SKYPE_DB_EVENT_TYPE_MOJI, LPGEN("Moji"), 0 },
+ { SKYPE_DB_EVENT_TYPE_FILE, LPGEN("File"), 0 },
+ { SKYPE_DB_EVENT_TYPE_UNKNOWN, LPGEN("Unknown event"), 0 },
+};
+
MEVENT CSkypeProto::GetMessageFromDb(MCONTACT hContact, const char *messageId, LONGLONG timestamp)
{
if (messageId == NULL)
@@ -143,40 +156,16 @@ void CSkypeProto::InitDBEvents() dbEventType.iconService = MODULE "/GetEventIcon";
dbEventType.textService = MODULE "/GetEventText";
- dbEventType.eventType = SKYPE_DB_EVENT_TYPE_EDITED_MESSAGE;
- dbEventType.descr = Translate("Edited message");
- CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
-
- dbEventType.eventType = SKYPE_DB_EVENT_TYPE_ACTION;
- dbEventType.descr = Translate("Action");
- CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
-
- dbEventType.eventType = SKYPE_DB_EVENT_TYPE_CALL_INFO;
- dbEventType.descr = Translate("Call information");
- CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
-
- dbEventType.eventType = SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO;
- dbEventType.descr = Translate("File transfer information");
- CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
-
- dbEventType.eventType = SKYPE_DB_EVENT_TYPE_URIOBJ;
- dbEventType.descr = Translate("URI object");
- CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
-
- dbEventType.eventType = SKYPE_DB_EVENT_TYPE_MOJI;
- dbEventType.descr = Translate("Moji");
- CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
+ for (size_t i = 0; i < _countof(g_SkypeDBTypes); i++)
+ {
+ SkypeDBType &cur = g_SkypeDBTypes[i];
- dbEventType.eventType = SKYPE_DB_EVENT_TYPE_FILE;
- dbEventType.descr = Translate("File");
- CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
+ dbEventType.eventType = cur.type;
+ dbEventType.descr = cur.name;
+ dbEventType.flags |= cur.flags;
- dbEventType.eventType = SKYPE_DB_EVENT_TYPE_UNKNOWN;
- dbEventType.descr = Translate("Unknown event");
- CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
+ CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
- dbEventType.eventType = SKYPE_DB_EVENT_TYPE_INCOMING_CALL;
- dbEventType.descr = Translate("Incoming call");
- dbEventType.flags |= DETF_NONOTIFY;
- CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
+ dbEventType.flags &= (~cur.flags);
+ }
}
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_db.h b/protocols/SkypeWeb/src/skype_db.h index ed1edaa653..cd101386a3 100644 --- a/protocols/SkypeWeb/src/skype_db.h +++ b/protocols/SkypeWeb/src/skype_db.h @@ -35,5 +35,41 @@ enum SKYPE_DB_EVENT_TYPE #define SKYPE_SETTINGS_PASSWORD "Password"
#define SKYPE_SETTINGS_GROUP "DefaultGroup"
+struct CSkypeOptions
+{
+ CMOption<BYTE> bAutoHistorySync;
+ CMOption<BYTE> bMarkAllAsUnread;
+
+ CMOption<BYTE> bUseHostnameAsPlace;
+ CMOption<TCHAR*> wstrPlace;
+
+ CMOption<BYTE> bUseBBCodes;
+
+ CMOption<TCHAR*> wstrCListGroup;
+
+ CSkypeOptions(PROTO_INTERFACE *proto) :
+
+ bAutoHistorySync(proto, "AutoSync", true),
+ bMarkAllAsUnread(proto, "MarkMesUnread", true),
+
+ wstrPlace(proto, "Place", _T("")),
+ bUseHostnameAsPlace(proto, "UseHostName", true),
+
+ bUseBBCodes(proto, "UseBBCodes", true),
+
+ wstrCListGroup(proto, SKYPE_SETTINGS_GROUP, _T("Skype"))
+ {
+ }
+
+};
+
+class CID
+{
+ ptrA m_value;
+public:
+ inline CID(PROTO_INTERFACE *ppro, const MCONTACT hContact) : m_value(ppro->getStringA(hContact, SKYPE_SETTINGS_ID)) {}
+ inline operator char *() { return m_value; }
+};
+
#endif //_SKYPE_DB_H_
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp index b0e4466ad6..27a14309ee 100644 --- a/protocols/SkypeWeb/src/skype_events.cpp +++ b/protocols/SkypeWeb/src/skype_events.cpp @@ -23,6 +23,7 @@ INT_PTR CSkypeProto::GetEventText(WPARAM, LPARAM lParam) DBEVENTGETTEXT *pEvent = (DBEVENTGETTEXT *)lParam;
CMStringA szText;
+
BOOL bUseBB = db_get_b(NULL, pEvent->dbei->szModule, "UseBBCodes", 1);
switch (pEvent->dbei->eventType)
{
diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp index 73483cfdcd..db2a34ec14 100644 --- a/protocols/SkypeWeb/src/skype_history_sync.cpp +++ b/protocols/SkypeWeb/src/skype_history_sync.cpp @@ -153,7 +153,7 @@ void CSkypeProto::OnSyncHistory(const NETLIBHTTPREQUEST *response) MCONTACT hContact = FindContact(szSkypename);
if (hContact != NULL)
{
- if (db_get_dw(hContact, m_szModuleName, "LastMsgTime", 0) < composeTime)
+ if (getDword(hContact, "LastMsgTime", 0) < composeTime)
{
PushRequest(new GetHistoryRequest(szSkypename, 100, false, 0, li), &CSkypeProto::OnGetServerHistory);
}
diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index 3bf80c0e37..5ffe9c610c 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -113,11 +113,9 @@ void CSkypeProto::OnLoginOAuth(const NETLIBHTTPREQUEST *response) SetStatus(ID_STATUS_OFFLINE);
return;
}
- std::string token = json["skypetoken"].as_string();
- setString("TokenSecret", token.c_str());
- int expiresIn = json["expiresIn"].as_int();
- setDword("TokenExpiresIn", time(NULL) + expiresIn);
+ setString("TokenSecret", json["skypetoken"].as_string().c_str());
+ setDword("TokenExpiresIn", time(NULL) + json["expiresIn"].as_int());
OnLoginSuccess();
}
@@ -164,6 +162,12 @@ void CSkypeProto::OnEndpointCreated(const NETLIBHTTPREQUEST *response) szCookieName = szToken.Tokenize("=", iStart2);
szCookieVal = szToken.Mid(iStart2);
setString(szCookieName, szCookieVal);
+
+ if (szCookieName == "registrationToken")
+ li.endpoint.szToken = szCookieVal.Detach();
+ else if (szCookieName == "endpointId")
+ li.endpoint.szId = szCookieVal.Detach();
+
}
}
else if (!mir_strcmpi(response->headers[i].szName, "Location"))
@@ -205,8 +209,6 @@ void CSkypeProto::OnEndpointCreated(const NETLIBHTTPREQUEST *response) }
}
- li.endpoint.szToken = getStringA("registrationToken");
- li.endpoint.szId = getStringA("endpointId");
SendRequest(new CreateSubscriptionsRequest(li), &CSkypeProto::OnSubscriptionsCreated);
}
@@ -230,9 +232,8 @@ void CSkypeProto::SendPresence(bool isLogin) {
ptrA epname;
- ptrT place(getTStringA("Place"));
- if (!getBool("UseHostName", false) && place && *place)
- epname = mir_utf8encodeT(place);
+ if (!m_opts.bUseHostnameAsPlace && m_opts.wstrPlace && *m_opts.wstrPlace)
+ epname = mir_utf8encodeT(m_opts.wstrPlace);
else
{
TCHAR compName[MAX_COMPUTERNAME_LENGTH + 1];
@@ -277,7 +278,7 @@ void CSkypeProto::OnCapabilitiesSended(const NETLIBHTTPREQUEST *response) PushRequest(new GetContactListRequest(li, NULL), &CSkypeProto::LoadContactList);
PushRequest(new GetAvatarRequest(ptrA(getStringA("AvatarUrl"))), &CSkypeProto::OnReceiveAvatar, NULL);
- if (getBool("AutoSync", true))
+ if (m_opts.bAutoHistorySync)
PushRequest(new SyncHistoryFirstRequest(100, li), &CSkypeProto::OnSyncHistory);
JSONNode root = JSONNode::parse(response->pData);
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index e3e9e6df10..2fd99c5d67 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -264,14 +264,13 @@ int CSkypeProto::OnDbEventRead(WPARAM hContact, LPARAM hDbEvent) void CSkypeProto::MarkMessagesRead(MCONTACT hContact, MEVENT hDbEvent)
{
debugLogA(__FUNCTION__);
- ptrA username(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID));
DBEVENTINFO dbei = { sizeof(dbei) };
db_event_get(hDbEvent, &dbei);
time_t timestamp = dbei.timestamp;
if(db_get_dw(hContact, m_szModuleName, "LastMsgTime", 0) > (timestamp - 300))
- PushRequest(new MarkMessageReadRequest(username, timestamp, timestamp, false, li));
+ PushRequest(new MarkMessageReadRequest(CID(this, hContact), timestamp, timestamp, false, li));
}
diff --git a/protocols/SkypeWeb/src/skype_network.cpp b/protocols/SkypeWeb/src/skype_network.cpp index d9179900f1..1442140613 100644 --- a/protocols/SkypeWeb/src/skype_network.cpp +++ b/protocols/SkypeWeb/src/skype_network.cpp @@ -19,12 +19,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. void CSkypeProto::InitNetwork()
{
- TCHAR name[128];
- mir_sntprintf(name, TranslateT("%s connection"), m_tszUserName);
+ CMString name(FORMAT, TranslateT("%s connection"), m_tszUserName);
+
NETLIBUSER nlu = { 0 };
nlu.cbSize = sizeof(nlu);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE;
- nlu.ptszDescriptiveName = name;
+ nlu.ptszDescriptiveName = name.GetBuffer();
nlu.szSettingsModule = m_szModuleName;
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
}
@@ -37,7 +37,9 @@ void CSkypeProto::UnInitNetwork() void CSkypeProto::ShutdownConnections()
{
- Netlib_Shutdown(m_pollingConnection);
- Netlib_Shutdown(m_TrouterConnection);
+ Netlib_CloseHandle(m_pollingConnection);
+ Netlib_CloseHandle(m_TrouterConnection);
+
+ m_pollingConnection = m_TrouterConnection = 0;
//Netlib_Shutdown(m_hNetlibUser);
}
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_options.cpp b/protocols/SkypeWeb/src/skype_options.cpp index b9967150da..fe161f1d5d 100644 --- a/protocols/SkypeWeb/src/skype_options.cpp +++ b/protocols/SkypeWeb/src/skype_options.cpp @@ -29,12 +29,12 @@ CSkypeOptionsMain::CSkypeOptionsMain(CSkypeProto *proto, int idDialog) m_usebb(this, IDC_BBCODES),
m_link(this, IDC_CHANGEPASS, "https://login.skype.com/recovery/password-change") // TODO : ...?username=%username%
{
- CreateLink(m_group, SKYPE_SETTINGS_GROUP, _T("Skype"));
- CreateLink(m_autosync, "AutoSync", DBVT_BYTE, 1);
- CreateLink(m_allasunread, "MarkMesUnread", DBVT_BYTE, 1);
- CreateLink(m_place, "Place", _T(""));
- CreateLink(m_usehostname, "UseHostName", DBVT_BYTE, 0);
- CreateLink(m_usebb, "UseBBCodes", DBVT_BYTE, 1);
+ CreateLink(m_group, proto->m_opts.wstrCListGroup);
+ CreateLink(m_autosync, proto->m_opts.bAutoHistorySync);
+ CreateLink(m_allasunread, proto->m_opts.bMarkAllAsUnread);
+ CreateLink(m_place, proto->m_opts.wstrPlace);
+ CreateLink(m_usehostname, proto->m_opts.bUseHostnameAsPlace);
+ CreateLink(m_usebb, proto->m_opts.bUseBBCodes);
m_usehostname.OnChange = Callback(this, &CSkypeOptionsMain::OnUsehostnameCheck);
}
@@ -44,7 +44,7 @@ void CSkypeOptionsMain::OnInitDialog() m_skypename.SetTextA(ptrA(m_proto->getStringA(SKYPE_SETTINGS_ID)));
m_password.SetTextA(pass_ptrA(m_proto->getStringA("Password")));
- m_place.Enable(!m_proto->getBool("UseHostName", false));
+ m_place.Enable(!m_proto->m_opts.bUseHostnameAsPlace);
m_skypename.SendMsg(EM_LIMITTEXT, 32, 0);
m_password.SendMsg(EM_LIMITTEXT, 128, 0);
m_group.SendMsg(EM_LIMITTEXT, 64, 0);
diff --git a/protocols/SkypeWeb/src/skype_polling.cpp b/protocols/SkypeWeb/src/skype_polling.cpp index 6fe8f198b3..31de0c75c1 100644 --- a/protocols/SkypeWeb/src/skype_polling.cpp +++ b/protocols/SkypeWeb/src/skype_polling.cpp @@ -27,12 +27,12 @@ void CSkypeProto::PollingThread(void*) m_hPollingEvent.Wait();
nErrors = 0;
+ PollRequest *request = new PollRequest(li);
+
while ((nErrors < POLLING_ERRORS_LIMIT) && m_iStatus != ID_STATUS_OFFLINE)
{
- PollRequest *request = new PollRequest(li);
request->nlc = m_pollingConnection;
NLHR_PTR response(request->Send(m_hNetlibUser));
- delete request;
if (response == NULL)
{
@@ -77,6 +77,7 @@ void CSkypeProto::PollingThread(void*) }
m_pollingConnection = response->nlc;
}
+ delete request;
if (m_iStatus != ID_STATUS_OFFLINE)
{
@@ -172,7 +173,7 @@ void CSkypeProto::ProcessEndpointPresence(const JSONNode &node) break;
case 13:
MirVer.AppendFormat("Skype (OSX) %s", ParseUrl(skypeNameVersion.c_str(), "/"));
- break;
+ break;
case 11:
MirVer.AppendFormat("Skype (Windows) %s", ParseUrl(skypeNameVersion.c_str(), "/"));
break;
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index d354234840..2032ab0c6b 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -25,7 +25,8 @@ CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName) : m_OutMessages(3, PtrKeySortT),
m_bThreadsTerminated(0),
m_TrouterConnection(0),
- m_pollingConnection(0)
+ m_pollingConnection(0),
+ m_opts(this)
{
InitNetwork();
@@ -105,7 +106,7 @@ DWORD_PTR CSkypeProto::GetCaps(int type, MCONTACT) case PFLAGNUM_4:
return PF4_FORCEADDED | PF4_NOAUTHDENYREASON | PF4_SUPPORTTYPING | PF4_AVATARS | PF4_IMSENDOFFLINE | PF4_OFFLINEFILES;
case PFLAG_UNIQUEIDTEXT:
- return (DWORD_PTR)"Skypename";
+ return (DWORD_PTR)Translate("Skypename");
case PFLAG_UNIQUEIDSETTING:
return (DWORD_PTR)SKYPE_SETTINGS_ID;
}
@@ -121,7 +122,7 @@ MCONTACT CSkypeProto::AddToList(int, PROTOSEARCHRESULT *psr) MCONTACT hContact;
if (psr->flags & PSR_UNICODE)
- hContact = AddContact(mir_utf8encodeT(psr->id.t));
+ hContact = AddContact(T2Utf(psr->id.t));
else
hContact = AddContact(psr->id.a);
@@ -155,9 +156,7 @@ int CSkypeProto::Authorize(MEVENT hDbEvent) if (hContact == INVALID_CONTACT_ID)
return 1;
- ptrA token(getStringA("TokenSecret"));
- ptrA skypename(getStringA(hContact, SKYPE_SETTINGS_ID));
- PushRequest(new AuthAcceptRequest(li, skypename));
+ PushRequest(new AuthAcceptRequest(li, CID(this, hContact)));
return 0;
}
@@ -167,9 +166,7 @@ int CSkypeProto::AuthDeny(MEVENT hDbEvent, const TCHAR*) if (hContact == INVALID_CONTACT_ID)
return 1;
- ptrA token(getStringA("TokenSecret"));
- ptrA skypename(getStringA(hContact, SKYPE_SETTINGS_ID));
- PushRequest(new AuthDeclineRequest(li, skypename));
+ PushRequest(new AuthDeclineRequest(li, CID(this, hContact)));
return 0;
}
@@ -183,9 +180,7 @@ int CSkypeProto::AuthRequest(MCONTACT hContact, const TCHAR *szMessage) if (hContact == INVALID_CONTACT_ID)
return 1;
- ptrA token(getStringA("TokenSecret"));
- ptrA skypename(getStringA(hContact, SKYPE_SETTINGS_ID));
- PushRequest(new AddContactRequest(li, skypename, T2Utf(szMessage)));
+ PushRequest(new AddContactRequest(li, CID(this, hContact), T2Utf(szMessage)));
return 0;
}
@@ -193,7 +188,7 @@ int CSkypeProto::GetInfo(MCONTACT hContact, int) {
if (!isChatRoom(hContact))
PushRequest(
- new GetProfileRequest(li, ptrA(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID))),
+ new GetProfileRequest(li, CID(this, hContact)),
&CSkypeProto::LoadProfile);
return 0;
}
@@ -237,9 +232,6 @@ int CSkypeProto::SetStatus(int iNewStatus) if (m_iStatus > ID_STATUS_CONNECTING + 1)
{
SendRequest(new DeleteEndpointRequest(li));
- delSetting("registrationRoken");
- delSetting("endpointId");
- delSetting("expires");
}
m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
// logout
@@ -273,7 +265,7 @@ int CSkypeProto::SetStatus(int iNewStatus) int CSkypeProto::UserIsTyping(MCONTACT hContact, int type)
{
- SendRequest(new SendTypingRequest(ptrA(getStringA(hContact, SKYPE_SETTINGS_ID)), type, li));
+ SendRequest(new SendTypingRequest(CID(this, hContact), type, li));
return 0;
}
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 4681836833..b5ce6cf33a 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -83,10 +83,14 @@ public: static INT_PTR EventGetIcon(WPARAM wParam, LPARAM lParam);
static INT_PTR GetEventText(WPARAM, LPARAM lParam);
+ CSkypeOptions m_opts;
+
private:
LoginInfo li;
+
+
static UINT_PTR m_timer;
//---Accounts
diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp index a1b6768ce9..0f9506ad6c 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -139,12 +139,13 @@ void CSkypeProto::TRouterThread(void*) m_hTrouterEvent.Wait();
errors = 0;
+ TrouterPollRequest *request = new TrouterPollRequest(TRouter.socketIo, TRouter.connId, TRouter.st, TRouter.se, TRouter.sig, TRouter.instance, TRouter.ccid, TRouter.sessId);
+
while (errors < POLLING_ERRORS_LIMIT && m_iStatus > ID_STATUS_OFFLINE)
{
- TrouterPollRequest *request = new TrouterPollRequest(TRouter.socketIo, TRouter.connId, TRouter.st, TRouter.se, TRouter.sig, TRouter.instance, TRouter.ccid, TRouter.sessId);
request->nlc = m_TrouterConnection;
NLHR_PTR response(request->Send(m_hNetlibUser));
- delete request;
+
if (response == NULL)
{
m_TrouterConnection = nullptr;
@@ -174,6 +175,7 @@ void CSkypeProto::TRouterThread(void*) }
m_TrouterConnection = response->nlc;
}
+ delete request;
}
m_hTrouterThread = NULL;
m_TrouterConnection = NULL;
diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp index c1bee2de45..fa3abdeb3b 100644 --- a/protocols/SkypeWeb/src/skype_utils.cpp +++ b/protocols/SkypeWeb/src/skype_utils.cpp @@ -552,8 +552,8 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) }
if (!mir_tstrcmpi(szCommand, _T("sendfile")))
{
- //CONTACT hContact = AddContact(_T2A(szJid), true);
- //CallService(MS_FILE_SENDFILE, hContact, NULL);
+ MCONTACT hContact = AddContact(_T2A(szJid), true);
+ CallService(MS_FILE_SENDFILE, hContact, NULL);
return 1;
}
if (!mir_tstrcmpi(szCommand, _T("voicemail")))
diff --git a/protocols/SkypeWeb/src/stdafx.h b/protocols/SkypeWeb/src/stdafx.h index 4a18fd8ea4..1422b847a5 100644 --- a/protocols/SkypeWeb/src/stdafx.h +++ b/protocols/SkypeWeb/src/stdafx.h @@ -107,8 +107,8 @@ struct MessageId #include "skype_dialogs.h"
#include "skype_options.h"
#include "skype_trouter.h"
-#include "skype_db.h"
#include "skype_utils.h"
+#include "skype_db.h"
#include "http_request.h"
#include "requests\login.h"
#include "requests\profile.h"
|