diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2014-08-20 18:30:56 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2014-08-20 18:30:56 +0000 |
commit | 32aac6884eeff071503b70d7e441244a5690382c (patch) | |
tree | ff7e896cdc5aa48197dda6f68547b2d3f20e9655 /protocols/Tox/src/tox_events.cpp | |
parent | 8c4e9632602b62e7484fab3a741bbc1daa33c412 (diff) |
Tox: fixed status message
git-svn-id: http://svn.miranda-ng.org/main/trunk@10244 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_events.cpp')
-rw-r--r-- | protocols/Tox/src/tox_events.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/protocols/Tox/src/tox_events.cpp b/protocols/Tox/src/tox_events.cpp index ee439c8fdf..eeedc29ac2 100644 --- a/protocols/Tox/src/tox_events.cpp +++ b/protocols/Tox/src/tox_events.cpp @@ -129,11 +129,22 @@ int CToxProto::OnContactDeleted(MCONTACT hContact, LPARAM lParam) int CToxProto::OnSettingsChanged(MCONTACT hContact, LPARAM lParam)
{
DBCONTACTWRITESETTING* dbcws = (DBCONTACTWRITESETTING*)lParam;
- if (hContact == NULL && !strcmp(dbcws->szModule, m_szModuleName) && !strcmp(dbcws->szSetting, "Nick"))
+ if (hContact == NULL && !strcmp(dbcws->szModule, m_szModuleName))
{
- if (tox_set_name(tox, (uint8_t*)(char*)ptrA(mir_utf8encodeW(dbcws->value.ptszVal)), (uint16_t)_tcslen(dbcws->value.ptszVal)))
+ if (!strcmp(dbcws->szSetting, "Nick"))
{
- SaveToxData();
+ if (tox_set_name(tox, (uint8_t*)(char*)ptrA(mir_utf8encodeW(dbcws->value.ptszVal)), (uint16_t)_tcslen(dbcws->value.ptszVal)))
+ {
+ SaveToxData();
+ }
+ }
+
+ if (!strcmp(dbcws->szSetting, "StatusMsg") || !strcmp(dbcws->szSetting, "StatusNote"))
+ {
+ if (tox_set_status_message(tox, (uint8_t*)(char*)ptrA(mir_utf8encodeW(dbcws->value.ptszVal)), (uint16_t)_tcslen(dbcws->value.ptszVal)))
+ {
+ SaveToxData();
+ }
}
}
@@ -148,7 +159,7 @@ void CToxProto::OnFriendRequest(Tox *tox, const uint8_t *userId, const uint8_t * std::string toxId = proto->DataToHexString(clientId);
proto->RaiseAuthRequestEvent(time(NULL), toxId.c_str(), (char*)message);
-
+
proto->SaveToxData();
}
@@ -198,7 +209,8 @@ void CToxProto::OnStatusMessageChanged(Tox *tox, const int friendnumber, const u MCONTACT hContact = proto->FindContact(toxId.c_str());
if (hContact)
{
- db_set_s(hContact, "CList", "StatusMsg", (char*)message);
+ ptrW statusMessage(mir_utf8decodeW((char*)message));
+ db_set_ws(hContact, "CList", "StatusMsg", statusMessage);
}
}
|