msg := t.GetField(fieldData)
ID := t.GetField(fieldUserID)
- reply := *NewTransaction(
+ reply := NewTransaction(
tranServerMsg,
&ID.Data,
NewField(fieldData, msg.Data),
reply.Fields = append(reply.Fields, NewField(fieldQuotingMsg, t.GetField(fieldQuotingMsg).Data))
}
- res = append(res, reply)
+ res = append(res, *reply)
id, _ := byteToInt(ID.Data)
- otherClient := cc.Server.Clients[uint16(id)]
- if otherClient == nil {
- return res, errors.New("ohno")
+ otherClient, ok := cc.Server.Clients[uint16(id)]
+ if !ok {
+ return res, errors.New("invalid client ID")
}
// Respond with auto reply if other client has it enabled
fileNewName := t.GetField(fieldFileNewName).Data
if fileNewName != nil {
- fi, err := FS.Stat(fullFilePath)
+ fi, err := cc.Server.FS.Stat(fullFilePath)
if err != nil {
return res, err
}
// TODO: check path and folder name lengths
- if _, err := FS.Stat(newFolderPath); !os.IsNotExist(err) {
+ if _, err := cc.Server.FS.Stat(newFolderPath); !os.IsNotExist(err) {
msg := fmt.Sprintf("Cannot create folder \"%s\" because there is already a file or folder with that name.", folderName)
return []Transaction{cc.NewErrReply(t, msg)}, nil
}
// TODO: check for disallowed characters to maintain compatibility for original client
- if err := FS.Mkdir(newFolderPath, 0777); err != nil {
+ if err := cc.Server.FS.Mkdir(newFolderPath, 0777); err != nil {
msg := fmt.Sprintf("Cannot create folder \"%s\" because an error occurred.", folderName)
return []Transaction{cc.NewErrReply(t, msg)}, nil
}
return res, err
}
- fileInfo, err := FS.Stat(fullFilePath + incompleteFileSuffix)
+ fileInfo, err := cc.Server.FS.Stat(fullFilePath + incompleteFileSuffix)
if err != nil {
return res, err
}
cc.Server.Logger.Debugw("Make alias", "src", fullFilePath, "dst", fullNewFilePath)
- if err := FS.Symlink(fullFilePath, fullNewFilePath); err != nil {
+ if err := cc.Server.FS.Symlink(fullFilePath, fullNewFilePath); err != nil {
res = append(res, cc.NewErrReply(t, "Error creating alias"))
return res, nil
}