gdamjan / erlang-irc-bot

A simple extendable irc bot in Erlang
http://github.com/gdamjan/erlang-irc-bot/wiki
MIT License
80 stars 25 forks source link

Differentiate private (direct) messages from those in a channel #9

Closed gdamjan closed 14 years ago

gdamjan commented 14 years ago

A direct message has the parsed form of: {Sender, His_Name, "PRIVMSG", MyNickname, Msg} A channel message: {Sender, His_Name, "PRIVMSG", ChannelName, Msg}

Replies to channel messages should on the channel (4th parameter), replies to direct messages need to go in private (1st parameter).

There are two strategies to solve this, 1) rely on the fact that IRC channel names must begin with '#', '&', '+' or '!' (but ussually restricted to just '#'), or 2) keep track of our own nickname (this is not that easy or desired) and match it explicitly. But that will require unneed state keeping for the plugins.

gdamjan commented 14 years ago

IRC RFC 2812: http://www.irchelp.org/irchelp/rfc/rfc2812.txt

Also, freenode denies JOIN-ing channels with anything but a # as first char.

gdamjan commented 14 years ago

The sollution used in commit 1b1708e6408cd168b49939aaacaee8922f0a039e is probably just ok.