summaryrefslogtreecommitdiff
path: root/protocols/Telegram/src/t_callback.cpp
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2016-03-24 10:22:48 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2016-03-24 10:22:48 +0000
commit1cba3f74c9607b7b03c85f23969cbdd4163b52d5 (patch)
treef7f505863d8a1ff0354111b2efb6fe76c187906f /protocols/Telegram/src/t_callback.cpp
parent5f3997157e81d4910bcc4659bee7124a9c744d2f (diff)
Telegram: attempt to implement login
git-svn-id: http://svn.miranda-ng.org/main/trunk@16534 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Telegram/src/t_callback.cpp')
-rw-r--r--protocols/Telegram/src/t_callback.cpp36
1 files changed, 35 insertions, 1 deletions
diff --git a/protocols/Telegram/src/t_callback.cpp b/protocols/Telegram/src/t_callback.cpp
index 97d7eb0d1a..9045ab2716 100644
--- a/protocols/Telegram/src/t_callback.cpp
+++ b/protocols/Telegram/src/t_callback.cpp
@@ -5,11 +5,39 @@ static void update_message_handler(tgl_state *TLS, tgl_message *msg)
((MirTLS*)TLS)->m_proto->OnMessage(msg);
}
+static void user_typing(tgl_state *TLS, tgl_user *U, enum tgl_typing_status status)
+{
+ ((MirTLS*)TLS)->m_proto->OnUserTyping(U, status);
+}
+
+static void on_login_success(tgl_state *TLS)
+{
+
+}
+
+static void on_login_failed(tgl_state *TLS)
+{
+
+}
+
+static void on_ready(tgl_state *TLS)
+{
+
+}
+
+void request_value(struct tgl_state *TLS, enum tgl_value_type type, const char *prompt, int num_values,
+ void(*callback) (struct tgl_state *TLS, const char *string[], void *arg), void *arg)
+{
+ char *result = nullptr;
+ ((MirTLS*)TLS)->m_proto->TGLGetValue(type, prompt, num_values, &result);
+ callback(TLS, (const char**)&result, arg);
+}
+
static void logprintf(const char *fmt, ...)
{
CMStringA str("[Telegram]: ");
va_list args;
- va_start(fmt, args);
+ va_start(args, fmt);
str.AppendFormatV(fmt, args);
va_end(args);
CallService(MS_NETLIB_LOG, 0, (LPARAM)str.GetString());
@@ -21,6 +49,12 @@ void CTelegramProto::InitCallbacks()
cb.new_msg = update_message_handler;
cb.msg_receive = update_message_handler;
cb.logprintf = logprintf;
+ cb.type_notification = user_typing;
+ cb.logged_in = on_login_success;
+ cb.started = on_ready;
+ cb.get_values = request_value;
+
+
tgl_set_callback(TLS, &cb);