Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event on successful pm #56

Closed
akavlie opened this issue Nov 6, 2011 · 5 comments
Closed

Event on successful pm #56

akavlie opened this issue Nov 6, 2011 · 5 comments

Comments

@akavlie
Copy link
Contributor

akavlie commented Nov 6, 2011

When sending a PRIVATEMSG to someone, it would be helpful if node-irc emitted an event indicating that the message went through.

As designed now, if you want to open a new window when I send a pm (as opposed to receiving one), I have to special-case it (other windows are opened only after event is emitted from node-irc). And if the nick doesn't exist, you've just opened a window that shouldn't be there.

@martynsmith
Copy link
Owner

Well certainly in all the clients I've ever used if you do /msg harold hi there! then the client won't actually open a window. By contrast (at least in irssi) if I do /query harold hi there! then it force opens a window and sends the message. In the former case, the window is opened when there is a reply, in the latter the window is opened regardless of if the nickname exists or not.

Apart from the fact that I'm not entirely sure by what you mean message went through, I'm not sure there's even a reliable way of determining that.

Can you provide me an example of an existing IRC client that behaves as you specify?

@akavlie
Copy link
Contributor Author

akavlie commented Nov 17, 2011

Colloquy on Mac does open a new window for /msg -- it seems to behave the same as /query

Apparently the behavior distinction you mentioned is somewhat of a convention:

On many clients, you would be able to type e.g. /MSG MyFriend Hi there! (to simply send the message) or /QUERY MyFriend Hi there! (to open a dedicated window for chatting with MyFriend).
(from http://www.anta.net/irc/survival/basics.shtml)

I was surprised to discover that neither /msg nor /query are part of the IRC protocol btw -- just PRIVMSG, which both commands apparently map to.

The biggest issue here is that messages appears to go through even when the nick doesn't exist. Know any way to avoid that?

@akavlie
Copy link
Contributor Author

akavlie commented Nov 17, 2011

Turns out this is emitted by the server when sending a message to a bogus nick:

ERROR: { prefix: 'calvino.freenode.net',
  server: 'calvino.freenode.net',
  command: 'err_nosuchnick',
  rawCommand: '401',
  commandType: 'error',
  args: 
   [ 'aktest',
     'asdfasdfasdfasdf',
     'No such nick/channel' ] }

I wonder if it would be useful to handle this in node-irc? Or if I should just deal with it in the client through the raw event?

@martynsmith
Copy link
Owner

I think errors such as that should just be handled by the client. It's not really the place of the library to go interpreting all that stuff in too much detail I think.

Also, you would never get an immediate response with your window, there's always server lag, and given you get no "everything worked fine" response from the server, how long should you wait before opening your window? It's impossible to know.

@akavlie
Copy link
Contributor Author

akavlie commented Nov 18, 2011

Sounds good, I wasn't aware that this error was sent from the server when I filed the issue.

I already coded it to open a new window immediately when a message is sent. My plan is to continue to let that happen, but throw a big obvious error in the channel window indicating the no such nick/channel error.

@akavlie akavlie closed this as completed Nov 18, 2011
Half-Shot referenced this issue in matrix-org/node-irc Feb 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants