readme and keepalives

This commit is contained in:
Tony Olagbaiye 2021-07-05 17:33:26 +01:00
parent 7c15319f50
commit 668eb4ace1
No known key found for this signature in database
GPG Key ID: 9E2FF3BDEBDFC910
3 changed files with 24 additions and 8 deletions

View File

@ -94,6 +94,7 @@
* [X] Allow /close without crashing
* [ ] [#B] Handle wide errors gracefully
* [ ] [#B] Event-driven MUC entrance
* [ ] Pings
* [ ] MUCs
* [X] Opening (/enter)
* [ ] Leave on /close
@ -127,6 +128,10 @@
Please submit a pull request or create an issue
to add a new or missing feature.
* Testemonials
"Weechat-Strophe - for the discerning dual IRCer XMPPer" -- [[github.com/janicez][Ellenor et al Bjornsdottir]]
* License
weechat-xmpp is licensed under the Mozilla Public

View File

@ -31,14 +31,18 @@ enum t_account_option
weechat_config_option_set(account->options[option], value, 1)
#define account_jid(account) \
weechat_config_string(account->options[ACCOUNT_OPTION_JID])
account->connection && xmpp_conn_is_connected(account->connection) ? \
xmpp_jid_bare(account->context, xmpp_conn_get_bound_jid(account->connection)) : \
weechat_config_string(account->options[ACCOUNT_OPTION_JID])
#define account_jid_device(account) \
xmpp_jid_new(account->context, \
xmpp_jid_node(account->context, \
weechat_config_string(account->options[ACCOUNT_OPTION_JID])), \
xmpp_jid_domain(account->context, \
weechat_config_string(account->options[ACCOUNT_OPTION_JID])), \
"weechat")
account->connection && xmpp_conn_is_connected(account->connection) ? \
xmpp_conn_get_bound_jid(account->connection) : \
xmpp_jid_new(account->context, \
xmpp_jid_node(account->context, \
weechat_config_string(account->options[ACCOUNT_OPTION_JID])), \
xmpp_jid_domain(account->context, \
weechat_config_string(account->options[ACCOUNT_OPTION_JID])), \
"weechat")
#define account_password(account) \
weechat_config_string(account->options[ACCOUNT_OPTION_PASSWORD])
#define account_tls(account) \

View File

@ -460,7 +460,8 @@ void connection__handler(xmpp_conn_t *conn, xmpp_conn_event_t status,
omemo__init(account);
} else {
//xmpp_stop(account->context);
account__disconnect(account, 1);
//xmpp_stop(account->context); //keep context?
}
}
@ -482,7 +483,13 @@ char* connection__rand_string(int length)
int connection__connect(struct t_account *account, xmpp_conn_t **connection,
const char* jid, const char* password, int tls)
{
static const unsigned ka_timeout_sec = 60;
static const unsigned ka_timeout_ivl = 1;
*connection = xmpp_conn_new(account->context);
xmpp_conn_set_keepalive(*connection, ka_timeout_sec, ka_timeout_ivl);
const char *resource = account_resource(account);
if (!(resource && strlen(resource)))
{