profanity-im / profanity

Ncurses based XMPP client
https://profanity-im.github.io/
Other
1.32k stars 185 forks source link

Invalid commands should not send as messages #390

Closed sudocurse closed 10 years ago

sudocurse commented 10 years ago

Commands with leading slashes should not send to the recipient(s) in the current window, and should instead produce an error message, either on the current window or the status window.

19:42:52 - contact: alright, see you then
19:52:52 - me: /window close
19:53:06 - me: whoops, sorry
boothj5 commented 10 years ago

A fix for this is in master, with the "Unknown command" message appearing in the console window.

akarl commented 10 years ago

I use YouTrack at work and the jabber bot takes commands by prefixing the messages with a slash. This does not work as the slash isn't sent to the receiver.

EDIT: I found out how to do my reading the code. I need to prefix with "/me". This isn't very convenient at all.

EDIT2: Actually that doesn't work either.

boothj5 commented 10 years ago

Perhaps in the long run the command prefix character can be configured for profanity. For now I'll make it an option to disable/enable sending the /.

I guess it would make sense to allow the user to escape the command prefix too, for example if your chat bot has a /who command, then profanity would never send it as it has it's own /who. So an escape would be required such as //who or \/who.

akarl commented 10 years ago

Yes I think that an escape character would be the best option because the commands could be the same both inside Profanity and for the receiver. In our case /help is a command for both.

boothj5 commented 10 years ago

Now a double slash will escape the command and allow it to be sent e.g.:

//help

Should send /help to your chat room/recipient.

I went for // rather than \/ as it seemed easier to type.

Note that /me is a special case and is always sent, since most clients handle it as a user action/mood etc.

Please reopen the issue if you find any problems.