prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  '<' character is an "escape" character when messaging characters?
  Hi! I'm not sure if anyone else has stumbled across this issue. I first discovered this using a custom character typeclass that didn't have its msg method overloaded, and then tested it again with the default character typeclass. I haven't messed/overrode any functions found in /src. It seems as though the character '<' works like an escape character, as of the latest Evennia patch when messaging characters.
  
  Examples of testing in-game with @py (using the default character typeclass):
  ![capture](https://cloud.githubusercontent.com/assets/3461344/4623802/33146316-5356-11e4-854d-8b6ee0ea87e5.GIF)
  
  It's pretty weird, and it likely doesn't affect anyone sorely, but I was using the '<' and '>' character for my prompt, so I was surprised and baffled when half of my prompt disappeared! It used to work as of last night, before I pulled in the latest Evennia changes. I was browsing through Evennia's latest commits, but I haven't found anything that I thought would affect this.
  
  
  </issue>
  <code>
  [start of src/server/portal/mxp.py]
  1 """
  2 MXP - Mud eXtension Protocol.
  3 
  4 Partial implementation of the MXP protocol.
  5 The MXP protocol allows more advanced formatting options for telnet clients
  6 that supports it (mudlet, zmud, mushclient are a few)
  7 
  8 This only implements the SEND tag.
  9 
  10 More information can be found on the following links:
  11 http://www.zuggsoft.com/zmud/mxp.htm
  12 http://www.mushclient.com/mushclient/mxp.htm
  13 http://www.gammon.com.au/mushclient/addingservermxp.htm
  14 """
  15 import re
  16 
  17 LINKS_SUB =  re.compile(r'\{lc(.*?)\{lt(.*?)\{le', re.DOTALL)
  18 
  19 MXP = "\x5B"
  20 MXP_TEMPSECURE = "\x1B[4z"
  21 MXP_SEND = MXP_TEMPSECURE + \
  22            "<SEND HREF='\\1'>" + \
  23            "\\2" + \
  24            MXP_TEMPSECURE + \
  25            "</SEND>"
  26 
  27 def mxp_parse(text):
  28     """
  29     Replaces links to the correct format for MXP.
  30     """
  31     text = LINKS_SUB.sub(MXP_SEND, text)
  32     return text
  33 
  34 class Mxp(object):
  35     """
  36     Implements the MXP protocol.
  37     """
  38 
  39     def __init__(self, protocol):
  40         """Initializes the protocol by checking if the client supports it."""
  41         self.protocol = protocol
  42         self.protocol.protocol_flags["MXP"] = False
  43         self.protocol.will(MXP).addCallbacks(self.do_mxp, self.no_mxp)
  44 
  45     def no_mxp(self, option):
  46         """
  47         Client does not support MXP.
  48         """
  49         self.protocol.protocol_flags["MXP"] = False
  50 
  51     def do_mxp(self, option):
  52         """
  53         Client does support MXP.
  54         """
  55         self.protocol.protocol_flags["MXP"] = True
  56         self.protocol.handshake_done()
  57         self.protocol.requestNegotiation(MXP, '')
  58
  [end of src/server/portal/mxp.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/src/server/portal/mxp.py b/src/server/portal/mxp.py
  --- a/src/server/portal/mxp.py
  +++ b/src/server/portal/mxp.py
  @@ -28,6 +28,10 @@
       """
       Replaces links to the correct format for MXP.
       """
  +    text = text.replace("&", "&amp;") \
  +               .replace("<", "&lt;") \
  +               .replace(">", "&gt;")
  +
       text = LINKS_SUB.sub(MXP_SEND, text)
       return text
  
verification_info: {"golden_diff": "diff --git a/src/server/portal/mxp.py b/src/server/portal/mxp.py\n--- a/src/server/portal/mxp.py\n+++ b/src/server/portal/mxp.py\n@@ -28,6 +28,10 @@\n     \"\"\"\n     Replaces links to the correct format for MXP.\n     \"\"\"\n+    text = text.replace(\"&\", \"&amp;\") \\\n+               .replace(\"<\", \"&lt;\") \\\n+               .replace(\">\", \"&gt;\")\n+\n     text = LINKS_SUB.sub(MXP_SEND, text)\n     return text\n", "issue": "'<' character is an \"escape\" character when messaging characters?\nHi! I'm not sure if anyone else has stumbled across this issue. I first discovered this using a custom character typeclass that didn't have its msg method overloaded, and then tested it again with the default character typeclass. I haven't messed/overrode any functions found in /src. It seems as though the character '<' works like an escape character, as of the latest Evennia patch when messaging characters.\n\nExamples of testing in-game with @py (using the default character typeclass):\n![capture](https://cloud.githubusercontent.com/assets/3461344/4623802/33146316-5356-11e4-854d-8b6ee0ea87e5.GIF)\n\nIt's pretty weird, and it likely doesn't affect anyone sorely, but I was using the '<' and '>' character for my prompt, so I was surprised and baffled when half of my prompt disappeared! It used to work as of last night, before I pulled in the latest Evennia changes. I was browsing through Evennia's latest commits, but I haven't found anything that I thought would affect this.\n\n", "before_files": [{"content": "\"\"\"\nMXP - Mud eXtension Protocol.\n\nPartial implementation of the MXP protocol.\nThe MXP protocol allows more advanced formatting options for telnet clients\nthat supports it (mudlet, zmud, mushclient are a few)\n\nThis only implements the SEND tag.\n\nMore information can be found on the following links:\nhttp://www.zuggsoft.com/zmud/mxp.htm\nhttp://www.mushclient.com/mushclient/mxp.htm\nhttp://www.gammon.com.au/mushclient/addingservermxp.htm\n\"\"\"\nimport re\n\nLINKS_SUB =  re.compile(r'\\{lc(.*?)\\{lt(.*?)\\{le', re.DOTALL)\n\nMXP = \"\\x5B\"\nMXP_TEMPSECURE = \"\\x1B[4z\"\nMXP_SEND = MXP_TEMPSECURE + \\\n           \"<SEND HREF='\\\\1'>\" + \\\n           \"\\\\2\" + \\\n           MXP_TEMPSECURE + \\\n           \"</SEND>\"\n\ndef mxp_parse(text):\n    \"\"\"\n    Replaces links to the correct format for MXP.\n    \"\"\"\n    text = LINKS_SUB.sub(MXP_SEND, text)\n    return text\n\nclass Mxp(object):\n    \"\"\"\n    Implements the MXP protocol.\n    \"\"\"\n\n    def __init__(self, protocol):\n        \"\"\"Initializes the protocol by checking if the client supports it.\"\"\"\n        self.protocol = protocol\n        self.protocol.protocol_flags[\"MXP\"] = False\n        self.protocol.will(MXP).addCallbacks(self.do_mxp, self.no_mxp)\n\n    def no_mxp(self, option):\n        \"\"\"\n        Client does not support MXP.\n        \"\"\"\n        self.protocol.protocol_flags[\"MXP\"] = False\n\n    def do_mxp(self, option):\n        \"\"\"\n        Client does support MXP.\n        \"\"\"\n        self.protocol.protocol_flags[\"MXP\"] = True\n        self.protocol.handshake_done()\n        self.protocol.requestNegotiation(MXP, '')\n", "path": "src/server/portal/mxp.py"}]}