summaryrefslogtreecommitdiff
path: root/protocols/Steam/src/steam_instances.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-04-03 12:29:38 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-04-03 12:29:38 +0000
commitcbf3dd8f411c1336c7bde2b6bbd0eb74941ac60b (patch)
tree37f5bca463411658f136952345661db54adaa4a5 /protocols/Steam/src/steam_instances.cpp
parenta5b7f6edac87d6caedb83e0fa34a3dacda28a175 (diff)
Steam: authorization, login, contact list retrieving
git-svn-id: http://svn.miranda-ng.org/main/trunk@8839 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Steam/src/steam_instances.cpp')
-rw-r--r--protocols/Steam/src/steam_instances.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/protocols/Steam/src/steam_instances.cpp b/protocols/Steam/src/steam_instances.cpp
new file mode 100644
index 0000000000..82b62f9654
--- /dev/null
+++ b/protocols/Steam/src/steam_instances.cpp
@@ -0,0 +1,45 @@
+#include "common.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::InitProtoInstance(const char* protoName, const wchar_t* userName)
+{
+ CSteamProto *ppro = new CSteamProto(protoName, userName);
+ InstanceList.insert(ppro);
+
+ return ppro;
+}
+
+int CSteamProto::UninitProtoInstance(CSteamProto* ppro)
+{
+ InstanceList.remove(ppro);
+ delete ppro;
+
+ return 0;
+}
+
+void CSteamProto::UninitProtoInstances()
+{
+ for (int i = InstanceList.getCount(); i > 0; i--)
+ UninitProtoInstance(InstanceList[i]);
+ InstanceList.destroy();
+}
+
+CSteamProto* CSteamProto::GetContactProtoInstance(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