Process gateway registration rejections
A message from gateway registration addres regarding registration rejection is processed and a dialog displayed to get a new email address. Fixes #14
This commit is contained in:
parent
6b8f255a60
commit
1a92db54c9
|
@ -2335,7 +2335,20 @@ class MyForm(settingsmixin.SMainWindow):
|
|||
if self.getCurrentAccount() is not None and ((self.getCurrentFolder(treeWidget) != "inbox" and self.getCurrentFolder(treeWidget) is not None) or self.getCurrentAccount(treeWidget) != acct.address):
|
||||
# Ubuntu should notify of new message irespective of whether it's in current message list or not
|
||||
self.ubuntuMessagingMenuUpdate(True, None, acct.toLabel)
|
||||
return
|
||||
if hasattr(acct, "feedback") and acct.feedback != GatewayAccount.ALL_OK:
|
||||
if acct.feedback == GatewayAccount.REGISTRATION_DENIED:
|
||||
self.dialog = EmailGatewayRegistrationDialog(self, _translate("EmailGatewayRegistrationDialog", "Registration failed:"),
|
||||
_translate("EmailGatewayRegistrationDialog", "The requested email address is not available, please try a new one. Fill out the new designed email address (including @mailchuck.com) below:")
|
||||
)
|
||||
if self.dialog.exec_():
|
||||
email = str(self.dialog.ui.lineEditEmail.text().toUtf8())
|
||||
# register resets address variables
|
||||
acct.register(email)
|
||||
shared.config.set(acct.fromAddress, 'label', email)
|
||||
shared.config.set(acct.fromAddress, 'gateway', 'mailchuck')
|
||||
shared.writeKeysFile()
|
||||
self.statusBar().showMessage(_translate(
|
||||
"MainWindow", "Sending email gateway registration request"))
|
||||
|
||||
def click_pushButtonAddAddressBook(self):
|
||||
self.AddAddressDialogInstance = AddAddressDialog(self)
|
||||
|
@ -4309,6 +4322,19 @@ class EmailGatewayDialog(QtGui.QDialog):
|
|||
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
|
||||
|
||||
|
||||
class EmailGatewayRegistrationDialog(QtGui.QDialog):
|
||||
|
||||
def __init__(self, parent, title, label):
|
||||
QtGui.QWidget.__init__(self, parent)
|
||||
self.ui = Ui_EmailGatewayRegistrationDialog()
|
||||
self.ui.setupUi(self)
|
||||
self.parent = parent
|
||||
self.setWindowTitle(title)
|
||||
self.ui.label.setText(label)
|
||||
|
||||
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
|
||||
|
||||
|
||||
class AddAddressDialog(QtGui.QDialog):
|
||||
|
||||
def __init__(self, parent):
|
||||
|
|
|
@ -138,6 +138,8 @@ class BroadcastAccount(BMAccount):
|
|||
|
||||
class GatewayAccount(BMAccount):
|
||||
gatewayName = None
|
||||
ALL_OK = 0
|
||||
REGISTRATION_DENIED = 1
|
||||
def __init__(self, address):
|
||||
super(BMAccount, self).__init__(address)
|
||||
|
||||
|
@ -179,6 +181,7 @@ class MailchuckAccount(GatewayAccount):
|
|||
regExpOutgoing = re.compile("(\S+) (.*)")
|
||||
def __init__(self, address):
|
||||
super(GatewayAccount, self).__init__(address)
|
||||
self.feedback = self.ALL_OK
|
||||
|
||||
def createMessage(self, toAddress, fromAddress, subject, message):
|
||||
self.subject = toAddress + " " + subject
|
||||
|
@ -273,3 +276,7 @@ class MailchuckAccount(GatewayAccount):
|
|||
if not matches.group(1) is None:
|
||||
self.toLabel = matches.group(1)
|
||||
self.toAddress = matches.group(1)
|
||||
self.feedback = self.ALL_OK
|
||||
if fromAddress == self.registrationAddress and self.subject == "Registration Request Denied":
|
||||
self.feedback = self.REGISTRATION_DENIED
|
||||
return self.feedback
|
||||
|
|
|
@ -72,3 +72,32 @@ class Ui_EmailGatewayDialog(object):
|
|||
self.label.setText(QtGui.QApplication.translate("EmailGatewayDialog", "Email gateway allows you to communicate with email users. Currently, only the Mailchuck email gateway (@mailchuck.com) is available.", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_2.setText(QtGui.QApplication.translate("EmailGatewayDialog", "Desired email address (including @mailchuck.com):", None, QtGui.QApplication.UnicodeUTF8))
|
||||
|
||||
|
||||
class Ui_EmailGatewayRegistrationDialog(object):
|
||||
def setupUi(self, EmailGatewayRegistrationDialog):
|
||||
EmailGatewayRegistrationDialog.setObjectName(_fromUtf8("EmailGatewayRegistrationDialog"))
|
||||
EmailGatewayRegistrationDialog.resize(386, 172)
|
||||
self.gridLayout = QtGui.QGridLayout(EmailGatewayRegistrationDialog)
|
||||
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
|
||||
self.label = QtGui.QLabel(EmailGatewayRegistrationDialog)
|
||||
self.label.setWordWrap(True)
|
||||
self.label.setObjectName(_fromUtf8("label"))
|
||||
self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
|
||||
self.lineEditEmail = QtGui.QLineEdit(EmailGatewayRegistrationDialog)
|
||||
self.lineEditEmail.setObjectName(_fromUtf8("lineEditEmail"))
|
||||
self.gridLayout.addWidget(self.lineEditEmail, 1, 0, 1, 1)
|
||||
self.buttonBox = QtGui.QDialogButtonBox(EmailGatewayRegistrationDialog)
|
||||
self.buttonBox.setMinimumSize(QtCore.QSize(368, 0))
|
||||
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
|
||||
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
|
||||
self.gridLayout.addWidget(self.buttonBox, 7, 0, 1, 1)
|
||||
|
||||
self.retranslateUi(EmailGatewayRegistrationDialog)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), EmailGatewayRegistrationDialog.accept)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), EmailGatewayRegistrationDialog.reject)
|
||||
QtCore.QMetaObject.connectSlotsByName(EmailGatewayRegistrationDialog)
|
||||
|
||||
def retranslateUi(self, EmailGatewayRegistrationDialog):
|
||||
EmailGatewayRegistrationDialog.setWindowTitle(QtGui.QApplication.translate("EmailGatewayRegistrationDialog", "Email gateway registration", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label.setText(QtGui.QApplication.translate("EmailGatewayRegistrationDialog", "Email gateway allows you to communicate with email users. Currently, only the Mailchuck email gateway (@mailchuck.com) is available.\nPlease type the desiged email address (including @mailchuck.com) below:", None, QtGui.QApplication.UnicodeUTF8))
|
||||
|
|
Reference in New Issue
Block a user