Explain why a chumhandle is invalid

This commit is contained in:
Kiooeht 2011-08-23 03:23:59 -07:00
parent 17b8b70b66
commit 65fd1d0b29
5 changed files with 11 additions and 9 deletions

View file

@ -27,6 +27,7 @@ CHANGELOG
* Chum notes - Kiooeht [evacipatedBox] * Chum notes - Kiooeht [evacipatedBox]
* Customizable name alerts - Kiooeht [evacipatedBox] * Customizable name alerts - Kiooeht [evacipatedBox]
* Update bug reporter - Kiooeht [evacipatedBox] * Update bug reporter - Kiooeht [evacipatedBox]
* Explain why a chumhandle is invalid - Kiooeht [evacipatedBox] (Idea: Lexi [lexicalNuance])
* Bug fixes * Bug fixes
* Don't delete random chum when blocking someone not on chumroll - Kiooeht [evacipatedBox] * Don't delete random chum when blocking someone not on chumroll - Kiooeht [evacipatedBox]
* Openning global userlist doesn't reset OP status of memo users - Kiooeht [evacipatedBox] * Openning global userlist doesn't reset OP status of memo users - Kiooeht [evacipatedBox]

View file

@ -15,7 +15,6 @@ Features
* Whowas for last seen online? * Whowas for last seen online?
* Tab completion of two letter names * Tab completion of two letter names
* When 'banned' make impossible to connect using timestamp banned under * When 'banned' make impossible to connect using timestamp banned under
* Explain why a chumhandle is invalid
* Fully working Toasts * Fully working Toasts
* Auto download/install updates via Windows installer * Auto download/install updates via Windows installer

View file

@ -295,11 +295,13 @@ class PesterProfile(object):
@staticmethod @staticmethod
def checkValid(handle): def checkValid(handle):
caps = [l for l in handle if l.isupper()] caps = [l for l in handle if l.isupper()]
if len(caps) != 1 or handle[0].isupper(): if len(caps) != 1:
return False return (False, "Must have exactly 1 uppercase letter")
if handle[0].isupper():
return (False, "Cannot start with uppercase letter")
if re.search("[^A-Za-z0-9]", handle) is not None: if re.search("[^A-Za-z0-9]", handle) is not None:
return False return (False, "Only alphanumeric characters allowed")
return True return (True,)
class PesterHistory(object): class PesterHistory(object):
def __init__(self): def __init__(self):

View file

@ -862,8 +862,8 @@ class PesterChooseProfile(QtGui.QDialog):
if not PesterProfile.checkLength(handle): if not PesterProfile.checkLength(handle):
self.errorMsg.setText("PROFILE HANDLE IS TOO LONG") self.errorMsg.setText("PROFILE HANDLE IS TOO LONG")
return return
if not PesterProfile.checkValid(handle): if not PesterProfile.checkValid(handle)[0]:
self.errorMsg.setText("NOT A VALID CHUMTAG") self.errorMsg.setText("NOT A VALID CHUMTAG. REASON:\n%s" % (PesterProfile.checkValid(handle)[1]))
return return
self.accept() self.accept()

View file

@ -1437,7 +1437,7 @@ class TrollSlumWindow(QtGui.QFrame):
if ok: if ok:
handle = unicode(handle) handle = unicode(handle)
if not (PesterProfile.checkLength(handle) and if not (PesterProfile.checkLength(handle) and
PesterProfile.checkValid(handle)): PesterProfile.checkValid(handle)[0]):
errormsg = QtGui.QErrorMessage(self) errormsg = QtGui.QErrorMessage(self)
errormsg.showMessage("THIS IS NOT A VALID CHUMTAG!") errormsg.showMessage("THIS IS NOT A VALID CHUMTAG!")
self.addchumdialog = None self.addchumdialog = None
@ -2399,7 +2399,7 @@ class PesterWindow(MovingWindow):
if ok: if ok:
handle = unicode(handle) handle = unicode(handle)
if not (PesterProfile.checkLength(handle) and if not (PesterProfile.checkLength(handle) and
PesterProfile.checkValid(handle)): PesterProfile.checkValid(handle)[0]):
errormsg = QtGui.QErrorMessage(self) errormsg = QtGui.QErrorMessage(self)
errormsg.showMessage("THIS IS NOT A VALID CHUMTAG!") errormsg.showMessage("THIS IS NOT A VALID CHUMTAG!")
self.addchumdialog = None self.addchumdialog = None