void LoadContactTree(void) { int i, status, hideOffline; BYTE bMsgFrequency = cfg::getByte("CList", "fhistdata", 0); CallService(MS_CLUI_LISTBEGINREBUILD, 0, 0); for (i = 1;; i++) { if (pcli->pfnGetGroupName(i, NULL) == NULL) break; CallService(MS_CLUI_GROUPADDED, i, 0); } hideOffline = cfg::getByte("CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT); for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { status = GetContactStatus(hContact); if ((!hideOffline || status != ID_STATUS_OFFLINE) && !CLVM_GetContactHiddenStatus(hContact, NULL, NULL)) pcli->pfnChangeContactIcon(hContact, IconFromStatusMode(GetContactProto(hContact), status, hContact, NULL), 1); // build initial data for message frequency if (!bMsgFrequency) MF_CalcFrequency(hContact, 100, 0); } cfg::writeByte("CList", "fhistdata", 1); CallService(MS_CLUI_LISTENDREBUILD, 0, 0); }
int CMraProto::OnModulesLoaded(WPARAM, LPARAM) { HookProtoEvent(ME_CLIST_EXTRA_IMAGE_APPLY, &CMraProto::MraExtraIconsApply); HookProtoEvent(ME_OPT_INITIALISE, &CMraProto::OnOptionsInit); HookProtoEvent(ME_DB_CONTACT_DELETED, &CMraProto::MraContactDeleted); HookProtoEvent(ME_DB_CONTACT_SETTINGCHANGED, &CMraProto::MraDbSettingChanged); HookProtoEvent(ME_CLIST_PREBUILDCONTACTMENU, &CMraProto::MraRebuildContactMenu); HookProtoEvent(ME_WAT_NEWSTATUS, &CMraProto::MraMusicChanged); HookProtoEvent(ME_CLIST_GROUPCHANGE, &CMraProto::OnGroupChanged); // всех в offline // тк unsaved values сохран¤ютс¤ их нужно инициализировать for (MCONTACT hContact = db_find_first(m_szModuleName); hContact != NULL; hContact = db_find_next(hContact, m_szModuleName)) SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID | SCBIF_GROUP_ID | SCBIF_SERVER_FLAG | SCBIF_STATUS), -1, -1, 0, 0, ID_STATUS_OFFLINE, 0, 0, 0); // unsaved values db_set_resident(m_szModuleName, "LogonTS"); db_set_resident(m_szModuleName, "ContactID"); db_set_resident(m_szModuleName, "GroupID"); db_set_resident(m_szModuleName, "ContactFlags"); db_set_resident(m_szModuleName, "ContactServerFlags"); db_set_resident(m_szModuleName, "HooksLocked"); db_set_resident(m_szModuleName, DBSETTING_CAPABILITIES); db_set_resident(m_szModuleName, DBSETTING_XSTATUSNAME); db_set_resident(m_szModuleName, DBSETTING_XSTATUSMSG); db_set_resident(m_szModuleName, DBSETTING_BLOGSTATUSTIME); db_set_resident(m_szModuleName, DBSETTING_BLOGSTATUSID); db_set_resident(m_szModuleName, DBSETTING_BLOGSTATUS); db_set_resident(m_szModuleName, DBSETTING_BLOGSTATUSMUSIC); // destroy all chat sessions bChatExists = MraChatRegister(); return 0; }
bool CIrcProto::CList_SetAllOffline(BYTE ChatsToo) { DBVARIANT dbv; DisconnectAllDCCSessions(false); for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { if ( isChatRoom(hContact)) continue; if ( getByte(hContact, "DCC", 0 ) != 0 ) { if ( ChatsToo ) setWord(hContact, "Status", ID_STATUS_OFFLINE); } else if ( !getTString( hContact, "Default", &dbv )) { setTString( hContact, "Nick", dbv.ptszVal); setWord( hContact, "Status", ID_STATUS_OFFLINE ); db_free( &dbv ); } db_unset( hContact, m_szModuleName, "IP" ); setString( hContact, "User", "" ); setString( hContact, "Host", "" ); } return true; }
void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) { for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *proto = GetContactProto(hContact); if (proto && (db_get_b(hContact, proto, "ChatRoom", 0) == 0) && (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) && isContactGoneFor(hContact, options.iAbsencePeriod2) && (db_get_b(hContact, MODULE_NAME, "StillAbsentNotified", 0) == 0)) { db_set_b(hContact, MODULE_NAME, "StillAbsentNotified", 1); SkinPlaySound("buddyExpectatorStillAbsent"); TCHAR* message = TranslateT("has not returned after a long absence."); time_t tmpTime; TCHAR tmpBuf[251] = { 0 }; tmpTime = getLastSeen(hContact); if (tmpTime != -1) { _tcsftime(tmpBuf, 250, TranslateT("has not returned after being absent since %#x"), gmtime(&tmpTime)); message = tmpBuf; } else { tmpTime = getLastInputMsg(hContact); if (tmpTime != -1) { _tcsftime(tmpBuf, 250, TranslateT("has not returned after being absent since %#x"), gmtime(&tmpTime)); message = tmpBuf; } } GoneNotify(hContact, message); } } }
// Initializes the services provided and the link to those needed // Called when the plugin is loaded into Miranda int LoadMetacontacts(void) { Icon_Register(g_hInst, LPGEN("MetaContacts"), iconList, _countof(iconList), "mc"); db_set_resident(META_PROTO, "Status"); db_set_resident(META_PROTO, "IdleTS"); //set all contacts to 'offline', and initialize subcontact counter for db consistency check for (MCONTACT hContact = db_find_first(META_PROTO); hContact; hContact = db_find_next(hContact, META_PROTO)) { db_set_w(hContact, META_PROTO, "Status", ID_STATUS_OFFLINE); db_set_dw(hContact, META_PROTO, "IdleTS", 0); } Meta_ReadOptions(); PROTOCOLDESCRIPTOR pd = { 0 }; pd.cbSize = sizeof(pd); pd.szName = META_FILTER; pd.type = PROTOTYPE_FILTER; Proto_RegisterModule(&pd); pd.szName = META_PROTO; pd.type = PROTOTYPE_VIRTUAL; Proto_RegisterModule(&pd); // further db setup done in modules loaded (nick [protocol string required] & clist display name) Meta_InitServices(); return 0; }
int ResetMissed(void) { for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) db_set_b(hContact, S_MOD, "Missed", 0); ZeroMemory(&mcs,sizeof(mcs)); return 0; }
int onModulesLoaded(WPARAM, LPARAM) { // Set initial value for all contacts for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) ExtraIconsApply(hContact, 1); return 0; }
int CheckIfOnline(void) { for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) if ( CallService(MS_CLIST_GETCONTACTICON, hContact, 0) != ICON_OFFLINE) db_set_b(hContact, S_MOD, "Missed", 2); return 0; }
void CJabberProto::CheckAllContactsAreTransported() { for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { ptrT jid( getTStringA(hContact, "jid")); if (jid) DBCheckIsTransportedContact(jid, hContact); } }
void TxtclrLoop() { for (MCONTACT hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) { HWND hwndDlg = WindowList_Find(hWindowList, hContact); SetDlgItemText(hwndDlg, IDC_DATA, _T("")); InvalidateRect(hwndDlg, NULL, 1); } }
void TwitterProto::SetAllContactStatuses(int status) { for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) if (!getByte(hContact, "ChatRoom")) setWord(hContact, "Status", (WORD)status); SetChatStatus(status); }
// load contactlist in the list of secureIM users void loadContactList() { freeContactList(); loadSupportedProtocols(); for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) addContact(hContact); }
void CMLan::SetAllOffline() { for (MCONTACT hContact = db_find_first(PROTONAME); hContact; hContact = db_find_next(hContact, PROTONAME)) { db_set_w(hContact, PROTONAME, "Status", ID_STATUS_OFFLINE); db_unset(hContact, PROTONAME, "IP"); } DeleteCache(); }
void RefreshContactListIcons(void) { for (int i=0; i < arIcoList.getCount(); i++) arIcoList[i].hCLIcon = 0; for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) if (isSecureProtocol(hContact)) ShowStatusIcon(hContact); }
void RefreshContactListIcons() { CallService(MS_CLUI_LISTBEGINREBUILD,0,0); for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) setClistIcon(hContact); CallService(MS_CLUI_LISTENDREBUILD,0,0); }
/** * name: SvcExImINI_Export * desc: Exports a certain contact or all contacts to an ini file. * param: hContact - contact to export or -1 to export all contacts * pszFileName - ini-filename to write the contact to **/ int SvcExImINI_Export(lpExImParam ExImContact, LPCSTR pszFileName) { FILE* file; errno_t err; DB::CEnumList Modules; SYSTEMTIME now; MCONTACT hContact; if (!DlgExImModules_SelectModulesToExport(ExImContact, &Modules, NULL)) { if ((err = fopen_s(&file, pszFileName, "wt")) != NULL) { MsgErr(NULL, LPGENT("The ini-file \"%s\"\nfor saving contact information could not be opened."), pszFileName); return 1; } SetCursor(LoadCursor(NULL, IDC_WAIT)); // write header GetLocalTime(&now); fprintf(file, ";DATE = %04d-%02d-%02d %02d:%02d:%02d\n\n", now.wYear, now.wMonth, now.wDay, now.wHour, now.wMinute, now.wSecond ); if (Modules.getCount() == 0) { Modules.EnumModules(); } // hContact == -1 export entire db. if (ExImContact->Typ != EXIM_CONTACT) { // Owner ExportContact(NULL, &Modules, file); fprintf(file, "\n\n"); // Contacts for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) { ExportContact(hContact, &Modules, file); fprintf(file, "\n\n"); } } // export only one contact else { ExportContact(ExImContact->hContact, &Modules, file); } if (file) fclose(file); SetCursor(LoadCursor(NULL, IDC_ARROW)); } return 0; }
static int lua_FindFirstContact(lua_State *L) { const char *szProto = lua_tostring(L, 1); MCONTACT res = db_find_first(szProto); lua_pushinteger(L, res); return 1; }
void FilterList(CCtrlClc *) { for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *proto = GetContactProto(hContact); if (mir_strcmp(proto, m_proto->m_szModuleName) || m_proto->isChatRoom(hContact)) if (HANDLE hItem = m_clc.FindContact(hContact)) m_clc.DeleteItem(hItem); } }
void CVkGCCreateForm::FilterList(CCtrlClc*) { for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *proto = GetContactProto(hContact); if (mir_strcmp(proto, m_proto->m_szModuleName) || m_proto->isChatRoom(hContact) || m_proto->getDword(hContact, "ID") == VK_FEED_USER) if (HANDLE hItem = m_clCList.FindContact(hContact)) m_clCList.DeleteItem(hItem); } }
void CVkInviteChatForm::OnInitDialog() { for (MCONTACT hContact = db_find_first(m_proto->m_szModuleName); hContact; hContact = db_find_next(hContact, m_proto->m_szModuleName)) { if (!m_proto->isChatRoom(hContact)) { TCHAR *ptszNick = pcli->pfnGetContactDisplayName(hContact, 0); m_cbxCombo.AddString(ptszNick, hContact); } } }
void BGclrLoop() { for (MCONTACT hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) { HWND hwndDlg = (WindowList_Find(hWindowList, hContact)); SetDlgItemText(hwndDlg, IDC_DATA, _T("")); SendMessage(GetDlgItem(hwndDlg, IDC_DATA), EM_SETBKGNDCOLOR, 0, BackgoundClr); InvalidateRect(hwndDlg, NULL, 1); } }
static INT_PTR CALLBACK PopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: SendDlgItemMessage(hwndDlg, IDC_RIGHT_ACTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Do nothing")); SendDlgItemMessage(hwndDlg, IDC_RIGHT_ACTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Close popup")); SendDlgItemMessage(hwndDlg, IDC_RIGHT_ACTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Show avatar history")); SendDlgItemMessage(hwndDlg, IDC_RIGHT_ACTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Show contact history")); SendDlgItemMessage(hwndDlg, IDC_LEFT_ACTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Do nothing")); SendDlgItemMessage(hwndDlg, IDC_LEFT_ACTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Close popup")); SendDlgItemMessage(hwndDlg, IDC_LEFT_ACTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Show avatar history")); SendDlgItemMessage(hwndDlg, IDC_LEFT_ACTION, CB_ADDSTRING, 0, (LPARAM)TranslateT("Show contact history")); // Needs to be called here in this case SaveOptsDlgProc(popupsControls, _countof(popupsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam); PopupsEnableDisableCtrls(hwndDlg); return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_POPUPS: case IDC_WINCOLORS: case IDC_DEFAULTCOLORS: case IDC_DELAYFROMPU: case IDC_DELAYPERMANENT: case IDC_DELAYCUSTOM: case IDC_CHANGED_L: case IDC_REMOVED_L: if (HIWORD(wParam) == BN_CLICKED) PopupsEnableDisableCtrls(hwndDlg); break; case IDC_PREV: Options op = opts; if (IsDlgButtonChecked(hwndDlg, IDC_DELAYFROMPU)) op.popup_delay_type = POPUP_DELAY_DEFAULT; else if (IsDlgButtonChecked(hwndDlg, IDC_DELAYCUSTOM)) op.popup_delay_type = POPUP_DELAY_CUSTOM; else if (IsDlgButtonChecked(hwndDlg, IDC_DELAYPERMANENT)) op.popup_delay_type = POPUP_DELAY_PERMANENT; op.popup_timeout = GetDlgItemInt(hwndDlg,IDC_DELAY, NULL, FALSE); op.popup_bkg_color = SendDlgItemMessage(hwndDlg,IDC_BGCOLOR,CPM_GETCOLOUR,0,0); op.popup_text_color = SendDlgItemMessage(hwndDlg,IDC_TEXTCOLOR,CPM_GETCOLOUR,0,0); op.popup_use_win_colors = IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS) != 0; op.popup_use_default_colors = IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS) != 0; MCONTACT hContact = db_find_first(); ShowTestPopup(hContact,TranslateT("Test Contact"), TranslateT("Test description"), &op); break; } } return SaveOptsDlgProc(popupsControls, _countof(popupsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam); }
MCONTACT CIrcProto::CList_FindContact(CONTACT *user) { if (!user || !user->name) return 0; TCHAR* lowercasename = mir_tstrdup(user->name); CharLower(lowercasename); for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { if (isChatRoom(hContact)) continue; MCONTACT hContact_temp = NULL; ptrT DBNick(getTStringA(hContact, "Nick")); ptrT DBUser(getTStringA(hContact, "UUser")); ptrT DBHost(getTStringA(hContact, "UHost")); ptrT DBDefault(getTStringA(hContact, "Default")); ptrT DBWildcard(getTStringA(hContact, "UWildcard")); if (DBWildcard) CharLower(DBWildcard); if (IsChannel(user->name)) { if (DBDefault && !lstrcmpi(DBDefault, user->name)) hContact_temp = (MCONTACT)-1; } else if (user->ExactNick && DBNick && !lstrcmpi(DBNick, user->name)) hContact_temp = hContact; else if (user->ExactOnly && DBDefault && !lstrcmpi(DBDefault, user->name)) hContact_temp = hContact; else if (user->ExactWCOnly) { if (DBWildcard && !lstrcmpi(DBWildcard, lowercasename) || (DBWildcard && !lstrcmpi(DBNick, lowercasename) && !WCCmp(DBWildcard, lowercasename)) || (!DBWildcard && !lstrcmpi(DBNick, lowercasename))) { hContact_temp = hContact; } } else if (_tcschr(user->name, ' ') == 0) { if ((DBDefault && !lstrcmpi(DBDefault, user->name) || DBNick && !lstrcmpi(DBNick, user->name) || DBWildcard && WCCmp(DBWildcard, lowercasename)) && (WCCmp(DBUser, user->user) && WCCmp(DBHost, user->host))) { hContact_temp = hContact; } } if (hContact_temp != NULL) { mir_free(lowercasename); if (hContact_temp != (MCONTACT)-1) return hContact_temp; return 0; } } mir_free(lowercasename); return 0; }
static int gg_gc_countcheckmarks(HWND hwndList) { int count = 0; for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0); if (hItem && SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) count++; } return count; }
void CSkypeProto::SetAllContactsStatus(WORD status) { for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { if (!isChatRoom(hContact)) SetContactStatus(hContact, status); } if (status == ID_STATUS_OFFLINE) CloseAllChatChatSessions(); }
//if oldClistIcon != -1 it will remove the old location of the clist extra icon //called with oldClistIcon != -1 from dlg_handlers whtn the extra icon slot changes. int RefreshAllContactListIcons(int oldClistIcon) { for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (oldClistIcon != -1) ExtraIcon_Clear(hWWIExtraIcons, hContact); RefreshContactListIcons(hContact); //will change bBirthdayFound if needed } return 0; }
static void FilterContacts(HWND hwndDlg, CVkProto *ppro) { HWND hwndClist = GetDlgItem(hwndDlg, IDC_CLIST); for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *proto = GetContactProto(hContact); if (lstrcmpA(proto, ppro->m_szModuleName) || ppro->isChatRoom(hContact)) if (HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_FINDCONTACT, (WPARAM)hContact, 0)) SendMessage(hwndClist, CLM_DELETEITEM, (WPARAM)hItem, 0); } }
void StartUpdate(void *dummy) { StartUpDelay = 1; Sleep(((db_get_dw(NULL, MODULENAME, START_DELAY_KEY, 0)) * SECOND)); for (MCONTACT hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) GetData((void*)hContact); StartUpDelay = 0; }
INT_PTR CMraProto::MraUpdateAllUsersInfo(WPARAM wParam, LPARAM lParam) { if ( MessageBox(NULL, TranslateT("Are you sure?"), TranslateT(MRA_UPD_ALL_USERS_INFO_STR), MB_YESNO | MB_ICONQUESTION) == IDYES ) { for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { CMStringA szEmail; if ( mraGetStringA(hContact, "e-mail", szEmail)) MraWPRequestByEMail(hContact, ACKTYPE_GETINFO, szEmail); } } return 0; }
void ExtraIcon::applyIcons() { if (!isEnabled()) return; for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { // Clear to assert that it will be cleared Clist_SetExtraIcon(hContact, m_slot, INVALID_HANDLE_VALUE); applyIcon(hContact); } }