diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2014-03-30 11:03:57 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2014-03-30 11:03:57 +0000 |
commit | f1b2e090d9a10b4fc6dc7326856cb5be81a1d4d8 (patch) | |
tree | 7bcea5fac7674bfbe0e9c3cfac31d073ee01dbb0 /protocols/Steam/src/steam_accounts.cpp | |
parent | d3fc664a564c8864eca2b2cd19396940e45f4dca (diff) |
Steam: init commit
git-svn-id: http://svn.miranda-ng.org/main/trunk@8790 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Steam/src/steam_accounts.cpp')
-rw-r--r-- | protocols/Steam/src/steam_accounts.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/protocols/Steam/src/steam_accounts.cpp b/protocols/Steam/src/steam_accounts.cpp new file mode 100644 index 0000000000..7c77af01c7 --- /dev/null +++ b/protocols/Steam/src/steam_accounts.cpp @@ -0,0 +1,45 @@ +#include "steam.h"
+
+int CSteamProto::CompareProtos(const CSteamProto *p1, const CSteamProto *p2)
+{
+ return lstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+}
+
+LIST<CSteamProto> CSteamProto::InstanceList(1, CSteamProto::CompareProtos);
+
+CSteamProto* CSteamProto::InitAccount(const char* protoName, const wchar_t* userName)
+{
+ CSteamProto *ppro = new CSteamProto(protoName, userName);
+ InstanceList.insert(ppro);
+
+ return ppro;
+}
+
+int CSteamProto::UninitAccount(CSteamProto* ppro)
+{
+ InstanceList.remove(ppro);
+ delete ppro;
+
+ return 0;
+}
+
+void CSteamProto::UninitAccounts()
+{
+ for (int i = InstanceList.getCount(); i > 0; i--)
+ UninitAccount(InstanceList[i]);
+ InstanceList.destroy();
+}
+
+CSteamProto* CSteamProto::GetContactAccount(MCONTACT hContact)
+{
+ char *proto = (char *)::CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0);
+
+ if (proto == NULL)
+ return NULL;
+
+ for (int i = 0; i < InstanceList.getCount(); i++)
+ if (!strcmp(proto, InstanceList[i]->m_szModuleName))
+ return InstanceList[i];
+
+ return NULL;
+}
\ No newline at end of file |