From 64e4c45c42ce093c7e6e9a99a5a0938dc212aa59 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Wed, 18 Feb 2015 15:28:53 +0000 Subject: added service for nickname changing git-svn-id: http://svn.miranda-ng.org/main/trunk@12181 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Tox/src/tox_proto.cpp | 2 ++ protocols/Tox/src/tox_proto.h | 2 ++ protocols/Tox/src/tox_svc.cpp | 10 ++++++++++ 3 files changed, 14 insertions(+) create mode 100644 protocols/Tox/src/tox_svc.cpp (limited to 'protocols/Tox/src') diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index 8dfa281296..5da0686a7a 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -46,6 +46,8 @@ CToxProto::CToxProto(const char* protoName, const TCHAR* userName) : CreateProtoService(PS_GETMYAVATART, &CToxProto::GetMyAvatar); CreateProtoService(PS_SETMYAVATART, &CToxProto::SetMyAvatar); + CreateProtoService(PS_SETMYNICKNAME, &CToxProto::SetMyNickname); + // transfers transfers = new CTransferList(); } diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index 2de83cdd38..ecfcc94b50 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -169,6 +169,8 @@ private: INT_PTR __cdecl GetMyAvatar(WPARAM wParam, LPARAM lParam); INT_PTR __cdecl SetMyAvatar(WPARAM wParam, LPARAM lParam); + INT_PTR __cdecl CToxProto::SetMyNickname(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); diff --git a/protocols/Tox/src/tox_svc.cpp b/protocols/Tox/src/tox_svc.cpp new file mode 100644 index 0000000000..83ea092f36 --- /dev/null +++ b/protocols/Tox/src/tox_svc.cpp @@ -0,0 +1,10 @@ +#include "common.h" + +INT_PTR __cdecl CToxProto::SetMyNickname(WPARAM wParam, LPARAM lParam) +{ + TCHAR *nickname = (wParam & SMNN_UNICODE) ? mir_u2t((WCHAR*)lParam) : mir_a2t((char*)lParam); + + setTString("Nick", nickname); + tox_set_name(tox, (uint8_t*)(char*)_T2A(nickname), mir_tstrlen(nickname)); + return 0; +} -- cgit v1.2.3