Просмотр исходного кода

don't let users block themselves

Mike 2 лет назад
Родитель
Сommit
783e8fbb16
1 измененных файлов с 13 добавлено и 0 удалено
  1. 13 0
      oscar/feedbag.go

+ 13 - 0
oscar/feedbag.go

@@ -389,6 +389,7 @@ func (f *feedbagItem) read(r io.Reader) error {
 		FeedbagAttributesPdFlags:         reflect.Uint32,
 		FeedbagAttributesPdMask:          reflect.Uint32,
 		FeedbagAttributesPdMode:          reflect.Uint8,
+		FeedbagAttributesNote:            reflect.String,
 	})
 }
 
@@ -534,6 +535,18 @@ func ReceiveInsertItem(sm *SessionManager, sess *Session, fm *FeedbagStore, flap
 			}
 			return err
 		}
+		// don't let users block themselves, it causes the AIM client to go
+		// into a weird state.
+		if item.classID == 3 && item.name == sess.ScreenName {
+			snacFrameOut := snacFrame{
+				foodGroup: FEEDBAG,
+				subGroup:  FeedbagErr,
+			}
+			snacPayloadOut := &snacError{
+				code: ErrorCodeNotSupportedByHost,
+			}
+			return writeOutSNAC(snac, flap, snacFrameOut, snacPayloadOut, sequence, w)
+		}
 		feedbag = append(feedbag, item)
 		snacPayloadOut.results = append(snacPayloadOut.results, 0x0000) // success by default
 		fmt.Printf("ReceiveInsertItem read SNAC feedbag item: %+v\n", item)