[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[minion-cvs] Make text formats more outlook-friendly, I think



Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.mit.edu:/tmp/cvs-serv21364/lib/mixminion

Modified Files:
	ClientMain.py Packet.py test.py 
Log Message:
Make text formats more outlook-friendly, I think

Index: ClientMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ClientMain.py,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- ClientMain.py	14 Feb 2003 17:01:49 -0000	1.60
+++ ClientMain.py	17 Feb 2003 14:40:34 -0000	1.61
@@ -1546,10 +1546,13 @@
                 results.append(msg.getContents())
             else:
                 surbKey = self.keys.getSURBKey(create=0)
-                results.append(
-                    mixminion.BuildMessage.decodePayload(msg.getContents(),
+                p = mixminion.BuildMessage.decodePayload(msg.getContents(),
                                                          tag=msg.getTag(),
-                                                         userKey=surbKey))
+                                                         userKey=surbKey)
+                if p:
+                    results.append(p)
+                else:
+                    raise UIError("Unable to decode message")
         return results
 
 def parseAddress(s):
@@ -1873,13 +1876,15 @@
         if self.wantReplyPath and self.address is None:
             address = self.config['Security'].get('SURBAddress')
             if address is None:
-                raise UIError("No recipient specified; exiting.")
+                raise UIError("No recipient specified; exiting.  (Try "
+                              "using -t <your-address>)")
             try:
                 self.address = parseAddress(address)
             except ParseError, e:
-                raise UIError(str(e))
+                raise UIError("Error in SURBAddress:"+str(e))
         elif self.address is None and self.replyBlockFiles == []:
-            raise UIError("No recipients specified; exiting")
+            raise UIError("No recipients specified; exiting. (Try using "
+                          "-t <recipient-address>")
         elif self.address is not None and self.replyBlockFiles:
             raise UIError("Cannot use both a recipient and a reply block")
         elif self.replyBlockFiles:

Index: Packet.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/Packet.py,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- Packet.py	16 Feb 2003 04:50:55 -0000	1.34
+++ Packet.py	17 Feb 2003 14:40:34 -0000	1.35
@@ -522,7 +522,7 @@
         text = encodeBase64(self.pack())
         if not text.endswith("\n"):
             text += "\n"
-        return "%s\nVersion: 0.1\n%s%s\n"%(RB_TEXT_START,text,RB_TEXT_END)
+        return "%s\nVersion: 0.1\n\n%s%s\n"%(RB_TEXT_START,text,RB_TEXT_END)
     
 #----------------------------------------------------------------------
 # Routing info
@@ -744,11 +744,11 @@
             tagLine = ""
         elif self.messageType == 'ENC':
             ascTag = binascii.b2a_base64(self.tag).strip()
-            tagLine = "Decoding-handle: %s\n" % ascTag
+            tagLine = "Decoding-handle: %s\n\n" % ascTag
         elif self.messageType == 'LONG':
-            tagLine = "Message-type: overcompressed\n"
+            tagLine = "Message-type: overcompressed\n\n"
         elif self.messageType == 'BIN':
-            tagLine = "Message-type: binary\n"
+            tagLine = "Message-type: binary\n\n"
 
         if c and c[-1] != '\n':
             postNL = "\n"

Index: test.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/test.py,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- test.py	16 Feb 2003 04:50:55 -0000	1.91
+++ test.py	17 Feb 2003 14:40:34 -0000	1.92
@@ -1227,17 +1227,18 @@
         mb1 = tem(v, "BIN")
         eq(mb1.pack(), start+"""\
 Message-type: binary
+
 ANHlD+0fHOUA0eUP7R8c5QDR5Q/tHxzlANHlD+0fHOUA0eUP7R8c5QDR5Q/tHxzl
 ANHlD+0fHOUA0eUP7R8c5QDR5Q/tHxzlANHlD+0fHOUA0eUP7R8c5QDR5Q/tHxzl
 """+end)
-        eq(mb1.pack(), start+"Message-type: binary\n"+v64+end)
+        eq(mb1.pack(), start+"Message-type: binary\n\n"+v64+end)
         # Overcompressed
         ml1 = tem(v, "LONG")
-        eq(ml1.pack(), start+"Message-type: overcompressed\n"+v64+end)
+        eq(ml1.pack(), start+"Message-type: overcompressed\n\n"+v64+end)
         # Encoded
         menc1 = tem(v, "ENC", "9"*20)
         tag64 = base64.encodestring("9"*20).strip()
-        eq(menc1.pack(), start+"Decoding-handle: "+tag64+"\n"+v64+end)
+        eq(menc1.pack(), start+"Decoding-handle: "+tag64+"\n\n"+v64+end)
 
         # Test parsing: successful cases
         p = ptem(mt1.pack())[0]
@@ -4078,11 +4079,11 @@
         ####
         # Tests escapeMessageForEmail
         self.assert_(stringContains(eme(FDPFast('plain',message)), message))
-        expect = "BEGINS =======\nMessage-type: binary\n"+\
+        expect = "BEGINS =======\nMessage-type: binary\n\n"+\
                  encodeBase64(binmessage)+"====="
         self.assert_(stringContains(eme(FDPFast('plain',binmessage)), expect))
         expect = "BEGINS =======\nDecoding-handle: "+\
-                 base64.encodestring(tag)+\
+                 base64.encodestring(tag)+"\n"+\
                  encodeBase64(binmessage)+"====="
         self.assert_(stringContains(eme(FDPFast('enc',binmessage,tag)),
                                         expect))
@@ -4113,6 +4114,7 @@
 
 ======= TYPE III ANONYMOUS MESSAGE BEGINS =======
 Decoding-handle: eHh4eHh4eHh4eHh4eHh4eHh4eHg=
+
 7/rOqx76yt7v+s6rHvrK3u/6zqse+sre7/rOqx76yt7v+s6rHvrK3u/6zqse+sre
 7/rOqx76yt7v+s6rHvrK3u/6zqse+sre7/rOqx76yt7v+s6rHvrK3u/6zqse+sre
 7/rOqx76yt7v+s6rHvrK3u/6zqse+sre7/rOqx76yt7v+s6rHvrK3u/6zqse+sre