Skip to content

Commit

Permalink
Reply-from-user subject key added to the reply from user dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Daniel Bennett committed Oct 16, 2020
1 parent d2ad5bb commit f389afb
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions api/ECNQueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ def __userReplyParsing(self, replyContent: list, lineNumber: int) -> dict:

replyFromInfo["type"] = "reply_from_user"

replyFromHeaders = []
newLineCounter = 0
endingDelimiterCount = 0

Expand Down Expand Up @@ -644,6 +645,18 @@ def __userReplyParsing(self, replyContent: list, lineNumber: int) -> dict:
replyFromInfo["from_name"] = emailList[0][0]
replyFromInfo["from_email"] = emailList[0][1]

linesToRemove.append(lineNum)
elif line.startswith("Subject: ") and newLineCounter == 1:
# Matches everything after "Subject: "
try:
subjectStr = (re.search("(?<=Subject: )(.*)", line)).group()
except:
errorMessage = "Expeted syntax of \"Subject: [subject]\""
return self.__errorParsing(line, lineNumber + lineNum + 1, errorMessage)

# Formatts the date to UTC
replyFromInfo["subject"] = subjectStr

linesToRemove.append(lineNum)

elif line.startswith("Date: ") and newLineCounter == 1:
Expand Down Expand Up @@ -938,10 +951,4 @@ def getQueues() -> list:
if isDirectory and isValid:
queues.append(Queue(file))

return queues
if __name__ == "__main__":
item = Item("ce", 100)
print()
# for queue in getQueues():
# for item in queue.items:
# print(f"${item.queue} ${item.number}")
return queues

0 comments on commit f389afb

Please sign in to comment.