From 4765705764d543ccbadc9a569bb03eebfdaa4e0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C3=B6=20Barany?= Date: Wed, 11 Sep 2013 12:18:13 +0200 Subject: [PATCH 1/2] More informative "message truncated" text that tells users what to do to view the full message. --- src/bitmessageqt/__init__.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 54e10adf..113c53c1 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -2718,23 +2718,26 @@ class MyForm(QtGui.QMainWindow): fromAddress = str(self.ui.tableWidgetInbox.item( currentRow, 1).data(Qt.UserRole).toPyObject()) + messageItem = self.ui.tableWidgetInbox.item(currentRow, 2) + messageText = messageItem.data(Qt.UserRole).toPyObject() + if len(messageText) > 30000: + messageText = ( + messageText[:30000] + '\n' + + '--- Display of the remainder of the message ' + + 'truncated because it is too long.\n' + + '--- To see the full message, right-click in the ' + + 'Inbox view and select "View HTML code as formatted ' + + 'text",\n' + + '--- or select "Save message as..." to save it to a ' + + 'file, or select "Reply" and ' + + 'view the full message in the quote.') # If we have received this message from either a broadcast address # or from someone in our address book, display as HTML if decodeAddress(fromAddress)[3] in shared.broadcastSendersForWhichImWatching or shared.isAddressInMyAddressBook(fromAddress): - if len(self.ui.tableWidgetInbox.item(currentRow, 2).data(Qt.UserRole).toPyObject()) < 30000: - self.ui.textEditInboxMessage.setText(self.ui.tableWidgetInbox.item( - currentRow, 2).data(Qt.UserRole).toPyObject()) # Only show the first 30K characters - else: - self.ui.textEditInboxMessage.setText(self.ui.tableWidgetInbox.item(currentRow, 2).data(Qt.UserRole).toPyObject()[ - :30000] + '\n\nDisplay of the remainder of the message truncated because it is too long.') # Only show the first 30K characters + self.ui.textEditInboxMessage.setText(messageText) else: - if len(self.ui.tableWidgetInbox.item(currentRow, 2).data(Qt.UserRole).toPyObject()) < 30000: - self.ui.textEditInboxMessage.setPlainText(self.ui.tableWidgetInbox.item( - currentRow, 2).data(Qt.UserRole).toPyObject()) # Only show the first 30K characters - else: - self.ui.textEditInboxMessage.setPlainText(self.ui.tableWidgetInbox.item(currentRow, 2).data(Qt.UserRole).toPyObject()[ - :30000] + '\n\nDisplay of the remainder of the message truncated because it is too long.') # Only show the first 30K characters - + self.ui.textEditInboxMessage.setPlainText(messageText) + self.ui.tableWidgetInbox.item(currentRow, 0).setFont(font) self.ui.tableWidgetInbox.item(currentRow, 1).setFont(font) self.ui.tableWidgetInbox.item(currentRow, 2).setFont(font) -- 2.45.1 From ed0a57d99886a8c89bbb7120ec3036b27a6b7019 Mon Sep 17 00:00:00 2001 From: Joshua Noble Date: Sat, 12 Oct 2013 00:33:19 -0400 Subject: [PATCH 2/2] Fixed typo in getInboxMessagesByAddress --- src/bitmessagemain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bitmessagemain.py b/src/bitmessagemain.py index ef2a2ddd..26a2a92d 100755 --- a/src/bitmessagemain.py +++ b/src/bitmessagemain.py @@ -461,7 +461,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): if len(params) == 0: raise APIError(0, 'I need parameters!') toAddress = params[0] - queryReturn = sqlQuery('''SELECT msgid, toaddress, fromaddress, subject, received, message, encodingtype FROM inbox WHERE folder='inbox' AND toAddress=?''', toAddress) + queryreturn = sqlQuery('''SELECT msgid, toaddress, fromaddress, subject, received, message, encodingtype FROM inbox WHERE folder='inbox' AND toAddress=?''', toAddress) data = '{"inboxMessages":[' for row in queryreturn: msgid, toAddress, fromAddress, subject, received, message, encodingtype = row -- 2.45.1