1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Make statusbar tab more resilient

If users input strange stuff and we can't create a jid from it even the
setting is set to 'user' we still should fallback to the regular
identifer.

For example with `/msg @name%matrix.domain.org@matrix.org hi`.
This commit is contained in:
Michael Vetter 2020-03-09 16:33:42 +01:00
parent a23d4e4af7
commit 7e62d458ee

View File

@ -199,10 +199,14 @@ _create_tab(const int win, win_type_t wintype, char *identifier, gboolean highli
char *pref = prefs_get_string(PREF_STATUSBAR_CHAT);
if (g_strcmp0("user", pref) == 0) {
Jid *jidp = jid_create(tab->identifier);
tab->display_name = jidp->localpart != NULL ?
strdup(jidp->localpart) :
strdup(jidp->barejid);
jid_destroy(jidp);
if (jidp) {
tab->display_name = jidp->localpart != NULL ?
strdup(jidp->localpart) :
strdup(jidp->barejid);
jid_destroy(jidp);
} else {
tab->display_name = strdup(tab->identifier);
}
} else {
tab->display_name = strdup(tab->identifier);
}