diff options
author | aunsane <aunsane@gmail.com> | 2017-03-12 21:19:21 +0300 |
---|---|---|
committer | aunsane <aunsane@gmail.com> | 2017-03-12 21:19:38 +0300 |
commit | b9c2a6953f0fa75a1c4de6079e9c97b3a60be7e5 (patch) | |
tree | 83940e0306fd9b0eca9dfe7ce679b437cde9331b /protocols/Slack/src/slack_accounts.cpp | |
parent | 9826bda7bcd2a2024eac0fcecffc9633f5ac79f6 (diff) |
Slack: initial commit
Diffstat (limited to 'protocols/Slack/src/slack_accounts.cpp')
-rw-r--r-- | protocols/Slack/src/slack_accounts.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/protocols/Slack/src/slack_accounts.cpp b/protocols/Slack/src/slack_accounts.cpp new file mode 100644 index 0000000000..1887c9fc95 --- /dev/null +++ b/protocols/Slack/src/slack_accounts.cpp @@ -0,0 +1,43 @@ +#include "stdafx.h" + +LIST<CSlackProto> CSlackProto::Accounts(1, CSlackProto::CompareAccounts); + +int CSlackProto::CompareAccounts(const CSlackProto *p1, const CSlackProto *p2) +{ + return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName); +} + +CSlackProto* CSlackProto::InitAccount(const char *protoName, const wchar_t *userName) +{ + CSlackProto *proto = new CSlackProto(protoName, userName); + Accounts.insert(proto); + return proto; +} + +int CSlackProto::UninitAccount(CSlackProto *proto) +{ + Accounts.remove(proto); + delete proto; + return 0; +} + +CSlackProto* CSlackProto::GetContactAccount(MCONTACT hContact) +{ + for (int i = 0; i < Accounts.getCount(); i++) + if (mir_strcmpi(GetContactProto(hContact), Accounts[i]->m_szModuleName) == 0) + return Accounts[i]; + return NULL; +} + +int CSlackProto::OnAccountLoaded(WPARAM, LPARAM) +{ + HookProtoEvent(ME_OPT_INITIALISE, &CSlackProto::OnOptionsInit); + HookProtoEvent(ME_MSG_PRECREATEEVENT, &CSlackProto::OnPreCreateMessage); + + return 0; +} + +INT_PTR CSlackProto::OnAccountManagerInit(WPARAM, LPARAM lParam) +{ + return (INT_PTR)(CSlackOptionsMain::CreateAccountManagerPage(this, (HWND)lParam))->GetHwnd(); +}
\ No newline at end of file |