Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Contextual errors for this and RegExp declarations in IRC module #8656

Merged
merged 8 commits into from
Dec 5, 2017
19 changes: 11 additions & 8 deletions packages/rocketchat-irc/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,13 @@ class IrcClient {
this.socket.setNoDelay;
this.socket.setEncoding('utf-8');
this.socket.setKeepAlive(true);
this.connect = this.connect.bind(this);
this.onConnect = this.onConnect.bind(this);
Copy link
Contributor

@graywolf336 graywolf336 Nov 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm unless I'm missing something, doesn't this get overwrote by the next line?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Derp, I was missing something. 🙈 so never mind!

Copy link
Contributor Author

@Pharserror Pharserror Nov 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

this.onConnect = bind(this.onConnect);
this.onClose = bind(this.onClose);
this.onTimeout = bind(this.onTimeout);
this.onError = bind(this.onError);
this.onReceiveRawMessage = this.onReceiveRawMessage.bind(this);
this.onReceiveRawMessage = bind(this.onReceiveRawMessage);
this.socket.on('data', this.onReceiveRawMessage);
this.socket.on('close', this.onClose);
Expand All @@ -59,14 +62,14 @@ class IrcClient {
this.receiveMemberListBuf = {};
this.pendingJoinRoomBuf = [];

this.successLoginMessageRegex = /RocketChat.settings.get('IRC_RegEx_successLogin');/;
this.failedLoginMessageRegex = /RocketChat.settings.get('IRC_RegEx_failedLogin');/;
this.receiveMessageRegex = /RocketChat.settings.get('IRC_RegEx_receiveMessage');/;
this.receiveMemberListRegex = /RocketChat.settings.get('IRC_RegEx_receiveMemberList');/;
this.endMemberListRegex = /RocketChat.settings.get('IRC_RegEx_endMemberList');/;
this.addMemberToRoomRegex = /RocketChat.settings.get('IRC_RegEx_addMemberToRoom');/;
this.removeMemberFromRoomRegex = /RocketChat.settings.get('IRC_RegEx_removeMemberFromRoom');/;
this.quitMemberRegex = /RocketChat.settings.get('IRC_RegEx_quitMember');/;
this.successLoginMessageRegex = new RegExp(RocketChat.settings.get('IRC_RegEx_successLogin'));
this.failedLoginMessageRegex = new RegExp(RocketChat.settings.get('IRC_RegEx_failedLogin'));
this.receiveMessageRegex = new RegExp(RocketChat.settings.get('IRC_RegEx_receiveMessage'));
this.receiveMemberListRegex = new RegExp(RocketChat.settings.get('IRC_RegEx_receiveMemberList'));
this.endMemberListRegex = new RegExp(RocketChat.settings.get('IRC_RegEx_endMemberList'));
this.addMemberToRoomRegex = new RegExp(RocketChat.settings.get('IRC_RegEx_addMemberToRoom'));
this.removeMemberFromRoomRegex = new RegExp(RocketChat.settings.get('IRC_RegEx_removeMemberFromRoom'));
this.quitMemberRegex = new RegExp(RocketChat.settings.get('IRC_RegEx_quitMember'));
}

connect(loginCb) {
Expand Down