diff options
Diffstat (limited to 'plugins/SecureIM/src/crypt_metacontacts.cpp')
-rw-r--r-- | plugins/SecureIM/src/crypt_metacontacts.cpp | 70 |
1 files changed, 30 insertions, 40 deletions
diff --git a/plugins/SecureIM/src/crypt_metacontacts.cpp b/plugins/SecureIM/src/crypt_metacontacts.cpp index d78f4adc49..87e948716a 100644 --- a/plugins/SecureIM/src/crypt_metacontacts.cpp +++ b/plugins/SecureIM/src/crypt_metacontacts.cpp @@ -1,58 +1,48 @@ #include "commonheaders.h"
-
-BOOL isProtoMetaContacts(HANDLE hContact) {
- if (bMetaContacts) {
- LPSTR proto = GetContactProto(hContact);
- if ( proto && strcmp(proto,"MetaContacts")==0 ) {
- return true;
- }
- }
-// for(int j=0;j<clist_cnt;j++)
-// if (clist[j].hContact==hContact && clist[j].proto->inspecting)
-// return strstr(clist[j].proto->name,"MetaContacts")!=NULL;
- return false;
+BOOL isProtoMetaContacts(HANDLE hContact)
+{
+ if (bMetaContacts) {
+ LPSTR proto = GetContactProto(hContact);
+ if ( proto && !strcmp(proto,"MetaContacts"))
+ return true;
+ }
+ return false;
}
+BOOL isDefaultSubContact(HANDLE hContact)
+{
+ if (bMetaContacts)
+ return (HANDLE)CallService(MS_MC_GETDEFAULTCONTACT,(WPARAM)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0),0) == hContact;
-BOOL isDefaultSubContact(HANDLE hContact) {
-
- if (bMetaContacts) {
- return (HANDLE)CallService(MS_MC_GETDEFAULTCONTACT,(WPARAM)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0),0)==hContact;
- }
- return false;
+ return false;
}
+HANDLE getMetaContact(HANDLE hContact)
+{
+ if (bMetaContacts)
+ return (HANDLE)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0);
-HANDLE getMetaContact(HANDLE hContact) {
-
- if (bMetaContacts) {
- return (HANDLE)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0);
- }
- return 0;
+ return 0;
}
+HANDLE getMostOnline(HANDLE hContact)
+{
+ if (bMetaContacts)
+ return (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0);
-HANDLE getMostOnline(HANDLE hContact) {
-
- if (bMetaContacts) {
- return (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)hContact,0);
- }
- return 0;
+ return 0;
}
-
// remove all secureim connections on subcontacts
-void DeinitMetaContact(HANDLE hContact) {
-
+void DeinitMetaContact(HANDLE hContact)
+{
HANDLE hMetaContact = isProtoMetaContacts(hContact) ? hContact : getMetaContact(hContact);
-
- if ( hMetaContact ) {
- for(int i=0;i<CallService(MS_MC_GETNUMCONTACTS,(WPARAM)hMetaContact,0);i++) {
- HANDLE hSubContact = (HANDLE)CallService(MS_MC_GETSUBCONTACT,(WPARAM)hMetaContact,(LPARAM)i);
- if ( hSubContact && isContactSecured(hSubContact)&SECURED ) {
- CallContactService(hSubContact,PSS_MESSAGE,(WPARAM)PREF_METANODB,(LPARAM)SIG_DEIN);
- }
+ if (hMetaContact) {
+ for (int i=0; i < CallService(MS_MC_GETNUMCONTACTS,(WPARAM)hMetaContact,0); i++) {
+ HANDLE hSubContact = (HANDLE)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hMetaContact, i);
+ if (hSubContact && (isContactSecured(hSubContact)&SECURED))
+ CallContactService(hSubContact,PSS_MESSAGE, PREF_METANODB, (LPARAM)SIG_DEIN);
}
}
}
|