mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Handle occupant nick change in private wins
This commit is contained in:
parent
3ddef99dfe
commit
292c9cf454
@ -850,7 +850,9 @@ sv_ev_muc_occupant_online(const char *const room, const char *const nick, const
|
||||
if (mucwin) {
|
||||
mucwin_occupant_nick_change(mucwin, old_nick, nick);
|
||||
}
|
||||
wins_private_nick_change(mucwin->roomjid, old_nick, nick);
|
||||
free(old_nick);
|
||||
|
||||
occupantswin_occupants(room);
|
||||
rosterwin_roster();
|
||||
return;
|
||||
|
@ -197,6 +197,30 @@ wins_get_private_chats(const char *const roomjid)
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
wins_private_nick_change(const char *const roomjid, const char *const oldnick, const char *const newnick)
|
||||
{
|
||||
Jid *oldjid = jid_create_from_bare_and_resource(roomjid, oldnick);
|
||||
|
||||
ProfPrivateWin *privwin = wins_get_private(oldjid->fulljid);
|
||||
if (privwin) {
|
||||
free(privwin->fulljid);
|
||||
|
||||
Jid *newjid = jid_create_from_bare_and_resource(roomjid, newnick);
|
||||
privwin->fulljid = strdup(newjid->fulljid);
|
||||
win_vprint((ProfWin*)privwin, '!', 0, NULL, 0, THEME_THEM, NULL, "** %s is now known as %s.", oldjid->resourcepart, newjid->resourcepart);
|
||||
|
||||
autocomplete_remove(wins_ac, oldjid->fulljid);
|
||||
autocomplete_remove(wins_close_ac, oldjid->fulljid);
|
||||
autocomplete_add(wins_ac, newjid->fulljid);
|
||||
autocomplete_add(wins_close_ac, newjid->fulljid);
|
||||
|
||||
jid_destroy(newjid);
|
||||
}
|
||||
|
||||
jid_destroy(oldjid);
|
||||
}
|
||||
|
||||
ProfWin*
|
||||
wins_get_current(void)
|
||||
{
|
||||
|
@ -47,6 +47,7 @@ ProfWin* wins_new_private(const char *const fulljid);
|
||||
|
||||
gboolean wins_chat_exists(const char *const barejid);
|
||||
GList* wins_get_private_chats(const char *const roomjid);
|
||||
void wins_private_nick_change(const char *const roomjid, const char *const oldnick, const char *const newnick);
|
||||
|
||||
ProfWin* wins_get_console(void);
|
||||
ProfChatWin* wins_get_chat(const char *const barejid);
|
||||
|
Loading…
Reference in New Issue
Block a user