mirror of
https://github.com/profanity-im/profanity.git
synced 2024-09-22 19:45:54 -04:00
Save SM queue on /reconnect now
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
This commit is contained in:
parent
ff32f51f4f
commit
2b51675e89
@ -997,22 +997,25 @@ _connection_handler(xmpp_conn_t* const xmpp_conn, const xmpp_conn_event_t status
|
|||||||
log_debug("Connection handler: XMPP_CONN_DISCONNECT");
|
log_debug("Connection handler: XMPP_CONN_DISCONNECT");
|
||||||
|
|
||||||
// lost connection for unknown reason
|
// lost connection for unknown reason
|
||||||
if (conn.conn_status == JABBER_CONNECTED) {
|
if (conn.conn_status == JABBER_CONNECTED || conn.conn_status == JABBER_DISCONNECTING) {
|
||||||
if (prefs_get_boolean(PREF_STROPHE_SM_ENABLED)) {
|
if (prefs_get_boolean(PREF_STROPHE_SM_ENABLED)) {
|
||||||
int send_queue_len = xmpp_conn_send_queue_len(conn.xmpp_conn);
|
int send_queue_len = xmpp_conn_send_queue_len(conn.xmpp_conn);
|
||||||
log_debug("Connection handler: Lost connection for unknown reason");
|
log_debug("Connection handler: Lost connection for unknown reason, %d messages in send queue", send_queue_len);
|
||||||
conn.sm_state = xmpp_conn_get_sm_state(conn.xmpp_conn);
|
conn.sm_state = xmpp_conn_get_sm_state(conn.xmpp_conn);
|
||||||
if (send_queue_len > 0 && prefs_get_boolean(PREF_STROPHE_SM_RESEND)) {
|
if (send_queue_len > 0 && prefs_get_boolean(PREF_STROPHE_SM_RESEND)) {
|
||||||
conn.queued_messages = calloc(send_queue_len + 1, sizeof(*conn.queued_messages));
|
conn.queued_messages = calloc(send_queue_len + 1, sizeof(*conn.queued_messages));
|
||||||
for (int n = 0; n < send_queue_len && conn.queued_messages[n]; ++n) {
|
for (int n = 0; n < send_queue_len && conn.queued_messages[n]; ++n) {
|
||||||
conn.queued_messages[n] = xmpp_conn_send_queue_drop_element(conn.xmpp_conn, XMPP_QUEUE_OLDEST);
|
conn.queued_messages[n] = xmpp_conn_send_queue_drop_element(conn.xmpp_conn, XMPP_QUEUE_OLDEST);
|
||||||
}
|
}
|
||||||
|
} else if (send_queue_len > 0) {
|
||||||
|
log_debug("Connection handler: dropping those messages since SM RESEND is disabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
session_lost_connection();
|
if (conn.conn_status == JABBER_CONNECTED)
|
||||||
|
session_lost_connection();
|
||||||
|
|
||||||
// login attempt failed
|
// login attempt failed
|
||||||
} else if (conn.conn_status != JABBER_DISCONNECTING) {
|
} else {
|
||||||
gchar* host;
|
gchar* host;
|
||||||
int port;
|
int port;
|
||||||
if (stream_error && stream_error->stanza && _get_other_host(stream_error->stanza, &host, &port)) {
|
if (stream_error && stream_error->stanza && _get_other_host(stream_error->stanza, &host, &port)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user