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
05c52fd4
Commit
05c52fd4
authored
May 31, 2015
by
Vincent Castellano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add global link preview method tgl.set_link_preview(bool)
parent
63f64a8e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
6 deletions
+23
-6
python-tg.c
python-tg.c
+22
-5
python-types.c
python-types.c
+1
-1
No files found.
python-tg.c
View file @
05c52fd4
...
...
@@ -803,10 +803,12 @@ void py_do_all (void) {
case
pq_msg
:
if
(
PyArg_ParseTuple
(
args
,
"O!s#|OO"
,
&
tgl_PeerType
,
&
peer
,
&
str
,
&
len
,
&
cb_extra
,
&
pyObj1
))
{
if
(
PyArg_ParseTuple
(
pyObj1
,
"ii"
,
&
preview
,
&
reply_id
))
{
if
(
preview
!=
-
1
)
{
if
(
preview
)
flags
|=
TGL_SEND_MSG_FLAG_ENABLE_PREVIEW
;
else
flags
|=
TGL_SEND_MSG_FLAG_DISABLE_PREVIEW
;
}
flags
|=
TGL_SEND_MSG_FLAG_REPLY
(
reply_id
);
}
tgl_do_send_message
(
TLS
,
PY_PEER_ID
(
peer
),
str
,
len
,
flags
,
py_msg_cb
,
cb_extra
);
...
...
@@ -1148,6 +1150,20 @@ PyObject* py_safe_quit(PyObject *self, PyObject *args)
Py_RETURN_NONE
;
}
PyObject
*
py_set_preview
(
PyObject
*
self
,
PyObject
*
args
)
{
int
preview
=
0
;
if
(
PyArg_ParseTuple
(
args
,
"p"
,
&
preview
))
{
if
(
preview
)
TLS
->
disable_link_preview
=
0
;
else
TLS
->
disable_link_preview
=
1
;
}
else
{
PyErr_Print
();
}
Py_RETURN_NONE
;
}
// Store callables for python functions
TGL_PYTHON_CALLBACK
(
"on_binlog_replay_end"
,
_py_binlog_end
);
...
...
@@ -1212,6 +1228,7 @@ static PyMethodDef py_tgl_methods[] = {
{
"set_on_user_update"
,
set_py_user_update
,
METH_VARARGS
,
""
},
{
"set_on_chat_update"
,
set_py_chat_update
,
METH_VARARGS
,
""
},
{
"set_on_loop"
,
set_py_on_loop
,
METH_VARARGS
,
""
},
{
"set_link_preview"
,
py_set_preview
,
METH_VARARGS
,
""
},
{
"safe_quit"
,
py_safe_quit
,
METH_VARARGS
,
""
},
{
"safe_exit"
,
py_safe_quit
,
METH_VARARGS
,
""
},
// Alias to safe_quit for naming consistancy in python.
{
NULL
,
NULL
,
0
,
NULL
}
...
...
python-types.c
View file @
05c52fd4
...
...
@@ -378,7 +378,7 @@ tgl_Peer_send_msg (tgl_Peer *self, PyObject *args, PyObject *kwargs)
static
char
*
kwlist
[]
=
{
"message"
,
"callback"
,
"preview"
,
"reply"
,
NULL
};
char
*
message
;
int
preview
=
1
;
int
preview
=
-
1
;
int
reply
=
0
;
PyObject
*
callback
=
NULL
;
...
...
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