1

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)

FernandoG
  • 51
  • 8

2 Answers2

1

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

FernandoG
  • 51
  • 8
0

You need to use PurpleConversationGetChatData method, it takes conversation id as a parameter (14414 in your case).

I have javascript client generated from introspection xml, it might be helpful addition to a dbus documentation - https://github.com/sidorares/node-pidgin/blob/master/index.js

Andrey Sidorov
  • 24,905
  • 4
  • 62
  • 75
  • Thank you, this sounds perfect. I'll try it and let you know. – FernandoG Aug 06 '14 at 17:21
  • Thanks to your answer @Andrey I got to [List of pidgin Methods](http://pidgin.sourcearchive.com/documentation/2.4.3-4lenny8/conversation_8h_4bf104e6b7080e7af44c10c2cce0aea3.html#4bf104e6b7080e7af44c10c2cce0aea3) and I found what i was looking for. Thank you – FernandoG Aug 07 '14 at 02:09