diff --git a/matrix/bar_items.py b/matrix/bar_items.py index 96e83a6..23e6fc9 100644 --- a/matrix/bar_items.py +++ b/matrix/bar_items.py @@ -112,7 +112,7 @@ def matrix_bar_item_buffer_modes(data, item, window, buffer, extra_info): and server.client.room_contains_unverified(room.room_id)): modes.append(G.CONFIG.look.encryption_warning_sign) - if not server.connected: + if not server.connected or not server.client.logged_in: modes.append(G.CONFIG.look.disconnect_sign) if room_buffer.backlog_pending or server.busy: diff --git a/matrix/buffer.py b/matrix/buffer.py index 7dc9f18..9060362 100644 --- a/matrix/buffer.py +++ b/matrix/buffer.py @@ -96,6 +96,10 @@ def room_buffer_input_cb(server_name, buffer, input_data): room_buffer.error("You are not connected to the server") return W.WEECHAT_RC_ERROR + if not server.client.logged_in: + room_buffer.error("You are not logged in.") + return W.WEECHAT_RC_ERROR + data = W.string_input_for_buffer(input_data) if not data: diff --git a/matrix/commands.py b/matrix/commands.py index cdb6444..92a20b1 100644 --- a/matrix/commands.py +++ b/matrix/commands.py @@ -933,6 +933,10 @@ def matrix_me_command_cb(data, buffer, args): W.prnt(server.server_buffer, message) return W.WEECHAT_RC_ERROR + if not server.client.logged_in: + room_buffer.error("You are not logged in.") + return W.WEECHAT_RC_ERROR + room_buffer = server.find_room_from_ptr(buffer) if not args: @@ -1817,6 +1821,10 @@ def matrix_send_anyways_cb(data, buffer, args): room_buffer.error("Server is diconnected") break + if not server.client.logged_in: + room_buffer.error("You are not logged in.") + return W.WEECHAT_RC_ERROR + if not room_buffer.last_message: room_buffer.error("No previously sent message found.") break diff --git a/matrix/server.py b/matrix/server.py index 93b1568..63705a1 100644 --- a/matrix/server.py +++ b/matrix/server.py @@ -862,7 +862,7 @@ class MatrixServer(object): be sent. event_id(str): the event id where to set the marker """ - if not self.connected: + if not self.connected or not self.client.logged_in: return _, request = self.client.room_read_markers( @@ -878,7 +878,7 @@ class MatrixServer(object): room_buffer(RoomBuffer): the room for which the typing notice needs to be sent. """ - if not self.connected: + if not self.connected or not self.client.logged_in: return input = room_buffer.weechat_buffer.input @@ -1098,8 +1098,9 @@ class MatrixServer(object): self.send_or_queue(request) def get_joined_members(self, room_id): - if not self.connected: + if not self.connected or not self.client.logged_in: return + if room_id in self.member_request_list: return @@ -1836,7 +1837,7 @@ def matrix_timer_cb(server_name, remaining_calls): server.reconnect() return W.WEECHAT_RC_OK - if not server.connected: + if not server.connected or not server.client.logged_in: return W.WEECHAT_RC_OK # check lag, disconnect if it's too big