diff options
author | aunsane <aunsane@gmail.com> | 2017-05-07 02:25:29 +0300 |
---|---|---|
committer | aunsane <aunsane@gmail.com> | 2017-05-07 02:25:29 +0300 |
commit | ff6a107e5f566da2644fbfe36455467beafaeb1e (patch) | |
tree | 3d5b96794ee835c8686a74da6c418c440c91c403 /plugins/CloudFile/src/events.cpp | |
parent | 453b3de91c372ee7b2661771aead6675e12fe98f (diff) |
CloudFile:
- reworked options to dupport default service
- added options to select conflict behavior
- multiple fix and refactoring
- version bump
Diffstat (limited to 'plugins/CloudFile/src/events.cpp')
-rw-r--r-- | plugins/CloudFile/src/events.cpp | 46 |
1 files changed, 15 insertions, 31 deletions
diff --git a/plugins/CloudFile/src/events.cpp b/plugins/CloudFile/src/events.cpp index df71721dfb..248397b8f4 100644 --- a/plugins/CloudFile/src/events.cpp +++ b/plugins/CloudFile/src/events.cpp @@ -2,16 +2,6 @@ int OnModulesLoaded(WPARAM, LPARAM) { - // init - InitServices(); - InitializeIcons(); - InitializeMenus(); - // netlib - NETLIBUSER nlu = {}; - nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; - nlu.szSettingsModule = MODULE; - nlu.szDescriptiveName.w = _A2W("MODULE"); - hNetlibConnection = Netlib_RegisterUser(&nlu); // options HookEvent(ME_OPT_INITIALISE, OnOptionsInitialized); // srfile @@ -35,27 +25,21 @@ int OnProtoAck(WPARAM, LPARAM lParam) { ACKDATA *ack = (ACKDATA*)lParam; - if (!mir_strcmp(ack->szModule, MODULE)) - return 0; // don't rebroadcast our own acks - - if (ack->type == ACKTYPE_STATUS) { - WORD status = ack->lParam; - bool canSendOffline = (CallProtoService(ack->szModule, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_IMSENDOFFLINE) > 0; - - for (MCONTACT hContact = db_find_first(ack->szModule); hContact; hContact = db_find_next(hContact, ack->szModule)) { - MessageWindowData msgw; - if (!Srmm_GetWindowData(hContact, msgw) && msgw.uState & MSG_WINDOW_STATE_EXISTS) { - BBButton bbd = {}; - bbd.pszModuleName = MODULE; - bbd.dwButtonID = BBB_ID_FILE_SEND; - bbd.bbbFlags = BBSF_RELEASED; - - if (status == ID_STATUS_OFFLINE && !canSendOffline) - bbd.bbbFlags = BBSF_DISABLED; - - Srmm_SetButtonState(hContact, &bbd); - } - } + if (ack->type != ACKTYPE_STATUS) + return 0; + + for (MCONTACT hContact = db_find_first(ack->szModule); hContact; hContact = db_find_next(hContact, ack->szModule)) { + MessageWindowData msgw; + if (Srmm_GetWindowData(hContact, msgw) || !(msgw.uState & MSG_WINDOW_STATE_EXISTS)) + continue; + + BBButton bbd = {}; + bbd.pszModuleName = MODULE; + bbd.dwButtonID = BBB_ID_FILE_SEND; + bbd.bbbFlags = CanSendToContact(hContact) + ? BBSF_RELEASED + : BBSF_DISABLED; + Srmm_SetButtonState(hContact, &bbd); } return 0; |