1package data 2 3import ( 4 "encoding/xml" 5 "fmt" 6) 7 8//See: Section 4.1 9type Room struct { 10 ID, Service string 11} 12 13func (o *Room) JID() string { 14 return fmt.Sprintf("%s@%s", o.ID, o.Service) 15} 16 17//See: Section 4.1 18type Occupant struct { 19 Room 20 Handle string 21} 22 23func (o *Occupant) JID() string { 24 return fmt.Sprintf("%s/%s", o.Room.JID(), o.Handle) 25} 26 27// RoomConfigurationQuery contains the deserialized information about a room configuration query 28// See: Section "10.2 Subsequent Room Configuration" 29type RoomConfigurationQuery struct { 30 XMLName xml.Name `xml:"http://jabber.org/protocol/muc#owner query"` 31 Form *Form `xml:,omitempty` 32} 33 34// See: Section 15.5.4 muc#roominfo FORM_TYPE 35type RoomInfoForm struct { 36 MaxHistoryFetch string `form-field:"muc#maxhistoryfetch"` 37 ContactJID []string `form-field:"muc#roominfo_contactjid"` 38 Description string `form-field:"muc#roominfo_description"` 39 Language string `form-field:"muc#roominfo_language"` 40 LDAPGroup string `form-field:"muc#roominfo_ldapgroup"` 41 Logs string `form-field:"muc#roominfo_logs"` 42 Occupants int `form-field:"muc#roominfo_occupants"` 43 Subject string `form-field:"muc#roominfo_subject"` 44 SubjectMod bool `form-field:"muc#roominfo_subjectmod"` 45} 46 47//See: Section 4.2 48type RoomType struct { 49 Public bool 50 //vs Hidden bool 51 52 Open bool 53 //vs MembersOnly bool 54 55 Moderated bool 56 //vs Unmoderated bool 57 58 SemiAnonymous bool 59 //vs NonAnonymous bool 60 61 PasswordProtected bool 62 //vs Unsecured bool 63 64 Persistent bool 65 //vs Temporary bool 66} 67 68//TODO: Ahh, naming 69type RoomInfo struct { 70 RoomInfoForm `form-type:"http://jabber.org/protocol/muc#roominfo"` 71 RoomType 72} 73