HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, int isSend, const char *pszInitialText, BOOL bActivateTab, BOOL bPopupContainer, BOOL bWantPopup, HANDLE hdbEvent) { TCHAR newcontactname[128], tabtitle[128]; int newItem; DBVARIANT dbv = {0}; if (M.FindWindow(hContact) != 0) { _DebugPopup(hContact, _T("Warning: trying to create duplicate window")); return 0; } // if we have a max # of tabs/container set and want to open something in the default container... if (hContact != 0 && M.GetByte("limittabs", 0) && !_tcsncmp(pContainer->szName, _T("default"), 6)) { if ((pContainer = FindMatchingContainer(_T("default"), hContact)) == NULL) { TCHAR szName[CONTAINER_NAMELEN + 1]; mir_sntprintf(szName, CONTAINER_NAMELEN, _T("default")); if ((pContainer = CreateContainer(szName, CNT_CREATEFLAG_CLONED, hContact)) == NULL) return 0; } } TNewWindowData newData = {0}; newData.hContact = hContact; newData.isWchar = isSend; newData.szInitialText = pszInitialText; char *szProto = GetContactProto(newData.hContact); ZeroMemory(&newData.item, sizeof(newData.item)); // obtain various status information about the contact TCHAR *contactName = pcli->pfnGetContactDisplayName(newData.hContact, 0); /* * cut nickname if larger than x chars... */ if (contactName && lstrlen(contactName) > 0) { if (M.GetByte("cuttitle", 0)) CutContactName(contactName, newcontactname, SIZEOF(newcontactname)); else { lstrcpyn(newcontactname, contactName, SIZEOF(newcontactname)); newcontactname[127] = 0; } //Mad: to fix tab width for nicknames with ampersands Utils::DoubleAmpersands(newcontactname); } else lstrcpyn(newcontactname, _T("_U_"), SIZEOF(newcontactname)); WORD wStatus = (szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(newData.hContact, szProto, "Status", ID_STATUS_OFFLINE)); TCHAR *szStatus = pcli->pfnGetStatusModeDescription(szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(newData.hContact, szProto, "Status", ID_STATUS_OFFLINE), 0); if (M.GetByte("tabstatus", 1)) mir_sntprintf(tabtitle, SIZEOF(tabtitle), _T("%s (%s) "), newcontactname, szStatus); else mir_sntprintf(tabtitle, SIZEOF(tabtitle), _T("%s "), newcontactname); newData.item.pszText = tabtitle; newData.item.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM; newData.item.iImage = 0; newData.item.cchTextMax = 255; HWND hwndTab = GetDlgItem(pContainer->hwnd, IDC_MSGTABS); // hide the active tab if (pContainer->hwndActive && bActivateTab) ShowWindow(pContainer->hwndActive, SW_HIDE); { int iTabIndex_wanted = M.GetDword(hContact, "tabindex", pContainer->iChilds * 100); int iCount = TabCtrl_GetItemCount(hwndTab); TCITEM item = {0}; int relPos; int i; pContainer->iTabIndex = iCount; if (iCount > 0) { for (i = iCount - 1; i >= 0; i--) { item.mask = TCIF_PARAM; TabCtrl_GetItem(hwndTab, i, &item); HWND hwnd = (HWND)item.lParam; TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA); if (dat) { relPos = M.GetDword(dat->hContact, "tabindex", i * 100); if (iTabIndex_wanted <= relPos) pContainer->iTabIndex = i; } } } } newItem = TabCtrl_InsertItem(hwndTab, pContainer->iTabIndex, &newData.item); SendMessage(hwndTab, EM_REFRESHWITHOUTCLIP, 0, 0); if (bActivateTab) TabCtrl_SetCurSel(GetDlgItem(pContainer->hwnd, IDC_MSGTABS), newItem); newData.iTabID = newItem; newData.iTabImage = newData.item.iImage; newData.pContainer = pContainer; newData.iActivate = (int) bActivateTab; pContainer->iChilds++; newData.bWantPopup = bWantPopup; newData.hdbEvent = hdbEvent; HWND hwndNew = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGSPLITNEW), GetDlgItem(pContainer->hwnd, IDC_MSGTABS), DlgProcMessage, (LPARAM)&newData); /* * switchbar support */ if (pContainer->dwFlags & CNT_SIDEBAR) { TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndNew, GWLP_USERDATA); if (dat) pContainer->SideBar->addSession(dat, pContainer->iTabIndex); } SendMessage(pContainer->hwnd, WM_SIZE, 0, 0); // if the container is minimized, then pop it up... if (IsIconic(pContainer->hwnd)) { if (bPopupContainer) { SendMessage(pContainer->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0); SetFocus(pContainer->hwndActive); } else { if (pContainer->dwFlags & CNT_NOFLASH) SendMessage(pContainer->hwnd, DM_SETICON, 0, (LPARAM)LoadSkinnedIcon(SKINICON_EVENT_MESSAGE)); else FlashContainer(pContainer, 1, 0); } } if (bActivateTab) { ActivateExistingTab(pContainer, hwndNew); SetFocus(hwndNew); RedrawWindow(pContainer->hwnd, NULL, NULL, RDW_ERASENOW); UpdateWindow(pContainer->hwnd); if (GetForegroundWindow() != pContainer->hwnd && bPopupContainer == TRUE) SetForegroundWindow(pContainer->hwnd); } else if (!IsIconic(pContainer->hwnd) && IsWindowVisible(pContainer->hwnd)) { SendMessage(pContainer->hwndActive, WM_SIZE, 0, 0); RedrawWindow(pContainer->hwndActive, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_UPDATENOW); RedrawWindow(pContainer->hwndActive, NULL, NULL, RDW_ERASENOW | RDW_UPDATENOW); } //MaD if (PluginConfig.m_HideOnClose&&!IsWindowVisible(pContainer->hwnd)) { WINDOWPLACEMENT wp={0}; wp.length = sizeof(wp); GetWindowPlacement(pContainer->hwnd, &wp); BroadCastContainer(pContainer, DM_CHECKSIZE, 0, 0); // make sure all tabs will re-check layout on activation if (wp.showCmd == SW_SHOWMAXIMIZED) ShowWindow(pContainer->hwnd, SW_SHOWMAXIMIZED); else { if (bPopupContainer) ShowWindow(pContainer->hwnd, SW_SHOWNORMAL); else ShowWindow(pContainer->hwnd, SW_SHOWMINNOACTIVE); } SendMessage(pContainer->hwndActive, WM_SIZE, 0, 0); } if (PluginConfig.m_bIsWin7 && PluginConfig.m_useAeroPeek && CSkin::m_skinEnabled) CWarning::show(CWarning::WARN_AEROPEEK_SKIN, MB_ICONWARNING|MB_OK); if (ServiceExists(MS_HPP_EG_EVENT) && ServiceExists(MS_IEVIEW_EVENT) && db_get_b(0, "HistoryPlusPlus", "IEViewAPI", 0)) if (IDYES == CWarning::show(CWarning::WARN_HPP_APICHECK, MB_ICONWARNING|MB_YESNO)) db_set_b(0, "HistoryPlusPlus", "IEViewAPI", 0); return hwndNew; // return handle of the new dialog }
HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateTab, BOOL bPopupContainer, BOOL bWantPopup) { MCONTACT hContact = si->hContact; if (M.FindWindow(hContact) != 0) return 0; if (hContact != 0 && M.GetByte("limittabs", 0) && !_tcsncmp(pContainer->szName, _T("default"), 6)) { if ((pContainer = FindMatchingContainer(_T("default"), hContact)) == NULL) { TCHAR szName[CONTAINER_NAMELEN + 1]; mir_sntprintf(szName, CONTAINER_NAMELEN, _T("default")); if ((pContainer = CreateContainer(szName, CNT_CREATEFLAG_CLONED, hContact)) == NULL) return 0; } } TNewWindowData newData = { 0 }; newData.hContact = hContact; newData.isWchar = 0; newData.szInitialText = NULL; memset(&newData.item, 0, sizeof(newData.item)); TCHAR *contactName = pcli->pfnGetContactDisplayName(newData.hContact, 0); // cut nickname if larger than x chars... TCHAR newcontactname[128]; if (lstrlen(contactName) > 0) { if (M.GetByte("cuttitle", 0)) CutContactName(contactName, newcontactname, SIZEOF(newcontactname)); else { lstrcpyn(newcontactname, contactName, SIZEOF(newcontactname)); newcontactname[127] = 0; } } else lstrcpyn(newcontactname, _T("_U_"), SIZEOF(newcontactname)); newData.item.pszText = newcontactname; newData.item.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM; newData.item.iImage = 0; HWND hwndTab = GetDlgItem(pContainer->hwnd, 1159); // hide the active tab if (pContainer->hwndActive && bActivateTab) ShowWindow(pContainer->hwndActive, SW_HIDE); int iTabIndex_wanted = M.GetDword(hContact, "tabindex", pContainer->iChilds * 100); int iCount = TabCtrl_GetItemCount(hwndTab); pContainer->iTabIndex = iCount; if (iCount > 0) { TCITEM item = { 0 }; for (int i = iCount - 1; i >= 0; i--) { item.mask = TCIF_PARAM; TabCtrl_GetItem(hwndTab, i, &item); HWND hwnd = (HWND)item.lParam; TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA); if (dat) { int relPos = M.GetDword(dat->hContact, "tabindex", i * 100); if (iTabIndex_wanted <= relPos) pContainer->iTabIndex = i; } } } int newItem = TabCtrl_InsertItem(hwndTab, pContainer->iTabIndex, &newData.item); SendMessage(hwndTab, EM_REFRESHWITHOUTCLIP, 0, 0); if (bActivateTab) TabCtrl_SetCurSel(hwndTab, newItem); newData.iTabID = newItem; newData.iTabImage = newData.item.iImage; newData.pContainer = pContainer; newData.iActivate = bActivateTab; pContainer->iChilds++; newData.bWantPopup = bWantPopup; newData.hdbEvent = (HANDLE)si; HWND hwndNew = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CHANNEL), GetDlgItem(pContainer->hwnd, 1159), RoomWndProc, (LPARAM)&newData); if (pContainer->dwFlags & CNT_SIDEBAR) { TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndNew, GWLP_USERDATA); if (dat) pContainer->SideBar->addSession(dat, pContainer->iTabIndex); } SendMessage(pContainer->hwnd, WM_SIZE, 0, 0); // if the container is minimized, then pop it up... if (IsIconic(pContainer->hwnd)) { if (bPopupContainer) { SendMessage(pContainer->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0); SetFocus(pContainer->hwndActive); } else { if (pContainer->dwFlags & CNT_NOFLASH) SendMessage(pContainer->hwnd, DM_SETICON, 0, (LPARAM)LoadSkinnedIcon(SKINICON_EVENT_MESSAGE)); else FlashContainer(pContainer, 1, 0); } } if (bActivateTab) { if (PluginConfig.m_HideOnClose && !IsWindowVisible(pContainer->hwnd)) { WINDOWPLACEMENT wp = { 0 }; wp.length = sizeof(wp); GetWindowPlacement(pContainer->hwnd, &wp); BroadCastContainer(pContainer, DM_CHECKSIZE, 0, 0); // make sure all tabs will re-check layout on activation if (wp.showCmd == SW_SHOWMAXIMIZED) ShowWindow(pContainer->hwnd, SW_SHOWMAXIMIZED); else { if (bPopupContainer) ShowWindow(pContainer->hwnd, SW_SHOWNORMAL); else ShowWindow(pContainer->hwnd, SW_SHOWMINNOACTIVE); } SendMessage(pContainer->hwndActive, WM_SIZE, 0, 0); SetFocus(hwndNew); } else { SetFocus(hwndNew); RedrawWindow(pContainer->hwnd, NULL, NULL, RDW_INVALIDATE); UpdateWindow(pContainer->hwnd); if (GetForegroundWindow() != pContainer->hwnd && bPopupContainer == TRUE) SetForegroundWindow(pContainer->hwnd); } } if (PluginConfig.m_bIsWin7 && PluginConfig.m_useAeroPeek && CSkin::m_skinEnabled && !M.GetByte("forceAeroPeek", 0)) CWarning::show(CWarning::WARN_AEROPEEK_SKIN, MB_ICONWARNING | MB_OK); return hwndNew; // return handle of the new dialog }
int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM lParam) { TCHAR szName[CONTAINER_NAMELEN + 1]; HANDLE hDbEvent = (HANDLE)lParam; DBEVENTINFO dbei = { sizeof(dbei) }; db_event_get(hDbEvent, &dbei); HWND hwnd = M.FindWindow(hContact); if (hwnd == NULL) hwnd = M.FindWindow(db_event_getContact(hDbEvent)); BOOL isCustomEvent = IsCustomEvent(dbei.eventType); BOOL isShownCustomEvent = DbEventIsForMsgWindow(&dbei); if (dbei.markedRead() || (isCustomEvent && !isShownCustomEvent)) return 0; CallServiceSync(MS_CLIST_REMOVEEVENT, hContact, 1); bool bAllowAutoCreate = false; bool bAutoPopup = M.GetByte(SRMSGSET_AUTOPOPUP, SRMSGDEFSET_AUTOPOPUP) != 0; bool bAutoCreate = M.GetByte("autotabs", 1) != 0; bool bAutoContainer = M.GetByte("autocontainer", 1) != 0; DWORD dwStatusMask = M.GetDword("autopopupmask", -1); if (hwnd) { TContainerData *pTargetContainer = 0; SendMessage(hwnd, DM_QUERYCONTAINER, 0, (LPARAM)&pTargetContainer); if (pTargetContainer == NULL || !PluginConfig.m_HideOnClose || IsWindowVisible(pTargetContainer->hwnd)) return 0; WINDOWPLACEMENT wp = { 0 }; wp.length = sizeof(wp); GetWindowPlacement(pTargetContainer->hwnd, &wp); GetContainerNameForContact(hContact, szName, CONTAINER_NAMELEN); if (bAutoPopup || bAutoCreate) { if (bAutoPopup) { if (wp.showCmd == SW_SHOWMAXIMIZED) ShowWindow(pTargetContainer->hwnd, SW_SHOWMAXIMIZED); else ShowWindow(pTargetContainer->hwnd, SW_SHOWNOACTIVATE); return 0; } TContainerData *pContainer = FindContainerByName(szName); if (pContainer != NULL) { if (bAutoContainer) { ShowWindow(pTargetContainer->hwnd, SW_SHOWMINNOACTIVE); return 0; } goto nowindowcreate; } else if (bAutoContainer) { ShowWindow(pTargetContainer->hwnd, SW_SHOWMINNOACTIVE); return 0; } } } else { switch (dbei.eventType) { case EVENTTYPE_AUTHREQUEST: case EVENTTYPE_ADDED: return 0; case EVENTTYPE_FILE: tabSRMM_ShowPopup(hContact, hDbEvent, dbei.eventType, 0, 0, 0, dbei.szModule, 0); return 0; } } // if no window is open, we are not interested in anything else but unread message events // new message if (!nen_options.iNoSounds) SkinPlaySound("AlertMsg"); if (nen_options.iNoAutoPopup) goto nowindowcreate; GetContainerNameForContact(hContact, szName, CONTAINER_NAMELEN); if (dwStatusMask == -1) bAllowAutoCreate = true; else { char *szProto = GetContactProto(hContact); if (szProto && !strcmp(szProto, META_PROTO)) szProto = GetContactProto(db_mc_getSrmmSub(hContact)); if (szProto) { DWORD dwStatus = (DWORD)CallProtoService(szProto, PS_GETSTATUS, 0, 0); if (dwStatus == 0 || dwStatus <= ID_STATUS_OFFLINE || ((1 << (dwStatus - ID_STATUS_ONLINE)) & dwStatusMask)) // should never happen, but... bAllowAutoCreate = true; } } if (bAllowAutoCreate && (bAutoPopup || bAutoCreate)) { if (bAutoPopup) { TContainerData *pContainer = FindContainerByName(szName); if (pContainer == NULL) pContainer = CreateContainer(szName, FALSE, hContact); if (pContainer) CreateNewTabForContact(pContainer, hContact, 0, NULL, TRUE, TRUE, FALSE, 0); return 0; } bool bActivate = false, bPopup = M.GetByte("cpopup", 0) != 0; TContainerData *pContainer = FindContainerByName(szName); if (pContainer != NULL) { if (M.GetByte("limittabs", 0) && !wcsncmp(pContainer->szName, L"default", 6)) { if ((pContainer = FindMatchingContainer(L"default", hContact)) != NULL) { CreateNewTabForContact(pContainer, hContact, 0, NULL, bActivate, bPopup, TRUE, hDbEvent); return 0; } } else { CreateNewTabForContact(pContainer, hContact, 0, NULL, bActivate, bPopup, TRUE, hDbEvent); return 0; } } if (bAutoContainer) { if ((pContainer = CreateContainer(szName, CNT_CREATEFLAG_MINIMIZED, hContact)) != NULL) { // 2 means create minimized, don't popup... CreateNewTabForContact(pContainer, hContact, 0, NULL, bActivate, bPopup, TRUE, hDbEvent); SendMessageW(pContainer->hwnd, WM_SIZE, 0, 0); } return 0; } } // for tray support, we add the event to the tray menu. otherwise we send it back to // the contact list for flashing nowindowcreate: if (!(dbei.flags & DBEF_READ)) { UpdateTrayMenu(0, 0, dbei.szModule, NULL, hContact, 1); if (!nen_options.bTraySupport) { TCHAR toolTip[256], *contactName; CLISTEVENT cle = { sizeof(cle) }; cle.hContact = hContact; cle.hDbEvent = hDbEvent; cle.flags = CLEF_TCHAR; cle.hIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE); cle.pszService = "SRMsg/ReadMessage"; contactName = pcli->pfnGetContactDisplayName(hContact, 0); mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("Message from %s"), contactName); cle.ptszTooltip = toolTip; CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle); } tabSRMM_ShowPopup(hContact, hDbEvent, dbei.eventType, 0, 0, 0, dbei.szModule, 0); } return 0; }
int CMimAPI::MessageEventAdded(WPARAM wParam, LPARAM lParam) { HWND hwnd; CLISTEVENT cle; DBEVENTINFO dbei; BYTE bAutoPopup = FALSE, bAutoCreate = FALSE, bAutoContainer = FALSE, bAllowAutoCreate = 0; struct TContainerData *pContainer = 0; TCHAR szName[CONTAINER_NAMELEN + 1]; DWORD dwStatusMask = 0; struct TWindowData *mwdat=NULL; ZeroMemory(&dbei, sizeof(dbei)); dbei.cbSize = sizeof(dbei); dbei.cbBlob = 0; CallService(MS_DB_EVENT_GET, lParam, (LPARAM) & dbei); hwnd = M->FindWindow((HANDLE) wParam); if (dbei.flags & DBEF_SENT || !(dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_FILE) || dbei.flags & DBEF_READ) return 0; CallServiceSync(MS_CLIST_REMOVEEVENT, wParam, (LPARAM) 1); //MaD: hide on close mod, simulating standard behavior for hidden container if (hwnd) { struct TContainerData *pTargetContainer = 0; WINDOWPLACEMENT wp={0}; wp.length = sizeof(wp); SendMessage(hwnd, DM_QUERYCONTAINER, 0, (LPARAM)&pTargetContainer); if(pTargetContainer && PluginConfig.m_HideOnClose && !IsWindowVisible(pTargetContainer->hwnd)) { GetWindowPlacement(pTargetContainer->hwnd, &wp); GetContainerNameForContact((HANDLE) wParam, szName, CONTAINER_NAMELEN); bAutoPopup = M->GetByte(SRMSGSET_AUTOPOPUP, SRMSGDEFSET_AUTOPOPUP); bAutoCreate = M->GetByte("autotabs", 1); bAutoContainer = M->GetByte("autocontainer", 1); dwStatusMask = M->GetDword("autopopupmask", -1); bAllowAutoCreate = FALSE; if (bAutoPopup || bAutoCreate) { BOOL bActivate = TRUE, bPopup = TRUE; if(bAutoPopup) { if(wp.showCmd == SW_SHOWMAXIMIZED) ShowWindow(pTargetContainer->hwnd, SW_SHOWMAXIMIZED); else ShowWindow(pTargetContainer->hwnd, SW_SHOWNOACTIVATE); return 0; } else { bActivate = FALSE; bPopup = (BOOL) M->GetByte("cpopup", 0); pContainer = FindContainerByName(szName); if (pContainer != NULL) { if(bAutoContainer) { ShowWindow(pTargetContainer->hwnd, SW_SHOWMINNOACTIVE); return 0; } else goto nowindowcreate; } else { if(bAutoContainer) { ShowWindow(pTargetContainer->hwnd, SW_SHOWMINNOACTIVE); return 0; } } } } } else return 0; } else { if(dbei.eventType == EVENTTYPE_FILE) { tabSRMM_ShowPopup(wParam, lParam, dbei.eventType, 0, 0, 0, dbei.szModule, 0); return(0); } } /* * if no window is open, we are not interested in anything else but unread message events */ /* new message */ if (!nen_options.iNoSounds) SkinPlaySound("AlertMsg"); if (nen_options.iNoAutoPopup) goto nowindowcreate; GetContainerNameForContact((HANDLE) wParam, szName, CONTAINER_NAMELEN); bAutoPopup = M->GetByte(SRMSGSET_AUTOPOPUP, SRMSGDEFSET_AUTOPOPUP); bAutoCreate = M->GetByte("autotabs", 1); bAutoContainer = M->GetByte("autocontainer", 1); dwStatusMask = M->GetDword("autopopupmask", -1); bAllowAutoCreate = FALSE; if (dwStatusMask == -1) bAllowAutoCreate = TRUE; else { char *szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)wParam, 0); DWORD dwStatus = 0; if (PluginConfig.g_MetaContactsAvail && szProto && !strcmp(szProto, (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0))) { HANDLE hSubconttact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, wParam, 0); szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hSubconttact, 0); } if (szProto) { dwStatus = (DWORD)CallProtoService(szProto, PS_GETSTATUS, 0, 0); if (dwStatus == 0 || dwStatus <= ID_STATUS_OFFLINE || ((1 << (dwStatus - ID_STATUS_ONLINE)) & dwStatusMask)) // should never happen, but... bAllowAutoCreate = TRUE; } } if (bAllowAutoCreate && (bAutoPopup || bAutoCreate)) { BOOL bActivate = TRUE, bPopup = TRUE; if (bAutoPopup) { bActivate = bPopup = TRUE; if ((pContainer = FindContainerByName(szName)) == NULL) pContainer = CreateContainer(szName, FALSE, (HANDLE)wParam); CreateNewTabForContact(pContainer, (HANDLE) wParam, 0, NULL, bActivate, bPopup, FALSE, 0); return 0; } else { bActivate = FALSE; bPopup = (BOOL) M->GetByte("cpopup", 0); pContainer = FindContainerByName(szName); if (pContainer != NULL) { //if ((IsIconic(pContainer->hwnd)) && PluginConfig.haveAutoSwitch()) // pContainer->dwFlags |= CNT_DEFERREDTABSELECT; if (M->GetByte("limittabs", 0) && !wcsncmp(pContainer->szName, L"default", 6)) { if ((pContainer = FindMatchingContainer(L"default", (HANDLE)wParam)) != NULL) { CreateNewTabForContact(pContainer, (HANDLE) wParam, 0, NULL, bActivate, bPopup, TRUE, (HANDLE)lParam); return 0; } else if (bAutoContainer) { pContainer = CreateContainer(szName, CNT_CREATEFLAG_MINIMIZED, (HANDLE)wParam); // 2 means create minimized, don't popup... CreateNewTabForContact(pContainer, (HANDLE) wParam, 0, NULL, bActivate, bPopup, TRUE, (HANDLE)lParam); SendMessageW(pContainer->hwnd, WM_SIZE, 0, 0); return 0; } } else { CreateNewTabForContact(pContainer, (HANDLE) wParam, 0, NULL, bActivate, bPopup, TRUE, (HANDLE)lParam); return 0; } } else { if (bAutoContainer) { pContainer = CreateContainer(szName, CNT_CREATEFLAG_MINIMIZED, (HANDLE)wParam); // 2 means create minimized, don't popup... CreateNewTabForContact(pContainer, (HANDLE) wParam, 0, NULL, bActivate, bPopup, TRUE, (HANDLE)lParam); SendMessageW(pContainer->hwnd, WM_SIZE, 0, 0); return 0; } } } } /* * for tray support, we add the event to the tray menu. otherwise we send it back to * the contact list for flashing */ nowindowcreate: if (!(dbei.flags & DBEF_READ)) { UpdateTrayMenu(0, 0, dbei.szModule, NULL, (HANDLE)wParam, 1); if (!nen_options.bTraySupport) { TCHAR toolTip[256], *contactName; ZeroMemory(&cle, sizeof(cle)); cle.cbSize = sizeof(cle); cle.hContact = (HANDLE) wParam; cle.hDbEvent = (HANDLE) lParam; cle.flags = CLEF_TCHAR; cle.hIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE); cle.pszService = "SRMsg/ReadMessage"; contactName = (TCHAR*) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, GCDNF_TCHAR); mir_sntprintf(toolTip, SIZEOF(toolTip), CTranslator::get(CTranslator::GEN_MSG_TTITLE), contactName); cle.ptszTooltip = toolTip; CallService(MS_CLIST_ADDEVENT, 0, (LPARAM) & cle); } tabSRMM_ShowPopup(wParam, lParam, dbei.eventType, 0, 0, 0, dbei.szModule, 0); } return 0; }