summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_chat_int.h1
-rw-r--r--plugins/Scriver/src/msgdialog.cpp5
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp3
-rw-r--r--src/mir_app/src/chat_manager.cpp7
-rw-r--r--src/mir_app/src/srmm_base.cpp7
5 files changed, 6 insertions, 17 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h
index 9eb1b989bb..d4856bc774 100644
--- a/include/m_chat_int.h
+++ b/include/m_chat_int.h
@@ -271,7 +271,6 @@ struct CHAT_MANAGER
HICON (*SM_GetStatusIcon)(SESSION_INFO *si, USERINFO * ui);
int (*SM_GetCount)(const char *pszModule);
SESSION_INFO* (*SM_FindSessionByIndex)(const char *pszModule, int iItem);
- USERINFO* (*SM_GetUserFromIndex)(const wchar_t *pszID, const char *pszModule, int index);
void (*SM_InvalidateLogDirectories)(void);
MODULEINFO* (*MM_CreateModule)(void);
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp
index c35b779569..ba50c46a25 100644
--- a/plugins/Scriver/src/msgdialog.cpp
+++ b/plugins/Scriver/src/msgdialog.cpp
@@ -873,7 +873,7 @@ LRESULT CMsgDialog::WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam)
if (wParam == VK_RETURN) {
int index = m_nickList.SendMsg(LB_GETCURSEL, 0, 0);
if (index != LB_ERR) {
- USERINFO *ui = g_chatApi.SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, index);
+ USERINFO *ui = g_chatApi.UM_FindUserFromIndex(m_si, index);
Chat_DoEventHook(m_si, GC_USER_PRIVMESS, ui, nullptr, 0);
}
break;
@@ -912,8 +912,7 @@ LRESULT CMsgDialog::WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam)
// string we have
int iItems = m_nickList.SendMsg(LB_GETCOUNT, 0, 0);
for (int i = 0; i < iItems; i++) {
- USERINFO *ui = g_chatApi.UM_FindUserFromIndex(m_si, i);
- if (ui) {
+ if (USERINFO *ui = g_chatApi.UM_FindUserFromIndex(m_si, i)) {
if (!wcsnicmp(ui->pszNick, m_wszSearch, mir_wstrlen(m_wszSearch))) {
m_nickList.SendMsg(LB_SETCURSEL, i, 0);
InvalidateRect(m_nickList.GetHwnd(), nullptr, FALSE);
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 253aa0c7b6..e4979c0b79 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -2017,8 +2017,7 @@ LRESULT CMsgDialog::WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam)
// string we have
int i, iItems = m_nickList.SendMsg(LB_GETCOUNT, 0, 0);
for (i = 0; i < iItems; i++) {
- USERINFO *ui = g_chatApi.UM_FindUserFromIndex(m_si, i);
- if (ui) {
+ if (USERINFO *ui = g_chatApi.UM_FindUserFromIndex(m_si, i)) {
if (!wcsnicmp(ui->pszNick, m_wszSearch, mir_wstrlen(m_wszSearch))) {
m_nickList.SendMsg(LB_SETSEL, FALSE, -1);
m_nickList.SendMsg(LB_SETSEL, TRUE, i);
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp
index ea74717a14..f8ceb299cf 100644
--- a/src/mir_app/src/chat_manager.cpp
+++ b/src/mir_app/src/chat_manager.cpp
@@ -257,12 +257,6 @@ BOOL SM_RemoveUser(SESSION_INFO *si, const wchar_t *pszUID)
return TRUE;
}
-static USERINFO* SM_GetUserFromIndex(const wchar_t *pszID, const char *pszModule, int index)
-{
- SESSION_INFO *si = Chat_Find(pszID, pszModule);
- return (si == nullptr) ? nullptr : UM_FindUserFromIndex(si, index);
-}
-
BOOL SM_GiveStatus(SESSION_INFO *si, const wchar_t *pszUID, const wchar_t *pszStatus)
{
if (si == nullptr)
@@ -787,7 +781,6 @@ static void ResetApi()
g_chatApi.SM_GetStatusIcon = ::SM_GetStatusIcon;
g_chatApi.SM_GetCount = ::SM_GetCount;
g_chatApi.SM_FindSessionByIndex = ::SM_FindSessionByIndex;
- g_chatApi.SM_GetUserFromIndex = ::SM_GetUserFromIndex;
g_chatApi.SM_InvalidateLogDirectories = ::SM_InvalidateLogDirectories;
g_chatApi.MM_CreateModule = ::MM_CreateModule;
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp
index 6612572732..99eea7065d 100644
--- a/src/mir_app/src/srmm_base.cpp
+++ b/src/mir_app/src/srmm_base.cpp
@@ -282,7 +282,7 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO *pa
CMStringW wszBuf;
- USERINFO *ui1 = g_chatApi.SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, currentHovered);
+ USERINFO *ui1 = g_chatApi.UM_FindUserFromIndex(parentdat, currentHovered);
if (ui1) {
if (ProtoServiceExists(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT)) {
wchar_t *p = (wchar_t*)CallProtoService(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)parentdat->ptszID, (LPARAM)ui1->pszUID);
@@ -323,7 +323,7 @@ static void CALLBACK ChatTimerProc(HWND hwnd, UINT, UINT_PTR idEvent, DWORD)
return;
}
- USERINFO *ui1 = g_chatApi.SM_GetUserFromIndex(si->ptszID, si->pszModule, si->currentHovered);
+ USERINFO *ui1 = g_chatApi.UM_FindUserFromIndex(si, si->currentHovered);
if (ui1) {
CMStringW wszBuf;
if (ProtoServiceExists(si->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT)) {
@@ -466,8 +466,7 @@ LRESULT CSrmmBaseDialog::WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam
if (HIWORD(item) != 0) // clicked outside the client area
break;
- USERINFO *ui = g_chatApi.SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, item);
- if (ui != nullptr) {
+ if (USERINFO *ui = g_chatApi.UM_FindUserFromIndex(m_si, item)) {
if (pt.x == -1 && pt.y == -1)
pt.y += height - 4;
ClientToScreen(m_nickList.GetHwnd(), &pt);