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

Merge branch 'master' into osx-functional

This commit is contained in:
James Booth 2016-01-31 23:13:43 +00:00
commit 75ddaa4696
2 changed files with 38 additions and 19 deletions

View File

@ -666,6 +666,7 @@ sv_ev_room_occupant_offline(const char *const room, const char *const nick,
} }
prefs_free_string(muc_status_pref); prefs_free_string(muc_status_pref);
occupantswin_occupants(room); occupantswin_occupants(room);
rosterwin_roster();
} }
void void
@ -678,6 +679,7 @@ sv_ev_room_occupent_kicked(const char *const room, const char *const nick, const
mucwin_occupant_kicked(mucwin, nick, actor, reason); mucwin_occupant_kicked(mucwin, nick, actor, reason);
} }
occupantswin_occupants(room); occupantswin_occupants(room);
rosterwin_roster();
} }
void void
@ -690,6 +692,7 @@ sv_ev_room_occupent_banned(const char *const room, const char *const nick, const
mucwin_occupant_banned(mucwin, nick, actor, reason); mucwin_occupant_banned(mucwin, nick, actor, reason);
} }
occupantswin_occupants(room); occupantswin_occupants(room);
rosterwin_roster();
} }
void void
@ -825,6 +828,7 @@ sv_ev_muc_occupant_online(const char *const room, const char *const nick, const
} }
free(old_nick); free(old_nick);
occupantswin_occupants(room); occupantswin_occupants(room);
rosterwin_roster();
return; return;
} }
@ -837,6 +841,7 @@ sv_ev_muc_occupant_online(const char *const room, const char *const nick, const
} }
prefs_free_string(muc_status_pref); prefs_free_string(muc_status_pref);
occupantswin_occupants(room); occupantswin_occupants(room);
rosterwin_roster();
return; return;
} }
@ -869,6 +874,8 @@ sv_ev_muc_occupant_online(const char *const room, const char *const nick, const
} }
occupantswin_occupants(room); occupantswin_occupants(room);
} }
rosterwin_roster();
} }
int int

View File

@ -661,26 +661,31 @@ _rosterwin_room(ProfLayoutSplit *layout, ProfMucWin *mucwin)
g_string_append_printf(privmsg, "%c", ch); g_string_append_printf(privmsg, "%c", ch);
} }
g_string_append(privmsg, privwin->fulljid + strlen(mucwin->roomjid) + 1); char *nick = privwin->fulljid + strlen(mucwin->roomjid) + 1;
g_string_append(privmsg, nick);
if ((g_strcmp0(unreadpos, "after") == 0) && privwin->unread > 0) { if ((g_strcmp0(unreadpos, "after") == 0) && privwin->unread > 0) {
g_string_append_printf(privmsg, " (%d)", privwin->unread); g_string_append_printf(privmsg, " (%d)", privwin->unread);
} }
prefs_free_string(unreadpos); prefs_free_string(unreadpos);
if (privwin->unread > 0) { const char *presence = "offline";
wattron(layout->subwin, theme_attrs(THEME_ROSTER_ROOM_UNREAD));
} else { Occupant *occupant = muc_roster_item(mucwin->roomjid, nick);
wattron(layout->subwin, theme_attrs(THEME_ROSTER_ROOM)); if (occupant) {
presence = string_from_resource_presence(occupant->presence);
} }
theme_item_t colour;
if (privwin->unread > 0) {
colour = _get_roster_theme(ROSTER_CONTACT_UNREAD, presence);
} else {
colour = _get_roster_theme(ROSTER_CONTACT_ACTIVE, presence);
}
wattron(layout->subwin, theme_attrs(colour));
win_sub_print(layout->subwin, privmsg->str, FALSE, wrap, current_indent); win_sub_print(layout->subwin, privmsg->str, FALSE, wrap, current_indent);
wattroff(layout->subwin, theme_attrs(colour));
if (privwin->unread > 0) {
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_ROOM_UNREAD));
} else {
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_ROOM));
}
g_string_free(privmsg, TRUE); g_string_free(privmsg, TRUE);
curr = g_list_next(curr); curr = g_list_next(curr);
@ -744,20 +749,27 @@ _rosterwin_private_chats(ProfLayoutSplit *layout, GList *orphaned_privchats)
} }
prefs_free_string(unreadpos); prefs_free_string(unreadpos);
Jid *jidp = jid_create(privwin->fulljid);
Occupant *occupant = muc_roster_item(jidp->barejid, jidp->resourcepart);
jid_destroy(jidp);
const char *presence = "offline";
if (occupant) {
presence = string_from_resource_presence(occupant->presence);
}
theme_item_t colour;
if (privwin->unread > 0) { if (privwin->unread > 0) {
wattron(layout->subwin, theme_attrs(THEME_ROSTER_ROOM_UNREAD)); colour = _get_roster_theme(ROSTER_CONTACT_UNREAD, presence);
} else { } else {
wattron(layout->subwin, theme_attrs(THEME_ROSTER_ROOM)); colour = _get_roster_theme(ROSTER_CONTACT_ACTIVE, presence);
} }
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP); gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
win_sub_print(layout->subwin, privmsg->str, FALSE, wrap, current_indent);
if (privwin->unread > 0) { wattron(layout->subwin, theme_attrs(colour));
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_ROOM_UNREAD)); win_sub_print(layout->subwin, privmsg->str, FALSE, wrap, current_indent);
} else { wattroff(layout->subwin, theme_attrs(colour));
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_ROOM));
}
g_string_free(privmsg, TRUE); g_string_free(privmsg, TRUE);
curr = g_list_next(curr); curr = g_list_next(curr);