Skip to content

Commit

Permalink
gitter: Pass query parameter to readAPIRequest
Browse files Browse the repository at this point in the history
- New parameter `query` is added to GitterBackend.rooms function. This parameter
  is used while making a request to the rooms endpoint.
- `rooms` function is called with the room uri in in `query_rooms` function.

Closes errbotio#21
  • Loading branch information
meetmangukiya committed Jul 4, 2017
1 parent 53ac5e0 commit 82fd6b8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,8 @@ def follow_room(self, room):
else:
log.info("Already joined %s", room.name)

def rooms(self):
json_rooms = self.readAPIRequest('rooms')
def rooms(self, query=None):
json_rooms = self.readAPIRequest('rooms', {'q': query} if query else None)
rooms = []
for json_room in json_rooms:
if not json_room['oneToOne']:
Expand Down Expand Up @@ -419,7 +419,7 @@ def build_identifier(self, strrep):

def query_room(self, room):
# TODO: maybe we can query the room resource only
for native_room in self.rooms():
for native_room in self.rooms(room):
if native_room.uri == room:
log.debug("Found room %s" % room)
return native_room
Expand Down

0 comments on commit 82fd6b8

Please sign in to comment.