Search code examples
pythondbuspidgin

Dbus.Array (Reading pidgin messages from python)


I am trying to read a message on a pidgin window using python. I have read Pidgin how to and I using the following code:

purple.PurpleGetConversations()

and I get the following output:

dbus.Array([dbus.Int32(14414)], signature=dbus.Signature('i'))

I dont know how to access the elements of this dbus.Array

Best Regards

PD: I am interested in reading the messages, if there is a better way please let me know

Progress update: If anyone else is interested in this, I came up with an alternative solution. Pidgin leaves chat logs in ~/purple, from python you can open this files and use regex to read all msgs.

(If there is a more straigthforward way please tell me)


Solution

  • I found it, Here is the resulting code:

        convID = purple.PurpleGetConversations()
    
        msgpos = purple.PurpleConversationGetMessageHistory(convID[0])[0]
    
        print purple.PurpleConversationMessageGetMessage(msgpos) 
    

    This will print the last message from an open chat