summaryrefslogtreecommitdiff
path: root/protocols/Telegram/src/utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Telegram/src/utils.cpp')
-rw-r--r--protocols/Telegram/src/utils.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/protocols/Telegram/src/utils.cpp b/protocols/Telegram/src/utils.cpp
index baf10e031d..3ea60b4c19 100644
--- a/protocols/Telegram/src/utils.cpp
+++ b/protocols/Telegram/src/utils.cpp
@@ -111,3 +111,16 @@ void CMTProto::Popup(MCONTACT hContact, const wchar_t *szMsg, const wchar_t *szT
ppd.hContact = hContact;
Popup_AddClass(&ppd);
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+CMStringA getMessageText(TD::MessageContent *pBody)
+{
+ if (pBody->get_id() == TD::messageText::ID) {
+ auto pText = ((TD::messageText *)pBody)->text_.get();
+ if (pText->get_id() == TD::formattedText::ID)
+ return CMStringA(((TD::formattedText *)pText)->text_.c_str());
+ }
+
+ return CMStringA();
+}