Revision 80684e32 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

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

  
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

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

Also available in: Unified diff