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
ce4d9aff
Commit
ce4d9aff
authored
May 21, 2015
by
Vincent Castellano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add additional peer functions
parent
99bf1828
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
313 additions
and
13 deletions
+313
-13
python-types.c
python-types.c
+313
-13
No files found.
python-types.c
View file @
ce4d9aff
...
...
@@ -391,16 +391,316 @@ tgl_Peer_send_msg (tgl_Peer *self, PyObject *args, PyObject *kwargs)
return
py_send_msg
(
Py_None
,
api_call
);
}
else
{
PyErr_Print
();
Py_XINCREF
(
Py_False
);
return
Py_False
;
}
}
static
PyObject
*
tgl_Peer_send_typing
(
tgl_Peer
*
self
,
PyObject
*
args
,
PyObject
*
kwargs
)
{
static
char
*
kwlist
[]
=
{
"callback"
,
NULL
};
PyObject
*
callback
=
NULL
;
if
(
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"|O"
,
kwlist
,
&
callback
))
{
PyObject
*
api_call
;
if
(
callback
)
api_call
=
Py_BuildValue
(
"OO"
,
(
PyObject
*
)
self
,
callback
);
else
api_call
=
Py_BuildValue
(
"O"
,
(
PyObject
*
)
self
);
Py_INCREF
(
Py_None
);
Py_XINCREF
(
api_call
);
return
py_send_typing
(
Py_None
,
api_call
);
}
else
{
PyErr_Print
();
Py_XINCREF
(
Py_False
);
return
Py_False
;
}
}
static
PyObject
*
tgl_Peer_send_typing_abort
(
tgl_Peer
*
self
,
PyObject
*
args
,
PyObject
*
kwargs
)
{
static
char
*
kwlist
[]
=
{
"callback"
,
NULL
};
PyObject
*
callback
=
NULL
;
if
(
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"O!|O"
,
kwlist
,
&
callback
))
{
PyObject
*
api_call
;
if
(
callback
)
api_call
=
Py_BuildValue
(
"OO"
,
(
PyObject
*
)
self
,
callback
);
else
api_call
=
Py_BuildValue
(
"O"
,
(
PyObject
*
)
self
);
Py_INCREF
(
Py_None
);
Py_XINCREF
(
api_call
);
return
py_send_typing_abort
(
Py_None
,
api_call
);
}
else
{
PyErr_Print
();
Py_XINCREF
(
Py_False
);
return
Py_False
;
}
}
static
PyObject
*
tgl_Peer_rename_chat
(
tgl_Peer
*
self
,
PyObject
*
args
,
PyObject
*
kwargs
)
{
static
char
*
kwlist
[]
=
{
"peer"
,
"title"
,
"callback"
,
NULL
};
char
*
title
;
PyObject
*
callback
=
NULL
;
if
(
self
->
peer
->
id
.
type
!=
TGL_PEER_CHAT
)
{
PyErr_SetString
(
PeerError
,
"Only a chat peer can be renamed"
);
Py_XINCREF
(
Py_False
);
return
Py_False
;
}
if
(
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"s|O"
,
kwlist
,
&
title
,
&
callback
))
{
PyObject
*
api_call
;
if
(
callback
)
api_call
=
Py_BuildValue
(
"OsO"
,
(
PyObject
*
)
self
,
title
,
callback
);
else
api_call
=
Py_BuildValue
(
"Os"
,
(
PyObject
*
)
self
,
title
);
Py_INCREF
(
Py_None
);
Py_XINCREF
(
api_call
);
return
py_rename_chat
(
Py_None
,
api_call
);
}
else
{
PyErr_Print
();
Py_XINCREF
(
Py_False
);
return
Py_False
;
}
}
static
PyObject
*
tgl_Peer_send_photo
(
tgl_Peer
*
self
,
PyObject
*
args
,
PyObject
*
kwargs
)
{
static
char
*
kwlist
[]
=
{
"filename"
,
"callback"
,
NULL
};
char
*
filename
;
PyObject
*
callback
=
NULL
;
if
(
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"s|O"
,
kwlist
,
&
filename
,
&
callback
))
{
PyObject
*
api_call
;
if
(
callback
)
api_call
=
Py_BuildValue
(
"OsO"
,
(
PyObject
*
)
self
,
filename
,
callback
);
else
api_call
=
Py_BuildValue
(
"Os"
,
(
PyObject
*
)
self
,
filename
);
Py_INCREF
(
Py_None
);
Py_XINCREF
(
api_call
);
return
py_send_photo
(
Py_None
,
api_call
);
}
else
{
PyErr_Print
();
Py_XINCREF
(
Py_False
);
return
Py_False
;
}
}
static
PyObject
*
tgl_Peer_send_video
(
tgl_Peer
*
self
,
PyObject
*
args
,
PyObject
*
kwargs
)
{
static
char
*
kwlist
[]
=
{
"filename"
,
"callback"
,
NULL
};
char
*
filename
;
PyObject
*
callback
=
NULL
;
if
(
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"s|O"
,
kwlist
,
&
filename
,
&
callback
))
{
PyObject
*
api_call
;
if
(
callback
)
api_call
=
Py_BuildValue
(
"OsO"
,
(
PyObject
*
)
self
,
filename
,
callback
);
else
api_call
=
Py_BuildValue
(
"Os"
,
(
PyObject
*
)
self
,
filename
);
Py_INCREF
(
Py_None
);
Py_XINCREF
(
api_call
);
return
py_send_video
(
Py_None
,
api_call
);
}
else
{
PyErr_Print
();
Py_XINCREF
(
Py_False
);
return
Py_False
;
}
}
static
PyObject
*
tgl_Peer_send_audio
(
tgl_Peer
*
self
,
PyObject
*
args
,
PyObject
*
kwargs
)
{
static
char
*
kwlist
[]
=
{
"filename"
,
"callback"
,
NULL
};
char
*
filename
;
PyObject
*
callback
=
NULL
;
if
(
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"s|O"
,
kwlist
,
&
filename
,
&
callback
))
{
PyObject
*
api_call
;
if
(
callback
)
api_call
=
Py_BuildValue
(
"OsO"
,
(
PyObject
*
)
self
,
filename
,
callback
);
else
api_call
=
Py_BuildValue
(
"Os"
,
(
PyObject
*
)
self
,
filename
);
Py_INCREF
(
Py_None
);
Py_XINCREF
(
api_call
);
return
py_send_audio
(
Py_None
,
api_call
);
}
else
{
PyErr_Print
();
Py_XINCREF
(
Py_False
);
return
Py_False
;
}
}
static
PyObject
*
tgl_Peer_send_document
(
tgl_Peer
*
self
,
PyObject
*
args
,
PyObject
*
kwargs
)
{
static
char
*
kwlist
[]
=
{
"filename"
,
"callback"
,
NULL
};
char
*
filename
;
PyObject
*
callback
=
NULL
;
if
(
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"s|O"
,
kwlist
,
&
filename
,
&
callback
))
{
PyObject
*
api_call
;
if
(
callback
)
api_call
=
Py_BuildValue
(
"OsO"
,
(
PyObject
*
)
self
,
filename
,
callback
);
else
api_call
=
Py_BuildValue
(
"Os"
,
(
PyObject
*
)
self
,
filename
);
Py_INCREF
(
Py_None
);
Py_XINCREF
(
api_call
);
return
py_send_document
(
Py_None
,
api_call
);
}
else
{
PyErr_Print
();
Py_XINCREF
(
Py_False
);
return
Py_False
;
}
}
static
PyObject
*
tgl_Peer_send_file
(
tgl_Peer
*
self
,
PyObject
*
args
,
PyObject
*
kwargs
)
{
static
char
*
kwlist
[]
=
{
"filename"
,
"callback"
,
NULL
};
char
*
filename
;
PyObject
*
callback
=
NULL
;
if
(
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"s|O"
,
kwlist
,
&
filename
,
&
callback
))
{
PyObject
*
api_call
;
if
(
callback
)
api_call
=
Py_BuildValue
(
"OsO"
,
(
PyObject
*
)
self
,
filename
,
callback
);
else
api_call
=
Py_BuildValue
(
"Os"
,
(
PyObject
*
)
self
,
filename
);
Py_INCREF
(
Py_None
);
Py_XINCREF
(
api_call
);
return
py_send_file
(
Py_None
,
api_call
);
}
else
{
PyErr_Print
();
Py_XINCREF
(
Py_False
);
return
Py_False
;
}
}
static
PyObject
*
tgl_Peer_send_text
(
tgl_Peer
*
self
,
PyObject
*
args
,
PyObject
*
kwargs
)
{
static
char
*
kwlist
[]
=
{
"filename"
,
"callback"
,
NULL
};
char
*
filename
;
PyObject
*
callback
=
NULL
;
if
(
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"s|O"
,
kwlist
,
&
filename
,
&
callback
))
{
PyObject
*
api_call
;
if
(
callback
)
api_call
=
Py_BuildValue
(
"OsO"
,
(
PyObject
*
)
self
,
filename
,
callback
);
else
api_call
=
Py_BuildValue
(
"Os"
,
(
PyObject
*
)
self
,
filename
);
Py_INCREF
(
Py_None
);
Py_XINCREF
(
api_call
);
return
py_send_text
(
Py_None
,
api_call
);
}
else
{
PyErr_Print
();
Py_XINCREF
(
Py_False
);
return
Py_False
;
}
}
static
PyObject
*
tgl_Peer_chat_set_photo
(
tgl_Peer
*
self
,
PyObject
*
args
,
PyObject
*
kwargs
)
{
static
char
*
kwlist
[]
=
{
"peer"
,
"filename"
,
"callback"
,
NULL
};
char
*
filename
;
PyObject
*
callback
=
NULL
;
if
(
self
->
peer
->
id
.
type
!=
TGL_PEER_CHAT
)
{
PyErr_SetString
(
PeerError
,
"Only a chat peer can have a chat photo set."
);
Py_XINCREF
(
Py_False
);
return
Py_False
;
}
if
(
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"s|O"
,
kwlist
,
&
filename
,
&
callback
))
{
PyObject
*
api_call
;
if
(
callback
)
api_call
=
Py_BuildValue
(
"OsO"
,
(
PyObject
*
)
self
,
filename
,
callback
);
else
api_call
=
Py_BuildValue
(
"Os"
,
(
PyObject
*
)
self
,
filename
);
Py_INCREF
(
Py_None
);
Py_XINCREF
(
api_call
);
return
py_chat_set_photo
(
Py_None
,
api_call
);
}
else
{
PyErr_Print
();
Py_XINCREF
(
Py_False
);
return
Py_False
;
}
}
static
PyMethodDef
tgl_Peer_methods
[]
=
{
{
"send_msg"
,
(
PyCFunction
)
tgl_Peer_send_msg
,
METH_VARARGS
|
METH_KEYWORDS
,
"Send a message to peer object"
},
{
"send_typing"
,
(
PyCFunction
)
tgl_Peer_send_typing
,
METH_VARARGS
|
METH_KEYWORDS
,
""
},
{
"send_typing_abort"
,
(
PyCFunction
)
tgl_Peer_send_typing_abort
,
METH_VARARGS
|
METH_KEYWORDS
,
""
},
{
"rename_chat"
,
(
PyCFunction
)
tgl_Peer_rename_chat
,
METH_VARARGS
|
METH_KEYWORDS
,
""
},
{
"send_photo"
,
(
PyCFunction
)
tgl_Peer_send_photo
,
METH_VARARGS
|
METH_KEYWORDS
,
""
},
{
"send_video"
,
(
PyCFunction
)
tgl_Peer_send_video
,
METH_VARARGS
|
METH_KEYWORDS
,
""
},
{
"send_audio"
,
(
PyCFunction
)
tgl_Peer_send_audio
,
METH_VARARGS
|
METH_KEYWORDS
,
""
},
{
"send_file"
,
(
PyCFunction
)
tgl_Peer_send_file
,
METH_VARARGS
|
METH_KEYWORDS
,
""
},
{
"send_document"
,
(
PyCFunction
)
tgl_Peer_send_document
,
METH_VARARGS
|
METH_KEYWORDS
,
""
},
{
"send_text"
,
(
PyCFunction
)
tgl_Peer_send_text
,
METH_VARARGS
|
METH_KEYWORDS
,
""
},
{
"chat_set_photo"
,
(
PyCFunction
)
tgl_Peer_chat_set_photo
,
METH_VARARGS
|
METH_KEYWORDS
,
""
},
{
NULL
}
/* Sentinel */
};
...
...
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