diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-07 13:51:06 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-07 13:51:06 +0300 |
commit | 609c3041668b36bc6abfa9511aa4e197bf0060ff (patch) | |
tree | 64c30677246aad9876ea037dbe8710833edd466f /plugins/Clist_modern | |
parent | 375c728e532139cb4ee4fe8c8266d511e5c9a289 (diff) |
duplicate ME_PROTO_ACK handlers merged together
Diffstat (limited to 'plugins/Clist_modern')
-rw-r--r-- | plugins/Clist_modern/src/modern_clc.cpp | 15 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clisttray.cpp | 45 |
2 files changed, 21 insertions, 39 deletions
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 1230408ffb..371d7ce1f2 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -1648,19 +1648,8 @@ int ClcUnloadModule() int ClcDoProtoAck(ACKDATA *ack)
{
if (MirandaExiting()) return 0;
- if (ack->type == ACKTYPE_STATUS) {
- if (ack->result == ACKRESULT_SUCCESS) {
- for (int i = 0; i < pcli->hClcProtoCount; i++) {
- if (!mir_strcmp(pcli->clcProto[i].szProto, ack->szModule)) {
- pcli->clcProto[i].dwStatus = (WORD)ack->lParam;
- if (pcli->clcProto[i].dwStatus >= ID_STATUS_OFFLINE)
- Clist_TrayIconUpdateBase(pcli->clcProto[i].szProto);
- return 0;
- }
- }
- }
- }
- else if (ack->type == ACKTYPE_AWAYMSG) {
+
+ if (ack->type == ACKTYPE_AWAYMSG) {
if (ack->result == ACKRESULT_SUCCESS && ack->lParam) {
if (ack->szModule != nullptr)
if (db_get_b(ack->hContact, ack->szModule, "ChatRoom", 0) != 0)
diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp index 40e25870c9..2e553b55f0 100644 --- a/plugins/Clist_modern/src/modern_clisttray.cpp +++ b/plugins/Clist_modern/src/modern_clisttray.cpp @@ -57,37 +57,33 @@ char* g_szConnectingProto = nullptr; int GetStatusVal(int status)
{
+ if (IsStatusConnecting(status)) // 'connecting' status has the top priority
+ return 600;
+
switch (status) {
- case ID_STATUS_OFFLINE: return 50;
- case ID_STATUS_ONLINE: return 100;
- case ID_STATUS_FREECHAT: return 110;
- case ID_STATUS_INVISIBLE: return 120;
- case ID_STATUS_AWAY: return 200;
- case ID_STATUS_DND: return 210;
- case ID_STATUS_NA: return 220;
- case ID_STATUS_OCCUPIED: return 230;
- case ID_STATUS_ONTHEPHONE: return 400;
- case ID_STATUS_OUTTOLUNCH: return 410;
+ case ID_STATUS_OFFLINE: return 50;
+ case ID_STATUS_ONLINE: return 100;
+ case ID_STATUS_FREECHAT: return 110;
+ case ID_STATUS_INVISIBLE: return 120;
+ case ID_STATUS_AWAY: return 200;
+ case ID_STATUS_DND: return 210;
+ case ID_STATUS_NA: return 220;
+ case ID_STATUS_OCCUPIED: return 230;
+ case ID_STATUS_ONTHEPHONE: return 400;
+ case ID_STATUS_OUTTOLUNCH: return 410;
}
- if (status > 0 && status < ID_STATUS_OFFLINE)
- return 600; // 'connecting' status has the top priority
return 0;
}
-int GetStatusOrder(int currentStatus, int newStatus)
-{
- int current = GetStatusVal(currentStatus);
- int newstat = GetStatusVal(newStatus);
- return (current > newstat) ? currentStatus : newStatus;
-}
-
INT_PTR CListTray_GetGlobalStatus(WPARAM, LPARAM)
{
g_szConnectingProto = nullptr;
int curstatus = 0;
int connectingCount = 0;
+ g_bMultiConnectionMode = false;
+
for (int i = 0; i < pcli->hClcProtoCount; i++) {
ClcProtoStatus &p = pcli->clcProto[i];
if (!Clist_GetProtocolVisibility(p.szProto))
@@ -97,16 +93,13 @@ INT_PTR CListTray_GetGlobalStatus(WPARAM, LPARAM) connectingCount++;
if (connectingCount == 1)
g_szConnectingProto = p.szProto;
+ else
+ g_bMultiConnectionMode = true;
}
- else curstatus = GetStatusOrder(curstatus, p.dwStatus);
+ else if (GetStatusVal(p.dwStatus) > GetStatusVal(curstatus))
+ curstatus = p.dwStatus;
}
- if (connectingCount == 0)
- g_bMultiConnectionMode = FALSE;
- else if (connectingCount > 1)
- g_bMultiConnectionMode = TRUE;
- else
- g_bMultiConnectionMode = FALSE;
return curstatus ? curstatus : ID_STATUS_OFFLINE;
}
|