summaryrefslogtreecommitdiff
path: root/metacontacts.cpp
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss123next@list.ru>2011-01-29 15:17:51 +0300
committerGluzskiy Alexandr <sss123next@list.ru>2011-01-29 15:17:51 +0300
commit4d9fce6f544f0c6782a7ade4900afd3e1c6c9c52 (patch)
tree286cf4e530cec23e62e1a629857b4366ddd9862f /metacontacts.cpp
parent8142cedd8b857edd99a92f328e8b692b32bfeba6 (diff)
Better metacontacts handling\nFixed subkey length in keygen
Diffstat (limited to 'metacontacts.cpp')
-rw-r--r--metacontacts.cpp200
1 files changed, 100 insertions, 100 deletions
diff --git a/metacontacts.cpp b/metacontacts.cpp
index d1e959c..30d3a75 100644
--- a/metacontacts.cpp
+++ b/metacontacts.cpp
@@ -1,100 +1,100 @@
-// Copyright © 2010 SecureIM developers (baloo and others), sss
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "commonheaders.h"
-
-extern bool bMetaContacts;
-
-bool metaIsProtoMetaContacts(HANDLE hContact)
-{
- if(bMetaContacts) {
- LPSTR proto = (LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- if( proto && strcmp(proto,"MetaContacts")==0 ) {
- return true;
- }
- }
- return false;
-}
-
-
-bool metaIsDefaultSubContact(HANDLE hContact)
-{
-
- if(bMetaContacts)
- return (HANDLE)CallService(MS_MC_GETDEFAULTCONTACT,(WPARAM)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0),0)==hContact;
- return false;
-}
-
-
-HANDLE metaGetContact(HANDLE hContact)
-{
- if(bMetaContacts)
- return (HANDLE)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0);
- return 0;
-}
-bool metaIsSubcontact(HANDLE hContact)
-{
- if(bMetaContacts)
- return (HANDLE)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0);
- return false;
-}
-
-
-HANDLE metaGetMostOnline(HANDLE hContact)
-{
-
- if(bMetaContacts)
- return (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)hContact,0);
- return 0;
-}
-HANDLE metaGetDefault(HANDLE hContact)
-{
-
- if(bMetaContacts)
- return (HANDLE)CallService(MS_MC_GETDEFAULTCONTACT,(WPARAM)hContact,0);
- return 0;
-}
-
-HANDLE metaGetCurrent(HANDLE hContact)
-{
- bool IsOnline(HANDLE hContact);
- if(bMetaContacts)
- {
- if(!metaIsProtoMetaContacts(hContact))
- return hContact;
- HANDLE hcnt = metaGetMostOnline (hContact);
- if(!hcnt)
- hcnt = metaGetDefault(hContact);
- return hcnt;
- }
- return hContact;
-}
-
-
-DWORD metaGetContactsNum(HANDLE hContact)
-{
- if(bMetaContacts)
- return CallService(MS_MC_GETNUMCONTACTS, (WPARAM)hContact, 0);
- return 0;
-}
-HANDLE metaGetSubcontact(HANDLE hContact, int num)
-{
- if(bMetaContacts)
- return (HANDLE)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hContact, (LPARAM)num);
- return 0;
-}
-
-
+// Copyright © 2010 SecureIM developers (baloo and others), sss
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#include "commonheaders.h"
+
+extern bool bMetaContacts;
+
+bool metaIsProtoMetaContacts(HANDLE hContact)
+{
+ if(bMetaContacts) {
+ LPSTR proto = (LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ if( proto && strcmp(proto,"MetaContacts")==0 ) {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+bool metaIsDefaultSubContact(HANDLE hContact)
+{
+
+ if(bMetaContacts)
+ return (HANDLE)CallService(MS_MC_GETDEFAULTCONTACT,(WPARAM)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0),0)==hContact;
+ return false;
+}
+
+
+HANDLE metaGetContact(HANDLE hContact)
+{
+ if(bMetaContacts)
+ return (HANDLE)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0);
+ return 0;
+}
+bool metaIsSubcontact(HANDLE hContact)
+{
+ if(bMetaContacts)
+ return (HANDLE)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0);
+ return false;
+}
+
+
+HANDLE metaGetMostOnline(HANDLE hContact)
+{
+
+ if(bMetaContacts)
+ return (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)hContact,0);
+ return 0;
+}
+HANDLE metaGetDefault(HANDLE hContact)
+{
+
+ if(bMetaContacts)
+ return (HANDLE)CallService(MS_MC_GETDEFAULTCONTACT,(WPARAM)hContact,0);
+ return 0;
+}
+
+HANDLE metaGetCurrent(HANDLE hContact)
+{
+ bool IsOnline(HANDLE hContact);
+ if(bMetaContacts)
+ {
+ if(!metaIsProtoMetaContacts(hContact))
+ return hContact;
+ HANDLE hcnt = metaGetMostOnline (hContact);
+ if(!hcnt)
+ hcnt = metaGetDefault(hContact);
+ return hcnt;
+ }
+ return hContact;
+}
+
+
+DWORD metaGetContactsNum(HANDLE hContact)
+{
+ if(bMetaContacts)
+ return CallService(MS_MC_GETNUMCONTACTS, (WPARAM)hContact, 0);
+ return 0;
+}
+HANDLE metaGetSubcontact(HANDLE hContact, int num)
+{
+ if(bMetaContacts)
+ return (HANDLE)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hContact, (LPARAM)num);
+ return 0;
+}
+
+