Skip to content

Commit

Permalink
Show more info about role/affiliation
Browse files Browse the repository at this point in the history
  • Loading branch information
N-Pex committed Oct 2, 2017
1 parent b563d8d commit 8570173
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ open class OTRRoomOccupantsViewController: UIViewController {
self.room = OTRXMPPRoom.fetchObject(withUniqueID: roomKey, transaction: transaction)
if let room = self.room, let manager = self.xmppRoomManager() {
self.ownOccupant = manager.roomOccupant(forUser: XMPPJID(string:room.ownJID), inRoom: XMPPJID(string:room.jid))
if let o = self.ownOccupant {
print("Got it")
}
}
})
viewHandler = OTRYapViewHandler(databaseConnection: databaseConnection)
Expand Down Expand Up @@ -352,6 +349,20 @@ extension OTRRoomOccupantsViewController: UITableViewDataSource {
})
if let buddy = buddy {
cell.setThread(buddy, account: nil)
if let occupantJid = roomOccupant.jid, let ownJid = ownOccupant?.jid, occupantJid.compare(ownJid) == .orderedSame {
cell.nameLabel.text?.append(" (You)")
}
if roomOccupant.affiliation == .owner {
cell.accountLabel.text = "Room owner"
} else if roomOccupant.affiliation == .admin {
cell.accountLabel.text = "Room admin"
}
if roomOccupant.role == .moderator {
if let chars = cell.accountLabel.text, chars.characters.count > 0 {
cell.accountLabel.text?.append(", ")
}
cell.accountLabel.text?.append("Moderator")
}
} else if let roomJid = roomOccupant.jid,
let jidStr = roomOccupant.realJID,
let displayName = roomOccupant.roomName {
Expand Down

0 comments on commit 8570173

Please sign in to comment.