weechat-matrix: Handle the case where our clients gets soft-logged out.
This commit is contained in:
parent
2aa70c7ead
commit
dc34a5bef9
4 changed files with 18 additions and 5 deletions
|
@ -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)):
|
and server.client.room_contains_unverified(room.room_id)):
|
||||||
modes.append(G.CONFIG.look.encryption_warning_sign)
|
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)
|
modes.append(G.CONFIG.look.disconnect_sign)
|
||||||
|
|
||||||
if room_buffer.backlog_pending or server.busy:
|
if room_buffer.backlog_pending or server.busy:
|
||||||
|
|
|
@ -96,6 +96,10 @@ def room_buffer_input_cb(server_name, buffer, input_data):
|
||||||
room_buffer.error("You are not connected to the server")
|
room_buffer.error("You are not connected to the server")
|
||||||
return W.WEECHAT_RC_ERROR
|
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)
|
data = W.string_input_for_buffer(input_data)
|
||||||
|
|
||||||
if not data:
|
if not data:
|
||||||
|
|
|
@ -933,6 +933,10 @@ def matrix_me_command_cb(data, buffer, args):
|
||||||
W.prnt(server.server_buffer, message)
|
W.prnt(server.server_buffer, message)
|
||||||
return W.WEECHAT_RC_ERROR
|
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)
|
room_buffer = server.find_room_from_ptr(buffer)
|
||||||
|
|
||||||
if not args:
|
if not args:
|
||||||
|
@ -1817,6 +1821,10 @@ def matrix_send_anyways_cb(data, buffer, args):
|
||||||
room_buffer.error("Server is diconnected")
|
room_buffer.error("Server is diconnected")
|
||||||
break
|
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:
|
if not room_buffer.last_message:
|
||||||
room_buffer.error("No previously sent message found.")
|
room_buffer.error("No previously sent message found.")
|
||||||
break
|
break
|
||||||
|
|
|
@ -862,7 +862,7 @@ class MatrixServer(object):
|
||||||
be sent.
|
be sent.
|
||||||
event_id(str): the event id where to set the marker
|
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
|
return
|
||||||
|
|
||||||
_, request = self.client.room_read_markers(
|
_, request = self.client.room_read_markers(
|
||||||
|
@ -878,7 +878,7 @@ class MatrixServer(object):
|
||||||
room_buffer(RoomBuffer): the room for which the typing notice needs
|
room_buffer(RoomBuffer): the room for which the typing notice needs
|
||||||
to be sent.
|
to be sent.
|
||||||
"""
|
"""
|
||||||
if not self.connected:
|
if not self.connected or not self.client.logged_in:
|
||||||
return
|
return
|
||||||
|
|
||||||
input = room_buffer.weechat_buffer.input
|
input = room_buffer.weechat_buffer.input
|
||||||
|
@ -1098,8 +1098,9 @@ class MatrixServer(object):
|
||||||
self.send_or_queue(request)
|
self.send_or_queue(request)
|
||||||
|
|
||||||
def get_joined_members(self, room_id):
|
def get_joined_members(self, room_id):
|
||||||
if not self.connected:
|
if not self.connected or not self.client.logged_in:
|
||||||
return
|
return
|
||||||
|
|
||||||
if room_id in self.member_request_list:
|
if room_id in self.member_request_list:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -1836,7 +1837,7 @@ def matrix_timer_cb(server_name, remaining_calls):
|
||||||
server.reconnect()
|
server.reconnect()
|
||||||
return W.WEECHAT_RC_OK
|
return W.WEECHAT_RC_OK
|
||||||
|
|
||||||
if not server.connected:
|
if not server.connected or not server.client.logged_in:
|
||||||
return W.WEECHAT_RC_OK
|
return W.WEECHAT_RC_OK
|
||||||
|
|
||||||
# check lag, disconnect if it's too big
|
# check lag, disconnect if it's too big
|
||||||
|
|
Loading…
Add table
Reference in a new issue