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
d67c5218
Commit
d67c5218
authored
Sep 25, 2015
by
V V
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updates
parent
4c270917
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
3 deletions
+55
-3
interface.c
interface.c
+54
-2
tgl
tgl
+1
-1
No files found.
interface.c
View file @
d67c5218
...
...
@@ -638,6 +638,7 @@ int disable_msg_preview;
void
print_user_list_gw
(
struct
tgl_state
*
TLS
,
void
*
extra
,
int
success
,
int
num
,
struct
tgl_user
*
UL
[]);
void
print_msg_list_gw
(
struct
tgl_state
*
TLS
,
void
*
extra
,
int
success
,
int
num
,
struct
tgl_message
*
ML
[]);
void
print_msg_list_history_gw
(
struct
tgl_state
*
TLS
,
void
*
extra
,
int
success
,
int
num
,
struct
tgl_message
*
ML
[]);
void
print_msg_list_success_gw
(
struct
tgl_state
*
TLS
,
void
*
extra
,
int
success
,
int
num
,
struct
tgl_message
*
ML
[]);
void
print_dialog_list_gw
(
struct
tgl_state
*
TLS
,
void
*
extra
,
int
success
,
int
size
,
tgl_peer_id_t
peers
[],
int
last_msg_id
[],
int
unread_count
[]);
void
print_chat_info_gw
(
struct
tgl_state
*
TLS
,
void
*
extra
,
int
success
,
struct
tgl_chat
*
C
);
...
...
@@ -797,6 +798,11 @@ void do_send_text (struct command *command, int arg_num, struct arg args[], stru
tgl_do_send_text
(
TLS
,
args
[
0
].
P
->
id
,
args
[
1
].
str
,
TGL_SEND_MSG_FLAG_REPLY
(
reply_id
)
|
disable_msg_preview
,
print_msg_success_gw
,
ev
);
}
void
do_post_text
(
struct
command
*
command
,
int
arg_num
,
struct
arg
args
[],
struct
in_ev
*
ev
)
{
assert
(
arg_num
==
2
);
if
(
ev
)
{
ev
->
refcnt
++
;
}
tgl_do_send_text
(
TLS
,
args
[
0
].
P
->
id
,
args
[
1
].
str
,
TGL_SEND_MSG_FLAG_REPLY
(
reply_id
)
|
disable_msg_preview
|
TGLMF_POST_AS_CHANNEL
,
print_msg_success_gw
,
ev
);
}
void
do_reply_text
(
struct
command
*
command
,
int
arg_num
,
struct
arg
args
[],
struct
in_ev
*
ev
)
{
assert
(
arg_num
==
2
);
if
(
ev
)
{
ev
->
refcnt
++
;
}
...
...
@@ -830,6 +836,26 @@ void do_send_document (struct command *command, int arg_num, struct arg args[],
_do_send_file
(
command
,
arg_num
,
args
,
ev
,
0
);
}
void
do_post_photo
(
struct
command
*
command
,
int
arg_num
,
struct
arg
args
[],
struct
in_ev
*
ev
)
{
_do_send_file
(
command
,
arg_num
,
args
,
ev
,
TGL_SEND_MSG_FLAG_DOCUMENT_PHOTO
|
TGLMF_POST_AS_CHANNEL
);
}
void
do_post_file
(
struct
command
*
command
,
int
arg_num
,
struct
arg
args
[],
struct
in_ev
*
ev
)
{
_do_send_file
(
command
,
arg_num
,
args
,
ev
,
TGL_SEND_MSG_FLAG_DOCUMENT_AUTO
|
TGLMF_POST_AS_CHANNEL
);
}
void
do_post_audio
(
struct
command
*
command
,
int
arg_num
,
struct
arg
args
[],
struct
in_ev
*
ev
)
{
_do_send_file
(
command
,
arg_num
,
args
,
ev
,
TGL_SEND_MSG_FLAG_DOCUMENT_AUDIO
|
TGLMF_POST_AS_CHANNEL
);
}
void
do_post_video
(
struct
command
*
command
,
int
arg_num
,
struct
arg
args
[],
struct
in_ev
*
ev
)
{
_do_send_file
(
command
,
arg_num
,
args
,
ev
,
TGL_SEND_MSG_FLAG_DOCUMENT_VIDEO
|
TGLMF_POST_AS_CHANNEL
);
}
void
do_post_document
(
struct
command
*
command
,
int
arg_num
,
struct
arg
args
[],
struct
in_ev
*
ev
)
{
_do_send_file
(
command
,
arg_num
,
args
,
ev
,
TGLMF_POST_AS_CHANNEL
);
}
void
_do_reply_file
(
struct
command
*
command
,
int
arg_num
,
struct
arg
args
[],
struct
in_ev
*
ev
,
unsigned
long
long
flags
)
{
assert
(
arg_num
>=
2
);
if
(
ev
)
{
ev
->
refcnt
++
;
}
...
...
@@ -896,6 +922,12 @@ void do_send_location (struct command *command, int arg_num, struct arg args[],
tgl_do_send_location
(
TLS
,
args
[
0
].
P
->
id
,
args
[
1
].
dval
,
args
[
2
].
dval
,
TGL_SEND_MSG_FLAG_REPLY
(
reply_id
),
print_msg_success_gw
,
ev
);
}
void
do_post_location
(
struct
command
*
command
,
int
arg_num
,
struct
arg
args
[],
struct
in_ev
*
ev
)
{
assert
(
arg_num
==
3
);
if
(
ev
)
{
ev
->
refcnt
++
;
}
tgl_do_send_location
(
TLS
,
args
[
0
].
P
->
id
,
args
[
1
].
dval
,
args
[
2
].
dval
,
TGL_SEND_MSG_FLAG_REPLY
(
reply_id
)
|
TGLMF_POST_AS_CHANNEL
,
print_msg_success_gw
,
ev
);
}
void
do_reply_location
(
struct
command
*
command
,
int
arg_num
,
struct
arg
args
[],
struct
in_ev
*
ev
)
{
assert
(
arg_num
==
3
);
if
(
ev
)
{
ev
->
refcnt
++
;
}
...
...
@@ -1211,7 +1243,7 @@ void do_mark_read (struct command *command, int arg_num, struct arg args[], stru
void
do_history
(
struct
command
*
command
,
int
arg_num
,
struct
arg
args
[],
struct
in_ev
*
ev
)
{
assert
(
arg_num
==
3
);
if
(
ev
)
{
ev
->
refcnt
++
;
}
tgl_do_get_history
(
TLS
,
args
[
0
].
P
->
id
,
args
[
2
].
num
!=
NOT_FOUND
?
args
[
2
].
num
:
0
,
args
[
1
].
num
!=
NOT_FOUND
?
args
[
1
].
num
:
40
,
offline_mode
,
print_msg_list_gw
,
ev
);
tgl_do_get_history
(
TLS
,
args
[
0
].
P
->
id
,
args
[
2
].
num
!=
NOT_FOUND
?
args
[
2
].
num
:
0
,
args
[
1
].
num
!=
NOT_FOUND
?
args
[
1
].
num
:
40
,
offline_mode
,
print_msg_list_
history_
gw
,
ev
);
}
void
print_fail
(
struct
in_ev
*
ev
);
...
...
@@ -1446,6 +1478,13 @@ struct command commands[MAX_COMMANDS_SIZE] = {
{
"msg"
,
{
ca_peer
,
ca_msg_string_end
,
ca_none
},
do_msg
,
"msg <peer> <text>
\t
Sends text message to peer"
,
NULL
},
{
"msg_kbd"
,
{
ca_peer
,
ca_string
,
ca_msg_string_end
,
ca_none
},
do_msg_kbd
,
"msg <peer> <kbd> <text>
\t
Sends text message to peer with custom kbd"
,
NULL
},
{
"post"
,
{
ca_peer
,
ca_msg_string_end
,
ca_none
},
do_post
,
"post <peer> <text>
\t
Sends text message to peer as admin"
,
NULL
},
{
"post_audio"
,
{
ca_peer
,
ca_file_name
,
ca_none
},
do_post_audio
,
"post_audio <peer> <file>
\t
Posts audio to peer"
,
NULL
},
{
"post_document"
,
{
ca_peer
,
ca_file_name
,
ca_none
},
do_post_document
,
"post_document <peer> <file>
\t
Posts document to peer"
,
NULL
},
{
"post_file"
,
{
ca_peer
,
ca_file_name
,
ca_none
},
do_post_file
,
"post_file <peer> <file>
\t
Sends document to peer"
,
NULL
},
{
"post_location"
,
{
ca_peer
,
ca_double
,
ca_double
,
ca_none
},
do_post_location
,
"post_location <peer> <latitude> <longitude>
\t
Sends geo location"
,
NULL
},
{
"post_photo"
,
{
ca_peer
,
ca_file_name
,
ca_string_end
|
ca_optional
,
ca_none
},
do_post_photo
,
"post_photo <peer> <file> [caption]
\t
Sends photo to peer"
,
NULL
},
{
"post_text"
,
{
ca_peer
,
ca_file_name_end
,
ca_none
},
do_post_text
,
"post_text <peer> <file>
\t
Sends contents of text file as plain text message"
,
NULL
},
{
"pist_video"
,
{
ca_peer
,
ca_file_name
,
ca_string_end
|
ca_optional
,
ca_none
},
do_post_video
,
"post_video <peer> <file> [caption]
\t
Sends video to peer"
,
NULL
},
{
"quit"
,
{
ca_none
},
do_quit
,
"quit
\t
Quits immediately"
,
NULL
},
{
"rename_chat"
,
{
ca_chat
,
ca_string_end
,
ca_none
},
do_rename_chat
,
"rename_chat <chat> <new name>
\t
Renames chat"
,
NULL
},
{
"rename_contact"
,
{
ca_user
,
ca_string
,
ca_string
,
ca_none
},
do_rename_contact
,
"rename_contact <user> <first name> <last name>
\t
Renames contact"
,
NULL
},
...
...
@@ -2038,6 +2077,19 @@ void print_msg_list_gw (struct tgl_state *TLSR, void *extra, int success, int nu
mprint_end
(
ev
);
}
void
print_msg_list_history_gw
(
struct
tgl_state
*
TLSR
,
void
*
extra
,
int
success
,
int
num
,
struct
tgl_message
*
ML
[])
{
print_msg_list_gw
(
TLSR
,
extra
,
success
,
num
,
ML
);
if
(
num
>
0
)
{
if
(
tgl_get_peer_type
(
ML
[
0
]
->
to_id
)
!=
TGL_PEER_CHANNEL
)
{
if
(
tgl_get_peer_type
(
ML
[
0
]
->
to_id
)
!=
TGL_PEER_USER
||
tgl_get_peer_id
(
ML
[
0
]
->
to_id
)
!=
TLS
->
our_id
)
{
tgl_do_messages_mark_read
(
TLS
,
ML
[
0
]
->
to_id
,
ML
[
0
]
->
id
,
0
,
NULL
,
NULL
);
}
else
{
tgl_do_messages_mark_read
(
TLS
,
ML
[
0
]
->
from_id
,
ML
[
0
]
->
id
,
0
,
NULL
,
NULL
);
}
}
}
}
void
print_msg_gw
(
struct
tgl_state
*
TLSR
,
void
*
extra
,
int
success
,
struct
tgl_message
*
M
)
{
assert
(
TLS
==
TLSR
);
struct
in_ev
*
ev
=
extra
;
...
...
tgl
@
83988520
Subproject commit
e5a9d0521aee36611bd2f51d50c6609902aa009
4
Subproject commit
839885202494fb66fadad80e7c327000dc92b17
4
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