add contact fixes

This commit is contained in:
ingvar1995 2016-03-12 18:34:10 +03:00
parent 23b603241e
commit 38593b7db1
2 changed files with 4 additions and 2 deletions

View File

@ -36,7 +36,7 @@ class AddContact(CenteredWidget):
self.tox_id.setGeometry(QtCore.QRect(50, 40, 471, 27)) self.tox_id.setGeometry(QtCore.QRect(50, 40, 471, 27))
self.tox_id.setObjectName("lineEdit") self.tox_id.setObjectName("lineEdit")
self.label = QtGui.QLabel(self) self.label = QtGui.QLabel(self)
self.label.setGeometry(QtCore.QRect(70, 10, 50, 20)) self.label.setGeometry(QtCore.QRect(30, 10, 80, 20))
self.error_label = QtGui.QLabel(self) self.error_label = QtGui.QLabel(self)
self.error_label.setGeometry(QtCore.QRect(120, 10, 400, 20)) self.error_label.setGeometry(QtCore.QRect(120, 10, 400, 20))
font = QtGui.QFont() font = QtGui.QFont()
@ -67,6 +67,8 @@ class AddContact(CenteredWidget):
# request was successful # request was successful
self.close() self.close()
else: # print error data else: # print error data
if len(send) > 40:
send = send[:40] + '...'
self.error_label.setText(send) self.error_label.setText(send)
def retranslateUi(self): def retranslateUi(self):

View File

@ -494,7 +494,7 @@ class Profile(Contact, Singleton):
try: try:
message = message or 'Add me to your contact list' message = message or 'Add me to your contact list'
if '@' in tox_id: # value like groupbot@toxme.io if '@' in tox_id: # value like groupbot@toxme.io
tox_id = tox_dns() 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')) result = self.tox.friend_add(tox_id, message.encode('utf-8'))