diff options
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Tox/src/tox_contacts.cpp | 10 | ||||
-rw-r--r-- | protocols/Tox/src/tox_events.cpp | 18 | ||||
-rw-r--r-- | protocols/Tox/src/tox_proto.cpp | 5 | ||||
-rw-r--r-- | protocols/Tox/src/tox_proto.h | 2 |
4 files changed, 34 insertions, 1 deletions
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index 1fd99bc36e..3ae3cf9f21 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -96,6 +96,16 @@ void CToxProto::LoadContactList() std::string toxId = DataToHexString(clientId);
MCONTACT hContact = AddContact(toxId.c_str());
+ if (hContact)
+ {
+ tox_get_name(tox, friends[i], &username[0]);
+ std::string nick(username.begin(), username.end());
+ setString(hContact, "Nick", nick.c_str());
+
+ uint8_t userstatus = tox_get_user_status(tox, friends[i]);
+ int status = ToxToMirandaStatus((TOX_USERSTATUS)userstatus);
+ SetContactStatus(hContact, status);
+ }
}
}
}
diff --git a/protocols/Tox/src/tox_events.cpp b/protocols/Tox/src/tox_events.cpp index ebc189aeba..6007530666 100644 --- a/protocols/Tox/src/tox_events.cpp +++ b/protocols/Tox/src/tox_events.cpp @@ -40,6 +40,24 @@ int CToxProto::OnOptionsInit(void *obj, WPARAM wParam, LPARAM lParam) return 0;
}
+INT_PTR CToxProto::OnContactDeleted(WPARAM wParam, LPARAM)
+{
+ MCONTACT hContact = (MCONTACT)wParam;
+ if (hContact)
+ {
+ std::string toxId(getStringA(hContact, TOX_SETTING_ID));
+ std::vector<uint8_t> clientId = HexStringToData(toxId);
+
+ uint32_t number = tox_get_friend_number(tox, clientId.data());
+ if (tox_del_friend(tox, number) == -1)
+ {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
void CToxProto::OnFriendRequest(Tox *tox, const uint8_t *userId, const uint8_t *message, const uint16_t messageSize, void *arg)
{
CToxProto *proto = (CToxProto*)arg;
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index 9029c54a16..87e0149f41 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -83,7 +83,7 @@ DWORD_PTR __cdecl CToxProto::GetCaps(int type, MCONTACT hContact) switch(type)
{
case PFLAGNUM_1:
- return PF1_IM | PF1_AUTHREQ;
+ return PF1_IM | PF1_AUTHREQ | PF1_BASICSEARCH;
case PFLAGNUM_2:
return PF2_ONLINE | PF2_SHORTAWAY | PF2_LIGHTDND;
case PFLAGNUM_4:
@@ -207,6 +207,9 @@ int __cdecl CToxProto::OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM {
case EV_PROTO_ONLOAD:
return OnModulesLoaded(wParam, lParam);
+
+ case EV_PROTO_ONCONTACTDELETED:
+ return OnContactDeleted(wParam, lParam);
}
return 1;
diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index f8db0371db..8c31e30d64 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -97,6 +97,8 @@ private: INT_PTR __cdecl OnAccountManagerInit(WPARAM, LPARAM);
static int __cdecl OnOptionsInit(void *obj, WPARAM wParam, LPARAM lParam);
+ INT_PTR __cdecl OnContactDeleted(WPARAM, LPARAM);
+
static void OnFriendRequest(Tox *tox, const uint8_t *userId, const uint8_t *message, const uint16_t messageSize, void *arg);
static void OnFriendMessage(Tox *tox, const int friendnumber, const uint8_t *message, const uint16_t messageSize, void *arg);
static void OnFriendNameChange(Tox *tox, const int friendnumber, const uint8_t *name, const uint16_t nameSize, void *arg);
|