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
41185472
Commit
41185472
authored
Jan 12, 2015
by
vvaltman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated to latest version of tgl
parent
46308629
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
322 additions
and
462 deletions
+322
-462
CHANGELOG
CHANGELOG
+2
-0
interface.c
interface.c
+157
-67
interface.h
interface.h
+1
-1
loop.c
loop.c
+133
-332
loop.h
loop.h
+1
-2
lua-tg.c
lua-tg.c
+20
-55
lua-tg.h
lua-tg.h
+1
-1
main.c
main.c
+3
-2
telegram.h
telegram.h
+3
-1
tgl
tgl
+1
-1
No files found.
CHANGELOG
View file @
41185472
1.2.0
* layer 22 support
1.0.6
1.0.6
* layer 18 support
* layer 18 support
1.0.5
1.0.5
...
...
interface.c
View file @
41185472
This diff is collapsed.
Click to expand it.
interface.h
View file @
41185472
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License
along with this telegram-cli. If not, see <http://www.gnu.org/licenses/>.
along with this telegram-cli. If not, see <http://www.gnu.org/licenses/>.
Copyright Vitaly Valtman 2013-201
4
Copyright Vitaly Valtman 2013-201
5
*/
*/
#ifndef __INTERFACE_H__
#ifndef __INTERFACE_H__
#define __INTERFACE_H__
#define __INTERFACE_H__
...
...
loop.c
View file @
41185472
This diff is collapsed.
Click to expand it.
loop.h
View file @
41185472
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License
along with this telegram-cli. If not, see <http://www.gnu.org/licenses/>.
along with this telegram-cli. If not, see <http://www.gnu.org/licenses/>.
Copyright Vitaly Valtman 2013-201
4
Copyright Vitaly Valtman 2013-201
5
*/
*/
#ifndef __LOOP_H__
#ifndef __LOOP_H__
#define __LOOP_H__
#define __LOOP_H__
...
@@ -23,7 +23,6 @@
...
@@ -23,7 +23,6 @@
int
loop
(
void
);
int
loop
(
void
);
void
do_halt
(
int
error
);
void
do_halt
(
int
error
);
void
net_loop
(
int
flags
,
int
(
*
end
)(
void
));
void
write_auth_file
(
void
);
void
write_auth_file
(
void
);
void
write_state_file
(
void
);
void
write_state_file
(
void
);
void
write_secret_chat_file
(
void
);
void
write_secret_chat_file
(
void
);
...
...
lua-tg.c
View file @
41185472
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License
along with this telegram-cli. If not, see <http://www.gnu.org/licenses/>.
along with this telegram-cli. If not, see <http://www.gnu.org/licenses/>.
Copyright Vitaly Valtman 2013-201
4
Copyright Vitaly Valtman 2013-201
5
*/
*/
#ifdef HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
...
@@ -248,7 +248,7 @@ void push_media (struct tgl_message_media *M) {
...
@@ -248,7 +248,7 @@ void push_media (struct tgl_message_media *M) {
lua_newtable
(
luaState
);
lua_newtable
(
luaState
);
lua_add_string_field
(
"type"
,
"photo"
);
lua_add_string_field
(
"type"
,
"photo"
);
break
;
break
;
case
tgl_message_media_video
:
/*
case tgl_message_media_video:
case tgl_message_media_video_encr:
case tgl_message_media_video_encr:
lua_newtable (luaState);
lua_newtable (luaState);
lua_add_string_field ("type", "video");
lua_add_string_field ("type", "video");
...
@@ -257,7 +257,7 @@ void push_media (struct tgl_message_media *M) {
...
@@ -257,7 +257,7 @@ void push_media (struct tgl_message_media *M) {
case tgl_message_media_audio_encr:
case tgl_message_media_audio_encr:
lua_newtable (luaState);
lua_newtable (luaState);
lua_add_string_field ("type", "audio");
lua_add_string_field ("type", "audio");
break
;
break;
*/
case
tgl_message_media_document
:
case
tgl_message_media_document
:
case
tgl_message_media_document_encr
:
case
tgl_message_media_document_encr
:
lua_newtable
(
luaState
);
lua_newtable
(
luaState
);
...
@@ -491,6 +491,7 @@ enum lua_query_type {
...
@@ -491,6 +491,7 @@ enum lua_query_type {
lq_create_group_chat
,
lq_create_group_chat
,
lq_send_audio
,
lq_send_audio
,
lq_send_document
,
lq_send_document
,
lq_send_file
,
lq_load_audio
,
lq_load_audio
,
lq_load_document
,
lq_load_document
,
lq_load_document_thumb
,
lq_load_document_thumb
,
...
@@ -883,22 +884,27 @@ void lua_do_all (void) {
...
@@ -883,22 +884,27 @@ void lua_do_all (void) {
p
+=
3
;
p
+=
3
;
break
;
break
;
case
lq_send_photo
:
case
lq_send_photo
:
tgl_do_send_
photo
(
TLS
,
tgl_message_media_photo
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
lua_msg_cb
,
lua_ptr
[
p
]);
tgl_do_send_
document
(
TLS
,
-
1
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
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_
photo
(
TLS
,
tgl_message_media_video
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
lua_msg_cb
,
lua_ptr
[
p
]);
tgl_do_send_
document
(
TLS
,
FLAG_DOCUMENT_VIDEO
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
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_
photo
(
TLS
,
tgl_message_media_audio
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
lua_msg_cb
,
lua_ptr
[
p
]);
tgl_do_send_
document
(
TLS
,
FLAG_DOCUMENT_AUDIO
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
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_photo
(
TLS
,
tgl_message_media_document
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
lua_msg_cb
,
lua_ptr
[
p
]);
tgl_do_send_document
(
TLS
,
0
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
lua_msg_cb
,
lua_ptr
[
p
]);
free
(
lua_ptr
[
p
+
2
]);
p
+=
3
;
break
;
case
lq_send_file
:
tgl_do_send_document
(
TLS
,
-
2
,
((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_ptr
[
p
+
2
],
lua_msg_cb
,
lua_ptr
[
p
]);
free
(
lua_ptr
[
p
+
2
]);
free
(
lua_ptr
[
p
+
2
]);
p
+=
3
;
p
+=
3
;
break
;
break
;
...
@@ -913,66 +919,24 @@ void lua_do_all (void) {
...
@@ -913,66 +919,24 @@ void lua_do_all (void) {
p
+=
3
;
p
+=
3
;
break
;
break
;
case
lq_load_photo
:
case
lq_load_photo
:
M
=
lua_ptr
[
p
+
1
];
if
(
!
M
||
(
M
->
media
.
type
!=
tgl_message_media_photo
&&
M
->
media
.
type
!=
tgl_message_media_photo_encr
))
{
lua_file_cb
(
TLS
,
lua_ptr
[
p
],
0
,
0
);
}
else
{
if
(
M
->
media
.
type
==
tgl_message_media_photo
)
{
tgl_do_load_photo
(
TLS
,
&
M
->
media
.
photo
,
lua_file_cb
,
lua_ptr
[
p
]);
}
else
{
tgl_do_load_encr_video
(
TLS
,
&
M
->
media
.
encr_video
,
lua_file_cb
,
lua_ptr
[
p
]);
}
}
p
+=
2
;
break
;
case
lq_load_video
:
case
lq_load_video
:
M
=
lua_ptr
[
p
+
1
];
if
(
!
M
||
(
M
->
media
.
type
!=
tgl_message_media_video
&&
M
->
media
.
type
!=
tgl_message_media_video_encr
))
{
lua_file_cb
(
TLS
,
lua_ptr
[
p
],
0
,
0
);
}
else
{
if
(
M
->
media
.
type
==
tgl_message_media_video
)
{
tgl_do_load_video
(
TLS
,
&
M
->
media
.
video
,
lua_file_cb
,
lua_ptr
[
p
]);
}
else
{
tgl_do_load_encr_video
(
TLS
,
&
M
->
media
.
encr_video
,
lua_file_cb
,
lua_ptr
[
p
]);
}
}
p
+=
2
;
break
;
case
lq_load_video_thumb
:
M
=
lua_ptr
[
p
+
1
];
if
(
!
M
||
(
M
->
media
.
type
!=
tgl_message_media_video
))
{
lua_file_cb
(
TLS
,
lua_ptr
[
p
],
0
,
0
);
}
else
{
tgl_do_load_video_thumb
(
TLS
,
&
M
->
media
.
video
,
lua_file_cb
,
lua_ptr
[
p
]);
}
p
+=
2
;
break
;
case
lq_load_audio
:
case
lq_load_audio
:
M
=
lua_ptr
[
p
+
1
];
if
(
!
M
||
(
M
->
media
.
type
!=
tgl_message_media_audio
&&
M
->
media
.
type
!=
tgl_message_media_audio_encr
))
{
lua_file_cb
(
TLS
,
lua_ptr
[
p
],
0
,
0
);
}
else
{
if
(
M
->
media
.
type
==
tgl_message_media_audio
)
{
tgl_do_load_audio
(
TLS
,
&
M
->
media
.
audio
,
lua_file_cb
,
lua_ptr
[
p
]);
}
else
{
tgl_do_load_encr_video
(
TLS
,
&
M
->
media
.
encr_video
,
lua_file_cb
,
lua_ptr
[
p
]);
}
}
p
+=
2
;
break
;
case
lq_load_document
:
case
lq_load_document
:
M
=
lua_ptr
[
p
+
1
];
M
=
lua_ptr
[
p
+
1
];
if
(
!
M
||
(
M
->
media
.
type
!=
tgl_message_media_document
&&
M
->
media
.
type
!=
tgl_message_media_document_encr
))
{
if
(
!
M
||
(
M
->
media
.
type
!=
tgl_message_media_
photo
&&
M
->
media
.
type
!=
tgl_message_media_photo_encr
&&
M
->
media
.
type
!=
tgl_message_media_
document
&&
M
->
media
.
type
!=
tgl_message_media_document_encr
))
{
lua_file_cb
(
TLS
,
lua_ptr
[
p
],
0
,
0
);
lua_file_cb
(
TLS
,
lua_ptr
[
p
],
0
,
0
);
}
else
{
}
else
{
if
(
M
->
media
.
type
==
tgl_message_media_document
)
{
if
(
M
->
media
.
type
==
tgl_message_media_photo
)
{
tgl_do_load_photo
(
TLS
,
&
M
->
media
.
photo
,
lua_file_cb
,
lua_ptr
[
p
]);
}
else
if
(
M
->
media
.
type
==
tgl_message_media_document
)
{
tgl_do_load_document
(
TLS
,
&
M
->
media
.
document
,
lua_file_cb
,
lua_ptr
[
p
]);
tgl_do_load_document
(
TLS
,
&
M
->
media
.
document
,
lua_file_cb
,
lua_ptr
[
p
]);
}
else
{
}
else
{
tgl_do_load_encr_
video
(
TLS
,
&
M
->
media
.
encr_video
,
lua_file_cb
,
lua_ptr
[
p
]);
tgl_do_load_encr_
document
(
TLS
,
&
M
->
media
.
encr_document
,
lua_file_cb
,
lua_ptr
[
p
]);
}
}
}
}
p
+=
2
;
p
+=
2
;
break
;
break
;
case
lq_load_video_thumb
:
case
lq_load_document_thumb
:
case
lq_load_document_thumb
:
M
=
lua_ptr
[
p
+
1
];
M
=
lua_ptr
[
p
+
1
];
if
(
!
M
||
(
M
->
media
.
type
!=
tgl_message_media_document
))
{
if
(
!
M
||
(
M
->
media
.
type
!=
tgl_message_media_document
))
{
...
@@ -1171,6 +1135,7 @@ struct lua_function functions[] = {
...
@@ -1171,6 +1135,7 @@ struct lua_function functions[] = {
{
"send_video"
,
lq_send_video
,
{
lfp_peer
,
lfp_string
,
lfp_none
}},
{
"send_video"
,
lq_send_video
,
{
lfp_peer
,
lfp_string
,
lfp_none
}},
{
"send_audio"
,
lq_send_audio
,
{
lfp_peer
,
lfp_string
,
lfp_none
}},
{
"send_audio"
,
lq_send_audio
,
{
lfp_peer
,
lfp_string
,
lfp_none
}},
{
"send_document"
,
lq_send_document
,
{
lfp_peer
,
lfp_string
,
lfp_none
}},
{
"send_document"
,
lq_send_document
,
{
lfp_peer
,
lfp_string
,
lfp_none
}},
{
"send_file"
,
lq_send_file
,
{
lfp_peer
,
lfp_string
,
lfp_none
}},
{
"send_text"
,
lq_send_text
,
{
lfp_peer
,
lfp_string
,
lfp_none
}},
{
"send_text"
,
lq_send_text
,
{
lfp_peer
,
lfp_string
,
lfp_none
}},
{
"chat_set_photo"
,
lq_chat_set_photo
,
{
lfp_chat
,
lfp_string
,
lfp_none
}},
{
"chat_set_photo"
,
lq_chat_set_photo
,
{
lfp_chat
,
lfp_string
,
lfp_none
}},
{
"load_photo"
,
lq_load_photo
,
{
lfp_msg
,
lfp_none
}},
{
"load_photo"
,
lq_load_photo
,
{
lfp_msg
,
lfp_none
}},
...
...
lua-tg.h
View file @
41185472
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License
along with this telegram-cli. If not, see <http://www.gnu.org/licenses/>.
along with this telegram-cli. If not, see <http://www.gnu.org/licenses/>.
Copyright Vitaly Valtman 2013-201
4
Copyright Vitaly Valtman 2013-201
5
*/
*/
#ifndef __LUA_TG_H__
#ifndef __LUA_TG_H__
#define __LUA_TG_H__
#define __LUA_TG_H__
...
...
main.c
View file @
41185472
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License
along with this telegram-cli. If not, see <http://www.gnu.org/licenses/>.
along with this telegram-cli. If not, see <http://www.gnu.org/licenses/>.
Copyright Vitaly Valtman 2013-201
4
Copyright Vitaly Valtman 2013-201
5
*/
*/
#ifdef HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
...
@@ -839,10 +839,11 @@ int main (int argc, char **argv) {
...
@@ -839,10 +839,11 @@ int main (int argc, char **argv) {
if
(
!
disable_output
)
{
if
(
!
disable_output
)
{
printf
(
printf
(
"Telegram-cli version "
T
GL_VERSION
", Copyright (C) 2013-2014
Vitaly Valtman
\n
"
"Telegram-cli version "
T
ELEGRAM_CLI_VERSION
", Copyright (C) 2013-2015
Vitaly Valtman
\n
"
"Telegram-cli comes with ABSOLUTELY NO WARRANTY; for details type `show_license'.
\n
"
"Telegram-cli comes with ABSOLUTELY NO WARRANTY; for details type `show_license'.
\n
"
"This is free software, and you are welcome to redistribute it
\n
"
"This is free software, and you are welcome to redistribute it
\n
"
"under certain conditions; type `show_license' for details.
\n
"
"under certain conditions; type `show_license' for details.
\n
"
"Telegram-cli uses libtgl version "
TGL_VERSION
"
\n
"
);
);
}
}
running_for_first_time
();
running_for_first_time
();
...
...
telegram.h
View file @
41185472
...
@@ -14,9 +14,11 @@
...
@@ -14,9 +14,11 @@
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License
along with this telegram-cli. If not, see <http://www.gnu.org/licenses/>.
along with this telegram-cli. If not, see <http://www.gnu.org/licenses/>.
Copyright Vitaly Valtman 2013-201
4
Copyright Vitaly Valtman 2013-201
5
*/
*/
#ifndef PROG_NAME
#ifndef PROG_NAME
#define PROG_NAME "telegram-cli"
#define PROG_NAME "telegram-cli"
#endif
#endif
#define TELEGRAM_CLI_VERSION "1.2.0"
tgl
@
24ed7ee1
Subproject commit
0205b668d3abcf35a348556776d1180439d115d9
Subproject commit
24ed7ee1fa0520dc4e69e845a84281e034b4c482
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