summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_events.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-08-20 19:58:30 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-08-20 19:58:30 +0000
commit8b5eb604f7dc0c87ce278feb52ba354f4e0ef6b2 (patch)
tree58e42eb96b9c2b474fc3c899e25facb35c12f588 /protocols/Tox/src/tox_events.cpp
parent32aac6884eeff071503b70d7e441244a5690382c (diff)
Tox:
- added typing support - updated tox core git-svn-id: http://svn.miranda-ng.org/main/trunk@10245 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_events.cpp')
-rw-r--r--protocols/Tox/src/tox_events.cpp52
1 files changed, 15 insertions, 37 deletions
diff --git a/protocols/Tox/src/tox_events.cpp b/protocols/Tox/src/tox_events.cpp
index eeedc29ac2..3857267c88 100644
--- a/protocols/Tox/src/tox_events.cpp
+++ b/protocols/Tox/src/tox_events.cpp
@@ -3,7 +3,6 @@
int CToxProto::OnAccountLoaded(WPARAM, LPARAM)
{
HookEventObj(ME_OPT_INITIALISE, OnOptionsInit, this);
- //HookEventObj(ME_USERINFO_INITIALISE, OnUserInfoInit, this);
HookEventObj(ME_PROTO_ACCLISTCHANGED, OnAccountListChanged, this);
InitNetlib();
@@ -71,42 +70,6 @@ int CToxProto::OnOptionsInit(void *obj, WPARAM wParam, LPARAM)
return 0;
}
-int CToxProto::OnUserInfoInit(void *obj, WPARAM wParam, LPARAM hContact)
-{
- return 0;
-
- CToxProto *proto = (CToxProto*)obj;
-
- if ((!proto->IsProtoContact(hContact) && hContact))
- return 0;
-
- OPTIONSDIALOGPAGE odp = { sizeof(odp) };
- odp.flags = ODPF_TCHAR | ODPF_USERINFOTAB | ODPF_DONTTRANSLATE;
- odp.hInstance = g_hInstance;
- odp.dwInitParam = (LPARAM)obj;
- odp.position = -1900000000;
- odp.ptszTitle = proto->m_tszUserName;
-
- if (hContact)
- {
- char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0);
- if (szProto != NULL && !strcmp(szProto, proto->m_szModuleName)) {
- //odp.pfnDlgProc = SkypeDlgProc;
- //odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_SKYPE);
- UserInfo_AddPage(wParam, &odp);
- }
- }
- else
- {
- //odp.pfnDlgProc = ContactSkypeDlgProc;
- //odp.pszTemplate = MAKEINTRESOURCEA(IDD_OWNINFO_CONTACT);
- odp.ptszTab = LPGENT("Contacts");
- UserInfo_AddPage(wParam, &odp);
- }
-
- return 0;
-}
-
int CToxProto::OnContactDeleted(MCONTACT hContact, LPARAM lParam)
{
if (hContact)
@@ -183,6 +146,21 @@ void CToxProto::OnFriendMessage(Tox *tox, const int friendnumber, const uint8_t
}
}
+void CToxProto::OnFriendTyping(Tox *tox, const int friendnumber, uint8_t isTyping, void *arg)
+{
+ CToxProto *proto = (CToxProto*)arg;
+
+ std::vector<uint8_t> clientId(TOX_CLIENT_ID_SIZE);
+ tox_get_client_id(tox, friendnumber, &clientId[0]);
+ std::string toxId = proto->DataToHexString(clientId);
+
+ MCONTACT hContact = proto->FindContact(toxId.c_str());
+ if (hContact)
+ {
+ CallService(MS_PROTO_CONTACTISTYPING, hContact, (LPARAM)isTyping);
+ }
+}
+
void CToxProto::OnFriendNameChange(Tox *tox, const int friendnumber, const uint8_t *name, const uint16_t nameSize, void *arg)
{
CToxProto *proto = (CToxProto*)arg;