jahschwa / sibyl

a python chatbot with a focus on XBMC
GNU General Public License v3.0
7 stars 6 forks source link

matrix: unnecessary room joins #61

Open jahschwa opened 5 years ago

jahschwa commented 5 years ago

It appears the matrix SDK isn't super smart about this. For example:

2019-05-12 15:46:55 | matrix   | DEB | Already in rooms: {u'!room1:domain.net': <matrix_client.room.Room object at 0x7f13909e71d0>, ...
2019-05-12 15:46:56 | sibylbot | INF | Success joining room "matrix:!room1:domain.net"

That is to say, the SDK call here: https://github.com/TheSchwa/sibyl/blob/23863ad4f2e0d91c6e177ea93e14c5b8da49821a/protocols/sibyl_matrix.py#L357

... actually makes an HTTP request. We have a local room dict, which is where the Already in rooms: line above comes from, so I'd say we should probably return without doing anything (except the _cb_join_room_success() call) if the requested room is already in there.

Or, I'll consider a change in sibylbot to check if we're in a room before attempting to join it.