Client can now create room
Client can now create room

/room create [roomname] [roompass] [[user]]

If the user is currently in another room and they don't explicity set a user to be used as owner, then whatever username they're using in the current room will be re-used for the new room

--- a/client/LocalChatClient.py
+++ b/client/LocalChatClient.py
@@ -131,7 +131,7 @@
         
         # TODO - this functionality isn't on the 
         # backend yet, so haven't defined the hashing mechanism etc
-        passhash = passw
+        passhash = self.hashpw(passw)
         
         payload = {"roomName": room, 
                    "passhash": passhash,
@@ -183,6 +183,39 @@
         
         return True
                 
+
+
+    def createRoom(self,room,passw,user=False):
+        ''' Create a new room
+        '''
+        
+        if not user and not self.user:
+            return False
+        
+        if not user:
+            user = self.user
+        
+        # Room passwords may well go way at some point, but honour the
+        # api structure for now
+        passhash = self.hashpw(passw)
+        
+        payload = {"roomName": room, 
+                   "owner": user,
+                   "passhash": passhash
+                   }
+        
+        request = {"action":"createRoom",
+                   "payload": json.dumps(payload)
+                   }        
+        
+        resp = self.sendRequest(request)
+
+        if resp == "BROKENLINK" or resp['status'] != "ok":
+            return False
+        
+        return resp['name']
+    
+
 
 
     def sendRequest(self,data):
@@ -211,6 +244,12 @@
         return msg
 
 
+    def hashpw(self,passw):
+        ''' Placeholder
+        '''
+        return passw
+
+
 
 class NotInRoom(Exception):
     def __init__(self,cmd):
@@ -251,6 +290,7 @@
                 
                 if len(args) < 3:
                     raise InvalidCommand(line)
+                    return
                 
                 if not msg.joinRoom(args[0],args[1],args[2]):
                     raise UnableTo('join',line)
@@ -260,11 +300,28 @@
                 # /leave
                 if not msg.leaveRoom():
                     raise UnableTo('leave',line)
+                    return
                 
                 global c
                 c.output('Left the room','magenta')
                 return
         
+            if cmd == "room":
+                # /room [create|invite] [roomname] [roompass] [[user]]
+                if args[0] == "create":
+                    
+                    if len(args) < 4:
+                        args[3] = False
+                    
+                    n = msg.createRoom(args[1],args[2],args[3])
+                    if not n:
+                        raise UnableTo('create room',line)
+                        return
+                    
+                    global c
+                    c.output('Created Room %s' %(n))
+                    return
+                    
 
         if cmd in self._quit_cmd:
             return Commander.Exit