readme and keepalives

v1
Tony Olagbaiye 4 years ago
parent 7c15319f50
commit 668eb4ace1
No known key found for this signature in database
GPG Key ID: 9E2FF3BDEBDFC910

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

@ -31,8 +31,12 @@ enum t_account_option
weechat_config_option_set(account->options[option], value, 1) weechat_config_option_set(account->options[option], value, 1)
#define account_jid(account) \ #define account_jid(account) \
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]) weechat_config_string(account->options[ACCOUNT_OPTION_JID])
#define account_jid_device(account) \ #define account_jid_device(account) \
account->connection && xmpp_conn_is_connected(account->connection) ? \
xmpp_conn_get_bound_jid(account->connection) : \
xmpp_jid_new(account->context, \ xmpp_jid_new(account->context, \
xmpp_jid_node(account->context, \ xmpp_jid_node(account->context, \
weechat_config_string(account->options[ACCOUNT_OPTION_JID])), \ weechat_config_string(account->options[ACCOUNT_OPTION_JID])), \

@ -460,7 +460,8 @@ void connection__handler(xmpp_conn_t *conn, xmpp_conn_event_t status,
omemo__init(account); omemo__init(account);
} else { } 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, int connection__connect(struct t_account *account, xmpp_conn_t **connection,
const char* jid, const char* password, int tls) 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); *connection = xmpp_conn_new(account->context);
xmpp_conn_set_keepalive(*connection, ka_timeout_sec, ka_timeout_ivl);
const char *resource = account_resource(account); const char *resource = account_resource(account);
if (!(resource && strlen(resource))) if (!(resource && strlen(resource)))
{ {

Loading…
Cancel
Save