summaryrefslogtreecommitdiff
path: root/src/roster.py
diff options
context:
space:
mode:
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