summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-11-14 17:56:01 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-11-14 17:56:01 +0000
commite3e2ecff1cdd34b1fd389ea61e0410c7745e2a32 (patch)
tree6c051b4caa59956e6df008ef5993340429df84dc
parentf675677cf3952399bc773817025c394654f0a46e (diff)
SkypeWeb: images uploading support (part 2)
git-svn-id: http://svn.miranda-ng.org/main/trunk@15725 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/SkypeWeb/SkypeWeb.vcxproj.filters3
-rw-r--r--protocols/SkypeWeb/src/requests/asm/images.h4
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h7
-rw-r--r--protocols/SkypeWeb/src/skype_utils.h12
4 files changed, 24 insertions, 2 deletions
diff --git a/protocols/SkypeWeb/SkypeWeb.vcxproj.filters b/protocols/SkypeWeb/SkypeWeb.vcxproj.filters
index 15498fe4c2..829d664e4e 100644
--- a/protocols/SkypeWeb/SkypeWeb.vcxproj.filters
+++ b/protocols/SkypeWeb/SkypeWeb.vcxproj.filters
@@ -59,5 +59,8 @@
<ClInclude Include="src\requests\mslogin.h">
<Filter>Header Files\requests</Filter>
</ClInclude>
+ <ClInclude Include="src\requests\asm\images.h">
+ <Filter>Header Files\requests\ASM</Filter>
+ </ClInclude>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/requests/asm/images.h b/protocols/SkypeWeb/src/requests/asm/images.h
index 853bbf2dc0..d1494c01ef 100644
--- a/protocols/SkypeWeb/src/requests/asm/images.h
+++ b/protocols/SkypeWeb/src/requests/asm/images.h
@@ -11,7 +11,7 @@ public:
JSONNode node, jPermissions, jPermission(JSON_ARRAY);
jPermissions.set_name("permissions");
- jPermission.set_name(CMStringA(::FORMAT, "8:%s", szContact).GetString());
+ jPermission.set_name(szContact);
jPermission << JSONNode("read", (char*)NULL);
jPermissions << jPermission;
node << JSONNode("type", "pish/image") << jPermissions;
@@ -25,7 +25,7 @@ class ASMObjectUploadRequest : public HttpRequest
{
public:
ASMObjectUploadRequest(LoginInfo &li, const char *szObject, const PBYTE data, const size_t size) :
- HttpRequest(REQUEST_POST, FORMAT, "api.asm.skype.com/v1/objects/%s/content/imgpsh", szObject)
+ HttpRequest(REQUEST_PUT, FORMAT, "api.asm.skype.com/v1/objects/%s/content/imgpsh", szObject)
{
Headers
<< CHAR_VALUE("Authorization:", CMStringA(::FORMAT, "skype_token %s", li.api.szToken));
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h
index 91f4c3351a..d6b35e7b9d 100644
--- a/protocols/SkypeWeb/src/skype_proto.h
+++ b/protocols/SkypeWeb/src/skype_proto.h
@@ -53,6 +53,8 @@ public:
virtual int __cdecl UserIsTyping(MCONTACT hContact, int type);
virtual int __cdecl OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam);
virtual int __cdecl RecvContacts(MCONTACT hContact, PROTORECVEVENT*);
+ virtual HANDLE __cdecl SendFile(MCONTACT hContact, const TCHAR *szDescription, TCHAR **ppszFiles);
+
// accounts
static CSkypeProto* InitAccount(const char *protoName, const TCHAR *userName);
static int UninitAccount(CSkypeProto *proto);
@@ -219,6 +221,11 @@ private:
void LoadProfile(const NETLIBHTTPREQUEST *response);
+
+ void __cdecl CSkypeProto::SendFileThread(void *p);
+ void OnASMObjectCreated(const NETLIBHTTPREQUEST *response, void *arg);
+ void OnASMObjectUploaded(const NETLIBHTTPREQUEST *response, void *arg);
+
// contacts
WORD GetContactStatus(MCONTACT hContact);
void SetContactStatus(MCONTACT hContact, WORD status);
diff --git a/protocols/SkypeWeb/src/skype_utils.h b/protocols/SkypeWeb/src/skype_utils.h
index 34c2324dda..9723fd0f7c 100644
--- a/protocols/SkypeWeb/src/skype_utils.h
+++ b/protocols/SkypeWeb/src/skype_utils.h
@@ -88,4 +88,16 @@ public:
__inline operator HANDLE() { return _hEvent; }
};
+struct CFileUploadParam : public MZeroedObject {
+ ptrT tszFileName;
+ ptrT tszDesc;
+ char* atr;
+ char* fname;
+ MCONTACT hContact;
+
+ __forceinline CFileUploadParam(MCONTACT _hContact, const TCHAR* _desc, TCHAR** _files) : hContact(_hContact), tszDesc(mir_tstrdup(_desc)), tszFileName(mir_tstrdup(_files[0])) {};
+ __forceinline bool IsAccess() { return ::_taccess(tszFileName, 0) == 0; }
+};
+
+
#endif //_UTILS_H_ \ No newline at end of file