summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-01-06 11:53:14 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-01-06 11:53:14 +0000
commit51acae2613c8a38e9116dcca3237fa7ad0dd3a6c (patch)
treee143fddf1c0d7cf959ce30ff25f36f245d5a3117 /protocols
parent9c66032fdc937f852771949c4b4c94ade67324d8 (diff)
Tox: sending own status message
git-svn-id: http://svn.miranda-ng.org/main/trunk@11779 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Tox/src/tox_proto.cpp20
-rw-r--r--protocols/Tox/src/tox_transfer.cpp2
2 files changed, 18 insertions, 4 deletions
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp
index 7986987fe4..2f4e749412 100644
--- a/protocols/Tox/src/tox_proto.cpp
+++ b/protocols/Tox/src/tox_proto.cpp
@@ -51,7 +51,6 @@ CToxProto::CToxProto(const char* protoName, const TCHAR* userName) :
CToxProto::~CToxProto()
{
mir_free(accountName);
- //UninitToxCore();
UninitNetlib();
}
@@ -60,9 +59,11 @@ DWORD_PTR __cdecl CToxProto::GetCaps(int type, MCONTACT hContact)
switch (type)
{
case PFLAGNUM_1:
- return PF1_IM | PF1_FILE | PF1_AUTHREQ | PF1_EXTSEARCH | PF1_SERVERCLIST;
+ return PF1_IM | PF1_FILE | PF1_AUTHREQ | PF1_MODEMSGSEND | PF1_EXTSEARCH | PF1_SERVERCLIST;
case PFLAGNUM_2:
return PF2_ONLINE | PF2_SHORTAWAY | PF2_LIGHTDND;
+ case PFLAGNUM_3:
+ return PF2_ONLINE | PF2_SHORTAWAY | PF2_LIGHTDND;
case PFLAGNUM_4:
return PF4_IMSENDUTF | PF4_SINGLEFILEONLY | PF4_SUPPORTTYPING | PF4_AVATARS
| PF4_FORCEADDED | PF4_NOAUTHDENYREASON | PF4_FORCEAUTH;
@@ -249,7 +250,20 @@ int __cdecl CToxProto::SetStatus(int iNewStatus)
HANDLE __cdecl CToxProto::GetAwayMsg(MCONTACT hContact) { return 0; }
int __cdecl CToxProto::RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT* evt) { return 0; }
-int __cdecl CToxProto::SetAwayMsg(int iStatus, const PROTOCHAR* msg) { return 0; }
+
+int __cdecl CToxProto::SetAwayMsg(int iStatus, const PROTOCHAR *msg)
+{
+ if (IsOnline())
+ {
+ ptrA statusMessage(msg == NULL ? mir_strdup("") : mir_utf8encodeT(msg));
+ if (tox_set_status_message(tox, (uint8_t*)(char*)statusMessage, min(TOX_MAX_STATUSMESSAGE_LENGTH, strlen(statusMessage))) == TOX_ERROR)
+ {
+ debugLogA("CToxProto::SetAwayMsg: failed to set status status message %s", msg);
+ }
+ }
+
+ return 0;
+}
int __cdecl CToxProto::OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam)
{
diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp
index 127c0340af..03ebe2c467 100644
--- a/protocols/Tox/src/tox_transfer.cpp
+++ b/protocols/Tox/src/tox_transfer.cpp
@@ -219,7 +219,7 @@ void CToxProto::SendFileAsync(void* arg)
uint8_t *data = (uint8_t*)mir_alloc(TOX_FILE_BLOCK_SIZE);
while (!feof(hFile) && fileProgress < fileSize && !transfer->isTerminated)
{
- // read file by block of 1mb
+ // read file by block of TOX_FILE_BLOCK_SIZE
size_t blockSize = min(chunkSize * (TOX_FILE_BLOCK_SIZE / chunkSize), fileSize - fileProgress);
if (fread(data, sizeof(uint8_t), blockSize, hFile) != blockSize)
{