From abbf1eafcb29ce1253ffac5d251e338ed2b01843 Mon Sep 17 00:00:00 2001 From: Aaron Weiss Date: Thu, 16 Aug 2018 12:18:05 -0400 Subject: [PATCH] Added notes for PRIVMSG and NOTICE about responses (re: #144). --- src/proto/command.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/proto/command.rs b/src/proto/command.rs index f0ec551..022e886 100644 --- a/src/proto/command.rs +++ b/src/proto/command.rs @@ -49,8 +49,32 @@ pub enum Command { // 3.3 Sending messages /// PRIVMSG msgtarget :message + /// + /// ## Responding to a `PRIVMSG` + /// + /// When responding to a message, it is not sufficient to simply copy the message target + /// (msgtarget). This will work just fine for responding to messages in channels where the + /// target is the same for all participants. However, when the message is sent directly to a + /// user, this target will be that client's username, and responding to that same target will + /// actually mean sending itself a response. In such a case, you should instead respond to the + /// user sending the message as specified in the message prefix. Since this is a common + /// pattern, there is a utility function + /// [`Message::response_target`](../message/struct.Message.html#method.response_target) + /// which is used for this exact purpose. PRIVMSG(String, String), /// NOTICE msgtarget :message + /// + /// ## Responding to a `NOTICE` + /// + /// When responding to a notice, it is not sufficient to simply copy the message target + /// (msgtarget). This will work just fine for responding to messages in channels where the + /// target is the same for all participants. However, when the message is sent directly to a + /// user, this target will be that client's username, and responding to that same target will + /// actually mean sending itself a response. In such a case, you should instead respond to the + /// user sending the message as specified in the message prefix. Since this is a common + /// pattern, there is a utility function + /// [`Message::response_target`](../message/struct.Message.html#method.response_target) + /// which is used for this exact purpose. NOTICE(String, String), // 3.4 Server queries and commands