Browse Source

don't let users block themselves

Mike 2 năm trước cách đây
mục cha
commit
783e8fbb16
1 tập tin đã thay đổi với 13 bổ sung0 xóa
  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,
 		FeedbagAttributesPdFlags:         reflect.Uint32,
 		FeedbagAttributesPdMask:          reflect.Uint32,
 		FeedbagAttributesPdMask:          reflect.Uint32,
 		FeedbagAttributesPdMode:          reflect.Uint8,
 		FeedbagAttributesPdMode:          reflect.Uint8,
+		FeedbagAttributesNote:            reflect.String,
 	})
 	})
 }
 }
 
 
@@ -534,6 +535,18 @@ func ReceiveInsertItem(sm *SessionManager, sess *Session, fm *FeedbagStore, flap
 			}
 			}
 			return err
 			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)
 		feedbag = append(feedbag, item)
 		snacPayloadOut.results = append(snacPayloadOut.results, 0x0000) // success by default
 		snacPayloadOut.results = append(snacPayloadOut.results, 0x0000) // success by default
 		fmt.Printf("ReceiveInsertItem read SNAC feedbag item: %+v\n", item)
 		fmt.Printf("ReceiveInsertItem read SNAC feedbag item: %+v\n", item)