void UpgradeDb() { if (db_get_b(NULL, "Compatibility", "Popup+ Opts", 0) == 1) return; CopyModule("PopUp", "Popup"); CopyModule("PopUpCLASS", "PopupCLASS"); CopyModule("PopUpActions", "PopupActions"); CopyModule("PopUpNotifications", "PopupNotifications"); db_set_b(NULL, "Compatibility", "Popup+ Opts", 1); }
INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam) { BOOL del = true; if (bPGPloaded) { if (bPGPkeyrings) { char szKeyID[128]; szKeyID[0] = '\0'; PVOID KeyID = pgp_select_keyid(GetForegroundWindow(), szKeyID); if (szKeyID[0]) { db_unset(wParam, MODULENAME, "pgp"); db_set_blob(wParam, MODULENAME, "pgp", KeyID, pgp_size_keyid()); db_set_b(wParam, MODULENAME, "pgp_mode", 0); db_set_s(wParam, MODULENAME, "pgp_abbr", szKeyID); del = false; } } else if (bPGPprivkey) { char KeyPath[MAX_PATH]; KeyPath[0] = '\0'; if (ShowSelectKeyDlg(0, KeyPath)) { char *publ = LoadKeys(KeyPath, false); if (publ) { db_unset(wParam, MODULENAME, "pgp"); db_set_s(wParam, MODULENAME, "pgp", publ); db_set_b(wParam, MODULENAME, "pgp_mode", 1); db_set_s(wParam, MODULENAME, "pgp_abbr", "(binary)"); mir_free(publ); del = false; } } } } if (del) Service_PGPdelKey(wParam, lParam); else { pUinKey ptr = getUinKey(wParam); cpp_delete_context(ptr->cntx); ptr->cntx = 0; } ShowStatusIconNotify(wParam); return 1; }
void DefSettings() { db_set_dw(NULL, MODULE_NAME, DelayComp, 20); db_set_b(NULL, MODULE_NAME, EnabledComp, 1); db_set_b(NULL, MODULE_NAME, PopUpComp, 1); db_set_dw(NULL, MODULE_NAME, PopUpTimeComp, 5); db_set_b(NULL, MODULE_NAME, MenuitemComp, 1); db_set_b(NULL, MODULE_NAME, TTBButtonsComp, 0); db_set_b(NULL, MODULE_NAME, DefSoundComp, 1); db_set_b(NULL, MODULE_NAME, DefPopupComp, 0); db_set_b(NULL, MODULE_NAME, DefEnabledComp, 0); db_set_b(NULL, MODULE_NAME, NonStatusAllowComp, 1); LoadSettings(); }
void WriteMainOptions() { db_set_dw(NULL, ModuleName, "HotkeyLayout", moOptions.dwHotkey_Layout); db_set_dw(NULL, ModuleName, "HotkeyLayout2", moOptions.dwHotkey_Layout2); db_set_dw(NULL, ModuleName, "HotkeyCase", moOptions.dwHotkey_Case); db_set_b(NULL, ModuleName, "CurrentWordLayout", moOptions.CurrentWordLayout); db_set_b(NULL, ModuleName, "CurrentWordLayout2", moOptions.CurrentWordLayout2); db_set_b(NULL, ModuleName, "CurrentWordCase", moOptions.CurrentWordCase); db_set_b(NULL, ModuleName, "TwoWay", moOptions.TwoWay); db_set_b(NULL, ModuleName, "ChangeSystemLayout", moOptions.ChangeSystemLayout); db_set_b(NULL, ModuleName, "CopyToClipboard", moOptions.CopyToClipboard); db_set_b(NULL, ModuleName, "ShowPopup", moOptions.ShowPopup); db_set_b(NULL, ModuleName, "CaseOperations", moOptions.bCaseOperations); }
int RefreshContactListIcons(MCONTACT hContact) { if (hContact == 0) return 0; int hidden = db_get_b(hContact, "CList", "Hidden", 0); int ignored = db_get_dw(hContact, "Ignore", "Mask1", 0); ignored = ((ignored & 0x3f) != 0) ? 1 : 0; int ok = 1; if (commonData.notifyFor & EXCLUDE_HIDDEN) ok &= (hidden == 0); if (commonData.notifyFor & EXCLUDE_IGNORED) ok &= (ignored == 0); time_t today = Today(); int dtb = NotifyContactBirthday(hContact, today, commonData.daysInAdvance); int dab = NotifyMissedContactBirthday(hContact, today, commonData.daysAfter); if (ok && (dtb >= 0 || dab > 0)) { int age = GetContactAge(hContact); db_set_b(hContact, "UserInfo", "Age", age); if ((bShouldCheckBirthdays) && (commonData.bUsePopups)) { if (dtb >= 0) { bBirthdayFound = 1; //only set it if we're called from our CheckBirthdays service PopupNotifyBirthday(hContact, dtb, age); } else if (dab > 0) PopupNotifyMissedBirthday(hContact, dab, age); } if (bShouldCheckBirthdays) if (dtb >= 0) SoundNotifyBirthday(dtb); if ((bShouldCheckBirthdays) && (commonData.bUseDialog)) { if (dtb >= 0) DialogNotifyBirthday(hContact, dtb, age); else if (dab > 0) DialogNotifyMissedBirthday(hContact, dab, age); } if (dtb >= 0) ExtraIcon_SetIcon(hWWIExtraIcons, hContact, GetDTBIconHandle(dtb)); } else ExtraIcon_Clear(hWWIExtraIcons, hContact); return 0; }
MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, hContact, hDbEvent) { DBEVENTINFO dbei = { sizeof(dbei) }; dbei.cbBlob = db_event_getBlobSize(hDbEvent); if (dbei.cbBlob == -1) return 0; dbei.pBlob = (BYTE*)alloca(dbei.cbBlob); db_event_get(hDbEvent, &dbei); // if event is in protocol that is not despammed if (!ProtoInList(dbei.szModule)) return 0; // event is an auth request if (gbHandleAuthReq) { if (!(dbei.flags & DBEF_SENT) && !(dbei.flags & DBEF_READ) && dbei.eventType == EVENTTYPE_AUTHREQUEST) { MCONTACT hcntct = DbGetAuthEventContact(&dbei); // if request is from unknown or not marked Answered contact int a = db_get_b(hcntct, "CList", "NotOnList", 0); int b = !db_get_b(hcntct, pluginName, "Answered", 0); if (a && b) { // ...send message if (gbHideContacts) db_set_b(hcntct, "CList", "Hidden", 1); if (gbSpecialGroup) db_set_ws(hcntct, "CList", "Group", gbSpammersGroup.c_str()); BYTE msg = 1; if (gbIgnoreURL) { TCHAR* EventText = ReqGetText(&dbei); //else return NULL msg = !IsUrlContains(EventText); mir_free(EventText); } if (gbInvisDisable) { if (CallProtoService(dbei.szModule, PS_GETSTATUS, 0, 0) == ID_STATUS_INVISIBLE) msg = 0; else if (db_get_w(hContact, dbei.szModule, "ApparentMode", 0) == ID_STATUS_OFFLINE) msg = 0; //is it useful ? } if (msg) { ptrA buff(mir_utf8encodeW(variables_parse(gbAuthRepl, hcntct).c_str())); CallContactService(hcntct, PSS_MESSAGE, 0, (LPARAM)buff); } return 1; } } } return 0; }
void RenameModule(HANDLE hContact, const char* pszOldName, const char* pszNewName) { SettingsList settingsList; DBCONTACTENUMSETTINGS dbces = {0}; dbces.szModule = pszOldName; dbces.lParam = (LPARAM)&settingsList; dbces.pfnEnumProc = EnumSettingsProc2; int nResult = ::CallService(MS_DB_CONTACT_ENUMSETTINGS, (WPARAM)hContact, (LPARAM)&dbces); if (nResult != -1) { DBVARIANT dbv; for(unsigned i=0; i<settingsList.size(); i++) { const char* pszSetting = settingsList[i]; if (!GetSetting(hContact, pszOldName, pszSetting, &dbv)) { switch (dbv.type) { case DBVT_BYTE: db_set_b(hContact, pszNewName, pszSetting, dbv.bVal); break; case DBVT_WORD: db_set_w(hContact, pszNewName, pszSetting, dbv.wVal); break; case DBVT_DWORD: db_set_dw(hContact, pszNewName, pszSetting, dbv.dVal); break; case DBVT_ASCIIZ: db_set_s(hContact, pszNewName, pszSetting, dbv.pszVal); break; case DBVT_UTF8: db_set_utf(hContact, pszNewName, pszSetting, dbv.pszVal); break; default: assert(0); break; } db_unset(hContact, pszOldName, pszSetting); db_free(&dbv); } free((char*)settingsList[i]); } } }
void SaveColumnSizes(HWND hwndResults) { int columnOrder[NUM_COLUMNID]; int columnCount; char szSetting[32]; int i; struct FindAddDlgData *dat; dat = (struct FindAddDlgData*)GetWindowLongPtr(GetParent(hwndResults), GWLP_USERDATA); columnCount = Header_GetItemCount(ListView_GetHeader(hwndResults)); if (columnCount != NUM_COLUMNID) return; ListView_GetColumnOrderArray(hwndResults, columnCount, columnOrder); for (i=0; i < NUM_COLUMNID; i++) { mir_snprintf(szSetting, SIZEOF(szSetting), "ColOrder%d", i); db_set_b(NULL, "FindAdd", szSetting, (BYTE)columnOrder[i]); if (i>=columnCount) continue; mir_snprintf(szSetting, SIZEOF(szSetting), "ColWidth%d", i); db_set_w(NULL, "FindAdd", szSetting, (WORD)ListView_GetColumnWidth(hwndResults, i)); } db_set_b(NULL, "FindAdd", "SortColumn", (BYTE)dat->iLastColumnSortIndex); db_set_b(NULL, "FindAdd", "SortAscending", (BYTE)dat->bSortAscending); }
INT_PTR CALLBACK ExitDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) { switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hdlg); LoadPosition(hdlg, "ExitDlg"); ShowWindow(hdlg, SW_SHOW); break; case WM_COMMAND: switch (LOWORD(wparam)) { case IDOK: SavePosition(hdlg, "ExitDlg"); SaveSessionDate(); SaveSessionHandles(0, 0); db_set_b(NULL, MODNAME, "lastempty", 0); DestroyWindow(hdlg); break; case IDCANCEL: SavePosition(hdlg, "ExitDlg"); db_set_b(NULL, MODNAME, "lastempty", 1); DestroyWindow(hdlg); break; } case WM_CLOSE: DestroyWindow(hdlg); break; case WM_DESTROY: PostQuitMessage(0); break; default: return FALSE; } return TRUE; }
static INT_PTR OnMainMenu_HideAll(WPARAM wParam, LPARAM lParam) { fcOpt.bHideAll = !fcOpt.bHideAll; db_set_b(NULL, MODULE, "HideAll", (BYTE)fcOpt.bHideAll); OnStatusChanged(); CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR; clmi.hIcon = LoadIcon( hInst, MAKEINTRESOURCE(fcOpt.bHideAll ? IDI_SHOW : IDI_HIDE)); clmi.ptszName = fcOpt.bHideAll ? LPGENT("Show all thumbs") : LPGENT("Hide all thumbs"); Menu_ModifyItem(hMainMenuItemHideAll, &clmi); return 0; }
int ExpandMetaContact(HWND hwnd, ClcContact *contact, ClcData *dat, BOOL bExpand) { KillTimer(hwnd, TIMERID_SUBEXPAND); if (contact->type != CLCIT_CONTACT || contact->SubAllocated == 0 || contact->SubExpanded == bExpand || !db_get_b(NULL, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT)) return 0; contact->SubExpanded = bExpand; db_set_b(contact->hContact, "CList", "Expanded", contact->SubExpanded); dat->needsResort = 1; pcli->pfnSortCLC(hwnd, dat, 1); cliRecalcScrollBar(hwnd, dat); return contact->SubExpanded; }
INT_PTR Meta_OnOff(WPARAM, LPARAM) { bool bToggled = !db_mc_isEnabled(); db_set_b(0, META_PROTO, "Enabled", bToggled); if (bToggled) Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts off"), GetIconHandle(I_MENUOFF)); else Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts on"), GetIconHandle(I_MENU)); db_mc_enable(bToggled); Meta_HideMetaContacts(!bToggled); return 0; }
void CALLBACK ConnectionTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD) { if (uMsg == WM_TIMER) { KillTimer(hwnd, idEvent); //We've received a timer message: enable the popups for a specified protocol. char szProto[256]; if (GetAtomNameA((ATOM)idEvent, szProto, sizeof(szProto)) > 0) { db_set_b(0, MODULE, szProto, 1); DeleteAtom((ATOM)idEvent); } } }
void CLuaOptions::OnApply() { int count = m_scripts.GetItemCount(); for (int iItem = 0; iItem < count; iItem++) { TCHAR fileName[MAX_PATH]; m_scripts.GetItemText(iItem, 0, fileName, _countof(fileName)); if (!m_scripts.GetCheckState(iItem)) db_set_b(NULL, MODULE, _T2A(fileName), 0); else db_unset(NULL, MODULE, _T2A(fileName)); } }
void SaveModuleSettings(int buttonnum,ButtonData* bd) { char szMEntry[256]={'\0'}; mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryName_%u_%u",buttonnum,bd->dwPos); db_set_ts(NULL, PLGNAME,szMEntry,bd->pszName ); mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryValue_%u_%u",buttonnum,bd->dwPos); if(bd->pszValue) db_set_ts(NULL, PLGNAME,szMEntry,bd->pszValue ); else db_unset(NULL, PLGNAME,szMEntry); mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryRel_%u_%u",buttonnum,bd->dwPos); db_set_b(NULL, PLGNAME,szMEntry,bd->fEntryType ); mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryToQMenu_%u_%u",buttonnum,bd->dwPos); db_set_b(NULL, PLGNAME,szMEntry,bd->bInQMenu); mir_snprintf(szMEntry,SIZEOF(szMEntry),"EntryIsServiceName_%u_%u",buttonnum,bd->dwPos); db_set_b(NULL, PLGNAME,szMEntry,bd->bIsServName); }
static INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_INITDIALOG: SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); TranslateDialogDefault(hwnd); wchar_t msg[MSG_SIZE], name[NAME_SIZE]; GetContactName((MCONTACT)lParam, nullptr, name, _countof(name)); mir_snwprintf(msg, TranslateT("Add module to \"%s\""), name); SetWindowText(hwnd, msg); break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: if (GetWindowTextLength(GetDlgItem(hwnd, IDC_MODNAME))) { char modulename[FLD_SIZE]; GetDlgItemTextA(hwnd, IDC_MODNAME, modulename, _countof(modulename)); if (IsDlgButtonChecked(hwnd, CHK_ADD2ALL)) { // null contact db_set_b(NULL, modulename, "(Default)", 0); for (auto &hContact : Contacts()) db_set_b(hContact, modulename, "(Default)", 0); } else db_set_b((MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA), modulename, "(Default)", 0); refreshTree(1); } __fallthrough; case IDCANCEL: DestroyWindow(hwnd); break; } } return 0; }
INT_PTR Toggle(WPARAM w, LPARAM l) { MCONTACT hContact = (MCONTACT)w; BOOL on = !db_get_b(hContact, protocolname, "TurnedOn", 0); db_set_b(hContact, protocolname, "TurnedOn", on); on = !on; if (on) Menu_ModifyItem(hToggle, LPGENT("Turn off Autoanswer"), iconList[0].hIcolib); else Menu_ModifyItem(hToggle, LPGENT("Turn on Autoanswer"), iconList[1].hIcolib); return 0; }
MCONTACT add_contact(char *name, DWORD flags) { MCONTACT hContact; // already on list? if (hContact = find_contact(name)) { if (!(flags & PALF_TEMPORARY) && db_get_b(hContact, "CList", "NotOnList", 1)) { db_unset(hContact, "CList", "NotOnList"); db_unset(hContact, "CList", "Hidden"); } LOG(("add_contact: Found %s", name)); return hContact; // already there, return handle } // no, so add LOG(("add_contact: Adding %s", name)); hContact = (MCONTACT)CallServiceSync(MS_DB_CONTACT_ADD, 0, 0); if (hContact) { if (CallServiceSync(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)SKYPE_PROTONAME) != 0) { LOG(("add_contact: Ouch! MS_PROTO_ADDTOCONTACT failed for some reason")); CallServiceSync(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0); return NULL; } if (name[0]) db_set_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, name); if (flags & PALF_TEMPORARY) { db_set_b(hContact, "CList", "NotOnList", 1); db_set_b(hContact, "CList", "Hidden", 1); } if (name[0]) { SkypeSend("GET USER %s DISPLAYNAME", name); } else { LOG(("add_contact: Info: The contact added has no name.")); } } else { LOG(("add_contact: Ouch! MS_DB_CONTACT_ADD failed for some reason")); } LOG(("add_contact succeeded")); return hContact; }
int Test(WPARAM wparam,LPARAM lparam) { if (lparam < ICON_OFFLINE || lparam > ICON_INVIS) return 0; if (CallService(MS_IGNORE_ISIGNORED,wparam,IGNOREEVENT_USERONLINE)) return 0; if ( db_get_b((MCONTACT)wparam,S_MOD,"Missed",0)==2) return 0; switch(lparam) { case ICON_OFFLINE: if ( db_get_b((MCONTACT)wparam,S_MOD,"Missed",0) == 1) { WORD missed = IsUserMissed(wparam); if (!LOWORD(missed)) { mcs.times[mcs.count]=1; mcs.wpcontact[mcs.count++]=wparam; } else mcs.times[HIWORD(missed)]++; db_set_b((MCONTACT)wparam,S_MOD,"Missed",0); } break; case ICON_ONLINE: case ICON_AWAY: case ICON_NA: case ICON_OCC: case ICON_DND: case ICON_FREE: case ICON_INVIS: db_set_b((MCONTACT)wparam,S_MOD,"Missed",1); break; } return 0; }
MIR_CORE_DLL(void) TimeZone_StoreByContact(MCONTACT hContact, LPCSTR szModule, HANDLE hTZ) { if (szModule == NULL) szModule = "UserInfo"; MIM_TIMEZONE *tz = (MIM_TIMEZONE*)hTZ; if (tz) { db_set_ts(hContact, szModule, "TzName", tz->tszName); db_set_b(hContact, szModule, "Timezone", (char)((tz->tzi.Bias + tz->tzi.StandardBias) / 30)); } else { db_unset(hContact, szModule, "TzName"); db_unset(hContact, szModule, "Timezone"); } }
LRESULT CALLBACK FrameContainerWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_CREATE: return TRUE; case WM_SHOWWINDOW: if (wParam) { db_set_b(0, MODULE, "ReminderFrameVisible", 1); Utils_RestoreWindowPosition(hwnd, 0, MODULE, "reminders_window"); PostMessage(hwnd, WM_SIZE, 0, 0); } else { db_set_b(0, MODULE, "ReminderFrameVisible", 0); Utils_SaveWindowPosition(hwnd, 0, MODULE, "reminders_window"); } break; case WM_SIZE: { HWND child = (HWND)GetWindowLongPtr(hwnd, GWLP_USERDATA); RECT r; GetClientRect(hwnd, &r); SetWindowPos(child, 0, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE); InvalidateRect(child, 0, TRUE); InvalidateRect(hwnd, 0, TRUE); } break; case WM_CLOSE: Utils_SaveWindowPosition(hwnd, 0, MODULE, "reminders_window"); ShowWindow(hwnd, SW_HIDE); FixMainMenu(); return TRUE; } return DefWindowProc(hwnd, msg, wParam, lParam); }
int MsgAck(WPARAM, LPARAM lParam) { ACKDATA *ack=(ACKDATA*)lParam; if (ack && ack->cbSize == sizeof(ACKDATA) && ack->type == ACKTYPE_MESSAGE) { if (ack->hProcess == (HANDLE)WindowList_Find(hWindowList,ack->hContact)) { if (db_get_b(NULL, modname, "ShowDeliveryMessages", 1)) CreateMessageAcknowlegedWindow(ack->hContact,ack->result == ACKRESULT_SUCCESS); if (ack->result == ACKRESULT_SUCCESS) { // wrtie it to the DB DBEVENTINFO dbei = { 0 }; DBVARIANT dbv; int reuse = db_get_b(ack->hContact,modname, "Reuse", 0); if (!db_get_ts(ack->hContact, modname, "PounceMsg", &dbv) && (dbv.ptszVal[0] != '\0')) { T2Utf pszUtf(dbv.ptszVal); dbei.cbSize = sizeof(dbei); dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_UTF | DBEF_SENT; dbei.szModule = (char*)ack->szModule; dbei.timestamp = time(NULL); dbei.cbBlob = (int)mir_strlen(pszUtf) + 1; dbei.pBlob = (PBYTE)(char*)pszUtf; db_event_add(ack->hContact, &dbei); } // check to reuse if (reuse > 1) db_set_b(ack->hContact, modname, "Reuse", (BYTE)(reuse-1)); else { db_set_b(ack->hContact,modname, "Reuse", 0); db_set_ws(ack->hContact, modname, "PounceMsg", _T("")); } } WindowList_Remove(hWindowList,(HWND)ack->hProcess); } } return 0; }
MCONTACT FacebookProto::AddToList(int flags, PROTOSEARCHRESULT* psr) { ptrA id( mir_t2a_cp(psr->id, CP_UTF8)); ptrA name( mir_t2a_cp(psr->firstName, CP_UTF8)); ptrA surname( mir_t2a_cp(psr->lastName, CP_UTF8)); if (id == NULL) return NULL; facebook_user fbu; fbu.user_id = id; if (name != NULL) fbu.real_name = name; if (surname != NULL) { fbu.real_name += " "; fbu.real_name += surname; } if (fbu.user_id.find_first_not_of("0123456789") != std::string::npos) { MessageBox(0, TranslateT("Facebook ID must be numeric value."), m_tszUserName, MB_ICONERROR | MB_OK); return NULL; } MCONTACT hContact = AddToContactList(&fbu, CONTACT_NONE); if (hContact) { if (flags & PALF_TEMPORARY) { db_set_b(hContact, "Clist", "Hidden", 1); db_set_b(hContact, "Clist", "NotOnList", 1); } else if (db_get_b(hContact, "CList", "NotOnList", 0)) { db_unset(hContact, "CList", "Hidden"); db_unset(hContact, "CList", "NotOnList"); } } return hContact; }
void InitButtonsList() { int i,j,k=0; QuickList=List_Create(0,1); for(i=0;i<g_iButtonsCount;i++) { TCHAR* pszBName=NULL; ListData* ld=NULL; if (!(pszBName=getMenuEntry(i,0,3))) { g_iButtonsCount=i; db_set_b(NULL, PLGNAME,"ButtonsCount", (BYTE)g_iButtonsCount); break;} ld = (ListData *)mir_alloc(sizeof(ListData)); ButtonsList[i]=ld; ld->sl=List_Create(0,1); ld->ptszQValue=ld->ptszOPQValue=getMenuEntry(i,0,2); ld->ptszButtonName=pszBName; ld->dwPos=ld->dwOPPos=i; ld->dwOPFlags=0; ld->bIsServName=ld->bIsOpServName=getEntryByte(i,0,3); for(j=0;;j++) { TCHAR* pszEntry=NULL; ButtonData *bd=NULL; if (!(pszEntry=getMenuEntry(i,j,0))) break; bd = (ButtonData *)mir_alloc(sizeof(ButtonData)); memset(bd,0,sizeof(ButtonData)); bd->dwPos=bd->dwOPPos=j; bd->pszName=bd->pszOpName=pszEntry; bd->pszValue=bd->pszOpValue=getMenuEntry(i,j,1); bd->fEntryType=bd->fEntryOpType=getEntryByte(i,j,1); bd->bInQMenu=bd->bOpInQMenu=getEntryByte(i,j,0); bd->bIsServName=bd->bIsOpServName=getEntryByte(i,j,2); if(bd->bInQMenu){ QuickData* qd = (QuickData *)mir_alloc(sizeof(QuickData)); qd->dwPos=k++; qd->ptszValue=bd->pszValue; qd->ptszValueName=bd->pszName; List_InsertPtr(QuickList,qd); } List_InsertPtr((SortedList*)ld->sl,bd); } } }
void SaveOptions() { db_set_w(0, MODULENAME, "DefaultPolicy", options.default_policy); db_set_w(0, MODULENAME, "ErrorDisplay", (int)options.err_method); db_set_b(0, MODULENAME, "PrefixMessages", options.prefix_messages ? 1 : 0); db_set_b(0, MODULENAME, "MsgInline", options.msg_inline ? 1 : 0); db_set_b(0, MODULENAME, "MsgPopup", options.msg_popup ? 1 : 0); db_set_b(0, MODULENAME, "NoHistory", options.delete_history ? 1 : 0); db_set_b(0, MODULENAME, "NoSystemHistory", options.delete_systeminfo ? 1 : 0); db_set_b(0, MODULENAME, "AutoShowVerify", options.autoshow_verify ? 1 : 0); db_set_utf(0, MODULENAME, "Prefix", options.prefix); db_set_b(0, MODULENAME, "EndOffline", options.end_offline ? 1 : 0); db_set_b(0, MODULENAME, "EndWindowClose", options.end_window_close ? 1 : 0); }
/** * name: DBSaveItemState * class: CPsTreeItem * desc: saves the current treeitem to database * param: pszGroup - name of the parent item * iItemPosition - iterated index to remember the order of the tree * iState - expanded|collapsed|invisible * dwFlags - tells what to save * return: handle to new (moved) treeitem if successful or NULL otherwise **/ WORD CPsTreeItem::DBSaveItemState(LPCSTR pszGroup, int iItemPosition, UINT iState, DWORD dwFlags) { WORD numErrors = 0; // save group if ((dwFlags & PSTVF_GROUPS) && (dwFlags & PSTVF_POS_CHANGED)) numErrors += db_set_utf(NULL, MODNAME, PropertyKey(SET_ITEM_GROUP), (LPSTR)pszGroup); // save label if ((dwFlags & PSTVF_LABEL_CHANGED) && (_dwFlags & PSTVF_LABEL_CHANGED)) numErrors += db_set_ts(NULL, MODNAME, GlobalPropertyKey(SET_ITEM_LABEL), Label()); // save position if ((dwFlags & PSTVF_POS_CHANGED) && !(dwFlags & PSTVF_SORTTREE)) numErrors += db_set_b(NULL, MODNAME, PropertyKey(SET_ITEM_POS), iItemPosition); // save state if (dwFlags & PSTVF_STATE_CHANGED) numErrors += db_set_b(NULL, MODNAME, PropertyKey(SET_ITEM_STATE), _hItem ? ((iState & TVIS_EXPANDED) ? DBTVIS_EXPANDED : DBTVIS_NORMAL) : DBTVIS_INVISIBLE); RemoveFlags(PSTVF_STATE_CHANGED|PSTVF_LABEL_CHANGED|PSTVF_POS_CHANGED); return numErrors; }
void WatcherModulesLoaded(void) { /* Weather Shutdown */ if (ServiceExists(MS_WEATHER_UPDATE)) hHookWeatherUpdated=HookEvent(ME_WEATHER_UPDATED,WeatherUpdated); /* Overheat Shutdown */ if (ServiceExists(MS_SYSINFO_HDDTEMP)) hHookHddOverheat=HookEvent(ME_SYSINFO_HDDOVERHEAT,HddOverheat); /* restore watcher if it was running on last exit */ if (db_get_b(NULL,"AutoShutdown","RememberOnRestart",0)==SDROR_RUNNING) { db_set_b(NULL,"AutoShutdown","RememberOnRestart",1); ServiceStartWatcher(0,0); /* after modules loaded */ } }
static INT_PTR AdvSt() { if ((Enabled == 1)){ POPUPDATAT ppd = {0}; TCHAR * lptzText =L""; db_set_b(NULL, "Skin", "UseSound", 0); EnablePopupModule(); if (PopUp == 1) { lptzText = NonStatusAllow == 1 ? ALL_DISABLED_FLT : ALL_DISABLED; ppd.lchIcon = (HICON)CallService(MS_SKIN2_GETICONBYHANDLE, 0, (LPARAM)(NonStatusAllow == 1 ? GetIconHandle(ALL_ENABLED_FLT) : GetIconHandle(MENU_NAME))); ppd.lchContact = NULL; ppd.iSeconds = PopUpTime; wcsncpy_s(ppd.lptzText, lptzText, size_t(lptzText)); lptzText = TranslateT(MENU_NAME); wcsncpy_s(ppd.lptzContactName, lptzText, size_t(lptzText)); PUAddPopupT(&ppd); } timer = 2; Sleep(delay * 1000); timer = 0; if (PopUp == 1) { lptzText = (DefEnabled == 1 && DefPopup == 1) ? TranslateT(ALL_ENABLED_FLT) : ALL_ENABLED; ppd.lchIcon = (HICON)CallService(MS_SKIN2_GETICONBYHANDLE, 0, (LPARAM)((DefEnabled == 1 && DefPopup == 1) ? GetIconHandle(ALL_ENABLED_FLT) : GetIconHandle(MENU_NAME))); wcsncpy_s(ppd.lptzText, lptzText, size_t(lptzText)); PUAddPopupT(&ppd); } if (DefEnabled == 1) { //predefined sound setting db_set_b(NULL, "Skin", "UseSound", DefSound); } else db_set_b(NULL, "Skin", "UseSound", 1); //or enable sounds every starts } return 0; }
void Check_ReorderPopups(HWND hwnd) { if (!PopupOptions.ReorderPopups && PopupOptions.ReorderPopupsWarning) { int res = MessageBox(hwnd, TranslateT("'Reorder popups' option is currently disabled.\r\nThis may cause misaligned popups when used with\r\navatars and text replacement (mainly NewXstatusNotify).\r\n\r\nDo you want to enable popup reordering now?\r\n"), TranslateT("Popup Plus Warning"), MB_ICONEXCLAMATION | MB_YESNOCANCEL); switch (res) { case IDYES: PopupOptions.ReorderPopups = TRUE; //Reset warning for next option change !!! PopupOptions.ReorderPopupsWarning = TRUE; break; case IDNO: PopupOptions.ReorderPopups = FALSE; PopupOptions.ReorderPopupsWarning = FALSE; break; default: return; } } db_set_b(NULL, MODULNAME, "ReorderPopups", PopupOptions.ReorderPopups); db_set_b(NULL, MODULNAME, "ReorderPopupsWarning", PopupOptions.ReorderPopupsWarning); if (hwnd) CheckDlgButton(hwnd, IDC_REORDERPOPUPS, PopupOptions.ReorderPopups); }
int nSystemShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/) { while (pclFirstNode) { CLFileShareNode * pclCur = pclFirstNode; pclFirstNode = pclFirstNode->pclNext; delete pclCur; } pclFirstNode = NULL; UnInitGuiElements(); db_set_b(NULL, MODULE, "IndexCreationMode", (BYTE)indexCreationMode); FreeIndexHTMLTemplate(); return 0; }