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

emit message event when client is the one sending the message #21

Open
jmcbee opened this issue Dec 9, 2014 · 1 comment
Open

emit message event when client is the one sending the message #21

jmcbee opened this issue Dec 9, 2014 · 1 comment

Comments

@jmcbee
Copy link

jmcbee commented Dec 9, 2014

Currently the message event only gets emitted when messages are from others.

I can't find the line though that prevents that from happening.

@erming
Copy link
Contributor

erming commented Dec 9, 2014

This is because the IRC networks doesn't respond when you send messages, like incoming messages/joins/parts/etc do.

Here's the function for sending messages:
https://github.com/slate/slate-irc/blob/master/index.js#L150-L152

I'm not sure if sending messages should emit an event at all (let me think about it..). But if it so, it should probably be emitted by the .send() function.

The object emitted by the message event is pretty simple:

{ 
  to: 'x',
  from: 'y',
  message: 'z'
}

And the event could be triggered like this (from within the .send() function):

this.emit("message", msgObj);

Reference: https://github.com/slate/slate-irc/blob/master/lib/plugins/privmsg.js

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