summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-12-20 16:51:59 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-12-20 16:51:59 +0300
commit72fc3f5206fc56f1a573d6a284be413411679c57 (patch)
treef24cba22844714c423931157d8045f839f736c00
parentd80970d9b26b5e9b7868ec61349490da5e24dc64 (diff)
Telegram: stickers are back
-rw-r--r--libs/mTextControl/src/services.cpp27
-rw-r--r--plugins/NewStory/src/history_array.cpp2
2 files changed, 16 insertions, 13 deletions
diff --git a/libs/mTextControl/src/services.cpp b/libs/mTextControl/src/services.cpp
index 3dcb82fd19..040fa973c3 100644
--- a/libs/mTextControl/src/services.cpp
+++ b/libs/mTextControl/src/services.cpp
@@ -34,19 +34,6 @@ void MText_InitFormatting1(TextObject *text)
{
// bbcodes
bbCodeParse(text->ftd);
-
- // smilies
- HWND hwnd = CreateProxyWindow();
- SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)text->ftd->getTextService());
-
- SMADD_RICHEDIT sm = {};
- sm.hwndRichEditControl = hwnd;
- sm.rangeToReplace = nullptr;
- sm.Protocolname = text->szProto;
- sm.flags = SAFLRE_INSERTEMF;
- CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&sm);
-
- SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -205,6 +192,20 @@ MTEXTCONTROL_DLL(int) MTextSetProto(TextObject *text, MCONTACT hContact, const c
text->hContact = hContact;
text->szProto = szProto;
+
+ // smilies
+ HWND hwnd = CreateProxyWindow();
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)text->ftd->getTextService());
+
+ SMADD_RICHEDIT sm = {};
+ sm.hwndRichEditControl = hwnd;
+ sm.rangeToReplace = nullptr;
+ sm.hContact = text->hContact;
+ sm.Protocolname = text->szProto;
+ sm.flags = SAFLRE_INSERTEMF;
+ CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&sm);
+
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
return TRUE;
}
diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp
index b17a4a9093..cc7c5b0900 100644
--- a/plugins/NewStory/src/history_array.cpp
+++ b/plugins/NewStory/src/history_array.cpp
@@ -479,12 +479,14 @@ void ItemData::markRead()
void ItemData::setText()
{
data = MTextCreateEx(htuLog, formatRtf().GetBuffer(), MTEXT_FLG_RTF);
+ MTextSetProto(data, hContact);
savedHeight = -1;
}
void ItemData::setTextAndHwnd(HWND hwnd)
{
data = MTextCreateEx2(hwnd, htuLog, formatRtf().GetBuffer(), MTEXT_FLG_RTF);
+ MTextSetProto(data, hContact);
savedHeight = -1;
}