diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-02-22 21:14:05 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-02-22 21:14:05 +0000 |
commit | 4ffd0909f7990643a0253849d46a750bd9f3233b (patch) | |
tree | a0a004674fcd9ad0600f7c1ae5728bea499f9db0 /protocols/Tox/src/tox_events.cpp | |
parent | 0e8ffa6f388f28411decbcc6fe6c834029830714 (diff) |
Tox: some code for group chats
git-svn-id: http://svn.miranda-ng.org/main/trunk@12241 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_events.cpp')
-rw-r--r-- | protocols/Tox/src/tox_events.cpp | 55 |
1 files changed, 24 insertions, 31 deletions
diff --git a/protocols/Tox/src/tox_events.cpp b/protocols/Tox/src/tox_events.cpp index 3820c500dd..e372b9ee39 100644 --- a/protocols/Tox/src/tox_events.cpp +++ b/protocols/Tox/src/tox_events.cpp @@ -1,37 +1,30 @@ #include "common.h"
-INT_PTR CToxProto::OnAccountManagerInit(WPARAM, LPARAM lParam)
+int CToxProto::OnContactDeleted(MCONTACT hContact, LPARAM)
{
- return (INT_PTR)CreateDialogParam(
- g_hInstance,
- MAKEINTRESOURCE(IDD_ACCOUNT_MANAGER),
- (HWND)lParam,
- CToxProto::MainOptionsProc,
- (LPARAM)this);
-}
+ if (!IsOnline())
+ {
+ return 1;
+ }
-int CToxProto::OnOptionsInit(WPARAM wParam, LPARAM)
-{
- char *title = mir_t2a(m_tszUserName);
-
- OPTIONSDIALOGPAGE odp = { sizeof(odp) };
- odp.hInstance = g_hInstance;
- odp.pszTitle = title;
- odp.dwInitParam = (LPARAM)this;
- odp.flags = ODPF_BOLDGROUPS;
- odp.pszGroup = LPGEN("Network");
-
- odp.pszTab = LPGEN("Account");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_MAIN);
- odp.pfnDlgProc = MainOptionsProc;
- Options_AddPage(wParam, &odp);
-
- odp.pszTab = LPGEN("Nodes");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_NODES);
- odp.pfnDlgProc = NodesOptionsProc;
- Options_AddPage(wParam, &odp);
-
- mir_free(title);
+ ToxBinAddress pubKey = ptrA(getStringA(hContact, TOX_SETTINGS_ID));
+ if (!isChatRoom(hContact))
+ {
+ int32_t friendNumber = tox_get_friend_number(tox, pubKey);
+ if (friendNumber == TOX_ERROR || tox_del_friend(tox, friendNumber) == TOX_ERROR)
+ {
+ return 1;
+ }
+ }
+ else
+ {
+ OnLeaveChatRoom(hContact, 0);
+ int groupNumber = 0; // ???
+ if (groupNumber == TOX_ERROR || tox_del_groupchat(tox, groupNumber) == TOX_ERROR)
+ {
+ return 1;
+ }
+ }
return 0;
-}
+}
\ No newline at end of file |