diff options
-rw-r--r-- | src/mir_app/src/proto_chains.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/mir_app/src/proto_chains.cpp b/src/mir_app/src/proto_chains.cpp index 83391ccc0d..bb8b91cb31 100644 --- a/src/mir_app/src/proto_chains.cpp +++ b/src/mir_app/src/proto_chains.cpp @@ -171,23 +171,22 @@ MIR_APP_DLL(int) Proto_IsProtoOnContact(MCONTACT hContact, const char *szProto) MIR_APP_DLL(int) Proto_AddToContact(MCONTACT hContact, const char *szProto)
{
- PROTOCOLDESCRIPTOR *pd = Proto_IsProtocolLoaded(szProto);
- if (pd == nullptr) {
- PROTOACCOUNT *pa = Proto_GetAccount(szProto);
- if (pa) {
- db_set_s(hContact, "Protocol", "p", szProto);
+ if (auto *pa = Proto_GetAccount(szProto)) {
+ db_set_s(hContact, "Protocol", "p", szProto);
- if (pa->ppro)
- pa->ppro->OnContactAdded(hContact);
- return 0;
- }
- return 1;
+ if (pa->ppro)
+ pa->ppro->OnContactAdded(hContact);
+ return 0;
}
- if (pd->type == PROTOTYPE_PROTOCOL || pd->type == PROTOTYPE_VIRTUAL || pd->type == PROTOTYPE_PROTOWITHACCS)
- db_set_s(hContact, "Protocol", "p", szProto);
+ if (auto *pd = Proto_IsProtocolLoaded(szProto)) {
+ if (pd->type == PROTOTYPE_PROTOCOL || pd->type == PROTOTYPE_VIRTUAL || pd->type == PROTOTYPE_PROTOWITHACCS)
+ db_set_s(hContact, "Protocol", "p", szProto);
- return 0;
+ return 0;
+ }
+
+ return 1;
}
MIR_APP_DLL(int) Proto_RemoveFromContact(MCONTACT hContact, const char *szProto)
|