使用 pidgin dbus python api 获取 xmpp 资源字符串
我使用 pidgin dbus api 通过编写以下 python 代码片段来打印我的 gtalk 好友的名称及其状态:
import dbus
# Initiate a connection to the Session Bus
bus = dbus.SessionBus()
# Associate Pidgin's D-Bus interface with Python objects
obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject")
purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface")
# Iterate through every active account
for acctID in purple.PurpleAccountsGetAllActive():
for buddy in purple.PurpleFindBuddies(acctID,""):
print purple.PurpleBuddyGetName(buddy),'Online' if purple.PurpleBuddyIsOnline(buddy) else 'Offline'
在 Pidgin 中,当我将鼠标悬停在特定好友上时,它还会显示该好友的资源字符串,例如 < strong>gtalk、android 等.. 它告诉我用户从哪个资源登录。
有没有办法使用 pidgins dbus api 或其他方式获取此资源字符串?
请帮忙 谢谢
I was using the pidgin dbus api to print the names of my gtalk buddies and their status by writing the following python code snippet:
import dbus
# Initiate a connection to the Session Bus
bus = dbus.SessionBus()
# Associate Pidgin's D-Bus interface with Python objects
obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject")
purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface")
# Iterate through every active account
for acctID in purple.PurpleAccountsGetAllActive():
for buddy in purple.PurpleFindBuddies(acctID,""):
print purple.PurpleBuddyGetName(buddy),'Online' if purple.PurpleBuddyIsOnline(buddy) else 'Offline'
In Pidgin when i hover my mouse over a particular buddy, it also shows the Resource string of that buddy for example gtalk, android etc... which tells me which resource the user is logged in from.
Is there a way to fetch this Resource string using pidgins dbus api or some other way ?
Please Help
Thank You
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 wiki 页面 中的脚本:
sender
这里将是像这样:'[email protected]/androidXXXXXXXX' 如果使用 android 或
'[email protected]/gmail.XXXXXXXX' 用于 gtalk 或
'[email protected]/XXXXXXXX' 对于其他即时消息,其中 X 是十六进制值。
you can use the script from the wiki page:
sender
here will be smth like this:'[email protected]/androidXXXXXXXX' in case of using android or
'[email protected]/gmail.XXXXXXXX' for gtalk or
'[email protected]/XXXXXXXX' for other im, where X is a hex value.