From 2b6bffc7ff6c93cb5c63702e3b8aaf4a24088f36 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Sun, 14 Feb 2016 20:13:23 +0100 Subject: [PATCH] Email gateway account status query - addresses #14 --- src/bitmessageqt/__init__.py | 8 ++++++++ src/bitmessageqt/account.py | 9 ++++++++- src/bitmessageqt/emailgateway.py | 9 +++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index b320a774..7d38e43b 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -2730,6 +2730,12 @@ class MyForm(settingsmixin.SMainWindow): acct.unregister() shared.config.remove_option(addressAtCurrentRow, 'gateway') shared.writeKeysFile() + self.statusBar().showMessage(_translate( + "MainWindow", "Sending email gateway unregistration request")) + elif self.dialog.ui.radioButtonStatus.isChecked() and isinstance(acct, GatewayAccount): + acct.status() + self.statusBar().showMessage(_translate( + "MainWindow", "Sending email gateway status request")) elif self.dialog.ui.radioButtonRegister.isChecked(): email = str(self.dialog.ui.lineEditEmail.text().toUtf8()) acct = MailchuckAccount(addressAtCurrentRow) @@ -2737,6 +2743,8 @@ class MyForm(settingsmixin.SMainWindow): shared.config.set(addressAtCurrentRow, 'label', email) shared.config.set(addressAtCurrentRow, 'gateway', 'mailchuck') shared.writeKeysFile() + self.statusBar().showMessage(_translate( + "MainWindow", "Sending email gateway registration request")) else: pass #print "well nothing" diff --git a/src/bitmessageqt/account.py b/src/bitmessageqt/account.py index d1afd560..0c3e95c6 100644 --- a/src/bitmessageqt/account.py +++ b/src/bitmessageqt/account.py @@ -200,6 +200,13 @@ class MailchuckAccount(GatewayAccount): self.fromAddress = self.address self.send() + def status(self): + self.toAddress = self.registrationAddress + self.subject = "status" + self.message = "" + self.fromAddress = self.address + self.send() + def parseMessage(self, toAddress, fromAddress, subject, message): super(GatewayAccount, self).parseMessage(toAddress, fromAddress, subject, message) if fromAddress == self.relayAddress: @@ -220,4 +227,4 @@ class MailchuckAccount(GatewayAccount): self.subject = matches.group(2) if not matches.group(1) is None: self.toLabel = matches.group(1) - self.toAddress = matches.group(1) \ No newline at end of file + self.toAddress = matches.group(1) diff --git a/src/bitmessageqt/emailgateway.py b/src/bitmessageqt/emailgateway.py index 0df4dd01..61b4a7f5 100644 --- a/src/bitmessageqt/emailgateway.py +++ b/src/bitmessageqt/emailgateway.py @@ -24,9 +24,12 @@ class Ui_EmailGatewayDialog(object): self.radioButtonRegister.setChecked(True) self.radioButtonRegister.setObjectName(_fromUtf8("radioButtonRegister")) self.gridLayout.addWidget(self.radioButtonRegister, 1, 0, 1, 1) + self.radioButtonStatus = QtGui.QRadioButton(EmailGatewayDialog) + self.radioButtonStatus.setObjectName(_fromUtf8("radioButtonStatus")) + self.gridLayout.addWidget(self.radioButtonStatus, 4, 0, 1, 1) self.radioButtonUnregister = QtGui.QRadioButton(EmailGatewayDialog) self.radioButtonUnregister.setObjectName(_fromUtf8("radioButtonUnregister")) - self.gridLayout.addWidget(self.radioButtonUnregister, 4, 0, 1, 1) + self.gridLayout.addWidget(self.radioButtonUnregister, 5, 0, 1, 1) self.label = QtGui.QLabel(EmailGatewayDialog) self.label.setWordWrap(True) self.label.setObjectName(_fromUtf8("label")) @@ -43,12 +46,13 @@ class Ui_EmailGatewayDialog(object): 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, 5, 0, 1, 1) + self.gridLayout.addWidget(self.buttonBox, 6, 0, 1, 1) self.retranslateUi(EmailGatewayDialog) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), EmailGatewayDialog.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), EmailGatewayDialog.reject) QtCore.QObject.connect(self.radioButtonRegister, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.lineEditEmail.setEnabled) + QtCore.QObject.connect(self.radioButtonStatus, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.lineEditEmail.setDisabled) QtCore.QObject.connect(self.radioButtonUnregister, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.lineEditEmail.setDisabled) QtCore.QMetaObject.connectSlotsByName(EmailGatewayDialog) EmailGatewayDialog.setTabOrder(self.radioButtonRegister, self.lineEditEmail) @@ -58,6 +62,7 @@ class Ui_EmailGatewayDialog(object): def retranslateUi(self, EmailGatewayDialog): EmailGatewayDialog.setWindowTitle(QtGui.QApplication.translate("EmailGatewayDialog", "Email gateway", None, QtGui.QApplication.UnicodeUTF8)) self.radioButtonRegister.setText(QtGui.QApplication.translate("EmailGatewayDialog", "Register on email gateway", None, QtGui.QApplication.UnicodeUTF8)) + self.radioButtonStatus.setText(QtGui.QApplication.translate("EmailGatewayDialog", "Account status at email gateway", None, QtGui.QApplication.UnicodeUTF8)) self.radioButtonUnregister.setText(QtGui.QApplication.translate("EmailGatewayDialog", "Unregister from email gateway", None, QtGui.QApplication.UnicodeUTF8)) 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))