changeset 56:c7f04d3c76f5 traipse_dev

Major update to Server GUI. Basically makes it functional.
author sirebral
date Fri, 07 Aug 2009 21:53:14 -0500
parents 0b79d5dbbe9e
children 9014d7861bb3
files orpg/networking/mplay_server.py orpg/networking/mplay_server_gui.py orpg/orpg_version.py start_server_gui.py
diffstat 4 files changed, 158 insertions(+), 197 deletions(-) [+]
line wrap: on
line diff
--- a/orpg/networking/mplay_server.py	Thu Aug 06 17:55:27 2009 -0500
+++ b/orpg/networking/mplay_server.py	Fri Aug 07 21:53:14 2009 -0500
@@ -367,34 +367,29 @@
             self.configDom = minidom.parse(self.userPath + 'server_ini.xml')
             self.configDom.normalize()
             self.configDoc = self.configDom.documentElement
-            # Obtain the lobby/server password if it's been specified
-            if self.configDoc.hasAttribute("admin"):
-                self.boot_pwd = self.configDoc.getAttribute("admin")
-            elif self.configDoc.hasAttribute("boot"):
-                self.boot_pwd = self.configDoc.getAttribute("boot")
-            if hasattr(self, 'bootPassword'):
-                self.boot_pwd = self.bootPassword
-            elif len(self.boot_pwd) < 1:
-                self.boot_pwd = raw_input("Enter boot password for the Lobby:  ")
+
+            if hasattr(self, 'bootPassword'): self.boot_pwd = self.bootPassword
+
+            else:
+                if self.configDoc.hasAttribute("admin"): self.boot_pwd = self.configDoc.getAttribute("admin") 
+                elif self.configDoc.hasAttribute("boot"): self.boot_pwd = self.configDoc.getAttribute("boot") 
+
+                if len(self.boot_pwd) < 1: self.boot_pwd = raw_input("Enter admin password:  ")
+
             if not hasattr(self, 'reg') and self.configDoc.hasAttribute("register"):
                 self.reg = self.configDoc.getAttribute("register")
             if not len(self.reg) > 0 or self.reg[0].upper() not in ("Y", "N"):
                 opt = raw_input("Do you want to post your server to the OpenRPG Meta Server list? (y,n) ")
-                if len(opt) and (opt[0].upper() == 'Y'):
-                    self.reg = 'Y'
-                else:
-                    self.reg = 'N'
+                if len(opt) and (opt[0].upper() == 'Y'): self.reg = 'Y'
+                else: self.reg = 'N'
             LobbyName = 'Lobby'
-            if self.configDoc.hasAttribute("lobbyname"):
-                LobbyName = self.configDoc.getAttribute("lobbyname")
+            if self.configDoc.hasAttribute("lobbyname"): LobbyName = self.configDoc.getAttribute("lobbyname")
             map_node = service_node = self.configDoc.getElementsByTagName("map")[0]
             msg_node = service_node = self.configDoc.getElementsByTagName("message")[0]
             mapFile = map_node.getAttribute('file')
             msgFile = msg_node.getAttribute('file')
-            if mapFile == '':
-                mapFile = 'Lobby_map.xml'
-            if msgFile == '':
-                msgFile = 'LobbyMessage.html'
+            if mapFile == '': mapFile = 'Lobby_map.xml'
+            if msgFile == '': msgFile = 'LobbyMessage.html'
             # Update the lobby with the passwords if they've been specified
             if len(self.boot_pwd):
                 self.groups = {'0': game_group( '0', LobbyName, "", 'The game lobby', self.boot_pwd, "",
@@ -406,19 +401,15 @@
             service_node = self.configDoc.getElementsByTagName("service")[0]
             address = service_node.getAttribute("address")
             address = address.lower()
-            if address == "" or address == "hostname/address" or address == "localhost":
-                self.server_address = None
-            else:
-                self.server_address = address
+            if address == "" or address == "hostname/address" or address == "localhost": self.server_address = None
+            else: self.server_address = address
             self.server_port = OPENRPG_PORT
-            if service_node.hasAttribute("port"):
-                self.server_port = int(service_node.getAttribute("port"))
+            if service_node.hasAttribute("port"): self.server_port = int(service_node.getAttribute("port"))
             if self.configDoc.hasAttribute("name") and len(self.configDoc.getAttribute("name")) > 0 :
                 self.name = self.configDoc.getAttribute("name")
             else:
                 if self.reg[0].upper() == "Y":
-                    if self.name == None:
-                       self.name = raw_input("Server Name? ")
+                    if self.name == None: self.name = raw_input("Server Name? ")
                     self.register()
 
             # Get the minimum openrpg version from config if available
@@ -429,8 +420,7 @@
             try:
                 mver = self.configDoc.getElementsByTagName("version")[0]
                 self.minClientVersion = mver.getAttribute("min")
-            except:
-                self.minClientVersion = SERVER_MIN_CLIENT_VERSION #from orpg/orpg_version.py
+            except: self.minClientVersion = SERVER_MIN_CLIENT_VERSION #from orpg/orpg_version.py
             self.defaultMessageFile = ""
             # This try/except bit is to allow older versions of python to continue without a list error.
 
@@ -446,10 +436,8 @@
             try:
                 ak = self.configDoc.getElementsByTagName("autokick")[0]
                 if ak.hasAttribute("silent"):
-                    if ((ak.getAttribute("silent")).lower() == "yes"):
-                        self.silent_auto_kick = 1
-                    else:
-                        self.silent_auto_kick = 0
+                    if ((ak.getAttribute("silent")).lower() == "yes"): self.silent_auto_kick = 1
+                    else: self.silent_auto_kick = 0
                 if ak.hasAttribute("delay"):
                     try:
                         delay = int(ak.getAttribute("delay"))
@@ -497,10 +485,8 @@
                     if rpw == "no" or rpw == "0":
                         roomdefault_pass = 0
                         self.log_msg("Room Defaults: Disallowing Passworded Rooms")
-                    else:
-                        self.log_msg("Room Defaults: Allowing Passworded Rooms")
-                except:
-                    self.log_msg("Room Defaults: [Warning] Allowing Passworded Rooms")
+                    else: self.log_msg("Room Defaults: Allowing Passworded Rooms")
+                except: self.log_msg("Room Defaults: [Warning] Allowing Passworded Rooms")
                 try:
                     setting = roomdefaults.getElementsByTagName('map')[0]
                     map = setting.getAttribute('file')
@@ -514,13 +500,10 @@
                     setting = roomdefaults.getElementsByTagName('message')[0]
                     msg = setting.getAttribute('file')
                     if msg != "":
-                        if msg[:4].lower() == 'http':
-                            roomdefault_msg = msg
-                        else:
-                            roomdefault_msg = self.userPath + msg.replace("myfiles/", "")
+                        if msg[:4].lower() == 'http': roomdefault_msg = msg
+                        else: roomdefault_msg = self.userPath + msg.replace("myfiles/", "")
                         self.log_msg("Room Defaults: Using " + str(msg) + " for room messages")
-                except:
-                    print ("Room Defaults: [Warning] Using Default Message")
+                except: print ("Room Defaults: [Warning] Using Default Message")
             except:
                 traceback.print_exc()
                 self.log_msg("**WARNING** Error loading default room settings from configuration file. Using internal defaults.")
@@ -529,13 +512,11 @@
             #set the defaults
             if roomdefault_msg != "" or roomdefault_msg != None:
                 self.defaultMessageFile = roomdefault_msg  #<room_defaults> tag superceeds older <newrooms> tag
-            else:
-                self.defaultMessageFile = None
+            else: self.defaultMessageFile = None
 
             if roomdefault_map != "" or roomdefault_map != None:
                 self.defaultMapFile = roomdefault_map  #<room_defaults> tag superceeds older <newrooms> tag
-            else:
-                self.defaultMapFile = None
+            else: self.defaultMapFile = None
 
             ##### room default map not handled yet. SETTING IGNORED
             if roomdefault_pass == 0: self.allow_room_passwords = 0
@@ -559,10 +540,8 @@
 
             self.validate_protocol = 1
 
-            if(validate_protocol_node):
-                self.validate_protocol = (validate_protocol_node[0].getAttribute("value") == "True")
-            if(self.validate_protocol != 1):
-                self.log_msg("Protocol Validation: OFF")
+            if(validate_protocol_node): self.validate_protocol = (validate_protocol_node[0].getAttribute("value") == "True")
+            if(self.validate_protocol != 1): self.log_msg("Protocol Validation: OFF")
             self.makePersistentRooms()
 
             self.log_msg("Server Configuration File: Processing Completed.")
@@ -581,10 +560,8 @@
             bootPassword = element.getAttribute('boot')
 
             # Conditionally check for minVersion attribute
-            if element.hasAttribute('minVersion'):
-                minVersion = element.getAttribute('minVersion')
-            else:
-                minVersion = ""
+            if element.hasAttribute('minVersion'): minVersion = element.getAttribute('minVersion')
+            else: minVersion = ""
 
             # Extract the map filename attribute from the map node
             # we only care about the first map element found -- others are ignored
@@ -594,19 +571,15 @@
             messageElement = element.getElementsByTagName('message')[0]
             messageFile = messageElement.getAttribute('file')
 
-            if messageFile[:4] != 'http':
-                messageFile = self.userPath + messageFile.replace("myfiles/", "")
+            if messageFile[:4] != 'http': messageFile = self.userPath + messageFile.replace("myfiles/", "")
 
             # Make sure we have a message to even mess with
-            if(len(messageFile) == 0):
-                messageFile = self.defaultMessageFile
-
-            if(len(mapFile) == 0):
-                mapFile = self.defaultMapFile
+            if(len(messageFile) == 0): messageFile = self.defaultMessageFile
+
+            if(len(mapFile) == 0): mapFile = self.defaultMapFile
 
             moderated = 0
-            if element.hasAttribute('moderated') and element.getAttribute('moderated').lower() == "true":
-                moderated = 1
+            if element.hasAttribute('moderated') and element.getAttribute('moderated').lower() == "true": moderated = 1
 
             #create the new persistant group
             self.new_group(roomName, roomPassword, bootPassword, minVersion, mapFile, messageFile, persist = 1, moderated=moderated)
@@ -658,10 +631,8 @@
         else: return
         #when log mode changes update all connection stubs
         for n in self.players:
-            try:
-                self.players[n].EnableMessageLogging = mode
-            except:
-                self.log_msg("Error changing Message Logging Mode for client #" + str(self.players[n].id))
+            try: self.players[n].EnableMessageLogging = mode
+            except: self.log_msg("Error changing Message Logging Mode for client #" + str(self.players[n].id))
     def NetworkLoggingStatus(self):
         if self.log_network_messages == 0: return "Network Traffic Log: Off"
         elif self.log_network_messages == 1: return "Network Traffic Log: Logging (composite file)"
@@ -683,12 +654,11 @@
                     metacache_lock.release()
 
                 if newlist != curlist:          #  If the two lists aren't identical
-                                               #  then something has changed.
+                                                #  then something has changed.
                     instance.register()             #  Call self.register()
                                                 #  which will force a re-read of the meta cache and
                                                 #  redo the registerThreads
-        else:
-            instance.register()
+        else: instance.register()
 
                 # Eventually, reset the MetaServerBaseURL here
 
@@ -699,8 +669,7 @@
     def clean_published_servername(self, name):
         #clean name of all apostrophes and quotes
         badchars = "\"\\`><"
-        for c in badchars:
-            name = name.replace(c,"")
+        for c in badchars: name = name.replace(c,"")
         return name
 
     def registerRooms(self, args=None):
@@ -724,25 +693,20 @@
 
 
     def register(self,name_given=None):
-        if name_given == None:
-            name = self.name
-        else:
-            self.name = name = name_given
+        if name_given == None: name = self.name
+        else: self.name = name = name_given
 
         name = self.clean_published_servername(name)
 
         #  Set up the value for num_users
-        if self.players:
-            num_players = len(self.players)
-        else:
-            num_players = 0
+        if self.players: num_players = len(self.players)
+        else: num_players = 0
 
         #  request only Meta servers compatible with version 2
         metalist = getMetaServers(versions=["2"])
         if self.show_meta_messages != 0:
             self.log_msg("Found these valid metas:")
-            for meta in metalist:
-                self.log_msg("Meta:" + meta)
+            for meta in metalist: self.log_msg("Meta:" + meta)
 
         #  Go through the list and see if there is already a running register
         #  thread for the meta.
@@ -759,7 +723,7 @@
                 if self.show_meta_messages != 0: self.log_msg( "Outdated.  Unregistering and removing")
                 self.metas[meta].unregister()
                 del self.metas[meta]
-            else:
+            else: 
                 if self.show_meta_messages != 0: self.log_msg( "Found in current meta list.  Leaving intact.")
 
         #  Now call register() for alive metas or start one if we need one
@@ -786,26 +750,20 @@
         #  Instead, loop through all existing meta threads and unregister them
 
         for meta in self.metas.values():
-            if meta and meta.isAlive():
-                meta.unregister()
-
+            if meta and meta.isAlive(): meta.unregister()
         self.be_registered = 0
 
-
-
-
-    #  This method runs as it's own thread and does the group_member_check every
-    #    sixty seconds.  This should eliminate zombies that linger when no one is
-    #    around to spook them.  GC: Frequency has been reduced as I question how valid
-    #    the implementation is as it will only catch a very small segment of lingering
-    #    connections.
+        #  This method runs as it's own thread and does the group_member_check every
+        #    sixty seconds.  This should eliminate zombies that linger when no one is
+        #    around to spook them.  GC: Frequency has been reduced as I question how valid
+        #    the implementation is as it will only catch a very small segment of lingering
+        #    connections.
     def player_reaper_thread_func(self,arg):
         while self.alive:
             time.sleep(60)
 
             self.p_lock.acquire()
-            for group in self.groups.keys():
-                self.check_group_members(group)
+            for group in self.groups.keys(): self.check_group_members(group)
             self.p_lock.release()
 
     #This thread runs ever 250 miliseconds, and checks various plugin stuff
@@ -815,12 +773,8 @@
             players = ServerPlugins.getPlayer()
 
             for player in players:
-                if player is not None:
-                    #Do something here so they can show up in the chat room for non web users'
-                    pass
-
+                if player is not None: pass #Do something here so they can show up in the chat room for non web users'
             data = ServerPlugins.preParseOutgoing()
-
             for msg in data:
                 try:
                     xml_dom = parseXml(msg)
@@ -832,8 +786,7 @@
                     xml_dom.setAttribute('to', 'all')
                     self.incoming_msg_handler(xml_dom, msg)
                     xml_dom.unlink()
-                except:
-                    pass
+                except: pass
 
             self.p_lock.release()
             time.sleep(0.250)
@@ -854,25 +807,14 @@
                 sent = sock.send(slice)
                 offset += sent
             sentm = offset
-        else:
-            # Calculate our message length
-            length = len( msg )
-
-            # Encode the message length into network byte order
-            lp = pack('!i', length)
-
+        else: 
+            length = len( msg ) # Calculate our message length
+            lp = pack('!i', length) # Encode the message length into network byte order
             try:
-                # Send the encoded length
-                sentl = sock.send( lp )
-
-                # Now, send the message the the length was describing
-                sentm = sock.send( msg )
-
-            except socket.error, e:
-                self.log_msg( e )
-
-            except Exception, e:
-                self.log_msg( e )
+                sentl = sock.send( lp ) # Send the encoded length
+                sentm = sock.send( msg ) # Now, send the message the the length was describing
+            except socket.error, e: self.log_msg( e )
+            except Exception, e: self.log_msg( e )
 
 
     def recvData( self, sock, readSize ):
@@ -885,26 +827,19 @@
         try:
             while offset != readSize:
                 frag = sock.recv( readSize - offset )
-
-                # See if we've been disconnected
-                rs = len( frag )
+                rs = len( frag ) # See if we've been disconnected
                 if rs <= 0:
                     # Loudly raise an exception because we've been disconnected!
                     raise IOError, "Remote closed the connection!"
-
-                else:
-                    # Continue to build complete message
+                else: # Continue to build complete message
                     offset += rs
                     data += frag
 
         except socket.error, e:
             self.log_msg("Socket Error: recvData(): " +  e )
             data = ""
-
         return data
 
-
-
     def recvMsg(self, sock, useCompression=False, cmpType=None):
         """This method now expects to receive a message having a 4-byte prefix length.  It will ONLY read
         completed messages.  In the event that the remote's connection is terminated, it will throw an
@@ -918,26 +853,18 @@
         msgData = ""
         try:
             lenData = self.recvData( sock, MPLAY_LENSIZE )
-
             # Now, convert to a usable form
             (length,) = unpack('!i', lenData)
-
             # Read exactly the remaining amount of data
             msgData = self.recvData( sock, length )
-
             try:
-                if useCompression and cmpType != None:
-                    msgData = cmpType.decompress(msgData)
-            except:
-                traceback.print_exc()
-
-        except Exception, e:
-            self.log_msg( "Exception: recvMsg(): " + str(e) )
-
+                if useCompression and cmpType != None: msgData = cmpType.decompress(msgData)
+            except: traceback.print_exc()
+
+        except Exception, e: self.log_msg( "Exception: recvMsg(): " + str(e) )
         return msgData
 
 
-
     def kill_server(self):
         self.alive = 0
         self.log_msg("Server stopping...")
@@ -1358,6 +1285,8 @@
 
                 cmsg = "Client Connect: (" + str(props['id']) + ") " + str(props['name']) + " [" + str(props['ip']) + "]"
                 self.log_msg(cmsg)
+                cmsg = ("connect", props) #################################################
+                self.log_msg(cmsg)
 
                 #  If already registered then re-register, thereby updating the Meta
                 #    on the number of players
@@ -1864,7 +1793,7 @@
 
             #notify user about others in the room
             self.return_room_roles(from_id,group_id)
-            self.log_msg(("join_group", (from_id, group_id)))
+            self.log_msg(("join_group", (self.groups[group_id].name, group_id, from_id)))
             self.handle_role("set", from_id, self.players[from_id].role, self.groups[group_id].boot_pwd, group_id)
 
         except Exception, e:
@@ -1887,13 +1816,13 @@
     def new_group( self, name, pwd, boot, minVersion, mapFile, messageFile, persist = 0, moderated=0 ):
         group_id = str( self.next_group_id )
         self.next_group_id += 1
-
         self.groups[group_id] = game_group( group_id, name, pwd, "", boot, minVersion, mapFile, messageFile, persist )
         self.groups[group_id].moderated = moderated
         ins = ""
         if persist !=0: ins="Persistant "
         lmsg = "Creating " + ins + "Group... (" + str(group_id) + ") " + str(name)
         self.log_msg( lmsg )
+        self.log_msg(("create_group", (str(name), int(group_id), 0) )) ##-99 works, could be better.
 
 
     def change_group_name(self,gid,name,pid):
@@ -2008,6 +1937,7 @@
             self.log_msg( lmsg )
             jmsg = "moving to room " + str(group_id) + "."
             self.log_msg( jmsg )
+            self.log_msg(("create_group", (str(name), group_id, from_id)))
             #even creators of the room should see the HTML --akoman
             #edit: jan10/03 - was placed in the except statement. Silly me.
             if self.defaultMessageFile != None:
@@ -2038,7 +1968,7 @@
             if not self.isPersistentRoom(group_id)  and self.groups[group_id].get_num_players() == 0:
                 self.send_to_all("0",self.groups[group_id].toxml('del'))
                 del self.groups[group_id]
-                self.log_msg(("delete_group", (from_id, group_id)))
+                self.log_msg(("delete_group", (group_id, from_id)))
 
             else:
                 self.send_to_all("0",self.groups[group_id].toxml('update'))
@@ -2056,6 +1986,7 @@
             self.groups[group_id].remove_player(id)
             del self.players[id]
             self.log_msg(dmsg)
+            self.log_msg(("disconnect",id))
 
 
             #  If already registered then re-register, thereby updating the Meta
@@ -2465,6 +2396,7 @@
 
     def send_to_all(self,from_id,data):
         try:
+            print data
             self.p_lock.acquire()
             keys = self.players.keys()
             self.p_lock.release()
@@ -2475,15 +2407,18 @@
             traceback.print_exc()
             self.log_msg("Exception: send_to_all(): " + str(e))
 
-
-
     def send_to_group(self, from_id, group_id, data):
-        data = ServerPlugins.postParseIncoming(data)
+        msg = ("<msg to='all' from='0' group_id='"+group_id+"'><font color='#FF0000'>" + data + "</font>")
+        #data = ServerPlugins.postParseIncoming(data)
         try:
+            print data
+            self.p_lock.acquire()
             keys = self.groups[group_id].get_player_ids()
+            self.p_lock.release()
+            print keys
             for k in keys:
                 if k != from_id:
-                    self.players[k].outbox.put(data)
+                    self.players[k].outbox.put(msg)
         except Exception, e:
             traceback.print_exc()
             self.log_msg("Exception: send_to_group(): " + str(e))
--- a/orpg/networking/mplay_server_gui.py	Thu Aug 06 17:55:27 2009 -0500
+++ b/orpg/networking/mplay_server_gui.py	Fri Aug 07 21:53:14 2009 -0500
@@ -7,9 +7,7 @@
 __appname__=' OpenRPG GUI Server v0.7 '
 __version__='$Revision: 1.26 $'[11:-2]
 __cvsinfo__='$Id: mplay_server_gui.py,v 1.26 2007/11/06 00:32:39 digitalxero Exp $'[5:-2]
-__doc__="""
-OpenRPG Server Graphical Interface
-"""
+__doc__="""OpenRPG Server Graphical Interface"""
 
 import os
 import sys
@@ -22,6 +20,7 @@
 from threading import Thread
 from meta_server_lib import post_server_data, remove_server
 from mplay_server import mplay_server
+from xml.dom import minidom
 
 # Constants ######################################
 SERVER_RUNNING = 1
@@ -88,10 +87,14 @@
         setting used to control the server.
     """
 
-    def __init__(self, owner ):
-        """ Loads default configuration settings.
-        """
-        OPENRPG_PORT = 9557
+    def __init__(self, owner ): 
+        """ Loads default configuration settings."""
+        userPath = orpg.dirpath.dir_struct["user"] 
+        validate = orpg.tools.validate.Validate(userPath) 
+        validate.config_file( "server_ini.xml", "default_server_ini.xml" ) 
+        configDom = minidom.parse(userPath + 'server_ini.xml') 
+        port = configDom.childNodes[0].childNodes[1].getAttribute('port')
+        OPENRPG_PORT = 6774 if port == '' else int(port) #Pretty ugly, but I couldn't find the tag any other way.
         self.owner = owner
 
     def load_xml(self, xml):
@@ -145,7 +148,7 @@
     def __init__( self, parent, main ):
         wx.ListCtrl.__init__( self, parent, -1, wx.DefaultPosition, wx.DefaultSize, wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES )
         self.main = main
-        self.roomList = { "0" : "Lobby" }
+        self.roomList = { 0 : "Lobby" }
         self._imageList = wx.ImageList( 16, 16, False )
         img = wx.Image(orpg.dirpath.dir_struct["icon"]+"player.gif", wx.BITMAP_TYPE_GIF).ConvertToBitmap()
         self._imageList.Add( img )
@@ -171,7 +174,8 @@
         self.menu.SetTitle( "Player Menu" )
         self.menu.Append( MENU_PLAYER_BOOT, "Boot Player" )
         self.menu.AppendSeparator()
-        self.menu.Append( MENU_PLAYER_SEND_MESSAGE, "Send Message" )
+        self.menu.Append( MENU_PLAYER_SEND_MESSAGE, "Send Player Message" )
+        self.menu.Append( MENU_PLAYER_SEND_ROOM_MESSAGE, "Send Room Message" ) 
         self.menu.Append( MENU_PLAYER_SEND_SERVER_MESSAGE, "Broadcast Server Message" )
 
         # Associate our events
@@ -184,8 +188,8 @@
     def add(self, player):
         i = self.InsertImageStringItem( 0, player["id"], 0 )
         self.SetStringItem( i, 1, self.stripHtml( player["name"] ) )
-        self.SetStringItem( i, 2, self.stripHtml( player["status"] ) )
-        self.SetStringItem( i, 3, "ROOM" )
+        self.SetStringItem( i, 2, "new" )
+        self.SetStringItem( i, 3, self.roomList[0] )
         self.SetStringItem( i, 4, self.stripHtml( player["version"] ) )
         self.SetStringItem( i, 5, self.stripHtml( player["role"] ) )
         self.SetStringItem( i, 6, self.stripHtml( player["ip"] ) )
@@ -212,17 +216,16 @@
     def update(self, player):
         i = self.FindItemData( -1, int(player["id"]) )
         if i > -1:
-            self.SetStringItem(i, 1, player["name"])
-            self.SetStringItem(i, 2, self.stripHtml( player["status"] ) )
+            self.SetStringItem(i, 1, self.stripHtml(player["name"]))
+            self.SetStringItem(i, 2, self.stripHtml(player["status"]))
             self.AutoAjust()
         else: self.add(player)
 
     def updateRoom( self, data ):
-        (from_id, id) = data
-        i = self.FindItemData( -1, int(from_id) )
-        self.SetStringItem( i, 3, self.roomList[id] )
-        self.SetStringItem( i, 5, "Lurker")
-        self.Refresh()
+        (room, room_id, player) = data
+        i = self.FindItemData( -1, int(player) )
+        self.SetStringItem( i, 3, room )
+        self.AutoAjust()
 
     def setPlayerRole( self, id, role ):
         i = self.FindItemData( -1, int(id) )
@@ -254,8 +257,13 @@
         if self.main.STATUS == SERVER_RUNNING:
             menuItem = event.GetId()
             playerID = str( self.GetItemData( self.selectedItem ) )
+            room = str(self.GetItem((int(playerID)-1), 3).GetText())
             idList = self.main.server.server.groups
-            groupID = 0
+            for r in self.roomList:
+                if room == self.roomList[r]: groupID = r
+                else: groupID = 0
+            print self.roomList[groupID]
+            #groupID = self.roomList.get("'"+room+"'"); print groupID
             if menuItem == MENU_PLAYER_BOOT:
                 print "booting player: ", playerID
                 self.main.server.server.del_player( playerID, groupID )
@@ -266,11 +274,11 @@
                 msg = self.GetMessageInput( "Send a message to player" )
                 if len(msg): self.main.server.server.send( msg, playerID, str(groupID) )
             #Leave this in for now.
-            #elif menuItem == MENU_PLAYER_SEND_TO_ROOM:
-            #    print "Send message to room..."
-            #    msg = self.GetMessageInput( "Send message to room of this player")
-            #    if len(msg):
-            #        self.main.server.server.send_to_group( 0, GroupID, msg )
+            elif menuItem == MENU_PLAYER_SEND_ROOM_MESSAGE:
+                print "Send message to room..."
+                msg = self.GetMessageInput( "Send message to room of this player")
+                if len(msg):
+                    self.main.server.server.send_to_group("0", str(groupID), msg )
 
             elif menuItem == MENU_PLAYER_SEND_SERVER_MESSAGE:
                 print "broadcast a message..."
@@ -310,7 +318,7 @@
         # Server Callbacks
         cb = {}
         cb["log"]        = self.Log
-        cb["connect"]    = self.OnConnect
+        cb["connect"]    = self.OnConnect  ##Fixed!!
         cb["disconnect"] = self.OnDisconnect
         cb["update"]     = self.OnUpdatePlayer
         cb["data_recv"]  = self.OnDataRecv
@@ -432,7 +440,7 @@
     def Log(self, log):
         wx.LogMessage(str(log))
 
-    def OnConnect(player, self, data):
+    def OnConnect(self, player):
         self.conns.add(player)
 
     def OnDisconnect(self, id):
@@ -452,15 +460,15 @@
         self.sb.SetStatusText("Recv: %s (%d)" % (format_bytes(self.total_data_received), self.total_messages_received), 2)
 
     def OnCreateGroup( self, data ):
-        print "room list: ", self.conns.roomList
-        self.conns.roomList[id] = name
-        (id, name) = data
-        print "room list: ", self.conns.roomList
+        room_id = data[1]
+        name = data[0]
+        self.conns.roomList[room_id] = name
+        (room, room_id, player) = data
+        self.conns.updateRoom(data)
 
     def OnDeleteGroup( self, data ):
-        (from_id, id) = data
-        #del self.conns.roomList[id]
-        print "OnDeleteGroup room list: ", self.conns.roomList, id
+        (room_id, player) = data
+        del self.conns.roomList[room_id]
 
     def OnJoinGroup( self, data ):
         self.conns.updateRoom( data )
@@ -473,12 +481,35 @@
     def OnStart(self, event = None):
         """ Start server. """
         if self.STATUS == SERVER_STOPPED:
-            serverNameEntry = wx.TextEntryDialog( self, "Please Enter The Server Name You Wish To Use:",
+            # see if we already have name specified 
+            try:
+                userPath = orpg.dirpath.dir_struct["user"] 
+                validate = orpg.tools.validate.Validate(userPath) 
+                validate.config_file( "server_ini.xml", "default_server_ini.xml" ) 
+                configDom = minidom.parse(userPath + 'server_ini.xml') 
+                configDom.normalize() 
+                configDoc = configDom.documentElement 
+                if configDoc.hasAttribute("name"): self.serverName = configDoc.getAttribute("name")
+            except: pass 
+            if self.serverName == '': 
+                serverNameEntry = wx.TextEntryDialog( self, "Please Enter The Server Name You Wish To Use:",
                                                  "Server's Name", self.serverName, wx.OK|wx.CANCEL|wx.CENTRE )
-            if serverNameEntry.ShowModal() == wx.ID_OK: self.serverName = serverNameEntry.GetValue()
-            serverPasswordEntry = wx.TextEntryDialog(self, "Please Enter The Server Admin Password:",
-                                                 "Server's Password", self.bootPwd, wx.OK|wx.CANCEL|wx.CENTRE)
-            if serverPasswordEntry.ShowModal() == wx.ID_OK: self.bootPwd = serverPasswordEntry.GetValue()
+                if serverNameEntry.ShowModal() == wx.ID_OK: self.serverName = serverNameEntry.GetValue()
+            # see if we already have password specified 
+            try: 
+                userPath = orpg.dirpath.dir_struct["user"] 
+                validate = orpg.tools.validate.Validate(userPath) 
+                validate.config_file( "server_ini.xml", "default_server_ini.xml" ) 
+                configDom = minidom.parse(userPath + 'server_ini.xml') 
+                configDom.normalize() 
+                configDoc = configDom.documentElement 
+                if configDoc.hasAttribute("admin"): self.bootPwd = configDoc.getAttribute("admin") 
+                elif configDoc.hasAttribute("boot"): self.bootPwd = configDoc.getAttribute("boot") 
+            except: pass 
+            if self.bootPwd == '': 
+                serverPasswordEntry = wx.TextEntryDialog(self, "Please Enter The Server Admin Password:", "Server's Password", self.bootPwd, wx.OK|wx.CANCEL|wx.CENTRE)
+                if serverPasswordEntry.ShowModal() == wx.ID_OK: self.bootPwd = serverPasswordEntry.GetValue()
+
             if len(self.serverName):
                 wx.BeginBusyCursor()
                 self.server = ServerMonitor(self.callbacks, self.conf, self.serverName, self.bootPwd)
--- a/orpg/orpg_version.py	Thu Aug 06 17:55:27 2009 -0500
+++ b/orpg/orpg_version.py	Fri Aug 07 21:53:14 2009 -0500
@@ -4,7 +4,7 @@
 #BUILD NUMBER FORMAT: "YYMMDD-##" where ## is the incremental daily build index (if needed)
 DISTRO = "Traipse Dev"
 DIS_VER = "Grumpy Goblin"
-BUILD = "090806-08"
+BUILD = "090807-00"
 
 # This version is for network capability.
 PROTOCOL_VERSION = "1.2"
@@ -16,5 +16,5 @@
 # If the minimum version you want doesn't have a micro (e.g. 2.0), use zero
 # for the micro
 NEEDS_PYTHON_MAJOR = 2
-NEEDS_PYTHON_MINOR = 3
-NEEDS_PYTHON_MICRO = 0
+NEEDS_PYTHON_MINOR = 5
+NEEDS_PYTHON_MICRO = 4
--- a/start_server_gui.py	Thu Aug 06 17:55:27 2009 -0500
+++ b/start_server_gui.py	Fri Aug 07 21:53:14 2009 -0500
@@ -1,16 +1,11 @@
 #!/usr/bin/env python
 
-import os
+#import os
 import sys
 
-HG = os.environ["HG"]
-
 import pyver
 pyver.checkPyVersion()
 
-os.system(HG + ' pull "http://hg.assembla.com/traipse"')
-os.system(HG + ' update')
-
 from orpg.orpg_wx import *
 
 if WXLOADED: