0
0
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 13:21:00 +02:00

Distinguish text message from file in receipient dialog

Fixes https://github.com/schollz/croc/issues/388
This commit is contained in:
Markus Wamser 2021-05-01 21:27:44 +02:00 committed by GitHub
parent 7c28279a58
commit d5fd2060dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -804,18 +804,17 @@ func (c *Client) processMessageFileInfo(m message.Message) (done bool, err error
} }
} }
// c.spinner.Stop() // c.spinner.Stop()
if strings.HasPrefix(fname, "'croc-stdin") { action = "Accept"
fname = "'stdin'"
if c.Options.SendingText { if c.Options.SendingText {
fname = "'text'" action = "Display"
} fname = "text message"
} }
if !c.Options.NoPrompt || c.Options.Ask || senderInfo.Ask { if !c.Options.NoPrompt || c.Options.Ask || senderInfo.Ask {
if c.Options.Ask || senderInfo.Ask { if c.Options.Ask || senderInfo.Ask {
machID, _ := machineid.ID() machID, _ := machineid.ID()
fmt.Fprintf(os.Stderr, "\rYour machine id is '%s'.\nAccept %s (%s) from '%s'? (y/n) ", machID, fname, utils.ByteCountDecimal(totalSize), senderInfo.MachineID) fmt.Fprintf(os.Stderr, "\rYour machine id is '%s'.\n%s %s (%s) from '%s'? (y/n) ", machID, action, fname, utils.ByteCountDecimal(totalSize), senderInfo.MachineID)
} else { } else {
fmt.Fprintf(os.Stderr, "\rAccept %s (%s)? (y/n) ", fname, utils.ByteCountDecimal(totalSize)) fmt.Fprintf(os.Stderr, "\r%s %s (%s)? (y/n) ", action, fname, utils.ByteCountDecimal(totalSize))
} }
if strings.ToLower(strings.TrimSpace(utils.GetInput(""))) != "y" { if strings.ToLower(strings.TrimSpace(utils.GetInput(""))) != "y" {
err = message.Send(c.conn[0], c.Key, message.Message{ err = message.Send(c.conn[0], c.Key, message.Message{