changeset 235:f6aca9a7370b alpha

Traipse Alpha 'OpenRPG' {100616-00} Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to the code. 'Ornery-Orc's main goal is to offer more advanced features and enhance the productivity of the user. Update Summary (Closed) New Features: New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order New to Server GUI, can now clear log Updates: Update to Warhammer PC Sheet. Rollers set as macros. Should work with little maintanence. Update to Browser Server window. Display rooms with ' " & cleaner Update to Server. Handles ' " & cleaner. Fixes: Fix to InterParse that was causing an Infernal Loop with Namespace Internal Fix to XML data, removed old Minidom and switched to Element Tree Fix to Server that was causing eternal attempt to find a Server ID, in Register Rooms thread Fix to metaservers.xml file not being created Fix to Single and Double quotes in Whiteboard text Fix to Background images not showing when using the Image Server Fix to Duplicate chat names appearing Fix to Server GUI's logging output Fix to FNB.COLORFUL_TABS bug.
author sirebral
date Wed, 16 Jun 2010 03:01:22 -0500
parents f96e0e6d32d2
children
files orpg/networking/gsclient.py orpg/networking/mplay_server.py orpg/orpg_version.py
diffstat 3 files changed, 26 insertions(+), 99 deletions(-) [+]
line wrap: on
line diff
--- a/orpg/networking/gsclient.py	Tue Jun 15 18:55:49 2010 -0500
+++ b/orpg/networking/gsclient.py	Wed Jun 16 03:01:22 2010 -0500
@@ -349,7 +349,9 @@
         i = self.room_list.GetItemCount()
         if (data[2]=="1") or (data[2]=="True"): pwd="yes"
         else: pwd="no"
-        self.room_list.InsertStringItem(i,data[1])
+        name = data[1].replace('&', "&")
+        name = name.replace('"', '&quote;').replace("'", '&#39;').replace("<", "&lt;").replace(">", "&gt;").replace('&quot;', '"').replace('&#39;', "'")
+        self.room_list.InsertStringItem(i, name)
         self.room_list.SetStringItem(i,1,data[3])
         self.room_list.SetStringItem(i,2,pwd)
         self.room_list.SetItemData(i,int(data[0]))
@@ -441,7 +443,9 @@
             i = self.room_list.GetItemCount()
             if (g[2]=="True") or (g[2]=="1") : pwd="yes"
             else: pwd="no"
-            self.room_list.InsertStringItem(i, g[1])
+            name = g[1].replace('&amp;', "&")
+            name = name.replace('"', '&quote;').replace("'", '&#39;').replace("<", "&lt;").replace(">", "&gt;")
+            self.room_list.InsertStringItem(i, name)
             self.room_list.SetStringItem(i, 1, g[3])
             self.room_list.SetStringItem(i, 2, pwd)
             self.room_list.SetItemData(i, int(g[0]))
@@ -481,7 +485,9 @@
                     rooms = n.findall('room')
 
                     for room in rooms:
-                        self.rmList[address].append((room.get("id"), room.get("name"), 
+                        name = room.get('name').replace('&amp;', "&")
+                        name = name.replace('"', '&quote;').replace("'", '&#39;').replace("<", "&lt;").replace(">", "&gt;")
+                        self.rmList[address].append((room.get("id"), name, 
                                                     room.get("pwd"), room.get("num_users")))
                 self.svrList.sort(server_instance_compare)
 
@@ -568,36 +574,7 @@
         name = self.texts["room_name"].GetValue()
         boot_pwd = self.texts["room_boot_pwd"].GetValue()
         minversion = self.texts["room_min_version"].GetValue()
-        #
-        # Check for & in name.  We want to allow this becaus of its common use in D&D.
-        #
-        loc = name.find("&")
-        oldloc=0
-        while loc > -1:
-            loc = name.find("&",oldloc)
-            if loc > -1:
-                b = name[:loc]
-                e = name[loc+1:]
-                name = b + "&amp;" + e
-                oldloc = loc+1
-        loc = name.find('"')
-        oldloc=0
-        while loc > -1:
-            loc = name.find('"',oldloc)
-            if loc > -1:
-                b = name[:loc]
-                e = name[loc+1:]
-                name = b + "&quote;" + e
-                oldloc = loc+1
-        loc = name.find("'")
-        oldloc=0
-        while loc > -1:
-            loc = name.find("'",oldloc)
-            if loc > -1:
-                b = name[:loc]
-                e = name[loc+1:]
-                name = b + "&#39;" + e
-                oldloc = loc+1
+
         if self.buttons['gs_pwd'].GetValue(): pwd = self.texts["room_pwd"].GetValue()
         else: pwd = ""
         if name == "": wx.MessageBox("Invalid Name","Error");
--- a/orpg/networking/mplay_server.py	Tue Jun 15 18:55:49 2010 -0500
+++ b/orpg/networking/mplay_server.py	Wed Jun 16 03:01:22 2010 -0500
@@ -51,6 +51,7 @@
 from mplay_client import MPLAY_LENSIZE
 from orpg.dirpath import dir_struct
 import orpg.tools.validate
+import htmlentitydefs
 
 from orpg.mapper.map_msg import *
 from threading import Lock, RLock
@@ -316,7 +317,7 @@
             self.banDoc = self.banDom.getroot()
 
             for element in self.banDom.findall('banned'):
-                playerName = element.get('name').replace("&", "&amp;").replace("<", "&lt;").replace('"', "&quot;").replace(">", "&gt;")
+                playerName = element.get('name').replace("&", "&amp;").replace("<", "&lt;").replace('"', "").replace(">", "&gt;")
                 playerIP = element.get('ip')
                 self.ban_list[playerIP] = {}
                 self.ban_list[playerIP]['ip'] = playerIP
@@ -336,7 +337,7 @@
             etreeEl = Element('server')
             for ip in self.ban_list:
                 el = Element('banned')
-                el.set('name', str(self.ban_list[ip]['name'].replace("&amp;", "&").replace("&lt;", "<").replace("&quot;", '"').replace("&gt;", ">")))
+                el.set('name', str(self.ban_list[ip]['name'].replace("&amp;", "&").replace("&lt;", "<").replace("", '"').replace("&gt;", ">")))
                 el.set('ip', str(self.ban_list[ip]['ip']))
                 etreeEl.append(el)
             file = open(self.userPath + self.banFile ,"w")
@@ -1691,33 +1692,8 @@
         # Check for & in name.  We want to allow this because of its common
         # use in d&d games.
         try:
-            loc = name.find("&")
-            oldloc = 0
-            while loc > -1:
-                loc = name.find("&",oldloc)
-                if loc > -1:
-                    b = name[:loc]
-                    e = name[loc+1:]
-                    value = b + "&amp;" + e
-                    oldloc = loc+1
-            loc = name.find("'")
-            oldloc = 0
-            while loc > -1:
-                loc = name.find("'",oldloc)
-                if loc > -1:
-                    b = name[:loc]
-                    e = name[loc+1:]
-                    name = b + "&#39;" + e
-                    oldloc = loc+1
-            loc = name.find('"')
-            oldloc = 0
-            while loc > -1:
-                loc = name.find('"',oldloc)
-                if loc > -1:
-                    b = name[:loc]
-                    e = name[loc+1:]
-                    name = b + "&quot;" + e
-                    oldloc = loc+1
+            name = name.replace('&', '&amp;')
+            name = name.replace('"', '&quote;').replace("'", '&#39;').replace("<", "&lt;").replace(">", "&gt;")
             oldroomname = self.groups[gid].name
             self.groups[gid].name = str(name)
             lmessage = "Room name changed to from \"" + oldroomname + "\" to \"" + name + "\""
@@ -1744,34 +1720,8 @@
 
         # Check for & in name.  We want to allow this because of its common
         # use in d&d games.
-
-        loc = name.find("&")
-        oldloc = 0
-        while loc > -1:
-            loc = name.find("&",oldloc)
-            if loc > -1:
-                b = name[:loc]
-                e = name[loc+1:]
-                name = b + "&amp;" + e
-                oldloc = loc+1
-        loc = name.find("'")
-        oldloc = 0
-        while loc > -1:
-            loc = name.find("'",oldloc)
-            if loc > -1:
-                b = name[:loc]
-                e = name[loc+1:]
-                name = b + "&#39;" + e
-                oldloc = loc+1
-        loc = name.find('"')
-        oldloc = 0
-        while loc > -1:
-            loc = name.find('"',oldloc)
-            if loc > -1:
-                b = name[:loc]
-                e = name[loc+1:]
-                name = b + "&quot;" + e
-                oldloc = loc+1
+        name = name.replace('&', '&amp;')
+        name = name.replace('"', '&quote;').replace("'", '&#39;').replace("<", "&lt;").replace(">", "&gt;")
         group_id = str(self.next_group_id)
         self.next_group_id += 1
 
@@ -2027,31 +1977,31 @@
                     """
                     if given_boot_pwd == server_admin_pwd:
                         # Send a message to everyone in the room, letting them know someone has been booted
-                        boot_msg = "<msg to='all' from='%s' group_id='%s'/><font color='#FF0000'>Booting '(%s) %s' from server...</font>" % (from_id, group_id, to_id, self.players[to_id].name)
+                        msg = '<font color="#FF0000">'
+                        msg += 'Booting (' +str(to_id)+ ') ' +self.players[to_id].name+ ' from server...</font>'
+
+                        boot_msg = self.buildMsg('all', '0', group_id, msg)
                         self.log_msg("boot_msg:" + boot_msg)
                         self.send_to_group( "0", group_id, boot_msg )
                         time.sleep( 1 )
                         self.log_msg("Booting player " + str(to_id) + " from server.")
-
                         #  Send delete player event to all
                         self.send_to_group("0",group_id,self.players[to_id].toxml("del"))
-
                         #  Remove the player from local data structures
                         self.del_player(to_id,group_id)
-
                         #  Refresh the group data
                         self.check_group(to_id, group_id)
 
                     elif actual_boot_pwd == given_boot_pwd:
                         # Send a message to everyone in the room, letting them know someone has been booted
-                        boot_msg = "<msg to='all' from='%s' group_id='%s'/><font color='#FF0000'>Booting '(%s) %s' from room...</font>" % (from_id, group_id, to_id, self.players[to_id].name)
+                        msg = '<font color="#FF0000">'
+                        msg += 'Booting (' +str(to_id)+ ') ' +self.players[to_id].name+ ' from server...</font>'
+                        boot_msg = self.buildMsg('all', from_id, group_id, msg)
                         self.log_msg("boot_msg:" + boot_msg)
                         self.send_to_group( "0", group_id, boot_msg )
                         time.sleep( 1 )
-
                         #dump player into the lobby
                         self.move_player(to_id,"0")
-
                         #  Refresh the group data
                         self.check_group(to_id, group_id)
                     else:
@@ -2112,7 +2062,7 @@
         configDom = parse(dir_struct["user"] + 'ban_list.xml')
         self.ban_list = {}
         for element in configDom.findall('banned'):
-            player = element.get('name').replace("&", "&amp;").replace("<", "&lt;").replace('"', "&quot;").replace(">", "&gt;")
+            player = element.get('name').replace("&", "&amp;").replace("<", "&lt;").replace('"', "").replace(">", "&gt;")
             ip = element.get('ip')
             self.ban_list[ip] = {}
             self.ban_list[ip]['ip'] = ip
--- a/orpg/orpg_version.py	Tue Jun 15 18:55:49 2010 -0500
+++ b/orpg/orpg_version.py	Wed Jun 16 03:01:22 2010 -0500
@@ -4,7 +4,7 @@
 #BUILD NUMBER FORMAT: "YYMMDD-##" where ## is the incremental daily build index (if needed)
 DISTRO = "Traipse Alpha"
 DIS_VER = "Ornery Orc"
-BUILD = "100615-02"
+BUILD = "100616-00"
 
 # This version is for network capability.
 PROTOCOL_VERSION = "1.2"