mirror of
https://github.com/deltachat/deltachat-core.git
synced 2025-10-04 10:19:16 +02:00
initial sphinx docs and many docstrings.
This commit is contained in:
parent
dd060d7cf2
commit
66d6621f93
19 changed files with 1277 additions and 27 deletions
6
python/CHANGELOG
Normal file
6
python/CHANGELOG
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
0.5
|
||||||
|
---
|
||||||
|
|
||||||
|
- initial release with full low level C-API, and a first
|
||||||
|
high level API
|
|
@ -16,7 +16,7 @@ Install
|
||||||
First you need to execute all the build steps to install the delta-core C-library,
|
First you need to execute all the build steps to install the delta-core C-library,
|
||||||
see https://github.com/deltachat/deltachat-core/blob/master/README.md#build
|
see https://github.com/deltachat/deltachat-core/blob/master/README.md#build
|
||||||
|
|
||||||
Next, you need to do perform::
|
Next, you need to perform::
|
||||||
|
|
||||||
pip install -e .
|
pip install -e .
|
||||||
|
|
||||||
|
@ -28,8 +28,8 @@ Afterwards you should be able to successfully import the bindings::
|
||||||
Running tests
|
Running tests
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
Install the delta-core C-library (see _Install) and then
|
Install the delta-core C-library and the deltachat bindings (see _Install)
|
||||||
type the following to execute tests::
|
and then type the following to execute tests::
|
||||||
|
|
||||||
pip install tox
|
pip install tox
|
||||||
tox
|
tox
|
||||||
|
@ -38,7 +38,7 @@ If you want to run functional tests that run against real
|
||||||
e-mail accounts, generate a "liveconfig" file where each
|
e-mail accounts, generate a "liveconfig" file where each
|
||||||
lines contains account settings, for example::
|
lines contains account settings, for example::
|
||||||
|
|
||||||
# liveconfig file for specifying real-life accounts
|
# 'liveconfig' file specifying imap/smtp accounts
|
||||||
addr=some-email@example.org mail_pw=password
|
addr=some-email@example.org mail_pw=password
|
||||||
addr=other-email@example.org mail_pw=otherpassword
|
addr=other-email@example.org mail_pw=otherpassword
|
||||||
|
|
||||||
|
|
167
python/doc/_static/delta-chat.svg
vendored
Executable file
167
python/doc/_static/delta-chat.svg
vendored
Executable file
|
@ -0,0 +1,167 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="48px"
|
||||||
|
height="48px"
|
||||||
|
id="svg2985"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.91 r13725"
|
||||||
|
sodipodi:docname="delta-v7-pathed.svg"
|
||||||
|
inkscape:export-filename="/home/bpetersen/projects/messenger-android/MessengerProj/src/main/res/drawable-xhdpi/ic_launcher.png"
|
||||||
|
inkscape:export-xdpi="183.83"
|
||||||
|
inkscape:export-ydpi="183.83">
|
||||||
|
<defs
|
||||||
|
id="defs2987">
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient4409">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#f9f9f9;stop-opacity:1"
|
||||||
|
offset="0"
|
||||||
|
id="stop4411" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#cccccc;stop-opacity:0;"
|
||||||
|
offset="1"
|
||||||
|
id="stop4413" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient4399">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#f9f9f9;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop4401" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#f9f9f9;stop-opacity:0;"
|
||||||
|
offset="1"
|
||||||
|
id="stop4403" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient4375">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#364e59;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop4377" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#364e59;stop-opacity:0;"
|
||||||
|
offset="1"
|
||||||
|
id="stop4379" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient4367">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#dc000f;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop4369" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#00ff00;stop-opacity:0;"
|
||||||
|
offset="1"
|
||||||
|
id="stop4371" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient4359">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#dc000f;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop4361" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#000000;stop-opacity:0;"
|
||||||
|
offset="1"
|
||||||
|
id="stop4363" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient4375"
|
||||||
|
id="linearGradient4381"
|
||||||
|
x1="31.957268"
|
||||||
|
y1="29.751493"
|
||||||
|
x2="-45.041405"
|
||||||
|
y2="-18.591616"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="matrix(0.93766393,0,0,0.93766393,1.542566,1.7199693)" />
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient4409"
|
||||||
|
id="linearGradient4415"
|
||||||
|
x1="16.345125"
|
||||||
|
y1="3.8388948"
|
||||||
|
x2="36.001561"
|
||||||
|
y2="24.359164"
|
||||||
|
gradientUnits="userSpaceOnUse" />
|
||||||
|
</defs>
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="9.8994949"
|
||||||
|
inkscape:cx="1.9547978"
|
||||||
|
inkscape:cy="28.000232"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="true"
|
||||||
|
inkscape:grid-bbox="true"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:snap-global="false"
|
||||||
|
inkscape:snap-bbox="true"
|
||||||
|
inkscape:bbox-nodes="true"
|
||||||
|
inkscape:bbox-paths="true"
|
||||||
|
inkscape:snap-bbox-edge-midpoints="true"
|
||||||
|
inkscape:window-width="1543"
|
||||||
|
inkscape:window-height="876"
|
||||||
|
inkscape:window-x="57"
|
||||||
|
inkscape:window-y="24"
|
||||||
|
inkscape:window-maximized="1" />
|
||||||
|
<metadata
|
||||||
|
id="metadata2990">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
id="layer1"
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer">
|
||||||
|
<path
|
||||||
|
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.57405078;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.43921569"
|
||||||
|
d="m 24.015419,1.2870249 c -12.549421,0 -22.7283936,10.1789711 -22.7283936,22.7283931 0,12.549422 10.1789726,22.728395 22.7283936,22.728395 14.337742,-0.342877 9.614352,-4.702705 23.697556,0.969161 -7.545453,-13.001555 -1.082973,-13.32964 -0.969161,-23.697556 0,-12.549422 -10.178973,-22.7283931 -22.728395,-22.7283931 z"
|
||||||
|
id="path3769"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="sscccs" />
|
||||||
|
<path
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path3799"
|
||||||
|
d="M 23.982249,5.3106163 C 13.645822,5.4364005 5.2618355,13.92999 5.2618355,24.275753 c 0,10.345764 8.3839865,18.635301 18.7204135,18.509516 9.827724,-0.03951 7.516769,-5.489695 18.380082,-0.443187 -5.950849,-9.296115 0.201753,-10.533667 0.340336,-18.521947 0,-10.345766 -8.383989,-18.6353031 -18.720418,-18.5095187 z"
|
||||||
|
style="fill:url(#linearGradient4381);fill-opacity:1;stroke:none"
|
||||||
|
sodipodi:nodetypes="sscccs" />
|
||||||
|
<g
|
||||||
|
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:Sans;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
|
||||||
|
id="text4383" />
|
||||||
|
<g
|
||||||
|
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:Sans;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
|
||||||
|
id="text4421" />
|
||||||
|
<g
|
||||||
|
transform="scale(1.1122373,0.89908874)"
|
||||||
|
style="font-style:normal;font-weight:normal;font-size:42.10587311px;line-height:125%;font-family:Sans;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none"
|
||||||
|
id="text3797">
|
||||||
|
<path
|
||||||
|
d="m 21.688854,23.636251 q -1.027975,-1.151333 -2.857771,-2.754974 -2.014832,-1.768118 -2.713855,-2.775534 -0.699024,-1.027975 -0.699024,-2.240986 0,-1.809237 1.68588,-2.837212 1.68588,-1.048535 4.399735,-1.048535 2.713855,0 4.728687,0.925178 2.035391,0.925177 2.035391,2.549379 0,0.781261 -0.493428,1.295249 -0.493428,0.513987 -1.151333,0.513987 -0.945737,0 -2.220426,-1.418606 -1.295249,-1.439165 -2.199868,-2.014832 -0.884059,-0.596225 -2.07651,-0.596225 -1.521404,0 -2.50826,0.678463 -0.966297,0.678464 -0.966297,1.726999 0,0.986857 0.801821,1.850356 0.801821,0.863499 4.132461,3.145605 3.556795,2.446581 5.01652,3.824068 1.480285,1.377487 2.405462,3.3512 0.925178,1.973713 0.925178,4.17358 0,3.865188 -2.734414,6.825757 -2.713855,2.94001 -6.352888,2.94001 -3.310081,0 -5.592187,-2.364344 -2.282105,-2.364343 -2.282105,-6.311769 0,-3.803509 2.50826,-6.352888 2.528819,-2.549379 6.208971,-3.083926 z m 0.904619,0.945737 q -5.900579,0.966297 -5.900579,8.100447 0,3.680152 1.459725,5.715543 1.480285,2.035391 3.433438,2.035391 2.035391,0 3.3512,-1.953153 1.315808,-1.973713 1.315808,-5.324913 0,-4.852044 -3.659592,-8.573315 z"
|
||||||
|
style="font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman';fill:#ffffff;fill-opacity:1"
|
||||||
|
id="path4161" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 7 KiB |
339
python/doc/_static/sphinxdoc.css
vendored
Normal file
339
python/doc/_static/sphinxdoc.css
vendored
Normal file
|
@ -0,0 +1,339 @@
|
||||||
|
/*
|
||||||
|
* sphinxdoc.css_t
|
||||||
|
* ~~~~~~~~~~~~~~~
|
||||||
|
*
|
||||||
|
* Sphinx stylesheet -- sphinxdoc theme. Originally created by
|
||||||
|
* Armin Ronacher for Werkzeug.
|
||||||
|
*
|
||||||
|
* :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS.
|
||||||
|
* :license: BSD, see LICENSE for details.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@import url("basic.css");
|
||||||
|
|
||||||
|
/* -- page layout ----------------------------------------------------------- */
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva',
|
||||||
|
'Verdana', sans-serif;
|
||||||
|
font-size: 1.1em;
|
||||||
|
letter-spacing: -0.01em;
|
||||||
|
line-height: 150%;
|
||||||
|
text-align: center;
|
||||||
|
background-color: #BFD1D4;
|
||||||
|
color: black;
|
||||||
|
padding: 0;
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
|
||||||
|
margin: 0px 80px 0px 80px;
|
||||||
|
min-width: 740px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.document {
|
||||||
|
background-color: white;
|
||||||
|
text-align: left;
|
||||||
|
background-image: url(contents.png);
|
||||||
|
background-repeat: repeat-x;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.bodywrapper {
|
||||||
|
margin: 0 240px 0 0;
|
||||||
|
border-right: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0.5em 20px 20px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.related {
|
||||||
|
font-size: 0.8em;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.related ul {
|
||||||
|
background-image: url(navigation.png);
|
||||||
|
height: 2em;
|
||||||
|
border-top: 1px solid #ddd;
|
||||||
|
border-bottom: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.related ul li {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
height: 2em;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.related ul li.right {
|
||||||
|
float: right;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.related ul li a {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0 5px 0 5px;
|
||||||
|
line-height: 1.75em;
|
||||||
|
color: #EE9816;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.related ul li a:hover {
|
||||||
|
color: #3CA8E7;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sphinxsidebarwrapper {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sphinxsidebar {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0.5em 15px 15px 0;
|
||||||
|
width: 210px;
|
||||||
|
float: right;
|
||||||
|
font-size: 1em;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sphinxsidebar h3, div.sphinxsidebar h4 {
|
||||||
|
margin: 1em 0 0.5em 0;
|
||||||
|
font-size: 1em;
|
||||||
|
padding: 0.1em 0 0.1em 0.5em;
|
||||||
|
color: white;
|
||||||
|
border: 1px solid #86989B;
|
||||||
|
background-color: #AFC1C4;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sphinxsidebar h3 a {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sphinxsidebar ul {
|
||||||
|
padding-left: 1.5em;
|
||||||
|
margin-top: 7px;
|
||||||
|
padding: 0;
|
||||||
|
line-height: 130%;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sphinxsidebar ul ul {
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.footer {
|
||||||
|
background-color: #E3EFF1;
|
||||||
|
color: #86989B;
|
||||||
|
padding: 3px 8px 3px 0;
|
||||||
|
clear: both;
|
||||||
|
font-size: 0.8em;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.footer a {
|
||||||
|
color: #86989B;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- body styles ----------------------------------------------------------- */
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 0.8em 0 0.5em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #CA7900;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: #2491CF;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.body a {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0.7em 0 0.3em 0;
|
||||||
|
font-size: 1.5em;
|
||||||
|
color: #11557C;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
margin: 1.3em 0 0.2em 0;
|
||||||
|
font-size: 1.35em;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
margin: 1em 0 -0.3em 0;
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.body h1 a, div.body h2 a, div.body h3 a, div.body h4 a, div.body h5 a, div.body h6 a {
|
||||||
|
color: black!important;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 a.anchor, h2 a.anchor, h3 a.anchor, h4 a.anchor, h5 a.anchor, h6 a.anchor {
|
||||||
|
display: none;
|
||||||
|
margin: 0 0 0 0.3em;
|
||||||
|
padding: 0 0.2em 0 0.2em;
|
||||||
|
color: #aaa!important;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor,
|
||||||
|
h5:hover a.anchor, h6:hover a.anchor {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 a.anchor:hover, h2 a.anchor:hover, h3 a.anchor:hover, h4 a.anchor:hover,
|
||||||
|
h5 a.anchor:hover, h6 a.anchor:hover {
|
||||||
|
color: #777;
|
||||||
|
background-color: #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.headerlink {
|
||||||
|
color: #c60f0f!important;
|
||||||
|
font-size: 1em;
|
||||||
|
margin-left: 6px;
|
||||||
|
padding: 0 4px 0 4px;
|
||||||
|
text-decoration: none!important;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.headerlink:hover {
|
||||||
|
background-color: #ccc;
|
||||||
|
color: white!important;
|
||||||
|
}
|
||||||
|
|
||||||
|
cite, code, tt {
|
||||||
|
font-family: 'Consolas', 'Deja Vu Sans Mono',
|
||||||
|
'Bitstream Vera Sans Mono', monospace;
|
||||||
|
font-size: 0.95em;
|
||||||
|
letter-spacing: 0.01em;
|
||||||
|
}
|
||||||
|
|
||||||
|
tt {
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
border-bottom: 1px solid #ddd;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
tt.descname, tt.descclassname, tt.xref {
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
border: 1px solid #abc;
|
||||||
|
margin: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
a tt {
|
||||||
|
border: 0;
|
||||||
|
color: #CA7900;
|
||||||
|
}
|
||||||
|
|
||||||
|
a tt:hover {
|
||||||
|
color: #2491CF;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
font-family: 'Consolas', 'Deja Vu Sans Mono',
|
||||||
|
'Bitstream Vera Sans Mono', monospace;
|
||||||
|
font-size: 0.95em;
|
||||||
|
letter-spacing: 0.015em;
|
||||||
|
line-height: 120%;
|
||||||
|
padding: 0.5em;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre a {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.linenos pre {
|
||||||
|
padding: 0.5em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.quotebar {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
max-width: 250px;
|
||||||
|
float: right;
|
||||||
|
padding: 2px 7px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.topic {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin: 0 -0.5em 0 -0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
table td, table th {
|
||||||
|
padding: 0.2em 0.5em 0.2em 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.admonition, div.warning {
|
||||||
|
font-size: 0.9em;
|
||||||
|
margin: 1em 0 1em 0;
|
||||||
|
border: 1px solid #86989B;
|
||||||
|
background-color: #f7f7f7;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.admonition p, div.warning p {
|
||||||
|
margin: 0.5em 1em 0.5em 1em;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.admonition pre, div.warning pre {
|
||||||
|
margin: 0.4em 1em 0.4em 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.admonition p.admonition-title,
|
||||||
|
div.warning p.admonition-title {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0.1em 0 0.1em 0.5em;
|
||||||
|
color: white;
|
||||||
|
border-bottom: 1px solid #86989B;
|
||||||
|
font-weight: bold;
|
||||||
|
background-color: #AFC1C4;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.warning {
|
||||||
|
border: 1px solid #940000;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.warning p.admonition-title {
|
||||||
|
background-color: #CF0000;
|
||||||
|
border-bottom-color: #940000;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.admonition ul, div.admonition ol,
|
||||||
|
div.warning ul, div.warning ol {
|
||||||
|
margin: 0.1em 0.5em 0.5em 3em;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.versioninfo {
|
||||||
|
margin: 1em 0 0 0;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
background-color: #DDEAF0;
|
||||||
|
padding: 8px;
|
||||||
|
line-height: 1.3em;
|
||||||
|
font-size: 0.9em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.viewcode-back {
|
||||||
|
font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva',
|
||||||
|
'Verdana', sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.viewcode-block:target {
|
||||||
|
background-color: #f4debf;
|
||||||
|
border-top: 1px solid #ac9;
|
||||||
|
border-bottom: 1px solid #ac9;
|
||||||
|
}
|
16
python/doc/_templates/globaltoc.html
vendored
Normal file
16
python/doc/_templates/globaltoc.html
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
|
||||||
|
<h3><a href="{{ pathto('contents') }}">{{ _('Table Of Contents') }}</a></h3>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li><a href="{{ pathto('index') }}">Home</a></li>
|
||||||
|
<li><a href="{{ pathto('install') }}">Install</a></li>
|
||||||
|
<li><a href="{{ pathto('api') }}">API Documentation</a></li>
|
||||||
|
</ul>
|
||||||
|
<b>External Links:</b>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://github.com/deltachat/deltachat-core">Github repository</a></li>
|
||||||
|
<!-- <li><a href="https://lists.codespeak.net/postorius/lists/muacrypt.lists.codespeak.net">Mailing list</></li> <-->
|
||||||
|
<li><a href="https://pypi.python.org/pypi/deltachat">PyPI: deltachat</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<b>#deltachat [freenode]</b>
|
4
python/doc/_templates/sidebarintro.html
vendored
Normal file
4
python/doc/_templates/sidebarintro.html
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<h3>deltachat {{release}}</h3>
|
||||||
|
<p>
|
||||||
|
Bindings for <a href="https://delta.chat">Delta.chat</a>
|
||||||
|
</p>
|
14
python/doc/api.rst
Normal file
14
python/doc/api.rst
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
|
||||||
|
deltachat API Reference
|
||||||
|
==============================
|
||||||
|
|
||||||
|
.. autosummary::
|
||||||
|
|
||||||
|
deltachat.account
|
||||||
|
|
||||||
|
account module
|
||||||
|
--------------
|
||||||
|
|
||||||
|
.. automodule:: deltachat.account
|
||||||
|
:members:
|
||||||
|
|
4
python/doc/changelog.rst
Normal file
4
python/doc/changelog.rst
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
Changelog for deltachat-core's Python bindings
|
||||||
|
==============================================
|
||||||
|
|
||||||
|
.. include:: ../CHANGELOG
|
285
python/doc/conf.py
Normal file
285
python/doc/conf.py
Normal file
|
@ -0,0 +1,285 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# devpi documentation build configuration file, created by
|
||||||
|
# sphinx-quickstart on Mon Jun 3 16:11:22 2013.
|
||||||
|
#
|
||||||
|
# This file is execfile()d with the current directory set to its containing dir.
|
||||||
|
#
|
||||||
|
# Note that not all possible configuration values are present in this
|
||||||
|
# autogenerated file.
|
||||||
|
#
|
||||||
|
# All configuration values have a default; values that are commented out
|
||||||
|
# serve to show the default.
|
||||||
|
|
||||||
|
import sys, os
|
||||||
|
|
||||||
|
# The version info for the project you're documenting, acts as replacement for
|
||||||
|
# |version| and |release|, also used in various other places throughout the
|
||||||
|
# built documents.
|
||||||
|
from deltachat import __version__ as release
|
||||||
|
version = ".".join(release.split(".")[:2])
|
||||||
|
|
||||||
|
# If extensions (or modules to document with autodoc) are in another directory,
|
||||||
|
# add these directories to sys.path here. If the directory is relative to the
|
||||||
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||||
|
#sys.path.insert(0, os.path.abspath('.'))
|
||||||
|
|
||||||
|
# -- General configuration -----------------------------------------------------
|
||||||
|
|
||||||
|
# If your documentation needs a minimal Sphinx version, state it here.
|
||||||
|
#needs_sphinx = '1.0'
|
||||||
|
|
||||||
|
# Add any Sphinx extension module names here, as strings. They can be extensions
|
||||||
|
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||||
|
extensions = [
|
||||||
|
'sphinx.ext.autodoc',
|
||||||
|
'sphinx.ext.autosummary',
|
||||||
|
#'sphinx.ext.intersphinx',
|
||||||
|
'sphinx.ext.todo',
|
||||||
|
'sphinx.ext.viewcode',
|
||||||
|
#'sphinx.ext.githubpages',
|
||||||
|
]
|
||||||
|
|
||||||
|
# Add any paths that contain templates here, relative to this directory.
|
||||||
|
templates_path = ['_templates']
|
||||||
|
|
||||||
|
# The suffix of source filenames.
|
||||||
|
source_suffix = '.rst'
|
||||||
|
|
||||||
|
# The encoding of source files.
|
||||||
|
#source_encoding = 'utf-8-sig'
|
||||||
|
|
||||||
|
# The master toctree document.
|
||||||
|
master_doc = 'index'
|
||||||
|
|
||||||
|
# General information about the project.
|
||||||
|
project = u'deltachat'
|
||||||
|
copyright = u'2018, holger krekel and contributors'
|
||||||
|
|
||||||
|
|
||||||
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
|
# for a list of supported languages.
|
||||||
|
#language = None
|
||||||
|
|
||||||
|
# There are two options for replacing |today|: either, you set today to some
|
||||||
|
# non-false value, then it is used:
|
||||||
|
#today = ''
|
||||||
|
# Else, today_fmt is used as the format for a strftime call.
|
||||||
|
#today_fmt = '%B %d, %Y'
|
||||||
|
|
||||||
|
# List of patterns, relative to source directory, that match files and
|
||||||
|
# directories to ignore when looking for source files.
|
||||||
|
exclude_patterns = ['sketch', '_build', "attic"]
|
||||||
|
|
||||||
|
# The reST default role (used for this markup: `text`) to use for all documents.
|
||||||
|
#default_role = None
|
||||||
|
|
||||||
|
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||||
|
#add_function_parentheses = True
|
||||||
|
|
||||||
|
# If true, the current module name will be prepended to all description
|
||||||
|
# unit titles (such as .. function::).
|
||||||
|
#add_module_names = True
|
||||||
|
|
||||||
|
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||||
|
# output. They are ignored by default.
|
||||||
|
#show_authors = False
|
||||||
|
|
||||||
|
# The name of the Pygments (syntax highlighting) style to use.
|
||||||
|
pygments_style = 'sphinx'
|
||||||
|
|
||||||
|
# A list of ignored prefixes for module index sorting.
|
||||||
|
#modindex_common_prefix = []
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for HTML output ---------------------------------------------------
|
||||||
|
|
||||||
|
sys.path.append(os.path.abspath('_themes'))
|
||||||
|
html_theme_path = ['_themes']
|
||||||
|
|
||||||
|
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||||
|
# a list of builtin themes.
|
||||||
|
# html_theme = 'flask'
|
||||||
|
html_theme = 'alabaster'
|
||||||
|
|
||||||
|
# Theme options are theme-specific and customize the look and feel of a theme
|
||||||
|
# further. For a list of options available for each theme, see the
|
||||||
|
# documentation.
|
||||||
|
html_theme_options = {
|
||||||
|
# 'index_logo': '_static/delta-chat.svg',
|
||||||
|
}
|
||||||
|
|
||||||
|
# Add any paths that contain custom themes here, relative to this directory.
|
||||||
|
#html_theme_path = ["_themes"]
|
||||||
|
|
||||||
|
# The name for this set of Sphinx documents. If None, it defaults to
|
||||||
|
# "<project> v<release> documentation".
|
||||||
|
#html_title = None
|
||||||
|
|
||||||
|
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||||
|
#html_short_title = None
|
||||||
|
|
||||||
|
# The name of an image file (relative to this directory) to place at the top
|
||||||
|
# of the sidebar.
|
||||||
|
html_logo = "_static/delta-chat.svg"
|
||||||
|
|
||||||
|
# The name of an image file (within the static path) to use as favicon of the
|
||||||
|
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||||
|
# pixels large.
|
||||||
|
#html_favicon = None
|
||||||
|
|
||||||
|
# Add any paths that contain custom static files (such as style sheets) here,
|
||||||
|
# relative to this directory. They are copied after the builtin static files,
|
||||||
|
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||||
|
html_static_path = ['_static']
|
||||||
|
|
||||||
|
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||||
|
# using the given strftime format.
|
||||||
|
#html_last_updated_fmt = '%b %d, %Y'
|
||||||
|
|
||||||
|
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||||
|
# typographically correct entities.
|
||||||
|
#html_use_smartypants = True
|
||||||
|
|
||||||
|
# Custom sidebar templates, maps document names to template names.
|
||||||
|
#
|
||||||
|
html_sidebars = {
|
||||||
|
'index': [
|
||||||
|
'sidebarintro.html',
|
||||||
|
'globaltoc.html',
|
||||||
|
'searchbox.html'
|
||||||
|
],
|
||||||
|
'**': [
|
||||||
|
'sidebarintro.html',
|
||||||
|
'globaltoc.html',
|
||||||
|
'relations.html',
|
||||||
|
'searchbox.html'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Additional templates that should be rendered to pages, maps page names to
|
||||||
|
# template names.
|
||||||
|
#html_additional_pages = {}
|
||||||
|
|
||||||
|
# If false, no module index is generated.
|
||||||
|
#html_domain_indices = True
|
||||||
|
|
||||||
|
# If false, no index is generated.
|
||||||
|
#html_use_index = True
|
||||||
|
|
||||||
|
# If true, the index is split into individual pages for each letter.
|
||||||
|
#html_split_index = False
|
||||||
|
|
||||||
|
# If true, links to the reST sources are added to the pages.
|
||||||
|
html_show_sourcelink = False
|
||||||
|
|
||||||
|
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||||
|
html_show_sphinx = False
|
||||||
|
|
||||||
|
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||||
|
#html_show_copyright = True
|
||||||
|
|
||||||
|
# If true, an OpenSearch description file will be output, and all pages will
|
||||||
|
# contain a <link> tag referring to it. The value of this option must be the
|
||||||
|
# base URL from which the finished HTML is served.
|
||||||
|
html_use_opensearch = 'https://doc.devpi.net'
|
||||||
|
|
||||||
|
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||||
|
#html_file_suffix = None
|
||||||
|
|
||||||
|
# Output file base name for HTML help builder.
|
||||||
|
htmlhelp_basename = 'deltachat-python'
|
||||||
|
|
||||||
|
# -- Options for LaTeX output --------------------------------------------------
|
||||||
|
|
||||||
|
latex_elements = {
|
||||||
|
# The paper size ('letterpaper' or 'a4paper').
|
||||||
|
#'papersize': 'letterpaper',
|
||||||
|
|
||||||
|
# The font size ('10pt', '11pt' or '12pt').
|
||||||
|
#'pointsize': '10pt',
|
||||||
|
|
||||||
|
# Additional stuff for the LaTeX preamble.
|
||||||
|
#'preamble': '',
|
||||||
|
}
|
||||||
|
|
||||||
|
# Grouping the document tree into LaTeX files. List of tuples
|
||||||
|
# (source start file, target name, title, author, documentclass [howto/manual]).
|
||||||
|
latex_documents = [
|
||||||
|
('index', 'devpi.tex', u'deltachat documentation',
|
||||||
|
u'holger krekel', 'manual'),
|
||||||
|
]
|
||||||
|
|
||||||
|
# The name of an image file (relative to this directory) to place at the top of
|
||||||
|
# the title page.
|
||||||
|
#latex_logo = None
|
||||||
|
|
||||||
|
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||||
|
# not chapters.
|
||||||
|
#latex_use_parts = False
|
||||||
|
|
||||||
|
# If true, show page references after internal links.
|
||||||
|
#latex_show_pagerefs = False
|
||||||
|
|
||||||
|
# If true, show URL addresses after external links.
|
||||||
|
#latex_show_urls = False
|
||||||
|
|
||||||
|
# Documents to append as an appendix to all manuals.
|
||||||
|
#latex_appendices = []
|
||||||
|
|
||||||
|
# If false, no module index is generated.
|
||||||
|
#latex_domain_indices = True
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for manual page output --------------------------------------------
|
||||||
|
|
||||||
|
# One entry per manual page. List of tuples
|
||||||
|
# (source start file, name, description, authors, manual section).
|
||||||
|
man_pages = [
|
||||||
|
('index', 'deltachat', u'deltachat documentation',
|
||||||
|
[u'holger krekel'], 1)
|
||||||
|
]
|
||||||
|
|
||||||
|
# If true, show URL addresses after external links.
|
||||||
|
#man_show_urls = False
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for Texinfo output ------------------------------------------------
|
||||||
|
|
||||||
|
# Grouping the document tree into Texinfo files. List of tuples
|
||||||
|
# (source start file, target name, title, author,
|
||||||
|
# dir menu entry, description, category)
|
||||||
|
texinfo_documents = [
|
||||||
|
('index', 'devpi', u'devpi Documentation',
|
||||||
|
u'holger krekel', 'devpi', 'One line description of project.',
|
||||||
|
'Miscellaneous'),
|
||||||
|
]
|
||||||
|
|
||||||
|
# Documents to append as an appendix to all manuals.
|
||||||
|
#texinfo_appendices = []
|
||||||
|
|
||||||
|
# If false, no module index is generated.
|
||||||
|
#texinfo_domain_indices = True
|
||||||
|
|
||||||
|
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||||
|
#texinfo_show_urls = 'footnote'
|
||||||
|
|
||||||
|
|
||||||
|
# Example configuration for intersphinx: refer to the Python standard library.
|
||||||
|
intersphinx_mapping = {'http://docs.python.org/': None}
|
||||||
|
|
||||||
|
# autodoc options
|
||||||
|
autodoc_member_order = "bysource"
|
||||||
|
# always document __init__ functions
|
||||||
|
def skip(app, what, name, obj, skip, options):
|
||||||
|
import attr
|
||||||
|
if name == "__init__":
|
||||||
|
if not hasattr(obj.im_class, "__attrs_attrs__"):
|
||||||
|
return False
|
||||||
|
return skip
|
||||||
|
|
||||||
|
def setup(app):
|
||||||
|
app.connect("autodoc-skip-member", skip)
|
||||||
|
|
19
python/doc/getting-started.rst
Normal file
19
python/doc/getting-started.rst
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
|
||||||
|
|
||||||
|
Getting started
|
||||||
|
================
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
# instantiate and configure deltachat account
|
||||||
|
import deltachat
|
||||||
|
ac1 = deltachat.Account("/tmp/db")
|
||||||
|
ac.set_config(addr="test2@hq5.merlinux.eu", mail_pw="********")
|
||||||
|
|
||||||
|
# start configuration activity and smtp/imap threads
|
||||||
|
ac.start()
|
||||||
|
|
||||||
|
# create a contact and send a message
|
||||||
|
contact = ac.create_contact("test3@hq5.merlinux.eu")
|
||||||
|
|
||||||
|
...
|
39
python/doc/index.rst
Normal file
39
python/doc/index.rst
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
deltachat: e-mail messaging/chatting API / deltachat-core C lib bindings
|
||||||
|
========================================================================
|
||||||
|
|
||||||
|
.. include:: links.rst
|
||||||
|
|
||||||
|
The deltachat library provides interfaces into the core
|
||||||
|
C-library for https://delta.chat:
|
||||||
|
|
||||||
|
- **low level bindings to deltachat-core**: ``deltachat.capi.lib`` exposes
|
||||||
|
a CFFI-interface to the `deltachat-core C-API <https://deltachat.github.io/api/index.html>`.
|
||||||
|
|
||||||
|
- **higher level bindings**: :class:`deltachat.Account` serves as a high
|
||||||
|
level object through which you can configure, send and receive messages,
|
||||||
|
create and manage groups.
|
||||||
|
|
||||||
|
Getting started
|
||||||
|
-----------------------------------------
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 2
|
||||||
|
|
||||||
|
install
|
||||||
|
getting-started
|
||||||
|
api
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:hidden:
|
||||||
|
|
||||||
|
links
|
||||||
|
changelog
|
||||||
|
|
||||||
|
..
|
||||||
|
Indices and tables
|
||||||
|
==================
|
||||||
|
|
||||||
|
* :ref:`genindex`
|
||||||
|
* :ref:`modindex`
|
||||||
|
* :ref:`search`
|
||||||
|
|
50
python/doc/install.rst
Normal file
50
python/doc/install.rst
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
|
||||||
|
deltachat python bindings
|
||||||
|
=========================
|
||||||
|
|
||||||
|
This package provides bindings to the delta-core_ C-library
|
||||||
|
which provides imap/smtp/crypto handling as well as chat/group/messages
|
||||||
|
handling to Android, Desktop and IO user interfaces.
|
||||||
|
|
||||||
|
Install
|
||||||
|
-------
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Currently the install instructions exist only for Debian based systems (Ubuntu etc.).
|
||||||
|
|
||||||
|
First you need to execute all the build steps to install the delta-core C-library,
|
||||||
|
see https://github.com/deltachat/deltachat-core/blob/master/README.md#build
|
||||||
|
|
||||||
|
Next, you need to perform::
|
||||||
|
|
||||||
|
pip install -e .
|
||||||
|
|
||||||
|
Afterwards you should be able to successfully import the bindings::
|
||||||
|
|
||||||
|
python -c "import deltachat"
|
||||||
|
|
||||||
|
|
||||||
|
Running tests
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Install the delta-core C-library and the deltachat bindings (see _Install)
|
||||||
|
and then type the following to execute tests::
|
||||||
|
|
||||||
|
pip install tox
|
||||||
|
tox
|
||||||
|
|
||||||
|
If you want to run functional tests that run against real
|
||||||
|
e-mail accounts, generate a "liveconfig" file where each
|
||||||
|
lines contains account settings, for example::
|
||||||
|
|
||||||
|
# 'liveconfig' file specifying imap/smtp accounts
|
||||||
|
addr=some-email@example.org mail_pw=password
|
||||||
|
addr=other-email@example.org mail_pw=otherpassword
|
||||||
|
|
||||||
|
And then run the tests with this live-accounts config file::
|
||||||
|
|
||||||
|
tox -- --liveconfig liveconfig
|
||||||
|
|
||||||
|
|
||||||
|
.. _`delta-core`: https://github.com/deltachat/deltachat-core
|
11
python/doc/links.rst
Normal file
11
python/doc/links.rst
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
links
|
||||||
|
================================
|
||||||
|
|
||||||
|
.. _`deltachat`: https://delta.chat
|
||||||
|
.. _`deltachat-core repo`: https://github.com/deltachat
|
||||||
|
.. _pip: http://pypi.org/project/pip/
|
||||||
|
.. _virtualenv: http://pypi.org/project/virtualenv/
|
||||||
|
.. _merlinux: http://merlinux.eu
|
||||||
|
.. _pypi: http://pypi.org/
|
||||||
|
.. _`issue-tracker`: https://github.com/deltachat/deltachat-core
|
190
python/doc/make.bat
Normal file
190
python/doc/make.bat
Normal file
|
@ -0,0 +1,190 @@
|
||||||
|
@ECHO OFF
|
||||||
|
|
||||||
|
REM Command file for Sphinx documentation
|
||||||
|
|
||||||
|
if "%SPHINXBUILD%" == "" (
|
||||||
|
set SPHINXBUILD=sphinx-build
|
||||||
|
)
|
||||||
|
set BUILDDIR=_build
|
||||||
|
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
|
||||||
|
set I18NSPHINXOPTS=%SPHINXOPTS% .
|
||||||
|
if NOT "%PAPER%" == "" (
|
||||||
|
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
|
||||||
|
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "" goto help
|
||||||
|
|
||||||
|
if "%1" == "help" (
|
||||||
|
:help
|
||||||
|
echo.Please use `make ^<target^>` where ^<target^> is one of
|
||||||
|
echo. html to make standalone HTML files
|
||||||
|
echo. dirhtml to make HTML files named index.html in directories
|
||||||
|
echo. singlehtml to make a single large HTML file
|
||||||
|
echo. pickle to make pickle files
|
||||||
|
echo. json to make JSON files
|
||||||
|
echo. htmlhelp to make HTML files and a HTML help project
|
||||||
|
echo. qthelp to make HTML files and a qthelp project
|
||||||
|
echo. devhelp to make HTML files and a Devhelp project
|
||||||
|
echo. epub to make an epub
|
||||||
|
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
|
||||||
|
echo. text to make text files
|
||||||
|
echo. man to make manual pages
|
||||||
|
echo. texinfo to make Texinfo files
|
||||||
|
echo. gettext to make PO message catalogs
|
||||||
|
echo. changes to make an overview over all changed/added/deprecated items
|
||||||
|
echo. linkcheck to check all external links for integrity
|
||||||
|
echo. doctest to run all doctests embedded in the documentation if enabled
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "clean" (
|
||||||
|
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
|
||||||
|
del /q /s %BUILDDIR%\*
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "html" (
|
||||||
|
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "dirhtml" (
|
||||||
|
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "singlehtml" (
|
||||||
|
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "pickle" (
|
||||||
|
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished; now you can process the pickle files.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "json" (
|
||||||
|
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished; now you can process the JSON files.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "htmlhelp" (
|
||||||
|
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished; now you can run HTML Help Workshop with the ^
|
||||||
|
.hhp project file in %BUILDDIR%/htmlhelp.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "qthelp" (
|
||||||
|
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished; now you can run "qcollectiongenerator" with the ^
|
||||||
|
.qhcp project file in %BUILDDIR%/qthelp, like this:
|
||||||
|
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\devpi.qhcp
|
||||||
|
echo.To view the help file:
|
||||||
|
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\devpi.ghc
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "devhelp" (
|
||||||
|
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "epub" (
|
||||||
|
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The epub file is in %BUILDDIR%/epub.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "latex" (
|
||||||
|
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "text" (
|
||||||
|
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The text files are in %BUILDDIR%/text.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "man" (
|
||||||
|
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The manual pages are in %BUILDDIR%/man.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "texinfo" (
|
||||||
|
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "gettext" (
|
||||||
|
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "changes" (
|
||||||
|
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.The overview file is in %BUILDDIR%/changes.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "linkcheck" (
|
||||||
|
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Link check complete; look for any errors in the above output ^
|
||||||
|
or in %BUILDDIR%/linkcheck/output.txt.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "doctest" (
|
||||||
|
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Testing of doctests in the sources finished, look at the ^
|
||||||
|
results in %BUILDDIR%/doctest/output.txt.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
:end
|
|
@ -1,17 +1,18 @@
|
||||||
import setuptools
|
import setuptools
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
with open('README.rst') as fd:
|
long_description, version = read_meta()
|
||||||
long_description = fd.read()
|
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name='deltachat',
|
name='deltachat',
|
||||||
version='0.1',
|
version=version,
|
||||||
description='Python bindings for deltachat-core using CFFI',
|
description='Python bindings for deltachat-core using CFFI',
|
||||||
long_description = long_description,
|
long_description = long_description,
|
||||||
author='holger krekel and contributors',
|
author='holger krekel, bjoern petersen and contributors',
|
||||||
setup_requires=['cffi>=1.0.0'],
|
setup_requires=['cffi>=1.0.0'],
|
||||||
install_requires=['cffi>=1.0.0', 'requests', 'attr'],
|
install_requires=['cffi>=1.0.0', 'requests', 'attrs'],
|
||||||
packages=setuptools.find_packages('src'),
|
packages=setuptools.find_packages('src'),
|
||||||
package_dir={'': 'src'},
|
package_dir={'': 'src'},
|
||||||
cffi_modules=['src/deltachat/_build.py:ffibuilder'],
|
cffi_modules=['src/deltachat/_build.py:ffibuilder'],
|
||||||
|
@ -25,6 +26,21 @@ def main():
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def read_meta():
|
||||||
|
with open('README.rst') as fd:
|
||||||
|
long_description = fd.read()
|
||||||
|
with open(os.path.join("src", "deltachat", "__init__.py")) as f:
|
||||||
|
for line in f:
|
||||||
|
m = re.match('__version__ = "(\S*).*"', line)
|
||||||
|
if m:
|
||||||
|
version, = m.groups()
|
||||||
|
|
||||||
|
with open("README.rst") as f:
|
||||||
|
long_desc = f.read()
|
||||||
|
return long_desc, version
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,9 @@ from deltachat.capi import ffi
|
||||||
from deltachat.account import Account # noqa
|
from deltachat.account import Account # noqa
|
||||||
|
|
||||||
|
|
||||||
|
__version__ = "0.5.dev"
|
||||||
|
|
||||||
|
|
||||||
_DC_CALLBACK_MAP = {}
|
_DC_CALLBACK_MAP = {}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
""" Delta.Chat high level API objects. """
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import threading
|
import threading
|
||||||
import re
|
import re
|
||||||
|
@ -11,7 +13,7 @@ except ImportError:
|
||||||
import deltachat
|
import deltachat
|
||||||
from . import capi
|
from . import capi
|
||||||
from .capi import ffi, lib
|
from .capi import ffi, lib
|
||||||
from .types import cached_property
|
from .types import cached_property, property_with_doc
|
||||||
import attr
|
import attr
|
||||||
from attr import validators as v
|
from attr import validators as v
|
||||||
|
|
||||||
|
@ -81,6 +83,10 @@ class EventLogger:
|
||||||
|
|
||||||
@attr.s
|
@attr.s
|
||||||
class Contact(object):
|
class Contact(object):
|
||||||
|
""" Delta-Chat Contact. You obtain instances of it through the :class:`Account`.
|
||||||
|
|
||||||
|
:ivar id: integer id of this chat.
|
||||||
|
"""
|
||||||
dc_context = attr.ib(validator=v.instance_of(ffi.CData))
|
dc_context = attr.ib(validator=v.instance_of(ffi.CData))
|
||||||
id = attr.ib(validator=v.instance_of(int))
|
id = attr.ib(validator=v.instance_of(int))
|
||||||
|
|
||||||
|
@ -92,12 +98,14 @@ class Contact(object):
|
||||||
if self._property_cache:
|
if self._property_cache:
|
||||||
dc_contact_unref(self.dc_contact_t)
|
dc_contact_unref(self.dc_contact_t)
|
||||||
|
|
||||||
@property
|
@property_with_doc
|
||||||
def addr(self):
|
def addr(self):
|
||||||
|
""" normalized e-mail address for this account. """
|
||||||
return ffi_unicode(capi.lib.dc_contact_get_addr(self.dc_contact_t))
|
return ffi_unicode(capi.lib.dc_contact_get_addr(self.dc_contact_t))
|
||||||
|
|
||||||
@property
|
@property_with_doc
|
||||||
def display_name(self):
|
def display_name(self):
|
||||||
|
""" display name for this contact. """
|
||||||
return ffi_unicode(capi.lib.dc_contact_get_display_name(self.dc_contact_t))
|
return ffi_unicode(capi.lib.dc_contact_get_display_name(self.dc_contact_t))
|
||||||
|
|
||||||
def is_blocked(self):
|
def is_blocked(self):
|
||||||
|
@ -111,6 +119,9 @@ class Contact(object):
|
||||||
|
|
||||||
@attr.s
|
@attr.s
|
||||||
class Chat(object):
|
class Chat(object):
|
||||||
|
""" Chat object which manages members and through which you can send and retrieve messages.
|
||||||
|
"""
|
||||||
|
|
||||||
dc_context = attr.ib(validator=v.instance_of(ffi.CData))
|
dc_context = attr.ib(validator=v.instance_of(ffi.CData))
|
||||||
id = attr.ib(validator=v.instance_of(int))
|
id = attr.ib(validator=v.instance_of(int))
|
||||||
|
|
||||||
|
@ -127,19 +138,29 @@ class Chat(object):
|
||||||
return self.id == lib.DC_CHAT_ID_DEADDROP
|
return self.id == lib.DC_CHAT_ID_DEADDROP
|
||||||
|
|
||||||
def send_text_message(self, msg):
|
def send_text_message(self, msg):
|
||||||
""" send a text message and return the resulting Message instance. """
|
""" send a text message and return the resulting Message instance.
|
||||||
|
|
||||||
|
:param msg: unicode text
|
||||||
|
:returns: the resulting :class:`Message` instance
|
||||||
|
"""
|
||||||
msg = convert_to_bytes_utf8(msg)
|
msg = convert_to_bytes_utf8(msg)
|
||||||
print ("chat id", self.id)
|
print ("chat id", self.id)
|
||||||
msg_id = capi.lib.dc_send_text_msg(self.dc_context, self.id, msg)
|
msg_id = capi.lib.dc_send_text_msg(self.dc_context, self.id, msg)
|
||||||
return Message(self.dc_context, msg_id)
|
return Message(self.dc_context, msg_id)
|
||||||
|
|
||||||
def get_messages(self):
|
def get_messages(self):
|
||||||
""" return list of messages in this chat. """
|
""" return list of messages in this chat.
|
||||||
|
|
||||||
|
:returns: list of Message objects for this chat.
|
||||||
|
"""
|
||||||
dc_array_t = lib.dc_get_chat_msgs(self.dc_context, self.id, 0, 0)
|
dc_array_t = lib.dc_get_chat_msgs(self.dc_context, self.id, 0, 0)
|
||||||
return list(iter_array_and_unref(dc_array_t, lambda x: Message(self.dc_context, x)))
|
return list(iter_array_and_unref(dc_array_t, lambda x: Message(self.dc_context, x)))
|
||||||
|
|
||||||
def count_fresh_messages(self):
|
def count_fresh_messages(self):
|
||||||
""" return number of fresh messages in this chat. """
|
""" return number of fresh messages in this chat.
|
||||||
|
|
||||||
|
:returns: number of fresh messages
|
||||||
|
"""
|
||||||
return lib.dc_get_fresh_msg_cnt(self.dc_context, self.id)
|
return lib.dc_get_fresh_msg_cnt(self.dc_context, self.id)
|
||||||
|
|
||||||
def mark_noticed(self):
|
def mark_noticed(self):
|
||||||
|
@ -152,6 +173,7 @@ class Chat(object):
|
||||||
|
|
||||||
@attr.s
|
@attr.s
|
||||||
class Message(object):
|
class Message(object):
|
||||||
|
""" Message object. """
|
||||||
dc_context = attr.ib(validator=v.instance_of(ffi.CData))
|
dc_context = attr.ib(validator=v.instance_of(ffi.CData))
|
||||||
id = attr.ib(validator=v.instance_of(int))
|
id = attr.ib(validator=v.instance_of(int))
|
||||||
|
|
||||||
|
@ -163,18 +185,34 @@ class Message(object):
|
||||||
if self._property_cache:
|
if self._property_cache:
|
||||||
dc_msg_unref(self.dc_msg_t)
|
dc_msg_unref(self.dc_msg_t)
|
||||||
|
|
||||||
@property
|
@property_with_doc
|
||||||
def text(self):
|
def text(self):
|
||||||
|
"""unicode representation. """
|
||||||
return ffi_unicode(capi.lib.dc_msg_get_text(self.dc_msg_t))
|
return ffi_unicode(capi.lib.dc_msg_get_text(self.dc_msg_t))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def chat(self):
|
def chat(self):
|
||||||
|
"""chat this message was posted in.
|
||||||
|
|
||||||
|
:returns: :class:`Chat` object
|
||||||
|
"""
|
||||||
chat_id = capi.lib.dc_msg_get_chat_id(self.dc_msg_t)
|
chat_id = capi.lib.dc_msg_get_chat_id(self.dc_msg_t)
|
||||||
return Chat(self.dc_context, chat_id)
|
return Chat(self.dc_context, chat_id)
|
||||||
|
|
||||||
|
|
||||||
class Account(object):
|
class Account(object):
|
||||||
|
""" An account contains configuration and provides methods
|
||||||
|
for configuration, contact and chat creation and manipulation.
|
||||||
|
"""
|
||||||
def __init__(self, db_path, logid=None):
|
def __init__(self, db_path, logid=None):
|
||||||
|
""" initialize account object.
|
||||||
|
|
||||||
|
:param db_path: a path to the account database. The database
|
||||||
|
will be created if it doesn't exist.
|
||||||
|
:param logid: an optional logging prefix that should be used with
|
||||||
|
the default internal logging.
|
||||||
|
"""
|
||||||
|
|
||||||
self.dc_context = ctx = capi.lib.dc_context_new(
|
self.dc_context = ctx = capi.lib.dc_context_new(
|
||||||
capi.lib.py_dc_callback,
|
capi.lib.py_dc_callback,
|
||||||
capi.ffi.NULL, capi.ffi.NULL)
|
capi.ffi.NULL, capi.ffi.NULL)
|
||||||
|
@ -189,39 +227,66 @@ class Account(object):
|
||||||
dc_context_unref(self.dc_context)
|
dc_context_unref(self.dc_context)
|
||||||
|
|
||||||
def set_config(self, **kwargs):
|
def set_config(self, **kwargs):
|
||||||
|
""" set configuration values.
|
||||||
|
|
||||||
|
:param kwargs: name=value settings for this account.
|
||||||
|
values need to be unicode.
|
||||||
|
:returns: None
|
||||||
|
"""
|
||||||
for name, value in kwargs.items():
|
for name, value in kwargs.items():
|
||||||
name = name.encode("utf8")
|
name = name.encode("utf8")
|
||||||
value = value.encode("utf8")
|
value = value.encode("utf8")
|
||||||
capi.lib.dc_set_config(self.dc_context, name, value)
|
capi.lib.dc_set_config(self.dc_context, name, value)
|
||||||
|
|
||||||
def get_config(self, name):
|
def get_config(self, name):
|
||||||
|
""" return unicode string value.
|
||||||
|
|
||||||
|
:param name: configuration key to lookup (eg "addr" or "mail_pw")
|
||||||
|
:returns: unicode value
|
||||||
|
"""
|
||||||
name = name.encode("utf8")
|
name = name.encode("utf8")
|
||||||
res = capi.lib.dc_get_config(self.dc_context, name, b'')
|
res = capi.lib.dc_get_config(self.dc_context, name, b'')
|
||||||
return ffi_unicode(res)
|
return ffi_unicode(res)
|
||||||
|
|
||||||
def is_configured(self):
|
def is_configured(self):
|
||||||
|
""" determine if the account is configured already.
|
||||||
|
|
||||||
|
:returns: True if account is configured.
|
||||||
|
"""
|
||||||
return capi.lib.dc_is_configured(self.dc_context)
|
return capi.lib.dc_is_configured(self.dc_context)
|
||||||
|
|
||||||
def check_is_configured(self):
|
def check_is_configured(self):
|
||||||
|
""" Raise ValueError if this account is not configured. """
|
||||||
if not self.is_configured():
|
if not self.is_configured():
|
||||||
raise ValueError("need to configure first")
|
raise ValueError("need to configure first")
|
||||||
|
|
||||||
def get_self_contact(self):
|
def get_self_contact(self):
|
||||||
|
""" return this account's identity as a :class:`Contact`.
|
||||||
|
|
||||||
|
:returns: :class:`Contact`
|
||||||
|
"""
|
||||||
self.check_is_configured()
|
self.check_is_configured()
|
||||||
return Contact(self.dc_context, capi.lib.DC_CONTACT_ID_SELF)
|
return Contact(self.dc_context, capi.lib.DC_CONTACT_ID_SELF)
|
||||||
|
|
||||||
def create_contact(self, email, name=ffi.NULL):
|
def create_contact(self, email, name=ffi.NULL):
|
||||||
|
""" Return a :class:`Contact` object.
|
||||||
|
|
||||||
|
:param email: email-address (text type)
|
||||||
|
:param name: display name for this contact (optional)
|
||||||
|
:returns: :class:`Contact` instance.
|
||||||
|
"""
|
||||||
name = convert_to_bytes_utf8(name)
|
name = convert_to_bytes_utf8(name)
|
||||||
email = convert_to_bytes_utf8(email)
|
email = convert_to_bytes_utf8(email)
|
||||||
contact_id = capi.lib.dc_create_contact(self.dc_context, name, email)
|
contact_id = capi.lib.dc_create_contact(self.dc_context, name, email)
|
||||||
return Contact(self.dc_context, contact_id)
|
return Contact(self.dc_context, contact_id)
|
||||||
|
|
||||||
def get_contacts(self, query=ffi.NULL, with_self=False, only_verified=False):
|
def get_contacts(self, query=ffi.NULL, with_self=False, only_verified=False):
|
||||||
""" return list of :pyclass:`Contact` objects.
|
""" return list of :class:`Contact` objects.
|
||||||
|
|
||||||
:query: if a string is specified, only return contacts whose name or e-mail matches query.
|
:param query: if a string is specified, only return contacts
|
||||||
:only_verified: if true only return verified contacts.
|
whose name or e-mail matches query.
|
||||||
:with_self: if true the self-contact is also returned.
|
:param only_verified: if true only return verified contacts.
|
||||||
|
:param with_self: if true the self-contact is also returned.
|
||||||
"""
|
"""
|
||||||
flags = 0
|
flags = 0
|
||||||
query = convert_to_bytes_utf8(query)
|
query = convert_to_bytes_utf8(query)
|
||||||
|
@ -235,7 +300,7 @@ class Account(object):
|
||||||
def create_chat_by_contact(self, contact):
|
def create_chat_by_contact(self, contact):
|
||||||
""" return a Chat object with the specified contact.
|
""" return a Chat object with the specified contact.
|
||||||
|
|
||||||
@param contact: chat_id (int) or contact object.
|
:param contact: chat_id (int) or contact object.
|
||||||
"""
|
"""
|
||||||
contact_id = getattr(contact, "id", contact)
|
contact_id = getattr(contact, "id", contact)
|
||||||
assert isinstance(contact_id, int)
|
assert isinstance(contact_id, int)
|
||||||
|
@ -246,7 +311,7 @@ class Account(object):
|
||||||
def create_chat_by_message(self, message):
|
def create_chat_by_message(self, message):
|
||||||
""" return a Chat object for the given message.
|
""" return a Chat object for the given message.
|
||||||
|
|
||||||
@param message: messsage id or message instance.
|
:param message: messsage id or message instance.
|
||||||
"""
|
"""
|
||||||
msg_id = getattr(message, "id", message)
|
msg_id = getattr(message, "id", message)
|
||||||
assert isinstance(msg_id, int)
|
assert isinstance(msg_id, int)
|
||||||
|
@ -254,12 +319,16 @@ class Account(object):
|
||||||
return Chat(self.dc_context, chat_id)
|
return Chat(self.dc_context, chat_id)
|
||||||
|
|
||||||
def get_message_by_id(self, msg_id):
|
def get_message_by_id(self, msg_id):
|
||||||
|
""" return a message object.
|
||||||
|
|
||||||
|
:returns: :class:`Message` instance.
|
||||||
|
"""
|
||||||
return Message(self.dc_context, msg_id)
|
return Message(self.dc_context, msg_id)
|
||||||
|
|
||||||
def mark_seen_messages(self, messages):
|
def mark_seen_messages(self, messages):
|
||||||
""" mark the given set of messages as seen.
|
""" mark the given set of messages as seen.
|
||||||
|
|
||||||
:messages: a list of message ids or Message instances.
|
:param messages: a list of message ids or Message instances.
|
||||||
"""
|
"""
|
||||||
arr = array("i")
|
arr = array("i")
|
||||||
for msg in messages:
|
for msg in messages:
|
||||||
|
@ -269,11 +338,14 @@ class Account(object):
|
||||||
lib.dc_markseen_msgs(self.dc_context, msg_ids, len(messages))
|
lib.dc_markseen_msgs(self.dc_context, msg_ids, len(messages))
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
|
""" configure this account object, start receiving events,
|
||||||
|
start IMAP/SMTP threads. """
|
||||||
deltachat.set_context_callback(self.dc_context, self._process_event)
|
deltachat.set_context_callback(self.dc_context, self._process_event)
|
||||||
capi.lib.dc_configure(self.dc_context)
|
capi.lib.dc_configure(self.dc_context)
|
||||||
self._threads.start()
|
self._threads.start()
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
|
""" shutdown IMAP/SMTP threads and stop receiving events"""
|
||||||
deltachat.clear_context_callback(self.dc_context)
|
deltachat.clear_context_callback(self.dc_context)
|
||||||
self._threads.stop(wait=True)
|
self._threads.stop(wait=True)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
|
|
||||||
|
|
||||||
|
def property_with_doc(f):
|
||||||
|
return property(f, None, None, f.__doc__)
|
||||||
|
|
||||||
|
|
||||||
# copied over unmodified from
|
# copied over unmodified from
|
||||||
# https://github.com/devpi/devpi/blob/master/common/devpi_common/types.py
|
# https://github.com/devpi/devpi/blob/master/common/devpi_common/types.py
|
||||||
|
|
||||||
|
|
||||||
def cached_property(f):
|
def cached_property(f):
|
||||||
"""returns a cached property that is calculated by function f"""
|
"""returns a cached property that is calculated by function f"""
|
||||||
def get(self):
|
def get(self):
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
[tox]
|
[tox]
|
||||||
minversion = 2.0
|
|
||||||
distshare = {homedir}/.tox/distshare
|
|
||||||
# make sure to update environment list in travis.yml and appveyor.yml
|
# make sure to update environment list in travis.yml and appveyor.yml
|
||||||
envlist =
|
envlist =
|
||||||
py27
|
py27
|
||||||
py35
|
py35
|
||||||
lint
|
lint
|
||||||
|
doc
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
commands = pytest {posargs:tests}
|
commands = pytest {posargs:tests}
|
||||||
|
@ -29,6 +28,17 @@ commands =
|
||||||
flake8 tests/
|
flake8 tests/
|
||||||
rst-lint --encoding 'utf-8' README.rst
|
rst-lint --encoding 'utf-8' README.rst
|
||||||
|
|
||||||
|
[testenv:doc]
|
||||||
|
usedevelop = True
|
||||||
|
deps =
|
||||||
|
sphinx
|
||||||
|
|
||||||
|
whitelist_externals = make
|
||||||
|
changedir = doc
|
||||||
|
commands =
|
||||||
|
make html
|
||||||
|
|
||||||
|
|
||||||
[pytest]
|
[pytest]
|
||||||
python_files = tests/test_*.py
|
python_files = tests/test_*.py
|
||||||
norecursedirs = .tox
|
norecursedirs = .tox
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue