// обновляет иконки в clist и в messagew void ShowStatusIcon(HANDLE hContact, int mode) { HANDLE hMC = getMetaContact(hContact); // обновить иконки в clist if (mode != -1) { HANDLE hIcon = mode2clicon(mode, 1); ExtraIcon_SetIcon(g_hCLIcon, hContact, hIcon); if (hMC) ExtraIcon_SetIcon(g_hCLIcon, hMC, hIcon); } else { ExtraIcon_Clear(g_hCLIcon, hContact); if (hMC) ExtraIcon_Clear(g_hCLIcon, hMC); } StatusIconData sid = { sizeof(sid) }; sid.szModule = (char*)MODULENAME; for (int i = MODE_NATIVE; i < MODE_CNT; i++) { sid.dwId = i; sid.flags = (mode & SECURED) ? 0 : MBF_DISABLED; if (mode == -1 || (mode & 0x0f) != i || isChatRoom(hContact)) sid.flags |= MBF_HIDDEN; // отключаем все ненужные иконки Srmm_ModifyIcon(hContact, &sid); if (hMC) Srmm_ModifyIcon(hMC, &sid); } }
void setSrmmIcon(MCONTACT h) { MCONTACT hContact = metaIsProtoMetaContacts(h) ? metaGetMostOnline(h) : h; bool enabled = isContactSecured(hContact); MCONTACT hMC = NULL; if(db_mc_isSub(hContact)) hMC = db_mc_getMeta(hContact); else if(metaIsProtoMetaContacts(hContact)) hMC = db_mc_getMeta(hContact); StatusIconData sid = { sizeof(sid) }; sid.szModule = szGPGModuleName; sid.hIcon = IconLibGetIcon("secured"); sid.dwId = 1; sid.flags = enabled ? 0 : MBF_HIDDEN; Srmm_ModifyIcon(hContact, &sid); if(hMC) Srmm_ModifyIcon(hMC, &sid); sid.hIcon = IconLibGetIcon("unsecured"); sid.dwId = 2; sid.flags = enabled ? MBF_HIDDEN : 0; Srmm_ModifyIcon(hContact, &sid); if(hMC) Srmm_ModifyIcon(hMC, &sid); }
void SetSRMMIcon(MCONTACT hContact, SRMM_ICON_TYPE type, time_t time) { if (hContact && arMonitoredWindows.getIndex((HANDLE)hContact) != -1) { StatusIconData sid = { sizeof(sid) }; sid.szModule = MODULENAME; sid.dwId = 1; sid.flags = MBF_TCHAR; switch (type) { case ICON_HIDDEN: { sid.flags |= MBF_HIDDEN; break; } case ICON_READ: { sid.hIcon = IcoLib_GetIcon("read_icon"); CMString tooltip; if (db_get_dw(hContact, MODULENAME, DBKEY_MESSAGE_READ_TIME_TYPE, -1) == MRD_TYPE_READTIME) { TCHAR ttime[64]; _locale_t locale = _create_locale(LC_ALL, ""); _tcsftime_l(ttime, _countof(ttime), _T("%X %x"), localtime(&time), locale); _free_locale(locale); tooltip.Format(L"%s %s", TranslateT("Last message read at"), ttime); } else { tooltip = TranslateT("Last message read (unknown time)"); } sid.tszTooltip = tooltip.Detach(); break; } case ICON_UNREAD: { sid.hIcon = IcoLib_GetIcon("unread_icon"); sid.tszTooltip = TranslateT("Last message is not read"); break; } case ICON_FAILED: { sid.hIcon = IcoLib_GetIcon("fail_icon"); sid.tszTooltip = TranslateT("Last message was not sent."); break; } case ICON_NOSENT: { sid.hIcon = IcoLib_GetIcon("nosent_icon"); sid.tszTooltip = TranslateT("Sending..."); break; } default: return; } Srmm_ModifyIcon(hContact, &sid); } }
// always call in context of main thread static void __fastcall UnsetStatusIcon(MCONTACT hContact) { StatusIconData sid = { sizeof(sid) }; sid.szModule = MODULENAME; sid.flags = MBF_HIDDEN; Srmm_ModifyIcon(hContact, &sid); }
int WindowEvent(WPARAM wParam, LPARAM lParam) { MessageWindowEventData *mwd = (MessageWindowEventData *)lParam; MCONTACT hContact = mwd->hContact; switch(mwd->uType) { case MSG_WINDOW_EVT_CLOSE: RemoveReadEvents(hContact); break; case MSG_WINDOW_EVT_OPEN: char *proto = GetContactProto(hContact); bool chat_room = (proto && db_get_b(hContact, proto, "ChatRoom", 0) != 0); int remove = db_get_b(hContact, MODULE, DBSETTING_REMOVE, 0) != 0; StatusIconData sid = { sizeof(sid) }; sid.szModule = MODULE; for (int i=0; i < 2; ++i) { sid.dwId = i; sid.flags = (chat_room ? MBF_HIDDEN : (i == remove) ? 0 : MBF_HIDDEN); Srmm_ModifyIcon(hContact, &sid); } } return 0; }
void ChangeStatusIcons() { StatusIconData sid = { sizeof(sid) }; sid.szModule = SRMMMOD; sid.dwId = 1; sid.hIcon = GetCachedIcon("scriver_TYPING"); sid.hIconDisabled = GetCachedIcon("scriver_TYPINGOFF"); sid.flags = MBF_HIDDEN; Srmm_ModifyIcon(NULL, &sid); }
void UpdateStatusIcons() { StatusIconData sid = { sizeof(sid) }; sid.szModule = MODNAMEFLAGS; if (!g_bShowStatusIconFlag) sid.flags = MBF_HIDDEN; Srmm_ModifyIcon(NULL, &sid); /* enum all opened message windows */ for (int i = 0; i < gMsgWndList.getCount(); i++) gMsgWndList[i]->FlagsIconSet(); }
int OnIconPressed(WPARAM hContact, LPARAM lParam) { StatusIconClickData *sicd = (StatusIconClickData *)lParam; if (!(sicd->flags & MBCF_RIGHTBUTTON) && !mir_strcmp(sicd->szModule, ModuleName) && db_get_b(NULL, ModuleName, "ChangeInMW", 0)) { int nh = sicd->dwId; StatusIconData sid = { sizeof(sid) }; sid.szModule = ModuleName; sid.dwId = nh; sid.flags = MBF_HIDDEN; Srmm_ModifyIcon(hContact, &sid); nh = (nh + 1) % 4; db_set_b(hContact, ModuleName, "SweepHistory", (BYTE)nh); sid.dwId = nh; sid.flags = 0; Srmm_ModifyIcon(hContact, &sid); } return 0; }
void setSrmmIcon(MCONTACT h) { MCONTACT hContact = db_mc_isMeta(h) ? metaGetMostOnline(h) : h; bool enabled = isContactSecured(hContact); MCONTACT hMC = db_mc_tryMeta(hContact); StatusIconData sid = { sizeof(sid) }; sid.szModule = szGPGModuleName; sid.hIcon = IcoLib_GetIcon("secured"); sid.dwId = 1; sid.flags = enabled ? 0 : MBF_HIDDEN; Srmm_ModifyIcon(hContact, &sid); if(hMC != hContact) Srmm_ModifyIcon(hMC, &sid); sid.hIcon = IcoLib_GetIcon("unsecured"); sid.dwId = 2; sid.flags = enabled ? MBF_HIDDEN : 0; Srmm_ModifyIcon(hContact, &sid); if(hMC != hContact) Srmm_ModifyIcon(hMC, &sid); }
void SetSrmmIcon(MCONTACT hContact) { int sweep = db_get_b(hContact, ModuleName, "SweepHistory", 0); StatusIconData sid = {}; sid.szModule = ModuleName; for (int i = 0; i < 4; i++) { sid.dwId = i; sid.flags = (sweep == i) ? 0 : MBF_HIDDEN; Srmm_ModifyIcon(hContact, &sid); } }
void CJabberProto::MenuUpdateSrmmIcon(JABBER_LIST_ITEM *item) { if (item->list != LIST_ROSTER) return; MCONTACT hContact = HContactFromJID(item->jid); if (!hContact) return; StatusIconData sid = { sizeof(sid) }; sid.szModule = m_szModuleName; sid.flags = item->arResources.getCount() ? 0 : MBF_DISABLED; Srmm_ModifyIcon(hContact, &sid); }
void MsgWndData::FlagsIconSet() { StatusIconData sid = { sizeof(sid) }; sid.szModule = MODNAMEFLAGS; if (!g_bShowStatusIconFlag) sid.flags = MBF_HIDDEN; if (m_countryID != 0xFFFF || g_bUseUnknownFlag) { sid.hIcon = LoadFlagIcon(m_countryID); sid.szTooltip = Translate((char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, m_countryID, 0)); } else sid.flags = MBF_HIDDEN; Srmm_ModifyIcon(m_hContact, &sid); }
static void SetSrmmIcon(MCONTACT hContact, LPTSTR ptszMirver) { StatusIconData sid = { sizeof(sid) }; sid.szModule = MODULENAME; sid.dwId = 1; sid.flags = MBF_TCHAR; sid.tszTooltip = ptszMirver; if (mir_tstrlen(ptszMirver)) sid.hIcon = (HICON)ServiceGetClientIconW((WPARAM)ptszMirver, TRUE); else sid.flags |= MBF_HIDDEN; Srmm_ModifyIcon(hContact, &sid); }
static void SrmmMenu_UpdateIcon(MCONTACT hContact) { if (!hContact) return; int mode = db_get_b(hContact, MODULNAME, "ShowMode", PU_SHOWMODE_AUTO); StatusIconData sid = { sizeof(sid) }; sid.szModule = MODULNAME; for (int i=0; i < 4; i++) { sid.dwId = i; sid.flags = (i == mode) ? 0 : MBF_HIDDEN; Srmm_ModifyIcon(hContact, &sid); } }
INT_PTR ServiceToggle(WPARAM hContact, LPARAM lParam) { int remove = db_get_b(hContact, MODULE, DBSETTING_REMOVE, 0) != 0; remove = !remove; db_set_b(hContact, MODULE, DBSETTING_REMOVE, remove != 0); StatusIconData sid = { sizeof(sid) }; sid.szModule = MODULE; for (int i = 0; i < 2; ++i) { sid.dwId = i; sid.flags = (i == remove) ? 0 : MBF_HIDDEN; Srmm_ModifyIcon(hContact, &sid); } return 0; }
// always call in context of main thread static void __fastcall SetStatusIcon(MCONTACT hContact,int countryNumber) { StatusIconData sid = { sizeof(sid) }; sid.szModule = MODULENAME; if (countryNumber != 0xFFFF || bUseUnknown) { /* copy icon as status icon API will call DestroyIcon() on it */ sid.hIcon = LoadFlagIcon(countryNumber); sid.szTooltip = (char*) CallService(MS_UTILS_GETCOUNTRYBYNUMBER,countryNumber,0); } else sid.flags = MBF_HIDDEN; Srmm_ModifyIcon(hContact, &sid); if (sid.hIcon) Skin_ReleaseIcon(sid.hIcon); }
static int IconsChanged(WPARAM, LPARAM) { StatusIconData sid = { sizeof(sid) }; sid.szModule = MODULE_NAME; sid.hIconDisabled = IcoLib_GetIcon("spellchecker_disabled"); sid.flags = MBF_HIDDEN | MBF_TCHAR; for (int i = 0; i < languages.getCount(); i++) { sid.dwId = i; TCHAR tmp[128]; mir_sntprintf(tmp, _T("%s - %s"), TranslateT("Spell Checker"), languages[i]->full_name); sid.tszTooltip = tmp; HICON hIcon = (opts.use_flags) ? IcoLib_GetIconByHandle(languages[i]->hIcolib) : IcoLib_GetIcon("spellchecker_enabled"); sid.hIcon = CopyIcon(hIcon); IcoLib_ReleaseIcon(hIcon); Srmm_ModifyIcon(NULL, &sid); } return 0; }