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 /src | |
parent | 375c728e532139cb4ee4fe8c8266d511e5c9a289 (diff) |
duplicate ME_PROTO_ACK handlers merged together
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/clc.cpp | 17 | ||||
-rw-r--r-- | src/mir_app/src/clistmod.cpp | 25 |
2 files changed, 17 insertions, 25 deletions
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index 0cb995c13e..7dd25496ae 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -156,11 +156,28 @@ static int ClcProtoAck(WPARAM, LPARAM lParam) {
ACKDATA *ack = (ACKDATA *)lParam;
if (ack->type == ACKTYPE_STATUS) {
+ cli.pfnCluiProtocolStatusChanged(lParam, ack->szModule);
+
+ if ((INT_PTR)ack->hProcess < ID_STATUS_ONLINE && ack->lParam >= ID_STATUS_ONLINE) {
+ // if we're going offline, kill all contacts scheduled for deletion
+ DWORD caps = (DWORD)CallProtoServiceInt(0, ack->szModule, PS_GETCAPS, PFLAGNUM_1, 0);
+ if (caps & PF1_SERVERCLIST) {
+ for (MCONTACT hContact = db_find_first(ack->szModule); hContact; ) {
+ MCONTACT hNext = db_find_next(hContact, ack->szModule);
+ if (db_get_b(hContact, "CList", "Delete", 0))
+ db_delete_contact(hContact);
+ hContact = hNext;
+ }
+ }
+ }
+
WindowList_BroadcastAsync(hClcWindowList, INTM_INVALIDATE, 0, 0);
+
if (ack->result == ACKRESULT_SUCCESS) {
for (int i = 0; i < cli.hClcProtoCount; i++) {
if (!mir_strcmp(cli.clcProto[i].szProto, ack->szModule)) {
cli.clcProto[i].dwStatus = (WORD)ack->lParam;
+ Clist_TrayIconUpdateBase(ack->szModule);
break;
}
}
diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp index 683c99e108..04245f11f5 100644 --- a/src/mir_app/src/clistmod.cpp +++ b/src/mir_app/src/clistmod.cpp @@ -109,30 +109,6 @@ MIR_APP_DLL(wchar_t*) Clist_GetStatusModeDescription(int mode, int flags) return (flags & GSMDF_UNTRANSLATED) ? descr : TranslateW(descr);
}
-static int ProtocolAck(WPARAM, LPARAM lParam)
-{
- ACKDATA *ack = (ACKDATA*)lParam;
- if (ack->type != ACKTYPE_STATUS)
- return 0;
-
- cli.pfnCluiProtocolStatusChanged(lParam, ack->szModule);
-
- if ((INT_PTR)ack->hProcess < ID_STATUS_ONLINE && ack->lParam >= ID_STATUS_ONLINE) {
- DWORD caps = (DWORD)CallProtoServiceInt(0, ack->szModule, PS_GETCAPS, PFLAGNUM_1, 0);
- if (caps & PF1_SERVERCLIST) {
- for (MCONTACT hContact = db_find_first(ack->szModule); hContact; ) {
- MCONTACT hNext = db_find_next(hContact, ack->szModule);
- if (db_get_b(hContact, "CList", "Delete", 0))
- db_delete_contact(hContact);
- hContact = hNext;
- }
- }
- }
-
- Clist_TrayIconUpdateBase(ack->szModule);
- return 0;
-}
-
HICON fnGetIconFromStatusMode(MCONTACT hContact, const char *szProto, int status)
{
return ImageList_GetIcon(hCListImages, cli.pfnIconFromStatusMode(szProto, status, hContact), ILD_NORMAL);
@@ -418,7 +394,6 @@ int LoadContactListModule2(void) HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged);
HookEvent(ME_DB_CONTACT_ADDED, ContactAdded);
HookEvent(ME_DB_CONTACT_DELETED, ContactDeleted);
- HookEvent(ME_PROTO_ACK, ProtocolAck);
hContactDoubleClicked = CreateHookableEvent(ME_CLIST_DOUBLECLICKED);
hContactIconChangedEvent = CreateHookableEvent(ME_CLIST_CONTACTICONCHANGED);
|