pidgin.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:tfc 作者: maqp 项目源码 文件源码
def im_command(queues: Dict[bytes, 'Queue']) -> None:
    """Loop that executes commands on IM client."""
    bus     = dbus.SessionBus(private=True)
    obj     = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject")
    purple  = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface")
    account = purple.PurpleAccountsGetAllActive()[0]
    queue   = queues[NH_TO_IM_QUEUE]

    while True:
        with ignored(dbus.exceptions.DBusException, EOFError, KeyboardInterrupt):
            while queue.qsize() == 0:
                time.sleep(0.01)

            command = queue.get()

            if command[:2] in [UNENCRYPTED_SCREEN_CLEAR, UNENCRYPTED_SCREEN_RESET]:
                contact  = command[2:]
                new_conv = purple.PurpleConversationNew(1, account, contact)
                purple.PurpleConversationClearMessageHistory(new_conv)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号