Added broadcast handler. Fixed bug in tell handler. Wired both up.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4041 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -164,6 +164,8 @@ public class ChatDirector extends BasicDirector
|
|||||||
registerCommandHandler(msg, "speak", new SpeakHandler());
|
registerCommandHandler(msg, "speak", new SpeakHandler());
|
||||||
registerCommandHandler(msg, "emote", new EmoteHandler());
|
registerCommandHandler(msg, "emote", new EmoteHandler());
|
||||||
registerCommandHandler(msg, "think", new ThinkHandler());
|
registerCommandHandler(msg, "think", new ThinkHandler());
|
||||||
|
registerCommandHandler(msg, "tell", new TellHandler());
|
||||||
|
registerCommandHandler(msg, "broadcast", new BroadcastHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1160,7 +1162,7 @@ public class ChatDirector extends BasicDirector
|
|||||||
}
|
}
|
||||||
// note the command to be stored in the history
|
// note the command to be stored in the history
|
||||||
history[0] = command + " ";
|
history[0] = command + " ";
|
||||||
return requestChat(null, args, true);
|
return requestChat(speakSvc, args, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1214,9 +1216,9 @@ public class ChatDirector extends BasicDirector
|
|||||||
while (!handle.endsWith("\"") && tok.hasMoreTokens()) {
|
while (!handle.endsWith("\"") && tok.hasMoreTokens()) {
|
||||||
handle = handle + " " + tok.nextToken();
|
handle = handle + " " + tok.nextToken();
|
||||||
}
|
}
|
||||||
}
|
if (!handle.endsWith("\"")) {
|
||||||
if (!handle.endsWith("\"")) {
|
return "m.usage_tell";
|
||||||
return "m.usage_tell";
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// now strip off everything after the handle for the message
|
// now strip off everything after the handle for the message
|
||||||
@@ -1276,6 +1278,27 @@ public class ChatDirector extends BasicDirector
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Implements <code>/broadcast</code>. */
|
||||||
|
protected class BroadcastHandler extends CommandHandler
|
||||||
|
{
|
||||||
|
public String handleCommand (SpeakService speakSvc, String command,
|
||||||
|
String args, String[] history)
|
||||||
|
{
|
||||||
|
if (StringUtil.isBlank(args)) {
|
||||||
|
return "m.usage_broadcast";
|
||||||
|
}
|
||||||
|
// note the command to be stored in the history
|
||||||
|
history[0] = command + " ";
|
||||||
|
requestBroadcast(args);
|
||||||
|
return ChatCodes.SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean checkAccess (BodyObject user)
|
||||||
|
{
|
||||||
|
return user.checkAccess(ChatCodes.BROADCAST_ACCESS, null) == null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Our active chat context. */
|
/** Our active chat context. */
|
||||||
protected CrowdContext _ctx;
|
protected CrowdContext _ctx;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user