Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
tg
Commits
611211cc
Commit
611211cc
authored
May 14, 2015
by
vvaltman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prerelease
parent
081c65ce
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
485 additions
and
432 deletions
+485
-432
CHANGELOG
CHANGELOG
+2
-0
interface.c
interface.c
+462
-411
lua-tg.c
lua-tg.c
+20
-20
tgl
tgl
+1
-1
No files found.
CHANGELOG
View file @
611211cc
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
* output in json format
* output in json format
* support for lua functions in CLI mode (register_interface_function)
* support for lua functions in CLI mode (register_interface_function)
* bugfixes
* bugfixes
* output error codes to socket
* allow [reply=<num>], [disable_preview] and [enable_preview] prefixes to query
1.2.1
1.2.1
* fixed registration/login problem
* fixed registration/login problem
* added extension to downloads
* added extension to downloads
...
...
interface.c
View file @
611211cc
This diff is collapsed.
Click to expand it.
lua-tg.c
View file @
611211cc
...
@@ -849,7 +849,7 @@ void lua_msg_list_cb (struct tgl_state *TLSR, void *cb_extra, int success, int n
...
@@ -849,7 +849,7 @@ void lua_msg_list_cb (struct tgl_state *TLSR, void *cb_extra, int success, int n
free
(
cb
);
free
(
cb
);
}
}
void
lua_file_cb
(
struct
tgl_state
*
TLSR
,
void
*
cb_extra
,
int
success
,
char
*
file_name
)
{
void
lua_file_cb
(
struct
tgl_state
*
TLSR
,
void
*
cb_extra
,
int
success
,
c
onst
c
har
*
file_name
)
{
assert
(
TLSR
==
TLS
);
assert
(
TLSR
==
TLS
);
struct
lua_query_extra
*
cb
=
cb_extra
;
struct
lua_query_extra
*
cb
=
cb_extra
;
lua_settop
(
luaState
,
0
);
lua_settop
(
luaState
,
0
);
...
@@ -977,7 +977,7 @@ void lua_user_cb (struct tgl_state *TLSR, void *cb_extra, int success, struct tg
...
@@ -977,7 +977,7 @@ void lua_user_cb (struct tgl_state *TLSR, void *cb_extra, int success, struct tg
free
(
cb
);
free
(
cb
);
}
}
void
lua_str_cb
(
struct
tgl_state
*
TLSR
,
void
*
cb_extra
,
int
success
,
char
*
data
)
{
void
lua_str_cb
(
struct
tgl_state
*
TLSR
,
void
*
cb_extra
,
int
success
,
c
onst
c
har
*
data
)
{
assert
(
TLSR
==
TLS
);
assert
(
TLSR
==
TLS
);
struct
lua_query_extra
*
cb
=
cb_extra
;
struct
lua_query_extra
*
cb
=
cb_extra
;
lua_settop
(
luaState
,
0
);
lua_settop
(
luaState
,
0
);
...
@@ -1025,7 +1025,7 @@ void lua_do_all (void) {
...
@@ -1025,7 +1025,7 @@ void lua_do_all (void) {
tgl_do_get_dialog_list
(
TLS
,
100
,
0
,
lua_dialog_list_cb
,
lua_ptr
[
p
++
]);
tgl_do_get_dialog_list
(
TLS
,
100
,
0
,
lua_dialog_list_cb
,
lua_ptr
[
p
++
]);
break
;
break
;
case
lq_msg
:
case
lq_msg
:
tgl_do_send_message
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
strlen
(
lua_ptr
[
p
+
2
]),
lua_msg_cb
,
lua_ptr
[
p
]);
tgl_do_send_message
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
strlen
(
lua_ptr
[
p
+
2
]),
0
,
lua_msg_cb
,
lua_ptr
[
p
]);
free
(
lua_ptr
[
p
+
2
]);
free
(
lua_ptr
[
p
+
2
]);
p
+=
3
;
p
+=
3
;
break
;
break
;
...
@@ -1038,37 +1038,37 @@ void lua_do_all (void) {
...
@@ -1038,37 +1038,37 @@ void lua_do_all (void) {
p
+=
2
;
p
+=
2
;
break
;
break
;
case
lq_rename_chat
:
case
lq_rename_chat
:
tgl_do_rename_chat
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
lua_empty_cb
,
lua_ptr
[
p
]);
tgl_do_rename_chat
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
strlen
(
lua_ptr
[
p
+
2
]),
lua_empty_cb
,
lua_ptr
[
p
]);
free
(
lua_ptr
[
p
+
2
]);
free
(
lua_ptr
[
p
+
2
]);
p
+=
3
;
p
+=
3
;
break
;
break
;
case
lq_send_photo
:
case
lq_send_photo
:
tgl_do_send_document
(
TLS
,
-
1
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
0
,
NULL
,
lua_msg_cb
,
lua_ptr
[
p
]);
tgl_do_send_document
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
NULL
,
0
,
TGL_SEND_MSG_FLAG_DOCUMENT_PHOTO
,
lua_msg_cb
,
lua_ptr
[
p
]);
free
(
lua_ptr
[
p
+
2
]);
free
(
lua_ptr
[
p
+
2
]);
p
+=
3
;
p
+=
3
;
break
;
break
;
case
lq_send_video
:
case
lq_send_video
:
tgl_do_send_document
(
TLS
,
FLAG_DOCUMENT_VIDEO
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
0
,
NULL
,
lua_msg_cb
,
lua_ptr
[
p
]);
tgl_do_send_document
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
NULL
,
0
,
TGL_SEND_MSG_FLAG_DOCUMENT_VIDEO
,
lua_msg_cb
,
lua_ptr
[
p
]);
free
(
lua_ptr
[
p
+
2
]);
free
(
lua_ptr
[
p
+
2
]);
p
+=
3
;
p
+=
3
;
break
;
break
;
case
lq_send_audio
:
case
lq_send_audio
:
tgl_do_send_document
(
TLS
,
FLAG_DOCUMENT_AUDIO
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
0
,
NULL
,
lua_msg_cb
,
lua_ptr
[
p
]);
tgl_do_send_document
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
NULL
,
0
,
TGL_SEND_MSG_FLAG_DOCUMENT_AUDIO
,
lua_msg_cb
,
lua_ptr
[
p
]);
free
(
lua_ptr
[
p
+
2
]);
free
(
lua_ptr
[
p
+
2
]);
p
+=
3
;
p
+=
3
;
break
;
break
;
case
lq_send_document
:
case
lq_send_document
:
tgl_do_send_document
(
TLS
,
0
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
0
,
NULL
,
lua_msg_cb
,
lua_ptr
[
p
]);
tgl_do_send_document
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
NULL
,
0
,
0
,
lua_msg_cb
,
lua_ptr
[
p
]);
free
(
lua_ptr
[
p
+
2
]);
free
(
lua_ptr
[
p
+
2
]);
p
+=
3
;
p
+=
3
;
break
;
break
;
case
lq_send_file
:
case
lq_send_file
:
tgl_do_send_document
(
TLS
,
-
2
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
0
,
NULL
,
lua_msg_cb
,
lua_ptr
[
p
]);
tgl_do_send_document
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
NULL
,
0
,
TGL_SEND_MSG_FLAG_DOCUMENT_AUTO
,
lua_msg_cb
,
lua_ptr
[
p
]);
free
(
lua_ptr
[
p
+
2
]);
free
(
lua_ptr
[
p
+
2
]);
p
+=
3
;
p
+=
3
;
break
;
break
;
case
lq_send_text
:
case
lq_send_text
:
tgl_do_send_text
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
lua_msg_cb
,
lua_ptr
[
p
]);
tgl_do_send_text
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
0
,
lua_msg_cb
,
lua_ptr
[
p
]);
free
(
lua_ptr
[
p
+
2
]);
free
(
lua_ptr
[
p
+
2
]);
p
+=
3
;
p
+=
3
;
break
;
break
;
...
@@ -1108,11 +1108,11 @@ void lua_do_all (void) {
...
@@ -1108,11 +1108,11 @@ void lua_do_all (void) {
p
+=
2
;
p
+=
2
;
break
;
break
;
case
lq_fwd
:
case
lq_fwd
:
tgl_do_forward_message
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
((
struct
tgl_message
*
)
lua_ptr
[
p
+
2
])
->
id
,
lua_msg_cb
,
lua_ptr
[
p
]);
tgl_do_forward_message
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
((
struct
tgl_message
*
)
lua_ptr
[
p
+
2
])
->
id
,
0
,
lua_msg_cb
,
lua_ptr
[
p
]);
p
+=
3
;
p
+=
3
;
break
;
break
;
case
lq_fwd_media
:
case
lq_fwd_media
:
tgl_do_forward_media
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
((
struct
tgl_message
*
)
lua_ptr
[
p
+
2
])
->
id
,
lua_msg_cb
,
lua_ptr
[
p
]);
tgl_do_forward_media
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
((
struct
tgl_message
*
)
lua_ptr
[
p
+
2
])
->
id
,
0
,
lua_msg_cb
,
lua_ptr
[
p
]);
p
+=
3
;
p
+=
3
;
break
;
break
;
case
lq_chat_info
:
case
lq_chat_info
:
...
@@ -1124,7 +1124,7 @@ void lua_do_all (void) {
...
@@ -1124,7 +1124,7 @@ void lua_do_all (void) {
p
+=
2
;
p
+=
2
;
break
;
break
;
case
lq_history
:
case
lq_history
:
tgl_do_get_history
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
(
long
)
lua_ptr
[
p
+
2
],
0
,
lua_msg_list_cb
,
lua_ptr
[
p
]);
tgl_do_get_history
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
0
,
(
long
)
lua_ptr
[
p
+
2
],
0
,
lua_msg_list_cb
,
lua_ptr
[
p
]);
p
+=
3
;
p
+=
3
;
break
;
break
;
case
lq_chat_add_user
:
case
lq_chat_add_user
:
...
@@ -1161,13 +1161,13 @@ void lua_do_all (void) {
...
@@ -1161,13 +1161,13 @@ void lua_do_all (void) {
break
;
break
;
case
lq_search
:
case
lq_search
:
s
=
lua_ptr
[
p
+
2
];
s
=
lua_ptr
[
p
+
2
];
tgl_do_msg_search
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
0
,
0
,
40
,
0
,
s
,
lua_msg_list_cb
,
lua_ptr
[
p
]);
tgl_do_msg_search
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
0
,
0
,
40
,
0
,
s
,
strlen
(
s
),
lua_msg_list_cb
,
lua_ptr
[
p
]);
free
(
s
);
free
(
s
);
p
+=
3
;
p
+=
3
;
break
;
break
;
case
lq_global_search
:
case
lq_global_search
:
s
=
lua_ptr
[
p
+
1
];
s
=
lua_ptr
[
p
+
1
];
tgl_do_msg_search
(
TLS
,
tgl_set_peer_id
(
TGL_PEER_UNKNOWN
,
0
),
0
,
0
,
40
,
0
,
s
,
lua_msg_list_cb
,
lua_ptr
[
p
]);
tgl_do_msg_search
(
TLS
,
tgl_set_peer_id
(
TGL_PEER_UNKNOWN
,
0
),
0
,
0
,
40
,
0
,
s
,
strlen
(
s
),
lua_msg_list_cb
,
lua_ptr
[
p
]);
free
(
s
);
free
(
s
);
p
+=
2
;
p
+=
2
;
break
;
break
;
...
@@ -1184,7 +1184,7 @@ void lua_do_all (void) {
...
@@ -1184,7 +1184,7 @@ void lua_do_all (void) {
case
lq_set_profile_name
:
case
lq_set_profile_name
:
s1
=
lua_ptr
[
p
+
1
];
s1
=
lua_ptr
[
p
+
1
];
s2
=
lua_ptr
[
p
+
1
];
s2
=
lua_ptr
[
p
+
1
];
tgl_do_set_profile_name
(
TLS
,
s1
,
s
2
,
lua_user_cb
,
lua_ptr
[
p
]);
tgl_do_set_profile_name
(
TLS
,
s1
,
s
trlen
(
s1
),
s2
,
strlen
(
s2
)
,
lua_user_cb
,
lua_ptr
[
p
]);
free
(
s1
);
free
(
s1
);
free
(
s2
);
free
(
s2
);
p
+=
3
;
p
+=
3
;
...
@@ -1195,7 +1195,7 @@ void lua_do_all (void) {
...
@@ -1195,7 +1195,7 @@ void lua_do_all (void) {
break
;
break
;
case
lq_create_group_chat
:
case
lq_create_group_chat
:
s
=
lua_ptr
[
p
+
2
];
s
=
lua_ptr
[
p
+
2
];
tgl_do_create_group_chat
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
s
,
lua_empty_cb
,
lua_ptr
[
p
]);
tgl_do_create_group_chat
(
TLS
,
1
,
&
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
s
,
strlen
(
s
)
,
lua_empty_cb
,
lua_ptr
[
p
]);
free
(
s
);
free
(
s
);
p
+=
3
;
p
+=
3
;
break
;
break
;
...
@@ -1215,7 +1215,7 @@ void lua_do_all (void) {
...
@@ -1215,7 +1215,7 @@ void lua_do_all (void) {
s1
=
lua_ptr
[
p
+
2
];
s1
=
lua_ptr
[
p
+
2
];
s2
=
lua_ptr
[
p
+
3
];
s2
=
lua_ptr
[
p
+
3
];
s3
=
lua_ptr
[
p
+
4
];
s3
=
lua_ptr
[
p
+
4
];
tgl_do_send_contact
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
s1
,
strlen
(
s1
),
s2
,
strlen
(
s2
),
s3
,
strlen
(
s3
),
lua_msg_cb
,
lua_ptr
[
p
]);
tgl_do_send_contact
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
s1
,
strlen
(
s1
),
s2
,
strlen
(
s2
),
s3
,
strlen
(
s3
),
0
,
lua_msg_cb
,
lua_ptr
[
p
]);
free
(
s1
);
free
(
s1
);
free
(
s2
);
free
(
s2
);
free
(
s3
);
free
(
s3
);
...
@@ -1237,9 +1237,9 @@ void lua_do_all (void) {
...
@@ -1237,9 +1237,9 @@ void lua_do_all (void) {
break
;
break
;
case
lq_send_location
:
case
lq_send_location
:
if
(
sizeof
(
void
*
)
==
4
)
{
if
(
sizeof
(
void
*
)
==
4
)
{
tgl_do_send_location
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
*
(
float
*
)(
lua_ptr
+
p
+
2
),
*
(
float
*
)(
lua_ptr
+
p
+
3
),
lua_msg_cb
,
lua_ptr
[
p
]);
tgl_do_send_location
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
*
(
float
*
)(
lua_ptr
+
p
+
2
),
*
(
float
*
)(
lua_ptr
+
p
+
3
),
0
,
lua_msg_cb
,
lua_ptr
[
p
]);
}
else
{
}
else
{
tgl_do_send_location
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
*
(
double
*
)(
lua_ptr
+
p
+
2
),
*
(
double
*
)(
lua_ptr
+
p
+
3
),
lua_msg_cb
,
lua_ptr
[
p
]);
tgl_do_send_location
(
TLS
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
*
(
double
*
)(
lua_ptr
+
p
+
2
),
*
(
double
*
)(
lua_ptr
+
p
+
3
),
0
,
lua_msg_cb
,
lua_ptr
[
p
]);
}
}
p
+=
4
;
p
+=
4
;
break
;
break
;
...
...
tgl
@
b3dcce35
Subproject commit
d3680da8636f4fdd58c91bb352f1bc9ceccd8961
Subproject commit
b3dcce35110f5c995366318c2886065287815d09
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment