diff options
author | George Hazan <george.hazan@gmail.com> | 2015-05-21 16:11:58 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-05-21 16:11:58 +0000 |
commit | 48266e479d1fcf5153b29c612866845990fccad8 (patch) | |
tree | c8cbc908cd3c5f08731e5e8d7eaac6b568007d09 /protocols/Tox/src/tox_messages.cpp | |
parent | ebdb556f152734035846f120eb8112f88ef91281 (diff) |
war against atavisms continues
- everything that goes to PSS_MESSAGE should be sent as utf8 string;
- thus PREF_UNICODE & PREF_UTF support discontinued, these constants are removed;
- support for PREF_UNICODE & PREF_UTF in protocols also removed;
- PREF_UNICODE used in file transfers (PROTOFILERECVT) replaced with PRFF_UNICODE / PRFF_TCHAR
git-svn-id: http://svn.miranda-ng.org/main/trunk@13734 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_messages.cpp')
-rw-r--r-- | protocols/Tox/src/tox_messages.cpp | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/protocols/Tox/src/tox_messages.cpp b/protocols/Tox/src/tox_messages.cpp index d6e77e1ab7..895e4e9aa1 100644 --- a/protocols/Tox/src/tox_messages.cpp +++ b/protocols/Tox/src/tox_messages.cpp @@ -18,17 +18,14 @@ void CToxProto::OnFriendMessage(Tox*, uint32_t friendNumber, TOX_MESSAGE_TYPE ty length -= 3;
mir_strncpy(rawMessage, (const char*)&message[4], length);
}
- else
- mir_strncpy(rawMessage, (const char*)message, length + 1);
+ else mir_strncpy(rawMessage, (const char*)message, length + 1);
rawMessage[length] = 0;
PROTORECVEVENT recv = { 0 };
- recv.flags = PREF_UTF;
+ recv.flags = 0;
recv.timestamp = time(NULL);
recv.szMessage = rawMessage;
- recv.lParam = type == TOX_MESSAGE_TYPE_NORMAL
- ? EVENTTYPE_MESSAGE : DB_EVENT_ACTION;
-
+ recv.lParam = type == TOX_MESSAGE_TYPE_NORMAL ? EVENTTYPE_MESSAGE : DB_EVENT_ACTION;
ProtoChainRecvMsg(hContact, &recv);
CallService(MS_PROTO_CONTACTISTYPING, hContact, (LPARAM)PROTOTYPE_CONTACTTYPING_OFF);
@@ -55,24 +52,16 @@ int CToxProto::OnReceiveMessage(MCONTACT hContact, PROTORECVEVENT *pre) /* MESSAGE SENDING */
// outcoming message flow
-int CToxProto::OnSendMessage(MCONTACT hContact, int flags, const char *szMessage)
+int CToxProto::OnSendMessage(MCONTACT hContact, const char *szMessage)
{
int32_t friendNumber = GetToxFriendNumber(hContact);
if (friendNumber == UINT32_MAX)
return 0;
- ptrA message;
- if (flags & PREF_UNICODE)
- message = mir_utf8encodeW((wchar_t*)&szMessage[mir_strlen(szMessage) + 1]);
- else //if (flags & PREF_UTF)
- message = mir_strdup(szMessage);
- //else
- //message = mir_utf8encode(szMessage);
-
- size_t msgLen = mir_strlen(message);
- uint8_t *msg = (uint8_t*)(char*)message;
+ size_t msgLen = mir_strlen(szMessage);
+ uint8_t *msg = (uint8_t*)szMessage;
TOX_MESSAGE_TYPE type = TOX_MESSAGE_TYPE_NORMAL;
- if (strncmp(message, "/me ", 4) == 0)
+ if (strncmp(szMessage, "/me ", 4) == 0)
{
msg += 4; msgLen -= 4;
type = TOX_MESSAGE_TYPE_ACTION;
|