diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-07 19:46:44 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-07 19:47:27 +0300 |
commit | 26a653ecae7edbeefb7966e08714e152c73b78eb (patch) | |
tree | e4f73b393a061ae296a36f802796f0fcc86cf573 | |
parent | 5565e5b9839eea8a57e9c46f87e611dd546c8b46 (diff) |
Proto_GetStatus() - fast method that returns a cached protocol status
-rw-r--r-- | include/m_protocols.h | 5 | ||||
-rw-r--r-- | libs/win32/mir_app.lib | bin | 155986 -> 156206 bytes | |||
-rw-r--r-- | libs/win64/mir_app.lib | bin | 151038 -> 151238 bytes | |||
-rw-r--r-- | src/mir_app/src/mir_app.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/protocols.cpp | 17 |
6 files changed, 18 insertions, 6 deletions
diff --git a/include/m_protocols.h b/include/m_protocols.h index 884ca2c5c3..ee81f41ef8 100644 --- a/include/m_protocols.h +++ b/include/m_protocols.h @@ -314,6 +314,11 @@ EXTERN_C MIR_APP_DLL(int) Proto_GetAverageStatus(int *pAccountNumber = nullptr); EXTERN_C MIR_APP_DLL(PROTOACCOUNT*) Proto_GetAccount(const char *pszModuleName);
/////////////////////////////////////////////////////////////////////////////////////////
+// returns last status reported by a protocol
+
+EXTERN_C MIR_APP_DLL(int) Proto_GetStatus(const char *pszModuleName);
+
+/////////////////////////////////////////////////////////////////////////////////////////
// this event is fired when the accounts list gets changed
// wParam = event type (1 - added, 2 - changed, 3 - deleted, 4 - upgraded, 5 - enabled/disabled)
// lParam = (LPARAM)(PROTOACCOUNT*) - account being changed
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib Binary files differindex 363e98de44..3b58fe9d1e 100644 --- a/libs/win32/mir_app.lib +++ b/libs/win32/mir_app.lib diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib Binary files differindex 9d004e115f..f004b34805 100644 --- a/libs/win64/mir_app.lib +++ b/libs/win64/mir_app.lib diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index a6aab7290b..987cb33996 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -578,3 +578,4 @@ Clist_RemoveItemFromGroup @597 Clist_ClcOptionsChanged @598
Clist_GetRealStatus @599
Clist_GetGeneralizedStatus @600
+Proto_GetStatus @601
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 3c749c9007..6d6a10621a 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -578,3 +578,4 @@ Clist_RemoveItemFromGroup @597 Clist_ClcOptionsChanged @598
Clist_GetRealStatus @599
Clist_GetGeneralizedStatus @600
+Proto_GetStatus @601
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp index 0179f80bde..477dbd2083 100644 --- a/src/mir_app/src/protocols.cpp +++ b/src/mir_app/src/protocols.cpp @@ -310,15 +310,20 @@ MIR_APP_DLL(PROTOACCOUNT*) Proto_GetAccount(const char *accName) if (accName == nullptr)
return nullptr;
- int idx;
- PROTOACCOUNT temp;
- temp.szModuleName = (char*)accName;
- if ((idx = accounts.getIndex(&temp)) == -1)
- return nullptr;
+ return accounts.find((PROTOACCOUNT*)&accName);
+}
- return accounts[idx];
+MIR_APP_DLL(int) Proto_GetStatus(const char *accName)
+{
+ if (accName == nullptr)
+ return ID_STATUS_OFFLINE;
+
+ PROTOACCOUNT *pa = accounts.find((PROTOACCOUNT*)&accName);
+ return (pa) ? pa->iRealStatus : ID_STATUS_OFFLINE;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
MIR_APP_DLL(void) Proto_EnumAccounts(int *nAccs, PROTOACCOUNT ***pAccs)
{
if (nAccs) *nAccs = accounts.getCount();
|