introduction to kopano... python-kopano 2 years ago started hacking on a high level python api acts...

22
www.kopano.com Introduction to Kopano Jelle van der Waa 1 / 22

Upload: others

Post on 11-May-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to Kopano... Python-kopano 2 years ago started hacking on a high level Python API Acts as a MAPI client Abstracts MAPI Easy to interface Tools / programs built on top

www.kopano.com

Introduction to KopanoJelle van der Waa

1 / 22

Page 2: Introduction to Kopano... Python-kopano 2 years ago started hacking on a high level Python API Acts as a MAPI client Abstracts MAPI Easy to interface Tools / programs built on top

www.kopano.com

$ whoamiDeveloper @ KopanoArch Linux Developer [email protected] / [email protected] @jelly @jvdwaa

2 / 22

Page 3: Introduction to Kopano... Python-kopano 2 years ago started hacking on a high level Python API Acts as a MAPI client Abstracts MAPI Easy to interface Tools / programs built on top

www.kopano.com

IntroductionOpen source communication, collaboration and sharing platformEmail, video, calendaring, tasks, notes and file sharingFork of ZarafaImplements the MAPI SpecificationAGPLv3

3 / 22

Page 4: Introduction to Kopano... Python-kopano 2 years ago started hacking on a high level Python API Acts as a MAPI client Abstracts MAPI Easy to interface Tools / programs built on top

www.kopano.com

IMAP / POP3 /CalDav supportActiveSync formobile devices / OL(13 and higher)Our own web anddesktop clientplugin support forweb / desktop client

Architecture (clients)

4 / 22

Page 5: Introduction to Kopano... Python-kopano 2 years ago started hacking on a high level Python API Acts as a MAPI client Abstracts MAPI Easy to interface Tools / programs built on top

www.kopano.com

Use of any MTApossibleMySQL as MAPIstorage dbVarious userbackends: LDAP, AD,DB, UnixAttachments on diskor S3 based(protocol)Multi-serverarchitecture

Architecture (backend)

5 / 22

Page 6: Introduction to Kopano... Python-kopano 2 years ago started hacking on a high level Python API Acts as a MAPI client Abstracts MAPI Easy to interface Tools / programs built on top

www.kopano.com

Architecture (backend)All data is stored as MAPI objectsBindings for C++, PHP, Python for MAPI ClientsConversion to eml, vcf, ics to and from MAPISOAP for transportDoes not implement the DCE/RPC, MAPI/HTTP or "Outlook anywhere"

6 / 22

Page 7: Introduction to Kopano... Python-kopano 2 years ago started hacking on a high level Python API Acts as a MAPI client Abstracts MAPI Easy to interface Tools / programs built on top

www.kopano.com

Z-PushOpen Source ActiveSync implementationSync mail, calender, contacts and tasks to Written in PHP (uses PHP-mapi extension)Supports multiple backends (Kopano, Maildir, Vcard, IMAP)Kopano Outlook Extension (KOE) - Extends the feature-set of OL'sActiveSync Implementation

http://z-push.org https://stash.z-hub.io/projects/ZP/repos/z-push/browsehttps://stash.kopano.io/projects/KOE/repos/kopano_ol_extension_source/browse

7 / 22

Page 8: Introduction to Kopano... Python-kopano 2 years ago started hacking on a high level Python API Acts as a MAPI client Abstracts MAPI Easy to interface Tools / programs built on top

www.kopano.com

MAPI (Objects)Store └── Folder └── Item └── Attachment

Proptag Proptype ValuePR_SUBJECT PT_STRING 'hello'PR_HASATTACH PT_BOOLEAN FalsePR_CREATION_TIME PT_SYSTIME 2017-01-26 10:26:22PR_MESSAGE_FLAGS PT_LONG 8

PR_SUBJECT = PROP_TAG( PT_TSTRING, 0x0037)mapiobj.SetProps([SPropValue(PR_SUBJECT, 'subject')], 0)mapiobj.GetProps([PR_SUBJECT], 0)

8 / 22

Page 9: Introduction to Kopano... Python-kopano 2 years ago started hacking on a high level Python API Acts as a MAPI client Abstracts MAPI Easy to interface Tools / programs built on top

www.kopano.com

MAPI (Good parts)Technology from ~ '80, still developedExtensibleICS framework (Incremental change synchronisation)

9 / 22

Page 10: Introduction to Kopano... Python-kopano 2 years ago started hacking on a high level Python API Acts as a MAPI client Abstracts MAPI Easy to interface Tools / programs built on top

www.kopano.com

MAPI (Bad parts)Hard to graspLow-levelDocumentationLegacy

10 / 22

Page 11: Introduction to Kopano... Python-kopano 2 years ago started hacking on a high level Python API Acts as a MAPI client Abstracts MAPI Easy to interface Tools / programs built on top

www.kopano.com

Python-kopano2 years ago started hacking on a high level Python APIActs as a MAPI clientAbstracts MAPIEasy to interfaceTools / programs built on top of it

Examples:

SearchBackupSpam learning daemonDebugging toolsFunctional tests

https://stash.kopano.io/projects/KSC/repos/lab-scripts/browse/python-kopano https://stash.kopano.io/projects/KSC/repos/kopano-spamd/browse

11 / 22

Page 12: Introduction to Kopano... Python-kopano 2 years ago started hacking on a high level Python API Acts as a MAPI client Abstracts MAPI Easy to interface Tools / programs built on top

www.kopano.com

MAPI Example (email)session = OpenECSession('user1','pass',os.getenv('KOPANO_SOCKET'))

12 / 22

Page 13: Introduction to Kopano... Python-kopano 2 years ago started hacking on a high level Python API Acts as a MAPI client Abstracts MAPI Easy to interface Tools / programs built on top

www.kopano.com

MAPI Example (email)session = OpenECSession('user1','pass',os.getenv('KOPANO_SOCKET'))

store = GetDefaultStore(session)outboxid = HrGetOneProp(store, PR_IPM_OUTBOX_ENTRYID).Valueoutbox = store.OpenEntry(outboxid, None, MAPI_MODIFY)

13 / 22

Page 14: Introduction to Kopano... Python-kopano 2 years ago started hacking on a high level Python API Acts as a MAPI client Abstracts MAPI Easy to interface Tools / programs built on top

www.kopano.com

MAPI Example (email)session = OpenECSession('user1','pass',os.getenv('KOPANO_SOCKET'))

store = GetDefaultStore(session)outboxid = HrGetOneProp(store, PR_IPM_OUTBOX_ENTRYID).Valueoutbox = store.OpenEntry(outboxid, None, MAPI_MODIFY)

message = outbox.CreateMessage(None, 0)

14 / 22

Page 15: Introduction to Kopano... Python-kopano 2 years ago started hacking on a high level Python API Acts as a MAPI client Abstracts MAPI Easy to interface Tools / programs built on top

www.kopano.com

MAPI Example (email)session = OpenECSession('user1','pass',os.getenv('KOPANO_SOCKET'))

store = GetDefaultStore(session)outboxid = HrGetOneProp(store, PR_IPM_OUTBOX_ENTRYID).Valueoutbox = store.OpenEntry(outboxid, None, MAPI_MODIFY)

message = outbox.CreateMessage(None, 0)

message.ModifyRecipients(0, [[SPropValue(PR_RECIPIENT_TYPE, MAPI_TO), SPropValue(PR_DISPLAY_NAME, 'Jelle van der Waa'), SPropValue(PR_EMAIL_ADDRESS_A, '[email protected]') ]])message.SetProps([SPropValue(PR_SUBJECT, 'hello fosdem'), SPropValue(PR_BODY, 'empty body!')])

15 / 22

Page 16: Introduction to Kopano... Python-kopano 2 years ago started hacking on a high level Python API Acts as a MAPI client Abstracts MAPI Easy to interface Tools / programs built on top

www.kopano.com

MAPI Example (email)session = OpenECSession('user1','pass',os.getenv('KOPANO_SOCKET'))

store = GetDefaultStore(session)outboxid = HrGetOneProp(store, PR_IPM_OUTBOX_ENTRYID).Valueoutbox = store.OpenEntry(outboxid, None, MAPI_MODIFY)

message = outbox.CreateMessage(None, 0)

message.ModifyRecipients(0, [[SPropValue(PR_RECIPIENT_TYPE, MAPI_TO), SPropValue(PR_DISPLAY_NAME, 'Jelle van der Waa'), SPropValue(PR_EMAIL_ADDRESS_A, '[email protected]') ]])message.SetProps([SPropValue(PR_SUBJECT, 'hello fosdem'), SPropValue(PR_BODY, 'empty body!')])

message.SubmitMessage(0)

16 / 22

Page 17: Introduction to Kopano... Python-kopano 2 years ago started hacking on a high level Python API Acts as a MAPI client Abstracts MAPI Easy to interface Tools / programs built on top

www.kopano.com

Python-kopano Example (e-mail)import kopanoserver = kopano.Server(auth_user='user1', auth_pass='user1')user = server.user('user1')

17 / 22

Page 18: Introduction to Kopano... Python-kopano 2 years ago started hacking on a high level Python API Acts as a MAPI client Abstracts MAPI Easy to interface Tools / programs built on top

www.kopano.com

Python-kopano Example (e-mail)import kopanoserver = kopano.Server(auth_user='user1', auth_pass='user1')user = server.user('user1')

# Send e-mailuser.outbox.create_item(subject='hello fosdem', body='empty body!', to='jelle van der Waa <[email protected]>').send()

18 / 22

Page 19: Introduction to Kopano... Python-kopano 2 years ago started hacking on a high level Python API Acts as a MAPI client Abstracts MAPI Easy to interface Tools / programs built on top

www.kopano.com

Python-kopano Example# access MAPI propertyitem = next(user.inbox.items())item.subject = 'new subject'

# Iterate usersfor user in server.users(): print(user) print(user.enabled) print(user.outofoffice.enabled)

# Search!for item in user.inbox.search('hello'): print(item)

# Low-level possibleitem.mapiobj.GetProps([PR_SUBJECT], 0)

19 / 22

Page 20: Introduction to Kopano... Python-kopano 2 years ago started hacking on a high level Python API Acts as a MAPI client Abstracts MAPI Easy to interface Tools / programs built on top

www.kopano.com

DownstreamDebian - process of getting into Debianhttps://wiki.debian.org/groupware/kopanoOpenSUSE - build service repositoryhttps://build.opensuse.org/project/show/server:mail:kopano

20 / 22

Page 21: Introduction to Kopano... Python-kopano 2 years ago started hacking on a high level Python API Acts as a MAPI client Abstracts MAPI Easy to interface Tools / programs built on top

www.kopano.com

ConclusionMain website https://kopano.ioPackages https://download.kopano.io/community/Git https://stash.kopano.io https://github.com/Kopano-mirror/

21 / 22

Page 22: Introduction to Kopano... Python-kopano 2 years ago started hacking on a high level Python API Acts as a MAPI client Abstracts MAPI Easy to interface Tools / programs built on top

www.kopano.com

Questions

22 / 22