コード例 #1
0
ファイル: text.py プロジェクト: Alberto-Beralix/Beralix
    def __init__(self, conn, manager, conversation, props, object_path=None):
        self._recv_id = 0
        self._conn_ref = weakref.ref(conn)
        self._send_typing_notification_timeout = 0
        self._typing_notifications = dict()

        self._conversation = None
        self._pending_messages2 = {}

        telepathy.server.ChannelTypeText.__init__(self, conn, manager, props, object_path=object_path)
        ButterflyChannel.__init__(self, conn, props)
        telepathy.server.ChannelInterfaceChatState.__init__(self)
        ChannelInterfaceMessages.__init__(self)
        papyon.event.ContactEventInterface.__init__(self, conn.msn_client)

        self._implement_property_get(
            CHANNEL_INTERFACE_MESSAGES,
            {
                "SupportedContentTypes": lambda: ["text/plain"],
                "MessagePartSupportFlags": lambda: 0,
                "DeliveryReportingSupport": lambda: telepathy.DELIVERY_REPORTING_SUPPORT_FLAG_RECEIVE_FAILURES,
                "PendingMessages": lambda: dbus.Array(self._pending_messages2.values(), signature="aa{sv}"),
            },
        )

        self._add_immutables(
            {
                "SupportedContentTypes": CHANNEL_INTERFACE_MESSAGES,
                "MessagePartSupportFlags": CHANNEL_INTERFACE_MESSAGES,
                "DeliveryReportingSupport": CHANNEL_INTERFACE_MESSAGES,
            }
        )
    def __init__(self, conn, manager, conversation, props, object_path=None):
        _, surpress_handler, handle = manager._get_type_requested_handle(props)
        self._recv_id = 0
        self._conn_ref = weakref.ref(conn)
        self.conn = conn
        
        self._pending_messages2 = {}

        self.handle = handle
        telepathy.server.ChannelTypeText.__init__(self, conn, manager, props, object_path=object_path)
        SunshineChannel.__init__(self, conn, props)
        telepathy.server.ChannelInterfaceChatState.__init__(self)
        ChannelInterfaceMessages.__init__(self)

        self._implement_property_get(CHANNEL_INTERFACE_MESSAGES, {
            'SupportedContentTypes': lambda: ["text/plain"],
            'MessagePartSupportFlags': lambda: 1,
            'DeliveryReportingSupport': lambda: 0,
            'PendingMessages': lambda: dbus.Array(self._pending_messages2.values(), signature='aa{sv}'),
            'MessageTypes': lambda: [telepathy.CHANNEL_TEXT_MESSAGE_TYPE_NORMAL]
            })

        self._add_immutables({
            'SupportedContentTypes': CHANNEL_INTERFACE_MESSAGES,
            'MessagePartSupportFlags': CHANNEL_INTERFACE_MESSAGES,
            'DeliveryReportingSupport': CHANNEL_INTERFACE_MESSAGES,
            'MessageTypes': CHANNEL_INTERFACE_MESSAGES,
            })
コード例 #3
0
ファイル: text.py プロジェクト: hagabaka/telepathy-gitter
    def __init__(self, conn, manager, room, props, object_path=None):
        logger.debug("GlitterTextChannel: %s", room)
        for k in props:
            logger.debug("GlitterTextChannel: %s: %s", k, props[k])
        self._recv_id = 0
        self._conn_ref = weakref.ref(conn)
        self._room = room
        self._room.messageSent.connect(self._signal_text_sent)
        self._room.messagesReceived.connect(self._signal_text_received)
        self._pending_counter = itertools.count()
        self._room.startMessageStream()

        telepathy.server.ChannelTypeText.__init__(self,
                                                  conn,
                                                  manager,
                                                  props,
                                                  object_path=object_path)
        self._message_types.append(telepathy.CHANNEL_TEXT_MESSAGE_TYPE_ACTION)
        logger.debug("trying to set %s",
                     telepathy.CHANNEL_INTERFACE_MESSAGES + '.MessageTypes')
        props[telepathy.CHANNEL_INTERFACE_MESSAGES +
              '.MessageTypes'] = self.GetMessageTypes()
        GlitterChannel.__init__(self, conn, props)
        ChannelInterfaceMessages.__init__(self)

        self._implement_property_get(
            CHANNEL_INTERFACE_MESSAGES,
            {
                'SupportedContentTypes':
                lambda: ['text/plain'],  #, 'text/html'],
                'MessageTypes':
                self.GetMessageTypes,
                'MessagePartSupportFlags':
                lambda: 0,
                'PendingMessages':
                lambda: dbus.Array(self._pending_messages.values(),
                                   signature='aa{sv}'),
                'DeliveryReportingSupport':
                lambda:
                (telepathy.DELIVERY_REPORTING_SUPPORT_FLAG_RECEIVE_FAILURES |
                 telepathy.DELIVERY_REPORTING_SUPPORT_FLAG_RECEIVE_SUCCESSES |
                 telepathy.DELIVERY_REPORTING_SUPPORT_FLAG_RECEIVE_READ)
            })

        self._add_immutables({
            'SupportedContentTypes':
            CHANNEL_INTERFACE_MESSAGES,
            'MessageTypes':
            CHANNEL_INTERFACE_MESSAGES,
            'MessagePartSupportFlags':
            CHANNEL_INTERFACE_MESSAGES,
            'DeliveryReportingSupport':
            CHANNEL_INTERFACE_MESSAGES,
        })
コード例 #4
0
 def __init__(self):
     _ChannelInterfaceMessages.__init__(self)
     self._implement_property_get(CHANNEL_INTERFACE_MESSAGES, {
         'SupportedContentTypes': lambda: dbus.Array(self._get_supported_content_types(), signature='s'),
         'MessageTypes': lambda: dbus.Array(self._get_message_types(), signature='u'),
         'MessagePartSupportFlags': lambda: dbus.UInt32(self._get_message_part_support_flags()),
         'PendingMessages': lambda: dbus.Array(self._get_pending_messages(), signature='aa{sv}'),
         'DeliveryReportingSupport': lambda: dbus.UInt32(self._get_delivery_reporting_support()),
     })
     self._add_immutable_properties({
         'SupportedContentTypes': CHANNEL_INTERFACE_MESSAGES,
         'MessageTypes': CHANNEL_INTERFACE_MESSAGES,
         'MessagePartSupportFlags': CHANNEL_INTERFACE_MESSAGES,
         'DeliveryReportingSupport': CHANNEL_INTERFACE_MESSAGES,
     })
コード例 #5
0
ファイル: text.py プロジェクト: detrout/telepathy-gitter
    def __init__(self, conn, manager, room, props, object_path=None):
        logger.debug("GlitterTextChannel: %s", room)
        for k in props:
            logger.debug("GlitterTextChannel: %s: %s", k, props[k])
        self._recv_id = 0
        self._conn_ref = weakref.ref(conn)
        self._room = room
        self._room.messageSent.connect(self._signal_text_sent)
        self._room.messagesReceived.connect(self._signal_text_received)
        self._pending_counter = itertools.count()
        self._room.startMessageStream()

        telepathy.server.ChannelTypeText.__init__(self, conn, manager, props, object_path=object_path)
        self._message_types.append(telepathy.CHANNEL_TEXT_MESSAGE_TYPE_ACTION)
        logger.debug("trying to set %s", telepathy.CHANNEL_INTERFACE_MESSAGES + ".MessageTypes")
        props[telepathy.CHANNEL_INTERFACE_MESSAGES + ".MessageTypes"] = self.GetMessageTypes()
        GlitterChannel.__init__(self, conn, props)
        ChannelInterfaceMessages.__init__(self)

        self._implement_property_get(
            CHANNEL_INTERFACE_MESSAGES,
            {
                "SupportedContentTypes": lambda: ["text/plain"],  # , 'text/html'],
                "MessageTypes": self.GetMessageTypes,
                "MessagePartSupportFlags": lambda: 0,
                "PendingMessages": lambda: dbus.Array(self._pending_messages.values(), signature="aa{sv}"),
                "DeliveryReportingSupport": lambda: (
                    telepathy.DELIVERY_REPORTING_SUPPORT_FLAG_RECEIVE_FAILURES
                    | telepathy.DELIVERY_REPORTING_SUPPORT_FLAG_RECEIVE_SUCCESSES
                    | telepathy.DELIVERY_REPORTING_SUPPORT_FLAG_RECEIVE_READ
                ),
            },
        )

        self._add_immutables(
            {
                "SupportedContentTypes": CHANNEL_INTERFACE_MESSAGES,
                "MessageTypes": CHANNEL_INTERFACE_MESSAGES,
                "MessagePartSupportFlags": CHANNEL_INTERFACE_MESSAGES,
                "DeliveryReportingSupport": CHANNEL_INTERFACE_MESSAGES,
            }
        )
コード例 #6
0
    def __init__(self, conn, manager, conversation, props, object_path=None):
        self._recv_id = 0
        self._conn_ref = weakref.ref(conn)
        self._send_typing_notification_timeout = 0
        self._typing_notifications = dict()

        self._conversation = None
        self._pending_messages2 = {}

        telepathy.server.ChannelTypeText.__init__(self,
                                                  conn,
                                                  manager,
                                                  props,
                                                  object_path=object_path)
        ButterflyChannel.__init__(self, conn, props)
        telepathy.server.ChannelInterfaceChatState.__init__(self)
        ChannelInterfaceMessages.__init__(self)
        papyon.event.ContactEventInterface.__init__(self, conn.msn_client)

        self._implement_property_get(
            CHANNEL_INTERFACE_MESSAGES, {
                'SupportedContentTypes':
                lambda: ["text/plain"],
                'MessagePartSupportFlags':
                lambda: 0,
                'DeliveryReportingSupport':
                lambda: telepathy.
                DELIVERY_REPORTING_SUPPORT_FLAG_RECEIVE_FAILURES,
                'PendingMessages':
                lambda: dbus.Array(self._pending_messages2.values(),
                                   signature='aa{sv}')
            })

        self._add_immutables({
            'SupportedContentTypes':
            CHANNEL_INTERFACE_MESSAGES,
            'MessagePartSupportFlags':
            CHANNEL_INTERFACE_MESSAGES,
            'DeliveryReportingSupport':
            CHANNEL_INTERFACE_MESSAGES,
        })
コード例 #7
0
    def __init__(self, conn, manager, conversation, props, object_path=None):
        _, surpress_handler, handle = manager._get_type_requested_handle(props)
        self._recv_id = 0
        self._conn_ref = weakref.ref(conn)
        self.conn = conn

        self._pending_messages2 = {}

        self.handle = handle
        telepathy.server.ChannelTypeText.__init__(self,
                                                  conn,
                                                  manager,
                                                  props,
                                                  object_path=object_path)
        SunshineChannel.__init__(self, conn, props)
        telepathy.server.ChannelInterfaceChatState.__init__(self)
        ChannelInterfaceMessages.__init__(self)

        self._implement_property_get(
            CHANNEL_INTERFACE_MESSAGES, {
                'SupportedContentTypes':
                lambda: ["text/plain"],
                'MessagePartSupportFlags':
                lambda: 1,
                'DeliveryReportingSupport':
                lambda: 0,
                'PendingMessages':
                lambda: dbus.Array(self._pending_messages2.values(),
                                   signature='aa{sv}'),
                'MessageTypes':
                lambda: [telepathy.CHANNEL_TEXT_MESSAGE_TYPE_NORMAL]
            })

        self._add_immutables({
            'SupportedContentTypes': CHANNEL_INTERFACE_MESSAGES,
            'MessagePartSupportFlags': CHANNEL_INTERFACE_MESSAGES,
            'DeliveryReportingSupport': CHANNEL_INTERFACE_MESSAGES,
            'MessageTypes': CHANNEL_INTERFACE_MESSAGES,
        })