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

Fixes join when password is set for room. #578

Merged
merged 2 commits into from
Jan 12, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions errbot/core_plugins/chatRoom.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@ def callback_connect(self):
self.log.exception("Joining room %s failed", repr(room))

def _join_room(self, room):
room_name = compat_str(room)
if room_name is not None:
room, username, password = (room_name, self.bot_config.CHATROOM_FN, None)
if isinstance(room, tuple) or isinstance(room, list):
Copy link
Member

Choose a reason for hiding this comment

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

This can be written as if isinstance(room, (list, tuple)):

room_name = compat_str(room[0])
room_password = compat_str(room[1])
room, username, password = (room_name, self.bot_config.CHATROOM_FN, room_password)
self.log.info("Joining room {} with username {} and password".format(room, username))
else:
room, username, password = (room[0], self.bot_config.CHATROOM_FN, room[1])
self.log.info("Joining room {} with username {}".format(room, username))
room_name = compat_str(room)
room, username, password = (room_name, self.bot_config.CHATROOM_FN, None)
self.log.info("Joining room {} with username {}".format(room, username))
try:
self.query_room(room).join(username=self.bot_config.CHATROOM_FN, password=password)
except NotImplementedError:
Expand Down