summaryrefslogtreecommitdiff
path: root/plugins/Scriver/src/chat/manager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Scriver/src/chat/manager.cpp')
-rw-r--r--plugins/Scriver/src/chat/manager.cpp28
1 files changed, 12 insertions, 16 deletions
diff --git a/plugins/Scriver/src/chat/manager.cpp b/plugins/Scriver/src/chat/manager.cpp
index cb8f50589a..307059dfd8 100644
--- a/plugins/Scriver/src/chat/manager.cpp
+++ b/plugins/Scriver/src/chat/manager.cpp
@@ -23,38 +23,34 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
HWND SM_FindWindowByContact(MCONTACT hContact)
{
- SESSION_INFO *pTemp = pci->wndList;
-
- while (pTemp != nullptr) {
- if (pTemp->hContact == hContact)
- return pTemp->hWnd;
-
- pTemp = pTemp->next;
+ for (int i = 0; i < pci->arSessions.getCount(); i++) {
+ SESSION_INFO *si = pci->arSessions[i];
+ if (si->hContact == hContact)
+ return (si->pDlg) ? si->pDlg->GetHwnd() : nullptr;
}
return nullptr;
}
-SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO* currSession, SESSION_INFO* prevSession, const wchar_t* pszOriginal, const wchar_t* pszCurrent)
+SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO *currSession, SESSION_INFO *prevSession, const wchar_t *pszOriginal, const wchar_t *pszCurrent)
{
SESSION_INFO* pResult = nullptr;
if (prevSession == nullptr && my_strstri(currSession->ptszName, pszOriginal) == currSession->ptszName)
pResult = currSession;
else {
wchar_t* pszName = nullptr;
- SESSION_INFO* pTemp = pci->wndList;
if (currSession == prevSession)
pszCurrent = pszOriginal;
- while (pTemp != nullptr) {
- if (pTemp != currSession && !mir_strcmpi(pszModule, pTemp->pszModule)) {
- if (my_strstri(pTemp->ptszName, pszOriginal) == pTemp->ptszName) {
- if (prevSession != pTemp && mir_wstrcmpi(pTemp->ptszName, pszCurrent) > 0 && (!pszName || mir_wstrcmpi(pTemp->ptszName, pszName) < 0)) {
- pResult = pTemp;
- pszName = pTemp->ptszName;
+ for (int i = 0; i < pci->arSessions.getCount(); i++) {
+ SESSION_INFO *si = pci->arSessions[i];
+ if (si != currSession && !mir_strcmpi(pszModule, si->pszModule)) {
+ if (my_strstri(si->ptszName, pszOriginal) == si->ptszName) {
+ if (prevSession != si && mir_wstrcmpi(si->ptszName, pszCurrent) > 0 && (!pszName || mir_wstrcmpi(si->ptszName, pszName) < 0)) {
+ pResult = si;
+ pszName = si->ptszName;
}
}
}
- pTemp = pTemp->next;
}
}
return pResult;