Skip navigation

Category Archives: devel

So I got accepted as a maintainer of  maemo extras repository. I also released and uploaded the the first version of Retro Conversations to extras-devel. I decided to do it early so as to have some credit in Open Source world when my GSOC proposals get reviewed.

I quickly wrapped things up,  made sure the app won’t crash/refuse to start/ behave funnily and went through creating a package process which made me suffer for 2 days. I couldn’t get happier when the application manager showed retroconv!

I will post later a short tutorial on how create deb package from python code for maemo. For now, just one advice, NEVER USE UPPER CASE IN DESCRIBING AN APP’S CATEGORY IN “SECTION” PART INSIDE CONTROL FILE!! (thanks to guys over irc..)

Retroconv Announcement

Retroconv Package Overview

Advertisements

So after 3 days of doing nothing but exploring and trying to get along with libabook and libebook APIs and how to deal with them using ctypes in python, I have to say that I failed this time. I did however find a work around. I did not notice how much bad my last working code was except today. I tried to optimize it a little bit and it worked flawlessly and loads immediately!

In the beginning I took the sender number of each message, opened the address book, searched for the number and returned it. The process took about 3 minutes for 175 contacts and about 200 msgs. Because looping over EContacts takes more time than looping over a normal List, I found it better to flip the process. Instead of trying to find the sender’s name from his number, I try to find the sender’s number inside messages from his contacts info. Meaning, instead of looping over the messages and fetch each sender’s name from address book, I loop over the address book and try to find for each contact his messages and stick his name to them.

The process might have sounded stupid a little but it works. I know it’s inefficient, especially when there is only a little number of messages and large number of contacts (miss ratio is highest) but if you think about it, a person with few messages most probably will not want to import them anyway.

I will try to test this with higher count of messages and see the result. Nevertheless, I will switch immediately to libabook or libebook APIs as soon as I find out how to use them to get what I want… in python.

Before: (called for each message)

for econtact in contacts:

	try:
		phones = econtact.get_property('phone')
		phones_p=int(str(phones)[13:-1],16)
		phoneList = GList.new(phones_p)
		
		while phoneList.has_next():
			currPhone = string_at(phoneList.next())

			if currPhone == phoneNum:
				return econtact.get_name

After: (called only once)

for contact in contacts:

	try:
		phones = contact.get_property('phone')
		phones_p=int(str(phones)[13:-1],16)
		phoneList = GList.new(phones_p)

		while phoneList.has_next():
			currPhone = string_at(phoneList.next())
			for msg in recvLst:
				if currPhone[-7:] == msg.fromNum[-7:]:
					msg.setSenderName(contact.get_name())
	except:
		continue

Following up with Retro Conversations, I’ve struggled yesterday for about 11 hours trying to find fetch a contact in address book using his/her number. I originally thought this would be an easy task, but it appears not as I found it that there are no python bindings for libabook yet.

I also found that the PyMaemo team were kind enough to write this tutorial on how to access APIs using ctypes for which there are no Python bindings yet that uses libosso-abook as an example. I read through the tutorial quickly which much of were very new to me and did not really understand.  So I  decided to explore Hermes’s source code to learn how it accesses contacts and I ended up writing this function:

def getContactNameFromPhone(self, phoneNum):
		addresses = evolution.ebook.open_addressbook('default')
		contacts = addresses.get_all_contacts()

		 #ai = GList.new(ebook.e_contact_get_attributes(hash(self._contact), E_CONTACT_EMAIL))

		for econtact in contacts:

			try:
				#print econtact.get_name()
				phones = econtact.get_property('phone')
				phones_p=int(str(phones)[13:-1],16)
				phoneList = GList.new(phones_p)

				while phoneList.has_next():
					currPhone = string_at(phoneList.next())

					if currPhone == phoneNum:
						return econtact.get_name()
			except:
				continue

which works, but if you examine the code, you’ll find that this is the worst solution ever! The app now takes about 2 or 3 minutes to start up. I also borrowed pygobject.py from Hermes to use its GList that is based on the PyMaemo tutorial I mentioned above.  I’m pretty sure things can be much simpler, I just didn’t get the whole ctypes things yet.. I guess I’m going to spend this night reading that PyMaemo tutorial again

So I mentioned before the inability of N900 to import old SMS from previous Nokia phones, and I will save the world by writing the ultimate Old SMS importer/reader 🙂

First things first, these are the project specs that I hope to accomplish:

Phase 1:

  • Inbox and Sent messages
  • Import SMS csv files
  • Old View (messages are represented by the their sender in inbox/ receiver in sent, ordered according to date of arrival, just like ordinary messaging before Nokia Conversations)
  • Options like forward, delete
  • Show contact card by tapping contact

Phase 2:

  • Mimicking the look and feel of Nokia Conversations
  • Favorites

Phase 3:

  • Find in messages
  • Filter by contact names
  • Sort

Phase 4:

  • Import directly from other phones

What I’ve done:

I can now show the received SMS list (kinetic scrolling with finger, I like that!), and tapping the sender displays his message. My next step now is associate phone numbers with contacts. I will also take a look at the Qt animation framework.

I’ve submitted the project on Maemo Garage and it has been approved in exactly 2 minutes! Now I will now explore maemo garage. Keep an eye on my project’s page: http://retroconv.garage.maemo.org 😉

So I got myself a Nokia N900 and couldn’t be more pleased with it! I was however little disappointed when I couldn’t import my contacts and SMS from my other Nokia phone like I always used to do before with previous phones. I worked around the contacts thing by copying them to my simcard then recopying to the N900. For the old SMS I found this guide on maemo talk forum for importing them to Nokia N900. I don’t really recommend it because of 2 issues:

  1. Old SMS appear to be received after new already existent SMS in conversations
  2. Not deletable

3 days ago I decided to get my hand dirty write my own Old SMS reader. It will show up as a separate application not integrated inside the original conversation application. This my first app on maemo and things could not get easier! Using Python and Qt I can say that I’ve done quite good progress in no time. I’ll post up the project features and progress shortly