diff options
Diffstat (limited to 'libs/mTextControl/src/services.cpp')
-rw-r--r-- | libs/mTextControl/src/services.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/libs/mTextControl/src/services.cpp b/libs/mTextControl/src/services.cpp index 35efa5f5f7..3dcb82fd19 100644 --- a/libs/mTextControl/src/services.cpp +++ b/libs/mTextControl/src/services.cpp @@ -20,20 +20,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "stdafx.h" #include "FormattedTextDraw.h" -struct TextObject -{ - uint32_t options = 0; - const char *szProto = nullptr; - CFormattedTextDraw *ftd = nullptr; - - TextObject() {} - - ~TextObject() - { - delete ftd; - } -}; - ///////////////////////////////////////////////////////////////////////////////////////// // Helper functions @@ -74,10 +60,9 @@ DWORD CALLBACK EditStreamOutCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, return 0; } -MTEXTCONTROL_DLL(TextObject *) MTextCreateW(HANDLE userHandle, const char *szProto, const wchar_t *text) +MTEXTCONTROL_DLL(TextObject *) MTextCreateW(HANDLE userHandle, const wchar_t *text) { TextObject *result = new TextObject; - result->szProto = szProto; result->options = TextUserGetOptions(userHandle); result->ftd = new CFormattedTextDraw(); InitRichEdit(result->ftd->getTextService()); @@ -209,6 +194,21 @@ MTEXTCONTROL_DLL(int) MTextSetParent(TextObject *text, HWND hwnd) } ///////////////////////////////////////////////////////////////////////////////////////// +// sets a contact & protocol (optionally, for hContact == 0) for text object (required for valid stickers' processing) + +MTEXTCONTROL_DLL(int) MTextSetProto(TextObject *text, MCONTACT hContact, const char *szProto) +{ + if (!text) return 0; + + if (hContact && szProto == nullptr) + szProto = Proto_GetBaseAccountName(hContact); + + text->hContact = hContact; + text->szProto = szProto; + return TRUE; +} + +///////////////////////////////////////////////////////////////////////////////////////// // send message to an object MTEXTCONTROL_DLL(int) MTextSendMessage(HWND hwnd, TextObject *text, UINT msg, WPARAM wParam, LPARAM lParam) |