mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Merge pull request #1891 from profanity-im/minor-improvements
Minor improvements
This commit is contained in:
commit
4e0981abc8
9
.github/pull_request_template.md
vendored
9
.github/pull_request_template.md
vendored
@ -1,8 +1,9 @@
|
|||||||
<!--- Make sure to read CONTRIBUTING.md -->
|
<!--- Make sure to read CONTRIBUTING.md -->
|
||||||
<!--- It mentions the rules to follow and helpful tools -->
|
<!--- It mentions the rules to follow and helpful tools -->
|
||||||
|
|
||||||
# How to test the functionality
|
<!-- For completed items, change [ ] to [x]. -->
|
||||||
* step 1
|
- [ ] I ran valgrind when using my new feature
|
||||||
|
|
||||||
# I ran valgrind when using my new feature
|
### How to test the functionality
|
||||||
yes/no
|
* step 1
|
||||||
|
* step 2
|
||||||
|
6
.gitignore
vendored
6
.gitignore
vendored
@ -43,6 +43,9 @@ src/gitversion.h.in
|
|||||||
src/stamp-h1
|
src/stamp-h1
|
||||||
src/plugins/profapi.lo
|
src/plugins/profapi.lo
|
||||||
|
|
||||||
|
# out-of-tree build folders
|
||||||
|
build*/
|
||||||
|
|
||||||
# binaries
|
# binaries
|
||||||
profanity
|
profanity
|
||||||
**/*.o
|
**/*.o
|
||||||
@ -89,8 +92,11 @@ python2/
|
|||||||
python3/
|
python3/
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
.gdbinit
|
||||||
*.bak
|
*.bak
|
||||||
*.orig
|
*.orig
|
||||||
|
*.patch
|
||||||
|
*.rej
|
||||||
breaks
|
breaks
|
||||||
|
|
||||||
*.tar.*
|
*.tar.*
|
||||||
|
@ -481,7 +481,7 @@ static void
|
|||||||
_accounts_set_string_option(const char* account_name, const char* const option, const char* const value)
|
_accounts_set_string_option(const char* account_name, const char* const option, const char* const value)
|
||||||
{
|
{
|
||||||
if (accounts_account_exists(account_name)) {
|
if (accounts_account_exists(account_name)) {
|
||||||
g_key_file_set_string(accounts, account_name, option, value);
|
g_key_file_set_string(accounts, account_name, option, value ?: "");
|
||||||
_save_accounts();
|
_save_accounts();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -300,7 +300,8 @@ sv_ev_room_history(ProfMessage* message)
|
|||||||
ProfMucWin* mucwin = wins_get_muc(message->from_jid->barejid);
|
ProfMucWin* mucwin = wins_get_muc(message->from_jid->barejid);
|
||||||
if (mucwin) {
|
if (mucwin) {
|
||||||
// if this is the first successful connection
|
// if this is the first successful connection
|
||||||
if (ev_is_first_connect()) {
|
// or for some reason the `last_msg_timestamp` is not initialized
|
||||||
|
if (ev_is_first_connect() || !mucwin->last_msg_timestamp) {
|
||||||
// save timestamp of last received muc message
|
// save timestamp of last received muc message
|
||||||
// so we dont display, if there was no activity in channel, once we reconnect
|
// so we dont display, if there was no activity in channel, once we reconnect
|
||||||
if (mucwin->last_msg_timestamp) {
|
if (mucwin->last_msg_timestamp) {
|
||||||
|
@ -176,8 +176,7 @@ static int
|
|||||||
_iq_handler(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void* const userdata)
|
_iq_handler(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void* const userdata)
|
||||||
{
|
{
|
||||||
log_debug("iq stanza handler fired");
|
log_debug("iq stanza handler fired");
|
||||||
|
autoping_timer_extend();
|
||||||
iq_autoping_timer_cancel(); // reset the autoping timer
|
|
||||||
|
|
||||||
char* text;
|
char* text;
|
||||||
size_t text_size;
|
size_t text_size;
|
||||||
@ -1391,6 +1390,13 @@ _autoping_timed_send(xmpp_conn_t* const conn, void* const userdata)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
autoping_timer_extend(void)
|
||||||
|
{
|
||||||
|
if (autoping_time)
|
||||||
|
g_timer_start(autoping_time);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_auto_pong_id_handler(xmpp_stanza_t* const stanza, void* const userdata)
|
_auto_pong_id_handler(xmpp_stanza_t* const stanza, void* const userdata)
|
||||||
{
|
{
|
||||||
|
@ -153,6 +153,7 @@ static int
|
|||||||
_message_handler(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void* const userdata)
|
_message_handler(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void* const userdata)
|
||||||
{
|
{
|
||||||
log_debug("Message stanza handler fired");
|
log_debug("Message stanza handler fired");
|
||||||
|
autoping_timer_extend();
|
||||||
|
|
||||||
if (_handled_by_plugin(stanza)) {
|
if (_handled_by_plugin(stanza)) {
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -347,6 +347,7 @@ static int
|
|||||||
_presence_handler(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void* const userdata)
|
_presence_handler(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void* const userdata)
|
||||||
{
|
{
|
||||||
log_debug("Presence stanza handler fired");
|
log_debug("Presence stanza handler fired");
|
||||||
|
autoping_timer_extend();
|
||||||
|
|
||||||
char* text = NULL;
|
char* text = NULL;
|
||||||
size_t text_size;
|
size_t text_size;
|
||||||
|
@ -104,6 +104,17 @@ roster_create(void)
|
|||||||
roster_pending_presence = NULL;
|
roster_pending_presence = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_pendingPresence_free(ProfPendingPresence* presence)
|
||||||
|
{
|
||||||
|
if (!presence)
|
||||||
|
return;
|
||||||
|
if (presence->last_activity)
|
||||||
|
g_date_time_unref(presence->last_activity);
|
||||||
|
free(presence->barejid);
|
||||||
|
free(presence);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
roster_destroy(void)
|
roster_destroy(void)
|
||||||
{
|
{
|
||||||
@ -119,6 +130,10 @@ roster_destroy(void)
|
|||||||
|
|
||||||
free(roster);
|
free(roster);
|
||||||
roster = NULL;
|
roster = NULL;
|
||||||
|
|
||||||
|
if (roster_pending_presence)
|
||||||
|
g_slist_free_full(roster_pending_presence, (GDestroyNotify)_pendingPresence_free);
|
||||||
|
roster_pending_presence = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@ -716,15 +731,6 @@ roster_compare_presence(PContact a, PContact b)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_pendingPresence_free(ProfPendingPresence* presence)
|
|
||||||
{
|
|
||||||
if (!presence)
|
|
||||||
return;
|
|
||||||
free(presence->barejid);
|
|
||||||
free(presence);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
roster_process_pending_presence(void)
|
roster_process_pending_presence(void)
|
||||||
{
|
{
|
||||||
@ -734,10 +740,6 @@ roster_process_pending_presence(void)
|
|||||||
for (iter = roster_pending_presence; iter != NULL; iter = iter->next) {
|
for (iter = roster_pending_presence; iter != NULL; iter = iter->next) {
|
||||||
ProfPendingPresence* presence = iter->data;
|
ProfPendingPresence* presence = iter->data;
|
||||||
roster_update_presence(presence->barejid, presence->resource, presence->last_activity);
|
roster_update_presence(presence->barejid, presence->resource, presence->last_activity);
|
||||||
/* seems like resource isn't free on the calling side */
|
|
||||||
if (presence->last_activity) {
|
|
||||||
g_date_time_unref(presence->last_activity);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_slist_free_full(roster_pending_presence, (GDestroyNotify)_pendingPresence_free);
|
g_slist_free_full(roster_pending_presence, (GDestroyNotify)_pendingPresence_free);
|
||||||
|
@ -269,6 +269,8 @@ void iq_mam_request_older(ProfChatWin* win);
|
|||||||
void iq_register_change_password(const char* const user, const char* const password);
|
void iq_register_change_password(const char* const user, const char* const password);
|
||||||
void iq_muc_register_nick(const char* const roomjid);
|
void iq_muc_register_nick(const char* const roomjid);
|
||||||
|
|
||||||
|
void autoping_timer_extend(void);
|
||||||
|
|
||||||
EntityCapabilities* caps_lookup(const char* const jid);
|
EntityCapabilities* caps_lookup(const char* const jid);
|
||||||
void caps_close(void);
|
void caps_close(void);
|
||||||
void caps_destroy(EntityCapabilities* caps);
|
void caps_destroy(EntityCapabilities* caps);
|
||||||
|
Loading…
Reference in New Issue
Block a user