summaryrefslogtreecommitdiff
path: root/protocols/Telegram/src/t_callback.cpp
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2016-03-23 15:50:14 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2016-03-23 15:50:14 +0000
commit0b60fcc5772e91c80c52527ab6554ed25a05bab0 (patch)
tree5e93c63fce34c4b6e90559e7062da6313760af4c /protocols/Telegram/src/t_callback.cpp
parentc49db60246165780c37b86ba8a084d31c5cc5446 (diff)
Telegram: more initial code
git-svn-id: http://svn.miranda-ng.org/main/trunk@16528 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Telegram/src/t_callback.cpp')
-rw-r--r--protocols/Telegram/src/t_callback.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/protocols/Telegram/src/t_callback.cpp b/protocols/Telegram/src/t_callback.cpp
new file mode 100644
index 0000000000..97d7eb0d1a
--- /dev/null
+++ b/protocols/Telegram/src/t_callback.cpp
@@ -0,0 +1,27 @@
+#include "stdafx.h"
+
+static void update_message_handler(tgl_state *TLS, tgl_message *msg)
+{
+ ((MirTLS*)TLS)->m_proto->OnMessage(msg);
+}
+
+static void logprintf(const char *fmt, ...)
+{
+ CMStringA str("[Telegram]: ");
+ va_list args;
+ va_start(fmt, args);
+ str.AppendFormatV(fmt, args);
+ va_end(args);
+ CallService(MS_NETLIB_LOG, 0, (LPARAM)str.GetString());
+}
+
+void CTelegramProto::InitCallbacks()
+{
+ tgl_update_callback cb = { 0 };
+ cb.new_msg = update_message_handler;
+ cb.msg_receive = update_message_handler;
+ cb.logprintf = logprintf;
+
+ tgl_set_callback(TLS, &cb);
+
+} \ No newline at end of file