ui checkbox update and friend addition via public key
This commit is contained in:
parent
160e9dc72f
commit
0e103749a2
@ -802,14 +802,17 @@ class Profile(Contact, Singleton):
|
|||||||
tox_id = tox_dns(tox_id)
|
tox_id = tox_dns(tox_id)
|
||||||
if tox_id is None:
|
if tox_id is None:
|
||||||
raise Exception('TOX DNS lookup failed')
|
raise Exception('TOX DNS lookup failed')
|
||||||
result = self._tox.friend_add(tox_id, message.encode('utf-8'))
|
if len(tox_id) == TOX_PUBLIC_KEY_SIZE * 2: # public key
|
||||||
tox_id = tox_id[:TOX_PUBLIC_KEY_SIZE * 2]
|
self.add_friend(tox_id)
|
||||||
item = self.create_friend_item()
|
else:
|
||||||
if not self._history.friend_exists_in_db(tox_id):
|
result = self._tox.friend_add(tox_id, message.encode('utf-8'))
|
||||||
self._history.add_friend_to_db(tox_id)
|
tox_id = tox_id[:TOX_PUBLIC_KEY_SIZE * 2]
|
||||||
message_getter = self._history.messages_getter(tox_id)
|
item = self.create_friend_item()
|
||||||
friend = Friend(message_getter, result, tox_id, '', item, tox_id)
|
if not self._history.friend_exists_in_db(tox_id):
|
||||||
self._friends.append(friend)
|
self._history.add_friend_to_db(tox_id)
|
||||||
|
message_getter = self._history.messages_getter(tox_id)
|
||||||
|
friend = Friend(message_getter, result, tox_id, '', item, tox_id)
|
||||||
|
self._friends.append(friend)
|
||||||
data = self._tox.get_savedata()
|
data = self._tox.get_savedata()
|
||||||
ProfileHelper.save_profile(data)
|
ProfileHelper.save_profile(data)
|
||||||
return True
|
return True
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 4.4 KiB |
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user