MCPcopy Index your code
hub / github.com/Bitmessage/PyBitmessage / inbox

Function inbox

src/bitmessagecli.py:890–920  ·  view source on GitHub ↗
(unreadOnly = False)

Source from the content-addressed store, hash-verified

888 main()
889
890def inbox(unreadOnly = False): #Lists the messages by: Message Number, To Address Label, From Address Label, Subject, Received Time)
891 global usrPrompt
892 try:
893 inboxMessages = json.loads(api.getAllInboxMessages())
894 numMessages = len(inboxMessages['inboxMessages'])
895 except:
896 print '\n Connection Error\n'
897 usrPrompt = 0
898 main()
899
900 messagesPrinted = 0
901 messagesUnread = 0
902 for msgNum in range (0, numMessages): #processes all of the messages in the inbox
903 message = inboxMessages['inboxMessages'][msgNum]
904 # if we are displaying all messages or if this message is unread then display it
905 if not unreadOnly or not message['read']:
906 print ' -----------------------------------\n'
907 print ' Message Number:',msgNum #Message Number
908 print ' To:', getLabelForAddress(message['toAddress']) #Get the to address
909 print ' From:', getLabelForAddress(message['fromAddress']) #Get the from address
910 print ' Subject:', message['subject'].decode('base64') #Get the subject
911 print ' Received:', datetime.datetime.fromtimestamp(float(message['receivedTime'])).strftime('%Y-%m-%d %H:%M:%S')
912 messagesPrinted += 1
913 if not message['read']: messagesUnread += 1
914
915 if (messagesPrinted%20 == 0 and messagesPrinted != 0):
916 userInput('(Press Enter to continue or type (Exit) to return to the main menu.)').lower() # uInput =
917
918 print '\n -----------------------------------'
919 print ' There are %d unread messages of %d messages in the inbox.' % (messagesUnread, numMessages)
920 print ' -----------------------------------\n'
921
922def outbox():
923 global usrPrompt

Callers 1

UIFunction · 0.85

Calls 4

getLabelForAddressFunction · 0.85
userInputFunction · 0.85
mainFunction · 0.70
decodeMethod · 0.45

Tested by

no test coverage detected