The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/packages/rocketchat-irc/server/methods/resetIrcConnection.js

52 lines
1.1 KiB

import Bridge from '../irc-bridge';
Meteor.methods({
resetIrcConnection() {
const ircEnabled = (!!RocketChat.settings.get('IRC_Enabled')) === true;
if (Meteor.ircBridge) {
Meteor.ircBridge.stop();
if (!ircEnabled) {
return {
message: 'Connection_Closed',
params: []
};
}
}
if (ircEnabled) {
if (Meteor.ircBridge) {
Meteor.ircBridge.init();
return {
message: 'Connection_Reset',
params: []
};
}
// Normalize the config values
const config = {
server: {
protocol: RocketChat.settings.get('IRC_Protocol'),
host: RocketChat.settings.get('IRC_Host'),
port: RocketChat.settings.get('IRC_Port'),
name: RocketChat.settings.get('IRC_Name'),
description: RocketChat.settings.get('IRC_Description')
},
passwords: {
local: RocketChat.settings.get('IRC_Local_Password'),
peer: RocketChat.settings.get('IRC_Peer_Password')
}
};
Meteor.ircBridge = new Bridge(config);
Meteor.ircBridge.init();
return {
message: 'Connection_Reset',
params: []
};
}
throw new Meteor.Error(t('IRC_Federation_Disabled'));
}
});