Beispiel #1
0
 def add_vcard(self, handle, name=None, kind=None):
     vcard_dir = self.data_directory('vcards', mode='w', mkdir=True)
     c = SimpleVCard()
     c.filename = os.path.join(vcard_dir, c.random_uid) + '.vcf'
     c.gpg_recipient = lambda: self.get('gpg_recipient')
     if kind == 'individual':
         c.email = handle
     else:
         c['NICKNAME'] = handle
     if name is not None: c.fn = name
     if kind is not None: c.kind = kind
     self.index_vcard(c)
     return c.save()
Beispiel #2
0
 def add_vcard(self, handle, name=None, kind=None):
   vcard_dir = self.data_directory('vcards', mode='w', mkdir=True)
   c = SimpleVCard()
   c.filename = os.path.join(vcard_dir, c.random_uid) + '.vcf'
   c.gpg_recipient = lambda: self.get('gpg_recipient')
   if kind == 'individual':
     c.email = handle
   else:
     c['NICKNAME'] = handle
   if name is not None: c.fn = name
   if kind is not None: c.kind = kind
   self.index_vcard(c)
   return c.save()
Beispiel #3
0
 def load_vcards(self, session):
     try:
         vcard_dir = self.data_directory('vcards')
         for fn in os.listdir(vcard_dir):
             try:
                 c = SimpleVCard().load(os.path.join(vcard_dir, fn))
                 c.gpg_recipient = lambda: self.get('gpg_recipient')
                 self.index_vcard(c)
                 session.ui.mark('Loaded %s' % c.email)
             except:
                 import traceback
                 traceback.print_exc()
                 session.ui.warning('Failed to load vcard %s' % fn)
     except OSError:
         pass
Beispiel #4
0
 def load_vcards(self, session):
   try:
     vcard_dir = self.data_directory('vcards')
     for fn in os.listdir(vcard_dir):
       try:
         c = SimpleVCard().load(os.path.join(vcard_dir, fn))
         c.gpg_recipient = lambda: self.get('gpg_recipient')
         self.index_vcard(c)
         session.ui.mark('Loaded %s' % c.email)
       except:
         import traceback
         traceback.print_exc()
         session.ui.warning('Failed to load vcard %s' % fn)
   except OSError:
     pass
Beispiel #5
0
 def add_vcard(self, handle, name=None, kind=None):
     vcard_dir = self.data_directory("vcards", mode="w", mkdir=True)
     c = SimpleVCard()
     c.filename = os.path.join(vcard_dir, c.random_uid) + ".vcf"
     c.gpg_recipient = lambda: self.get("gpg_recipient")
     if kind == "individual":
         c.email = handle
     else:
         c["NICKNAME"] = handle
     if name is not None:
         c.fn = name
     if kind is not None:
         c.kind = kind
     self.index_vcard(c)
     return c.save()