I'm using a python script with the dbus interface to send messages to my buddies. It works perfectly, except it won't send messages to group conversations. There's no error message or exception, it just silently fails to do what it's meant to do. I've posted my script below in case I've made a mistake in it. Is PurpleConvImSend not meant to work with group chats? Should I be using a different function? Any help/suggestions are appreciated.
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/pythonimportsys,dbus,gobject;bus=dbus.SessionBus()obj=bus.get_object("im.pidgin.purple.PurpleService","/im/pidgin/purple/PurpleObject")purple=dbus.Interface(obj,"im.pidgin.purple.PurpleInterface")forconvinpurple.PurpleGetConversations():user=purple.PurpleConversationGetName(conv)name=purple.PurpleBuddyGetAlias(purple.PurpleFindBuddy(purple.PurpleConversationGetAccount(conv),user))iflen(sys.argv)==1:printuser+'|'+nameelifuser==sys.argv[1]:purple.PurpleConvImSend(purple.PurpleConvIm(conv),sys.argv[2])print"Sending \""+sys.argv[2]+"\" to "+sys.argv[1]
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
PurpleConvImSend will only send to an IM conversation (two-person). In pidgin terms that's what IM means. To send to chats you would need to get the PurpleConvChat data from the conversation and use PurpleConvChatSend.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the help! I'm surprised PurpleConvImSend isn't mentioned on this page. Is there a more comprehensive list of functions available via Dbus?
I've now modified the script to work with group chats. Here it is for future reference:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/pythonimportsys,dbus,gobject;bus=dbus.SessionBus()obj=bus.get_object("im.pidgin.purple.PurpleService","/im/pidgin/purple/PurpleObject")purple=dbus.Interface(obj,"im.pidgin.purple.PurpleInterface")forconvinpurple.PurpleGetConversations():user=purple.PurpleConversationGetName(conv)name=purple.PurpleBuddyGetAlias(purple.PurpleFindBuddy(purple.PurpleConversationGetAccount(conv),user))iflen(sys.argv)==1:printuser+'|'+nameelifuser==sys.argv[1]:ifpurple.PurpleConversationGetType(conv)==1:purple.PurpleConvImSend(purple.PurpleConvIm(conv),sys.argv[2])elifpurple.PurpleConversationGetType(conv)==2:purple.PurpleConvChatSend(purple.PurpleConvChat(conv),sys.argv[2])print"Sending \""+sys.argv[2]+"\" to "+sys.argv[1]
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The DBus api is more-or-less just the C api, so the C api documentation is the resource. The howto is a "getting started" guide not a comprehensive listing. It should also be possible to introspect a running pidgin via the normal DBus introspection system to discover the API.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using a python script with the dbus interface to send messages to my buddies. It works perfectly, except it won't send messages to group conversations. There's no error message or exception, it just silently fails to do what it's meant to do. I've posted my script below in case I've made a mistake in it. Is PurpleConvImSend not meant to work with group chats? Should I be using a different function? Any help/suggestions are appreciated.
PurpleConvImSend will only send to an IM conversation (two-person). In pidgin terms that's what IM means. To send to chats you would need to get the PurpleConvChat data from the conversation and use PurpleConvChatSend.
Thanks for the help! I'm surprised PurpleConvImSend isn't mentioned on this page. Is there a more comprehensive list of functions available via Dbus?
I've now modified the script to work with group chats. Here it is for future reference:
The DBus api is more-or-less just the C api, so the C api documentation is the resource. The howto is a "getting started" guide not a comprehensive listing. It should also be possible to introspect a running pidgin via the normal DBus introspection system to discover the API.