Changed a bunch of function names to be shorter but still descriptive

This commit is contained in:
KimLS 2014-08-02 14:31:39 -07:00
parent ae30d8b257
commit 379ecc655c
7 changed files with 22 additions and 24 deletions

View File

@ -8,16 +8,16 @@ extern std::map<std::string, MethodHandler> unauthorized_methods;
void register_authorized_methods() void register_authorized_methods()
{ {
authorized_methods["WebInterface::Authorize"] = std::make_pair(0, handle_method_token_auth); authorized_methods["WebInterface.Authorize"] = std::make_pair(0, handle_method_token_auth);
authorized_methods["World::ListZones"] = std::make_pair(10, handle_method_no_args); authorized_methods["World.ListZones"] = std::make_pair(10, handle_method_no_args);
authorized_methods["World::GetZoneDetails"] = std::make_pair(10, handle_method_get_zone_info); authorized_methods["World.GetZoneDetails"] = std::make_pair(10, handle_method_get_zone_info);
authorized_methods["Zone::Subscribe"] = std::make_pair(10, handle_method_subscribe); authorized_methods["Zone.Subscribe"] = std::make_pair(10, handle_method_subscribe);
authorized_methods["Zone::Unsubscribe"] = std::make_pair(10, handle_method_subscribe); authorized_methods["Zone.Unsubscribe"] = std::make_pair(10, handle_method_subscribe);
} }
void register_unauthorized_methods() void register_unauthorized_methods()
{ {
unauthorized_methods["WebInterface::Authorize"] = handle_method_token_auth; unauthorized_methods["WebInterface.Authorize"] = handle_method_token_auth;
} }
void register_methods() void register_methods()

View File

@ -22,7 +22,7 @@
socket.onopen = function(e) { socket.onopen = function(e) {
var obj = {}; var obj = {};
obj.id = 'token_auth_id'; obj.id = 'token_auth_id';
obj.method = 'WebInterface::Authorize'; obj.method = 'WebInterface.Authorize';
obj.params = ['c5b80ec8-4174-4c4c-d332-dbf3c3a551fc']; obj.params = ['c5b80ec8-4174-4c4c-d332-dbf3c3a551fc'];
socket.send(JSON.stringify(obj)); socket.send(JSON.stringify(obj));
}; };
@ -32,18 +32,18 @@
console.log(obj); console.log(obj);
if(obj.id == 'token_auth_id') { if(obj.id == 'token_auth_id') {
socket.send(JSON.stringify({id: 'list_zones_id', method: 'World::ListZones', params: []})); socket.send(JSON.stringify({id: 'list_zones_id', method: 'World.ListZones', params: []}));
} else if(obj.id == 'list_zones_id') { } else if(obj.id == 'list_zones_id') {
for (var key in obj.result) { for (var key in obj.result) {
if(obj.result.hasOwnProperty(key)) { if(obj.result.hasOwnProperty(key)) {
var str = JSON.stringify({id: 'get_zone_info_id', method: 'World::GetZoneDetails', params: [obj.result[key]]}); var str = JSON.stringify({id: 'get_zone_info_id', method: 'World.GetZoneDetails', params: [obj.result[key]]});
console.log(str);
socket.send(str); socket.send(str);
} }
} }
} }
else if(obj.id == 'get_zone_info_id') { else if(obj.id == 'get_zone_info_id') {
socket.send(JSON.stringify({id: 'subscribe_id', method: 'Zone::Subscribe', params: [obj.result["zone_id"], obj.result["instance_id"], 'NPC::MakeSpawnUpdateNoDelta']})); socket.send(JSON.stringify({id: 'subscribe_id', method: 'Zone.Subscribe', params: [obj.result["zone_id"], obj.result["instance_id"], 'NPCPosition']}));
} else if(obj.method = "On.NPCPosition") {
} }
}; };
</script> </script>

View File

@ -46,10 +46,10 @@ void RemoteCallResponse(const std::string &connection_id, const std::string &req
} }
void register_remote_call_handlers() { void register_remote_call_handlers() {
remote_call_methods["World::ListZones"] = handle_rc_list_zones; remote_call_methods["World.ListZones"] = handle_rc_list_zones;
remote_call_methods["World::GetZoneDetails"] = handle_rc_get_zone_info; remote_call_methods["World.GetZoneDetails"] = handle_rc_get_zone_info;
remote_call_methods["Zone::Subscribe"] = handle_rc_relay; remote_call_methods["Zone.Subscribe"] = handle_rc_relay;
remote_call_methods["Zone::Unsubscribe"] = handle_rc_relay; remote_call_methods["Zone.Unsubscribe"] = handle_rc_relay;
} }
void handle_rc_list_zones(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector<std::string> &params) { void handle_rc_list_zones(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector<std::string> &params) {

View File

@ -1225,7 +1225,7 @@ void Mob::MakeSpawnUpdateNoDelta(PlayerPositionUpdateServer_Struct *spu){
params.push_back(std::to_string((double)y_pos)); params.push_back(std::to_string((double)y_pos));
params.push_back(std::to_string((double)z_pos)); params.push_back(std::to_string((double)z_pos));
params.push_back(std::to_string((double)heading)); params.push_back(std::to_string((double)heading));
RemoteCallSubscriptionHandler::Instance()->OnEvent("NPC::MakeSpawnUpdateNoDelta", params); RemoteCallSubscriptionHandler::Instance()->OnEvent("NPCPosition", params);
} }
} }

View File

@ -406,10 +406,6 @@ int main(int argc, char** argv) {
worldwasconnected = false; worldwasconnected = false;
} }
if(RemoteCallProcessTimer.Check()) {
RemoteCallSubscriptionHandler::Instance()->Process();
}
if (ZoneLoaded && zoneupdate_timer.Check()) { if (ZoneLoaded && zoneupdate_timer.Check()) {
{ {
if(net.group_timer.Enabled() && net.group_timer.Check()) if(net.group_timer.Enabled() && net.group_timer.Check())
@ -445,6 +441,9 @@ int main(int argc, char** argv) {
if(quest_timers.Check()) if(quest_timers.Check())
quest_manager.Process(); quest_manager.Process();
if(RemoteCallProcessTimer.Check()) {
RemoteCallSubscriptionHandler::Instance()->Process();
}
} }
} }
DBAsyncWork* dbaw = 0; DBAsyncWork* dbaw = 0;

View File

@ -68,8 +68,8 @@ void RemoteCall(const std::string &connection_id, const std::string &method, con
} }
void register_remote_call_handlers() { void register_remote_call_handlers() {
remote_call_methods["Zone::Subscribe"] = handle_rc_subscribe; remote_call_methods["Zone.Subscribe"] = handle_rc_subscribe;
remote_call_methods["Zone::Unsubscribe"] = handle_rc_unsubscribe; remote_call_methods["Zone.Unsubscribe"] = handle_rc_unsubscribe;
} }
void handle_rc_subscribe(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector<std::string> &params) { void handle_rc_subscribe(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector<std::string> &params) {

View File

@ -96,7 +96,7 @@ void RemoteCallSubscriptionHandler::OnEvent(std::string method, std::vector<std:
return; return;
} }
std::string func = "WebInterface::DispatchEvent::" + method; std::string func = "On." + method;
std::vector<std::string> &conns = registered_events[method]; std::vector<std::string> &conns = registered_events[method];
if(conns.size() > 0) { if(conns.size() > 0) {
auto &iter = conns.begin(); auto &iter = conns.begin();
@ -158,5 +158,4 @@ void RemoteCallSubscriptionHandler::ClearConnection(std::string connection_id) {
void RemoteCallSubscriptionHandler::ClearAllConnections() { void RemoteCallSubscriptionHandler::ClearAllConnections() {
registered_events.clear(); registered_events.clear();
connection_ids.clear(); connection_ids.clear();
} }