summaryrefslogtreecommitdiff
path: root/protocols/Telegram/docs/tgl/event-old.h
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2016-03-12 17:48:57 +0000
committerKirill Volinsky <mataes2007@gmail.com>2016-03-12 17:48:57 +0000
commit534db770dbe8c358ea267df20145e9793fb0275a (patch)
tree66989fb4e5511b4efe5652cf5312ac4f160bfd01 /protocols/Telegram/docs/tgl/event-old.h
parent461f53bf697335fabdc82c6c9143e6020de4f022 (diff)
tgl inside telegram
git-svn-id: http://svn.miranda-ng.org/main/trunk@16471 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Telegram/docs/tgl/event-old.h')
-rw-r--r--protocols/Telegram/docs/tgl/event-old.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/protocols/Telegram/docs/tgl/event-old.h b/protocols/Telegram/docs/tgl/event-old.h
new file mode 100644
index 0000000000..b920e68f02
--- /dev/null
+++ b/protocols/Telegram/docs/tgl/event-old.h
@@ -0,0 +1,48 @@
+#ifndef __EVENT_OLD_H__
+#define __EVENT_OLD_H__
+
+#include <assert.h>
+#include <stdlib.h>
+
+#define BEV_EVENT_READ EVBUFFER_READ
+#define BEV_EVENT_WRITE EVBUFFER_WRITE
+#define BEV_EVENT_EOF EVBUFFER_EOF
+#define BEV_EVENT_ERROR EVBUFFER_ERROR
+#define BEV_EVENT_TIMEOUT EVBUFFER_TIMEOUT
+
+typedef int evutil_socket_t;
+
+static inline struct event *event_new (struct event_base *base, int fd, int what, void(*callback)(int, short, void *), void *arg) __attribute__ ((unused));
+static inline struct event *event_new (struct event_base *base, int fd, int what, void(*callback)(int, short, void *), void *arg) {
+ struct event *ev = malloc (sizeof (*ev));
+ event_set (ev, fd, what, callback, arg);
+ event_base_set (base, ev);
+ return ev;
+}
+
+static inline struct event *evtimer_new (struct event_base *base, void(*callback)(int, short, void *), void *arg) __attribute__ ((unused));
+static inline struct event *evtimer_new (struct event_base *base, void(*callback)(int, short, void *), void *arg) {
+ struct event *ev = malloc (sizeof (*ev));
+ event_set (ev, -1, 0, callback, arg);
+ event_base_set (base, ev);
+ return ev;
+}
+
+static void event_free (struct event *ev) __attribute__ ((unused));
+static void event_free (struct event *ev) {
+ event_del (ev);
+ free (ev);
+}
+
+static struct bufferevent *bufferevent_socket_new (struct event_base *base, int fd, int flags) __attribute__ ((unused));
+static struct bufferevent *bufferevent_socket_new (struct event_base *base, int fd, int flags) {
+ assert (!flags);
+ struct bufferevent *bev = bufferevent_new(fd, 0, 0, 0, 0);
+ bufferevent_base_set (base, bev);
+ return bev;
+}
+
+static inline void *event_get_callback_arg(const struct event *ev) {
+ return ev->ev_arg;
+}
+#endif