Revision 74191bbf ChatSecure/Classes/Model/Yap Storage/OTRXMPPRoomOccupant.swift

View differences:

ChatSecure/Classes/Model/Yap Storage/OTRXMPPRoomOccupant.swift
32 32
    }
33 33
}
34 34

  
35
// Helper class to create from string, callable from obj-c
36
@objc public class RoomOccupantRoleHelper: NSObject {
37
    @objc public static func role(withString role:String) -> RoomOccupantRole {
38
        switch role {
39
        case "moderator":
40
            return RoomOccupantRole.moderator
41
        case "participant":
42
            return RoomOccupantRole.participant
43
        case "visitor":
44
            return RoomOccupantRole.visitor
45
        default:
46
            return RoomOccupantRole.none
47
        }
48
    }
49
}
50

  
35 51
@objc public enum RoomOccupantAffiliation:Int {
36 52
    case none = 0
37 53
    case outcast = 1
......
47 63
    }
48 64
}
49 65

  
66
// Helper class to create from string, callable from obj-c
67
@objc public class RoomOccupantAffiliationHelper: NSObject {
68
    @objc public static func affiliation(withString affiliation:String) -> RoomOccupantAffiliation {
69
        switch affiliation {
70
        case "owner":
71
            return RoomOccupantAffiliation.owner
72
        case "admin":
73
            return RoomOccupantAffiliation.admin
74
        case "member":
75
            return RoomOccupantAffiliation.member
76
        case "outcast":
77
            return RoomOccupantAffiliation.outcast
78
        default:
79
            return RoomOccupantAffiliation.none
80
        }
81
    }
82
}
83

  
50 84
open class OTRXMPPRoomOccupant: OTRYapDatabaseObject, YapDatabaseRelationshipNode {
51 85
    
52 86
    @objc open static let roomEdgeName = "OTRRoomOccupantEdgeName"

Also available in: Unified diff