summaryrefslogtreecommitdiff
path: root/src/roster.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2011-05-24 20:33:37 +0200
committermathieui <mathieui@mathieui.net>2011-05-24 20:33:37 +0200
commit5d1953a807333c6e013d6be818f2e7c7133201df (patch)
treee97c21eef154a44c2423a5d19534a16522d33ca6 /src/roster.py
parent7182f968682909760a2e0f35a27510e861202d08 (diff)
downloadpoezio-5d1953a807333c6e013d6be818f2e7c7133201df.tar.gz
poezio-5d1953a807333c6e013d6be818f2e7c7133201df.tar.bz2
poezio-5d1953a807333c6e013d6be818f2e7c7133201df.tar.xz
poezio-5d1953a807333c6e013d6be818f2e7c7133201df.zip
fixes #2187 (import/export)
Diffstat (limited to 'src/roster.py')
-rw-r--r--src/roster.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/roster.py b/src/roster.py
index 79de1868..aed5f5a0 100644
--- a/src/roster.py
+++ b/src/roster.py
@@ -22,6 +22,7 @@ import logging
log = logging.getLogger(__name__)
from config import config
+from os import path as p
from contact import Contact, Resource
from sleekxmpp.xmlstream.stanzabase import JID
@@ -33,6 +34,17 @@ class Roster(object):
self._contacts = {} # key = bare jid; value = Contact()
self._roster_groups = []
+ def export(self, path):
+ if p.isfile(path):
+ return
+ try:
+ f = open(path, 'w+')
+ f.writelines([i + "\n" for i in self._contacts])
+ f.close()
+ return True
+ except IOError:
+ return
+
def add_contact(self, contact, jid):
"""
Add a contact to the contact list