diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2014-09-23 20:28:25 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2014-09-23 20:28:25 +0000 |
commit | 1eec1e5f5b57fb56fbfeb56fc57777153c14df82 (patch) | |
tree | 2dd0e9780a378d11de0235b44d2c005376386578 /protocols | |
parent | dd8371ae948f88bc64c05728f18ebb2277e671c2 (diff) |
Tox: avatars support part one
git-svn-id: http://svn.miranda-ng.org/main/trunk@10568 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Tox/Tox_12.vcxproj | 1 | ||||
-rw-r--r-- | protocols/Tox/Tox_12.vcxproj.filters | 3 | ||||
-rw-r--r-- | protocols/Tox/src/common.h | 2 | ||||
-rw-r--r-- | protocols/Tox/src/tox_account.cpp | 4 | ||||
-rw-r--r-- | protocols/Tox/src/tox_proto.cpp | 9 | ||||
-rw-r--r-- | protocols/Tox/src/tox_proto.h | 11 |
6 files changed, 29 insertions, 1 deletions
diff --git a/protocols/Tox/Tox_12.vcxproj b/protocols/Tox/Tox_12.vcxproj index 455a12b2db..bcc2ddd6e5 100644 --- a/protocols/Tox/Tox_12.vcxproj +++ b/protocols/Tox/Tox_12.vcxproj @@ -211,6 +211,7 @@ </ClCompile>
<ClCompile Include="src\tox_account.cpp" />
<ClCompile Include="src\tox_accounts.cpp" />
+ <ClCompile Include="src\tox_avatars.cpp" />
<ClCompile Include="src\tox_events.cpp" />
<ClCompile Include="src\tox_messages.cpp" />
<ClCompile Include="src\tox_netlib.cpp" />
diff --git a/protocols/Tox/Tox_12.vcxproj.filters b/protocols/Tox/Tox_12.vcxproj.filters index 5ae989f241..06f6e9dc92 100644 --- a/protocols/Tox/Tox_12.vcxproj.filters +++ b/protocols/Tox/Tox_12.vcxproj.filters @@ -74,6 +74,9 @@ <ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\tox_avatars.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\resource.rc">
diff --git a/protocols/Tox/src/common.h b/protocols/Tox/src/common.h index 240b8817d7..fb36ce1557 100644 --- a/protocols/Tox/src/common.h +++ b/protocols/Tox/src/common.h @@ -29,6 +29,7 @@ #include <m_userinfo.h>
#include <m_addcontact.h>
#include <m_message.h>
+#include <m_avatars.h>
#include <tox.h>
#include <toxdns.h>
@@ -45,6 +46,7 @@ extern HINSTANCE g_hInstance; #define TOX_SETTINGS_ID "ToxID"
#define TOX_SETTINGS_GROUP "DefaultGroup"
+#define TOX_SETTINGS_AVATAR_HASH "AvatarHash"
#define TOX_DB_EVENT_TYPE_ACTION 10001
diff --git a/protocols/Tox/src/tox_account.cpp b/protocols/Tox/src/tox_account.cpp index c975276811..8af024e9f8 100644 --- a/protocols/Tox/src/tox_account.cpp +++ b/protocols/Tox/src/tox_account.cpp @@ -51,9 +51,13 @@ void CToxProto::InitToxCore() tox_callback_user_status(tox, OnUserStatusChanged, this);
tox_callback_read_receipt(tox, OnReadReceipt, this);
tox_callback_connection_status(tox, OnConnectionStatusChanged, this);
+ // file transfers
tox_callback_file_control(tox, OnFileRequest, this);
tox_callback_file_send_request(tox, OnFriendFile, this);
tox_callback_file_data(tox, OnFileData, this);
+ // avatars + tox_callback_avatar_info(tox, OnGotFriendAvatarInfo, this);
+ tox_callback_avatar_data(tox, OnGotFriendAvatarData, this);
LoadToxData();
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index 7106d88af6..19d830d97b 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -39,6 +39,12 @@ PROTO<CToxProto>(protoName, userName) dbEventType.eventType = TOX_DB_EVENT_TYPE_ACTION;
dbEventType.descr = "Tox action";
CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
+
+ // avatars
+ /*CreateProtoService(PS_GETAVATARCAPS, &CToxProto::GetAvatarCaps);
+ CreateProtoService(PS_GETAVATARINFOT, &CToxProto::GetAvatarInfo);
+ CreateProtoService(PS_GETMYAVATART, &CToxProto::GetMyAvatar);
+ CreateProtoService(PS_SETMYAVATART, &CToxProto::SetMyAvatar);*/
}
CToxProto::~CToxProto()
@@ -57,7 +63,8 @@ DWORD_PTR __cdecl CToxProto::GetCaps(int type, MCONTACT hContact) case PFLAGNUM_2:
return PF2_ONLINE | PF2_SHORTAWAY | PF2_LIGHTDND;
case PFLAGNUM_4:
- return PF4_IMSENDUTF | PF4_SINGLEFILEONLY | PF4_NOAUTHDENYREASON | PF4_FORCEAUTH | PF4_FORCEADDED | PF4_SUPPORTTYPING;
+ return PF4_IMSENDUTF | PF4_SINGLEFILEONLY | PF4_NOAUTHDENYREASON |PF4_FORCEAUTH
+ | PF4_FORCEADDED | PF4_SUPPORTTYPING | PF4_AVATARS;
case PFLAG_UNIQUEIDTEXT:
return (INT_PTR)"Tox ID";
case PFLAG_UNIQUEIDSETTING:
diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index 7051e5c381..b0cda8f390 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -197,6 +197,17 @@ private: static void OnFriendFile(Tox *tox, int32_t number, uint8_t fileNumber, uint64_t fileSize, const uint8_t *fileName, uint16_t length, void *arg);
static void OnFileData(Tox *tox, int32_t number, uint8_t fileNumber, const uint8_t *data, uint16_t length, void *arg);
+ // avatars
+ TCHAR* GetContactAvatarFilePath(MCONTACT hContact);
+
+ INT_PTR __cdecl GetAvatarCaps(WPARAM wParam, LPARAM lParam);
+ INT_PTR __cdecl GetAvatarInfo(WPARAM, LPARAM lParam);
+ INT_PTR __cdecl GetMyAvatar(WPARAM wParam, LPARAM lParam);
+ INT_PTR __cdecl SetMyAvatar(WPARAM wParam, LPARAM lParam);
+
+ static void OnGotFriendAvatarInfo(Tox *tox, int32_t number, uint8_t format, uint8_t *hash, void *arg);
+ static void OnGotFriendAvatarData(Tox *tox, int32_t number, uint8_t format, uint8_t *hash, uint8_t *data, uint32_t length, void *arg);
+
// utils
TOX_USERSTATUS MirandaToToxStatus(int status);
int ToxToMirandaStatus(TOX_USERSTATUS userstatus);
|