def __init__(self, account_file, muc_id):
        self.conn = connection_from_file(account_file, ready_handler=self.ready_cb)
        self.muc_id = muc_id

        self.conn[CONN_INTERFACE].connect_to_signal('StatusChanged',
            self.status_changed_cb)

        self.test = None
        self.joined = False
        self.tube = None
Beispiel #2
0
    def __init__(self, account_file, muc_id):
        self.conn = connection_from_file(account_file,
                                         ready_handler=self.ready_cb)
        self.muc_id = muc_id

        self.conn[CONN_INTERFACE].connect_to_signal('StatusChanged',
                                                    self.status_changed_cb)

        self.test = None
        self.joined = False
        self.tube = None
    def __init__(self, account_file, muc_id, contact_id):
        self.conn = connection_from_file(account_file, ready_handler=self.ready_cb)
        self.muc_id = muc_id
        self.contact_id = contact_id

        self.joined = False
        self.tube = None

        assert self.muc_id is None or self.contact_id is None

        self.conn[CONN_INTERFACE].connect_to_signal("StatusChanged", self.status_changed_cb)
Beispiel #4
0
    def __init__(self, account_file):
        self.conn = connection_from_file(account_file,
            ready_handler=self.ready_cb)
        self.channel = None
        self.fschannel = None
        self.pipeline = gst.Pipeline()
        self.pipeline.get_bus().add_watch(self.async_handler)

        self.conn[CONN_INTERFACE].connect_to_signal('StatusChanged',
            self.status_changed_cb)
        self.conn[CONN_INTERFACE].connect_to_signal('NewChannel',
            self.new_channel_cb)
Beispiel #5
0
    def __init__(self, account_file):
        self.conn = connection_from_file(account_file,
                                         ready_handler=self.ready_cb)
        self.channel = None
        self.fschannel = None
        self.pipeline = gst.Pipeline()
        self.pipeline.get_bus().add_watch(self.async_handler)

        self.conn[CONN_INTERFACE].connect_to_signal('StatusChanged',
                                                    self.status_changed_cb)
        self.conn[CONN_INTERFACE].connect_to_signal('NewChannel',
                                                    self.new_channel_cb)
Beispiel #6
0
    def __init__(self, *stuff):
        self.contact = None
        self.message = None

        self.contact = stuff[0]

        if len(stuff) > 1:
            self.message = stuff[1]

        self.conn = connection_from_file(sys.argv[1],
            ready_handler=self.ready_cb)

        print "connecting"
        self.conn[CONN_INTERFACE].Connect()
Beispiel #7
0
    def __init__(self, *stuff):
        self.contact = None
        self.message = None

        self.contact = stuff[0]

        if len(stuff) > 1:
            self.message = stuff[1]

        self.conn = connection_from_file(sys.argv[1],
                                         ready_handler=self.ready_cb)

        print "connecting"
        self.conn[CONN_INTERFACE].Connect()
Beispiel #8
0
            self.channel = channel

    def received_cb(self, id, timestamp, sender, type, flags, text):
        self.channel[telepathy.CHANNEL_TYPE_TEXT].AcknowledgePendingMessages([id])
        contact = self.conn[telepathy.CONN_INTERFACE].InspectHandles(telepathy.HANDLE_TYPE_CONTACT, [sender])[0]
        print "<%s> %s" % (contact, text)

    def stdin_cb(self, fd, condition):
        text = fd.readline()[:-1]
        self.channel[telepathy.CHANNEL_TYPE_TEXT].Send(telepathy.CHANNEL_TEXT_MESSAGE_TYPE_NORMAL, text)
        return True


if __name__ == "__main__":
    account_file, chatroom = sys.argv[1], sys.argv[2]
    conn = connection_from_file(account_file)
    client = ChatroomClient(conn, chatroom)
    conn[telepathy.CONN_INTERFACE].Connect()
    loop = gobject.MainLoop()

    try:
        loop.run()
    except KeyboardInterrupt:
        print "interrupted"

    print "disconnecting"

    try:
        conn[telepathy.CONN_INTERFACE].Disconnect()
    except dbus.DBusException:
        pass
Beispiel #9
0
    image, mime = conn[CONN_INTERFACE_AVATARS].RequestAvatar(handle)
    image = ''.join(chr(i) for i in image)

    window = Gtk.Window()
    loader = Gtk.gdk.PixbufLoader()
    loader.write(image)
    loader.close()
    image = Gtk.Image()
    image.set_from_pixbuf(loader.get_pixbuf())
    window.add(image)
    window.show_all()
    window.connect('destroy', Gtk.main_quit)

def usage():
    print("Usage:\n" \
            "\tpython %s [account-file]\n" \
            % (sys.argv[0]))

if __name__ == '__main__':
    if len(sys.argv) != 2:
        usage()
        sys.exit(0)

    conn = connection_from_file(sys.argv[1], connection_ready_cb)

    print('connecting')
    conn[CONN_INTERFACE].Connect()
    Gtk.main()
    conn[CONN_INTERFACE].Disconnect()

Beispiel #10
0
            self.quit()

    def rooms_cb(self, rooms):
        handles = [room[0] for room in rooms]
        names = self.conn[CONN_INTERFACE].InspectHandles(HANDLE_TYPE_ROOM,
                                                         handles)

        for i in xrange(len(rooms)):
            handle, ctype, info = rooms[i]
            name = names[i]
            print "Found room:", name
            print "\t", ctype
            for key in info:
                print "\t", repr(str(key)), " => ", repr(info[key])

if __name__ == '__main__':
    conn = connection_from_file(sys.argv[1])

    ex = RoomListExample(conn)

    print "connecting"
    conn[CONN_INTERFACE].Connect()

    try:
        ex.run()
    except KeyboardInterrupt:
        print "killed"

    print "disconnecting"
    conn[CONN_INTERFACE].Disconnect()
Beispiel #11
0
    def __init__(self, account_file):
        self.conn = connection_from_file(account_file,
            ready_handler=self.ready_cb)

        self.conn[CONN_INTERFACE].connect_to_signal(
            'StatusChanged', self.status_changed_cb)
Beispiel #12
0
        if removed:
            for handle in removed:
                print '%s: removed: %d' % (name, added)

    def run(self):
        self.loop = gobject.MainLoop()

        try:
            self.loop.run()
        except KeyboardInterrupt:
            print 'interrupted'

    def quit(self):
        self.loop.quit()


if __name__ == '__main__':
    assert len(sys.argv) == 2
    conn = connection_from_file(sys.argv[1])
    client = RosterClient(conn)

    print "connecting"
    conn[CONN_INTERFACE].Connect()
    client.run()
    print "disconnecting"

    try:
        conn[CONN_INTERFACE].Disconnect()
    except dbus.DBusException:
        pass
Beispiel #13
0
    def __init__(self, account_file):
        self.conn = connection_from_file(account_file,
                                         ready_handler=self.ready_cb)

        self.conn[CONN_INTERFACE].connect_to_signal('StatusChanged',
                                                    self.status_changed_cb)
Beispiel #14
0
        self.channel[telepathy.CHANNEL_TYPE_TEXT].AcknowledgePendingMessages(
            [id])
        contact = self.conn[telepathy.CONN_INTERFACE].InspectHandles(
            telepathy.HANDLE_TYPE_CONTACT, [sender])[0]
        print '<%s> %s' % (contact, text)

    def stdin_cb(self, fd, condition):
        text = fd.readline()[:-1]
        self.channel[telepathy.CHANNEL_TYPE_TEXT].Send(
            telepathy.CHANNEL_TEXT_MESSAGE_TYPE_NORMAL, text)
        return True


if __name__ == '__main__':
    account_file, chatroom = sys.argv[1], sys.argv[2]
    conn = connection_from_file(account_file)
    client = ChatroomClient(conn, chatroom)
    conn[telepathy.CONN_INTERFACE].Connect()
    loop = gobject.MainLoop()

    try:
        loop.run()
    except KeyboardInterrupt:
        print 'interrupted'

    print 'disconnecting'

    try:
        conn[telepathy.CONN_INTERFACE].Disconnect()
    except dbus.DBusException:
        pass