Example #1
0
 def get_items(self):
     name = None
     folderList = ['TopLevel']
     TRASH = 'XXXTRASHXXX'
     try:
         with codecs.open(self._contacts_path, "r", "UTF-8") as bfile:
             for line in bfile:
                 line = line.strip()
                 if line.startswith(u'-'):
                     folderList.pop()
                 elif line.startswith(u'#FOLDER'):
                     entryType = 'Folder'
                 elif line.startswith(u'#CONTACT'):
                     entryType = 'Contact'
                 elif line.startswith(u'TRASH FOLDER=YES'):
                     folderList[-1] = TRASH
                 elif line.startswith(u'NAME='):
                     name = line[5:]
                     if entryType == 'Folder':
                         folderList.append(name)
                 elif line.startswith(u'MAIL=') and name and \
                   entryType == 'Contact' and not TRASH in folderList:
                     # multiple addresses separated with
                     # two Ctrl-B (\x02) characters
                     emails = line[5:].split('\x02\x02')
                     for e in emails:
                         yield EmailContact(e, name)
     except EnvironmentError, exc:
         self.output_error(exc)
Example #2
0
	def get_items(self):
		ebook_ = evolution.ebook.open_addressbook("default")
		if not ebook_:
			return
		for contact in ebook_.get_all_contacts():
			name = contact.get_property("full-name")
			email = contact.get_property("email-1")
			if email:
				yield EmailContact(email, name)

		yield ComposeMail()
Example #3
0
	def get_items(self):
		if os.path.isfile(self._claws_addrbook_index):
			for addrbook_file in self._load_address_books():
				addrbook_filepath = os.path.join(self._claws_addrbook_dir, addrbook_file)
				if not os.path.exists(addrbook_filepath):
					continue

				try:
					dtree = minidom.parse(addrbook_filepath)
					persons = dtree.getElementsByTagName('person')
					for person in persons:
						cn = person.getAttribute('cn')
						addresses = person.getElementsByTagName('address')
						for address in addresses:
							email = address.getAttribute('email')
							yield EmailContact(email, cn)
				except (StandardError, xml.parsers.expat.ExpatError), err:
					self.output_error(err)
Example #4
0
	def get_thumbnail(self, width, height):
		if self.image:
			return icons.get_pixbuf_from_data(self.image, width, height)
		return EmailContact.get_thumbnail(self, width, height)
Example #5
0
	def __init__(self, email, name, image):
		EmailContact.__init__(self, email, name)
		self.image = image
Example #6
0
	def get_items(self):
		for name, email in support.get_contacts():
			yield EmailContact(email, name)

		yield ComposeMail()
Example #7
0
 def get_thumbnail(self, width, height):
     if self.image:
         return icons.get_pixbuf_from_data(self.image, width, height)
     return EmailContact.get_thumbnail(self, width, height)
Example #8
0
 def __init__(self, email, name, image):
     EmailContact.__init__(self, email, name)
     self.image = image