diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/stdmsg/src/chat_manager.cpp | 6 | ||||
-rw-r--r-- | src/core/stdmsg/src/chat_options.cpp | 10 | ||||
-rw-r--r-- | src/core/stdmsg/src/chat_window.cpp | 2 | ||||
-rw-r--r-- | src/core/stdmsg/src/globals.h | 2 | ||||
-rw-r--r-- | src/core/stdmsg/src/msglog.cpp | 33 | ||||
-rw-r--r-- | src/core/stdmsg/src/stdafx.h | 2 |
6 files changed, 43 insertions, 12 deletions
diff --git a/src/core/stdmsg/src/chat_manager.cpp b/src/core/stdmsg/src/chat_manager.cpp index 4597554fd1..ed1badbeb4 100644 --- a/src/core/stdmsg/src/chat_manager.cpp +++ b/src/core/stdmsg/src/chat_manager.cpp @@ -57,8 +57,6 @@ SESSION_INFO* SM_GetNextWindow(SESSION_INFO *si) HMENU g_hMenu = nullptr; -BOOL SmileyAddInstalled = FALSE, PopupInstalled = FALSE; - GlobalLogSettings g_Settings; static void OnDestroyModule(MODULEINFO *mi) @@ -220,8 +218,8 @@ static void ShowRoom(SESSION_INFO *si) int OnCheckPlugins(WPARAM, LPARAM) { - SmileyAddInstalled = ServiceExists(MS_SMILEYADD_REPLACESMILEYS); - PopupInstalled = ServiceExists(MS_POPUP_ADDPOPUPT); + g_dat.bSmileyInstalled = ServiceExists(MS_SMILEYADD_REPLACESMILEYS); + g_dat.bPopupInstalled = ServiceExists(MS_POPUP_ADDPOPUPT); return 0; } diff --git a/src/core/stdmsg/src/chat_options.cpp b/src/core/stdmsg/src/chat_options.cpp index 1b20b5aee1..272b75ef6c 100644 --- a/src/core/stdmsg/src/chat_options.cpp +++ b/src/core/stdmsg/src/chat_options.cpp @@ -330,7 +330,7 @@ class COptMainDlg : public CDlgBase CheckHeading(hListHeading3); CheckHeading(hListHeading4); CheckHeading(hListHeading5); - if (PopupInstalled) + if (g_dat.bPopupInstalled) CheckHeading(hListHeading6); } @@ -358,7 +358,7 @@ public: FillBranch(hListHeading4, branch4, _countof(branch4), 0x0000); FillBranch(hListHeading5, branch5, _countof(branch5), 0x1000); - if (PopupInstalled) { + if (g_dat.bPopupInstalled) { hListHeading6 = InsertBranch(LPGEN("Popups to display"), db_get_b(0, CHAT_MODULE, "Branch6Exp", 0) ? TRUE : FALSE); FillBranch(hListHeading6, branch6, _countof(branch6), 0x0000); } @@ -372,7 +372,7 @@ public: SaveBranch(branch3, _countof(branch3)); SaveBranch(branch4, _countof(branch4)); SaveBranch(branch5, _countof(branch5)); - if (PopupInstalled) + if (g_dat.bPopupInstalled) SaveBranch(branch6, _countof(branch6)); g_chatApi.ReloadSettings(); @@ -392,7 +392,7 @@ public: b = checkBoxes.GetItemState(hListHeading5, TVIS_EXPANDED) & TVIS_EXPANDED ? 1 : 0; db_set_b(0, CHAT_MODULE, "Branch5Exp", b); - if (PopupInstalled) { + if (g_dat.bPopupInstalled) { b = checkBoxes.GetItemState(hListHeading6, TVIS_EXPANDED) & TVIS_EXPANDED ? 1 : 0; db_set_b(0, CHAT_MODULE, "Branch6Exp", b); } @@ -679,7 +679,7 @@ int ChatOptionsInitialize(WPARAM wParam) odp.pDialog = new COptLogDlg(); g_plugin.addOptions(wParam, &odp); - if (PopupInstalled) { + if (g_dat.bPopupInstalled) { odp.position = 910000002; odp.szTitle.a = LPGEN("Chat"); odp.szGroup.a = LPGEN("Popups"); diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index abb4ba1244..86662eaac5 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -436,7 +436,7 @@ void CChatRoomDlg::StreamInEvents(LOGINFO *lin, bool bRedraw) m_log.SendMsg(EM_STREAMIN, wp, (LPARAM)&stream); // do smileys - if (SmileyAddInstalled && (bRedraw || (lin->ptszText && lin->iType != GC_EVENT_JOIN && lin->iType != GC_EVENT_NICK && lin->iType != GC_EVENT_ADDSTATUS && lin->iType != GC_EVENT_REMOVESTATUS))) { + if (g_dat.bSmileyInstalled && (bRedraw || (lin->ptszText && lin->iType != GC_EVENT_JOIN && lin->iType != GC_EVENT_NICK && lin->iType != GC_EVENT_ADDSTATUS && lin->iType != GC_EVENT_REMOVESTATUS))) { CHARRANGE newsel; newsel.cpMax = -1; newsel.cpMin = sel.cpMin; diff --git a/src/core/stdmsg/src/globals.h b/src/core/stdmsg/src/globals.h index 78148da5cd..0c4d9d3205 100644 --- a/src/core/stdmsg/src/globals.h +++ b/src/core/stdmsg/src/globals.h @@ -64,6 +64,8 @@ struct GlobalMessageData CMOption<BYTE> iLoadHistory;
CMOption<WORD> nLoadCount, nLoadTime;
+
+ bool bSmileyInstalled = false, bPopupInstalled = false;
};
void InitGlobals();
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index 1a2d22043b..6d119f616a 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -425,9 +425,21 @@ void CSrmmWindow::StreamInEvents(MEVENT hDbEventFirst, int count, bool bAppend) if (!bottomScroll)
m_log.SendMsg(EM_GETSCROLLPOS, 0, (LPARAM)&scrollPos);
}
+
+ FINDTEXTEXA fi;
if (bAppend) {
sel.cpMin = sel.cpMax = -1;
m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel);
+ fi.chrg.cpMin = 0;
+ }
+ else {
+ GETTEXTLENGTHEX gtxl = { 0 };
+ gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMCHARS;
+ gtxl.codepage = 1200;
+ fi.chrg.cpMin = m_log.SendMsg(EM_GETTEXTLENGTHEX, (WPARAM)>xl, 0);
+
+ sel.cpMin = sel.cpMax = m_log.GetRichTextLength();
+ m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel);
}
mir_strcpy(szSep2, bAppend ? "\\par\\sl0" : "\\sl1000");
@@ -444,6 +456,27 @@ void CSrmmWindow::StreamInEvents(MEVENT hDbEventFirst, int count, bool bAppend) m_log.SendMsg(EM_SETSCROLLPOS, 0, (LPARAM)&scrollPos);
}
+ if (g_dat.bSmileyInstalled) {
+ SMADD_RICHEDIT3 smre;
+ smre.cbSize = sizeof(SMADD_RICHEDIT3);
+ smre.hwndRichEditControl = m_log.GetHwnd();
+
+ MCONTACT hContact = db_mc_getSrmmSub(m_hContact);
+ smre.Protocolname = (hContact != 0) ? GetContactProto(hContact) : m_szProto;
+
+ if (fi.chrg.cpMin > 0) {
+ sel.cpMin = fi.chrg.cpMin;
+ sel.cpMax = -1;
+ smre.rangeToReplace = &sel;
+ }
+ else smre.rangeToReplace = nullptr;
+
+ smre.disableRedraw = TRUE;
+ smre.hContact = m_hContact;
+ smre.flags = 0;
+ CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&smre);
+ }
+
m_log.SendMsg(WM_SETREDRAW, TRUE, 0);
if (bottomScroll)
RedrawWindow(m_log.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW);
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h index c9a59ce866..344b40992a 100644 --- a/src/core/stdmsg/src/stdafx.h +++ b/src/core/stdmsg/src/stdafx.h @@ -119,8 +119,6 @@ struct CMPlugin : public PLUGIN<CMPlugin> extern GlobalLogSettings g_Settings;
extern HMENU g_hMenu;
-extern BOOL SmileyAddInstalled, PopupInstalled;
-
// main.cpp
void LoadIcons(void);
void Unload_ChatModule(void);
|