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

Function replyMsg

src/bitmessagecli.py:1063–1116  ·  view source on GitHub ↗
(msgNum,forwardORreply)

Source from the content-addressed store, hash-verified

1061 return inboxMessages['inboxMessages'][msgNum]['msgid']
1062
1063def replyMsg(msgNum,forwardORreply): #Allows you to reply to the message you are currently on. Saves typing in the addresses and subject.
1064 global usrPrompt
1065 forwardORreply = forwardORreply.lower() #makes it lowercase
1066 try:
1067 inboxMessages = json.loads(api.getAllInboxMessages())
1068 except:
1069 print '\n Connection Error\n'
1070 usrPrompt = 0
1071 main()
1072
1073 fromAdd = inboxMessages['inboxMessages'][msgNum]['toAddress']#Address it was sent To, now the From address
1074 message = inboxMessages['inboxMessages'][msgNum]['message'].decode('base64') #Message that you are replying too.
1075
1076 subject = inboxMessages['inboxMessages'][msgNum]['subject']
1077 subject = subject.decode('base64')
1078
1079 if (forwardORreply == 'reply'):
1080 toAdd = inboxMessages['inboxMessages'][msgNum]['fromAddress'] #Address it was From, now the To address
1081 subject = "Re: " + subject
1082
1083 elif (forwardORreply == 'forward'):
1084 subject = "Fwd: " + subject
1085
1086 while True:
1087 toAdd = userInput("What is the To Address?")
1088
1089 if (toAdd == "c"):
1090 usrPrompt = 1
1091 print ' '
1092 main()
1093 elif (validAddress(toAdd)== False):
1094 print '\n Invalid Address. "c" to cancel. Please try again.\n'
1095 else:
1096 break
1097 else:
1098 print '\n Invalid Selection. Reply or Forward only'
1099 usrPrompt = 0
1100 main()
1101
1102 subject = subject.encode('base64')
1103
1104 newMessage = userInput("Enter your Message.")
1105
1106 uInput = userInput('Would you like to add an attachment, (Y)es or (N)o?').lower()
1107 if uInput == "y":
1108 newMessage = newMessage + '\n\n' + attachment()
1109
1110 newMessage = newMessage + '\n\n------------------------------------------------------\n'
1111 newMessage = newMessage + message
1112 newMessage = newMessage.encode('base64')
1113
1114 sendMsg(toAdd, fromAdd, subject, newMessage)
1115
1116 main()
1117
1118def delMsg(msgNum): #Deletes a specified message from the inbox
1119 global usrPrompt

Callers 1

UIFunction · 0.85

Calls 7

userInputFunction · 0.85
validAddressFunction · 0.85
attachmentFunction · 0.85
sendMsgFunction · 0.85
mainFunction · 0.70
decodeMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected