]> git.r.bdr.sh - rbdr/mobius/blobdiff - hotline/field.go
Merge pull request #42 from jhalter/implement_user_ban
[rbdr/mobius] / hotline / field.go
index 5f2e87354b4c4e0c188c9e0da70693baab15f0a8..30760170b4710bacc734068319a2894a73568d5e 100644 (file)
@@ -19,10 +19,11 @@ const fieldUserAccess = 110
 
 // const fieldUserAlias = 111 TODO: implement
 const fieldUserFlags = 112
-const fieldOptions = 113
+const fieldOptions = 113 // Server message (1) or admin message (any other value)
 const fieldChatID = 114
 const fieldChatSubject = 115
 const fieldWaitingCount = 116
+const fieldBannerType = 152
 const fieldVersion = 160
 const fieldCommunityBannerID = 161
 const fieldServerName = 162
@@ -90,3 +91,12 @@ func NewField(id uint16, data []byte) Field {
 func (f Field) Payload() []byte {
        return concat.Slices(f.ID, f.FieldSize, f.Data)
 }
+
+func getField(id int, fields *[]Field) *Field {
+       for _, field := range *fields {
+               if id == int(binary.BigEndian.Uint16(field.ID)) {
+                       return &field
+               }
+       }
+       return nil
+}