aboutsummaryrefslogtreecommitdiff
path: root/webclient
diff options
context:
space:
mode:
Diffstat (limited to 'webclient')
-rw-r--r--webclient/client.html44
1 files changed, 43 insertions, 1 deletions
diff --git a/webclient/client.html b/webclient/client.html
index 7ea65cf..b68b51f 100644
--- a/webclient/client.html
+++ b/webclient/client.html
@@ -280,7 +280,7 @@ function executeCommand(roomid,text){
var spl=fancySplit(text,true);
if(spl.word.length==0)return;
var cmd=spl.word[0];
- var creds=null;
+ var creds=null,othername;
switch(cmd){
case "register":
case "login":
@@ -303,6 +303,48 @@ function executeCommand(roomid,text){
});
break;
+ case "createroom":
+ if(spl.word.length!=1){
+ addRoomEntry(roomid,"error",["Usage: /createroom"]);
+ break;
+ }
+ if(!username){
+ addRoomEntry(roomid,"error",["createroom: not logged in"]);
+ break;
+ }
+ net_send("create_room",function(name,err){
+ if(err){
+ addRoomEntry(roomid,"error",["Unable to create a room: "+err]);
+ } else {
+ addRoomEntry(roomid,"notice",["Successfully created room '"+name+"'"]);
+ fetchRoomList();
+ }
+ });
+ break;
+
+ case "invite":
+ if(spl.word.length<2){
+ addRoomEntry(roomid,"error",["Usage: /invite <username> (adds to current room)"]);
+ break;
+ }
+ if(!username){
+ addRoomEntry(roomid,"error",["invite: not logged in"]);
+ break;
+ }
+ if(!currentroom||currentroom[0]==":"){
+ addRoomEntry(roomid,"error",["invite: cannot invite into room '"+currentroom+"'"]);
+ break;
+ }
+ othername=spl.rest[1];
+ net_send("invite "+currentroom+" "+othername,function(ok,err){
+ if(err){
+ addRoomEntry(roomid,"error",["Unable to invite '"+othername+": "+err]);
+ } else {
+ addRoomEntry(roomid,"notice",["Successfully invited '"+othername+"'"]);
+ }
+ });
+ break;
+
default:
addRoomEntry(roomid,"error",["Unknown command '"+cmd+"'"]);
break;