]> git.r.bdr.sh - rbdr/mobius/blobdiff - hotline/transaction_handlers.go
Fix issue with HL 1.5+ user flag unset
[rbdr/mobius] / hotline / transaction_handlers.go
index ea4649933e26534180831b60df0a8a1ad89e0dd9..7e3afa14de1df9217968745a98c43003bc02331b 100644 (file)
@@ -821,11 +821,8 @@ func (cc *ClientConn) notifyNewUserHasJoined() (res []Transaction, err error) {
 }
 
 func HandleTranAgreed(cc *ClientConn, t *Transaction) (res []Transaction, err error) {
 }
 
 func HandleTranAgreed(cc *ClientConn, t *Transaction) (res []Transaction, err error) {
-       bs := make([]byte, 2)
-       binary.BigEndian.PutUint16(bs, *cc.Server.NextGuestID)
-
+       cc.Agreed = true
        cc.UserName = t.GetField(fieldUserName).Data
        cc.UserName = t.GetField(fieldUserName).Data
-       *cc.ID = bs
        *cc.Icon = t.GetField(fieldUserIconID).Data
 
        options := t.GetField(fieldOptions).Data
        *cc.Icon = t.GetField(fieldUserIconID).Data
 
        options := t.GetField(fieldOptions).Data
@@ -1143,7 +1140,7 @@ func HandlePostNewsArt(cc *ClientConn, t *Transaction) (res []Transaction, err e
        newArt := NewsArtData{
                Title:         string(t.GetField(fieldNewsArtTitle).Data),
                Poster:        string(cc.UserName),
        newArt := NewsArtData{
                Title:         string(t.GetField(fieldNewsArtTitle).Data),
                Poster:        string(cc.UserName),
-               Date:          NewsDate(),
+               Date:          toHotlineTime(time.Now()),
                PrevArt:       []byte{0, 0, 0, 0},
                NextArt:       []byte{0, 0, 0, 0},
                ParentArt:     append([]byte{0, 0}, t.GetField(fieldNewsArtID).Data...),
                PrevArt:       []byte{0, 0, 0, 0},
                NextArt:       []byte{0, 0, 0, 0},
                ParentArt:     append([]byte{0, 0}, t.GetField(fieldNewsArtID).Data...),
@@ -1370,17 +1367,11 @@ func HandleSetClientUserInfo(cc *ClientConn, t *Transaction) (res []Transaction,
                optBitmap := big.NewInt(int64(binary.BigEndian.Uint16(options)))
                flagBitmap := big.NewInt(int64(binary.BigEndian.Uint16(*cc.Flags)))
 
                optBitmap := big.NewInt(int64(binary.BigEndian.Uint16(options)))
                flagBitmap := big.NewInt(int64(binary.BigEndian.Uint16(*cc.Flags)))
 
-               // Check refuse private PM option
-               if optBitmap.Bit(refusePM) == 1 {
-                       flagBitmap.SetBit(flagBitmap, userFlagRefusePM, 1)
-                       binary.BigEndian.PutUint16(*cc.Flags, uint16(flagBitmap.Int64()))
-               }
+               flagBitmap.SetBit(flagBitmap, userFlagRefusePM, optBitmap.Bit(refusePM))
+               binary.BigEndian.PutUint16(*cc.Flags, uint16(flagBitmap.Int64()))
 
 
-               // Check refuse private chat option
-               if optBitmap.Bit(refuseChat) == 1 {
-                       flagBitmap.SetBit(flagBitmap, userFLagRefusePChat, 1)
-                       binary.BigEndian.PutUint16(*cc.Flags, uint16(flagBitmap.Int64()))
-               }
+               flagBitmap.SetBit(flagBitmap, userFLagRefusePChat, optBitmap.Bit(refuseChat))
+               binary.BigEndian.PutUint16(*cc.Flags, uint16(flagBitmap.Int64()))
 
                // Check auto response
                if optBitmap.Bit(autoResponse) == 1 {
 
                // Check auto response
                if optBitmap.Bit(autoResponse) == 1 {
@@ -1402,9 +1393,9 @@ func HandleSetClientUserInfo(cc *ClientConn, t *Transaction) (res []Transaction,
        return res, err
 }
 
        return res, err
 }
 
-// HandleKeepAlive response to keepalive transactions with an empty reply
-// HL 1.9.2 Client sends keepalive msg every 3 minutes
-// HL 1.2.3 Client doesn't send keepalives
+// HandleKeepAlive responds to keepalive transactions with an empty reply
+// HL 1.9.2 Client sends keepalive msg every 3 minutes
+// HL 1.2.3 Client doesn't send keepalives
 func HandleKeepAlive(cc *ClientConn, t *Transaction) (res []Transaction, err error) {
        res = append(res, cc.NewReply(t))
 
 func HandleKeepAlive(cc *ClientConn, t *Transaction) (res []Transaction, err error) {
        res = append(res, cc.NewReply(t))