Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __on_connect(self, initial_data):
""" Handle connection """
self.__log.debug("Bot connected")
self.__id = initial_data.self_entity.id_.gaia_id
self.__user_list = hangups.UserList(self.__client,
initial_data.self_entity,
initial_data.entities,
initial_data.conversation_participants)
self.__conversation_list = hangups.ConversationList(self.__client,
initial_data.conversation_states,
self.__user_list,
initial_data.sync_timestamp)
self.__conversation_list.on_event.add_observer(self.__on_conversation_event)
# create known conversation
self.__log.debug('Loading initial conversations:')
for conversation in self.__conversation_list.get_all():
self.__brain.register_conversation(get_conv_name(conversation, truncate=True), conversation.id_)
self.__log.debug(' {} ({})'
def _on_connect(self, initial_data):
"""Handle connecting for the first time"""
print(_('Connected!'))
self._user_list = hangups.UserList(self._client,
initial_data.self_entity,
initial_data.entities,
initial_data.conversation_participants)
self._conv_list = hangups.ConversationList(self._client,
initial_data.conversation_states,
self._user_list,
initial_data.sync_timestamp)
self._conv_list.on_event.add_observer(self._on_event)
print(_('Conversations:'))
for c in self.list_conversations():
print(' {} ({})'.format(get_conv_name(c, truncate=True), c.id_))
print()
def _on_connect(initial_data):
print ("connected")
global user_list
global conversation_list
user_list = hangups.UserList(
client, initial_data.self_entity, initial_data.entities,
initial_data.conversation_participants
)
conversation_list = hangups.ConversationList(
client, initial_data.conversation_states, user_list,
initial_data.sync_timestamp)
conversation_list.on_event.add_observer(on_conversation_list_event)
for x in user_list._user_dict:
print ("ROSTER: " + user_list._user_dict[x].full_name)
for conv in conversation_list.get_all():
print ("active conv", conv.name, conv.users)
conv.on_event.add_observer(on_conversation_event)
def on_connect(self, initial_data):
"""Handle connecting for the first time (callback)"""
print('Connected')
self.user_list = hangups.UserList(self.client,
initial_data.self_entity,
initial_data.entities,
initial_data.conversation_participants)
self.conv_list = hangups.ConversationList(self.client,
initial_data.conversation_states,
self.user_list,
initial_data.sync_timestamp)
self.conv_list.on_event.add_observer(self.on_event)
# Setup notifications
self.notifier = Notifier(self.conv_list)
# Setup conversations window
self.messages_dialog.init_conversations(self.client, self.conv_list)
# Setup conversations list window and show it
def _on_connect(self, initial_data):
"""Handle connecting for the first time"""
print('Connected!')
self._message_handler = handlers.MessageHandler(self)
self._user_list = hangups.UserList(self._client,
initial_data.self_entity,
initial_data.entities,
initial_data.conversation_participants)
self._conv_list = hangups.ConversationList(self._client,
initial_data.conversation_states,
self._user_list,
initial_data.sync_timestamp)
self._conv_list.on_event.add_observer(self._on_event)
def __on_connect(self, initial_data):
"""Handle connecting for the first time."""
self.output('BW: connected')
# FIXME: temporaly workaround to grab self id
self.__id = initial_data.self_entity.id_.gaia_id
self.__users = hangups.UserList(
initial_data.self_entity,
initial_data.entities,
initial_data.conversation_participants
)
self.__conversations = hangups.ConversationList(
self.__client,
initial_data.conversation_states,
self.__users
)
self.__conversations.on_message.add_observer(self.__on_message)
def _on_connect(self, initial_data):
print("CONNECTED!!!!!!")
self._user_list = hangups.UserList(
self._client, initial_data.self_entity, initial_data.entities,
initial_data.conversation_participants
)
for i in self._user_list._user_dict:
user = self._user_list._user_dict[i]
handle = self.create_handle(telepathy.HANDLE_TYPE_CONTACT, user.id_)
self._user_map[user.id_] = handle
self._conversation_list = hangups.ConversationList(
self._client, initial_data.conversation_states, self._user_list,
initial_data.sync_timestamp)
self.StatusChanged(telepathy.CONNECTION_STATUS_CONNECTED, telepathy.CONNECTION_STATUS_REASON_REQUESTED)
def _on_connect(self, initial_data):
"""Handle connecting for the first time"""
print('Connected!')
self._message_handler = Handlers.MessageHandler(self, command_char=self._command_char)
self._user_list = hangups.UserList(self._client,
initial_data.self_entity,
initial_data.entities,
initial_data.conversation_participants)
self._conv_list = hangups.ConversationList(self._client,
initial_data.conversation_states,
self._user_list,
initial_data.sync_timestamp)
self._conv_list.on_event.add_observer(self._on_event)
print('Conversations:')
for c in self.list_conversations():
print(' {} ({})'.format(get_conv_name(c, truncate=True), c.id_))
print()