diff orpg/networking/mplay_server.py @ 98:95b5281e8d34 alpha

Traipse Alpha 'OpenRPG' {090925-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: 00: Update forwards to the 090909-02 Server code that now works. New default Lobby Map, designed for Traipse. Feel free to change it. Updates to Server GUI: * Admin can Ban from Backend. * Prework to modify Ban List in back end. * Server GUI finds your Lobby Name * New users default as Lurker unless a Role is set New Addition to Chat Die Roll commands. Math Ordering. Ex. [(X+Y)dZ]. Currently does pairs only, no nesting either. Cleaner TraipseSuiteAttention portability and clean up in Main (Beta!) 01: Die Roll Commands addition removed in favor of Core code {090925-00}: Updates to Server GUI: *Admin can Modify Ban List and Un Ban users. New About Dialog. A more uniform About Dialog.
author sirebral
date Fri, 25 Sep 2009 06:16:37 -0500
parents 65c1604e7949
children ded1e7a25f8d
line wrap: on
line diff
--- a/orpg/networking/mplay_server.py	Thu Sep 24 21:21:49 2009 -0500
+++ b/orpg/networking/mplay_server.py	Fri Sep 25 06:16:37 2009 -0500
@@ -2080,8 +2080,22 @@
             traceback.print_exc()
             self.log_msg('Exception in admin_kick() ' + str(e))
 
+    ### Alpha ### Addition added to assist in Un Banning users.
+    def admin_build_banlist(self):
+        validate.config_file("ban_list.xml", "default_ban_list.xml" ) 
+        configDom = minidom.parse(dir_struct["user"] + 'ban_list.xml')
+        self.ban_list = {}
+        for element in configDom.getElementsByTagName('banned'):
+            player = element.getAttribute('name').replace("&", "&amp;").replace("<", "&lt;").replace('"', "&quot;").replace(">", "&gt;")
+            ip = element.getAttribute('ip')
+            self.ban_list[ip] = {}
+            self.ban_list[ip]['ip'] = ip
+            self.ban_list[ip]['name'] = element.getAttribute('name')
+    ################
+
     def admin_banip(self, ip, name="", silent = 0):
         "Ban a player from a server from the console"
+        self.adming_buile_banlist() ### Alpha ###
         try:
             self.ban_list[ip] = {}
             self.ban_list[ip]['ip'] = ip
@@ -2125,6 +2139,7 @@
             self.log_msg('Exception in admin_ban() ' + str(e))
 
     def admin_unban(self, ip):
+        self.admin_build_banlist()
         try:
             if self.ban_list.has_key(ip): del self.ban_list[ip]
             self.saveBanList()
@@ -2571,3 +2586,5 @@
         except Exception, e: self.log_msg(str(e))
         self.p_lock.release()
         return pl
+
+server = mplay_server()