Skip to content

Commit

Permalink
XEP-0215: Resume updating the field expires after reconnection
Browse files Browse the repository at this point in the history
  • Loading branch information
VadimNk authored and mxlgv committed Apr 24, 2024
1 parent 5bca236 commit c00d3a1
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions plugins/ice/src/plugin.vala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public class Dino.Plugins.Ice.Plugin : RootInterface, Object {
stream.get_module(JingleRawUdp.Module.IDENTITY).set_local_ip_address_handler(get_local_ip_addresses);
}
});
app.stream_interactor.stream_negotiated.connect(external_discovery_refresh_services);
app.stream_interactor.connection_manager.connection_state_changed.connect(on_connection_state_changed);
}

Expand Down Expand Up @@ -102,13 +101,20 @@ public class Dino.Plugins.Ice.Plugin : RootInterface, Object {
}

public void on_connection_state_changed(Account account, ConnectionManager.ConnectionState state) {
if (state == ConnectionManager.ConnectionState.DISCONNECTED) {
XmppStream? stream = app.stream_interactor.connection_manager.get_stream(account);
if (stream == null) return;
if (!timeouts.has_key(stream)) return;

Source.remove(timeouts[stream].timeout_handle_id);
timeouts.unset(stream);
switch(state)
{
case ConnectionManager.ConnectionState.DISCONNECTED:
XmppStream? stream = app.stream_interactor.connection_manager.get_stream(account);
if (stream == null) return;
if (!timeouts.has_key(stream)) return;

Source.remove(timeouts[stream].timeout_handle_id);
timeouts.unset(stream);
break;
case ConnectionManager.ConnectionState.CONNECTED:
XmppStream? stream = app.stream_interactor.connection_manager.get_stream(account);
external_discovery_refresh_services(account, stream);
break;
}
}

Expand Down

0 comments on commit c00d3a1

Please sign in to comment.