summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_protoint.h1
-rw-r--r--protocols/Tox/src/tox_accounts.cpp19
-rw-r--r--protocols/Tox/src/tox_proto.cpp6
-rw-r--r--src/mir_app/src/proto_opts.cpp1
4 files changed, 13 insertions, 14 deletions
diff --git a/include/m_protoint.h b/include/m_protoint.h
index 136f54481d..da863f4251 100644
--- a/include/m_protoint.h
+++ b/include/m_protoint.h
@@ -36,7 +36,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
typedef enum
{
- EV_PROTO_ONRENAME,
EV_PROTO_ONERASE,
EV_PROTO_ONMENU
}
diff --git a/protocols/Tox/src/tox_accounts.cpp b/protocols/Tox/src/tox_accounts.cpp
index 2d02f68c4b..ff40c4bb2e 100644
--- a/protocols/Tox/src/tox_accounts.cpp
+++ b/protocols/Tox/src/tox_accounts.cpp
@@ -1,18 +1,21 @@
#include "stdafx.h"
-int CToxProto::OnAccountRenamed(WPARAM, LPARAM)
+int CToxProto::OnAccountRenamed(WPARAM wParam, LPARAM lParam)
{
- mir_cslock lock(m_profileLock);
+ PROTOACCOUNT *pa = (PROTOACCOUNT*)lParam;
+ if (wParam == PRAC_CHANGED && pa->ppro == this) {
+ mir_cslock lock(m_profileLock);
- ptrW newPath(GetToxProfilePath());
- wchar_t oldPath[MAX_PATH];
- mir_snwprintf(oldPath, MAX_PATH, L"%s\\%s.tox", VARSW(L"%miranda_userdata%"), m_accountName);
- _wrename(oldPath, newPath);
- m_accountName = mir_wstrdup(m_tszUserName);
+ ptrW newPath(GetToxProfilePath());
+ wchar_t oldPath[MAX_PATH];
+ mir_snwprintf(oldPath, MAX_PATH, L"%s\\%s.tox", VARSW(L"%miranda_userdata%"), m_accountName);
+ _wrename(oldPath, newPath);
+ m_accountName = mir_wstrdup(m_tszUserName);
+ }
return 0;
}
INT_PTR CToxProto::OnAccountManagerInit(WPARAM, LPARAM lParam)
{
return (INT_PTR)(CToxOptionsMain::CreateAccountManagerPage(this, (HWND)lParam))->GetHwnd();
-} \ No newline at end of file
+}
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp
index 004211284f..f893e881fe 100644
--- a/protocols/Tox/src/tox_proto.cpp
+++ b/protocols/Tox/src/tox_proto.cpp
@@ -34,6 +34,7 @@ CToxProto::CToxProto(const char* protoName, const wchar_t* userName)
CreateServiceFunction(MODULE "/GetEventIcon", &CToxProto::EventGetIcon);
HookProtoEvent(ME_CLIST_PREBUILDCONTACTMENU, &CToxProto::OnPrebuildContactMenu);
+ HookProtoEvent(ME_PROTO_ACCLISTCHANGED, &CToxProto::OnAccountRenamed);
hTerminateEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
}
@@ -224,12 +225,9 @@ int CToxProto::UserIsTyping(MCONTACT hContact, int type)
return OnUserIsTyping(hContact, type);
}
-int CToxProto::OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam)
+int CToxProto::OnEvent(PROTOEVENTTYPE iEventType, WPARAM, LPARAM)
{
switch (iEventType) {
- case EV_PROTO_ONRENAME:
- return OnAccountRenamed(wParam, lParam);
-
case EV_PROTO_ONMENU:
return OnInitStatusMenu();
diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp
index c0b561d3a1..a506e633ea 100644
--- a/src/mir_app/src/proto_opts.cpp
+++ b/src/mir_app/src/proto_opts.cpp
@@ -996,7 +996,6 @@ static int OnAccListChanged(WPARAM eventCode, LPARAM lParam)
case PRAC_CHANGED:
if (pa->ppro) {
replaceStrW(pa->ppro->m_tszUserName, pa->tszAccountName);
- pa->ppro->OnEvent(EV_PROTO_ONRENAME, 0, lParam);
if (pa->ppro->m_hmiMainMenu)
Menu_ModifyItem(pa->ppro->m_hmiMainMenu, pa->tszAccountName);