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

Refactor handle_muc_occupant_online

This commit is contained in:
James Booth 2014-10-07 00:57:51 +01:00
parent d6a4af9992
commit d8eb97eec8

View File

@ -719,26 +719,27 @@ void
handle_muc_occupant_online(const char * const room, const char * const nick, const char * const jid,
const char * const role, const char * const affiliation, const char * const show, const char * const status)
{
if (!muc_roster_complete(room)) {
muc_roster_add(room, nick, jid, role, affiliation, show, status);
} else {
char *old_nick = muc_roster_nick_change_complete(room, nick);
gboolean updated = muc_roster_add(room, nick, jid, role, affiliation, show, status);
if (!muc_roster_complete(room)) {
return;
}
char *old_nick = muc_roster_nick_change_complete(room, nick);
if (old_nick) {
muc_roster_add(room, nick, jid, role, affiliation, show, status);
ui_room_member_nick_change(room, old_nick, nick);
free(old_nick);
} else {
if (!muc_roster_contains_nick(room, nick)) {
muc_roster_add(room, nick, jid, role, affiliation, show, status);
return;
}
if (!muc_roster_contains_nick(room, nick)) {
char *muc_status_pref = prefs_get_string(PREF_STATUSES_MUC);
if (g_strcmp0(muc_status_pref, "none") != 0) {
ui_room_member_online(room, nick, show, status);
}
prefs_free_string(muc_status_pref);
} else {
gboolean updated = muc_roster_add(room, nick, jid, role, affiliation, show, status);
return;
}
if (updated) {
char *muc_status_pref = prefs_get_string(PREF_STATUSES_MUC);
@ -748,6 +749,3 @@ handle_muc_occupant_online(const char * const room, const char * const nick, con
prefs_free_string(muc_status_pref);
}
}
}
}
}