]> git.r.bdr.sh - rbdr/mobius/blobdiff - hotline/transaction_handlers.go
Use fixed size array types in Transaction fields
[rbdr/mobius] / hotline / transaction_handlers.go
index 20b87e2118105e0cdbd977f5a0dc19eba9db6c12..cff19d52d4630e2e8f67588c7330eb43820897a2 100644 (file)
@@ -995,9 +995,7 @@ func HandleGetClientInfoText(cc *ClientConn, t *Transaction) (res []Transaction,
 }
 
 func HandleGetUserNameList(cc *ClientConn, t *Transaction) (res []Transaction, err error) {
-       res = append(res, cc.NewReply(t, cc.Server.connectedUsers()...))
-
-       return res, err
+       return []Transaction{cc.NewReply(t, cc.Server.connectedUsers()...)}, nil
 }
 
 func HandleTranAgreed(cc *ClientConn, t *Transaction) (res []Transaction, err error) {
@@ -1256,8 +1254,9 @@ func HandleNewNewsFldr(cc *ClientConn, t *Transaction) (res []Transaction, err e
 func HandleGetNewsArtNameList(cc *ClientConn, t *Transaction) (res []Transaction, err error) {
        if !cc.Authorize(accessNewsReadArt) {
                res = append(res, cc.NewErrReply(t, "You are not allowed to read news."))
-               return res, err
+               return res, nil
        }
+
        pathStrs := ReadNewsPath(t.GetField(FieldNewsPath).Data)
 
        var cat NewsCategoryListData15
@@ -1272,11 +1271,11 @@ func HandleGetNewsArtNameList(cc *ClientConn, t *Transaction) (res []Transaction
 
        b, err := io.ReadAll(&nald)
        if err != nil {
-
+               return res, fmt.Errorf("error loading news articles: %w", err)
        }
 
        res = append(res, cc.NewReply(t, NewField(FieldNewsArtListData, b)))
-       return res, err
+       return res, nil
 }
 
 // HandleGetNewsArtData requests information about the specific news article.