34 lines
735 B
JavaScript
34 lines
735 B
JavaScript
module.exports = function(app) {
|
|
return new ChatRemote(app, app.get('chatService'));
|
|
}
|
|
|
|
class ChatRemote {
|
|
constructor(app, chatService) {
|
|
this.app = app;
|
|
this.chatService = chatService;
|
|
this.channelService = app.get('channelService');
|
|
}
|
|
|
|
add = function (uid, name, channelName, cb) {
|
|
this.chatService.add(uid, name, channelName, cb);
|
|
cb();
|
|
};
|
|
|
|
leave = function(uid, channelName, cb) {
|
|
this.chatService.leave(uid, channelName, cb);
|
|
cb();
|
|
}
|
|
|
|
kick = function(uid, sid, cb) {
|
|
|
|
const channelId = "worldChannel";
|
|
const channel = this.channelService.getChannel(channelId, false);
|
|
if (channel) {
|
|
channel.leave(uid, sid);
|
|
}
|
|
|
|
this.chatService.kick(uid, cb);
|
|
cb();
|
|
}
|
|
}
|